Martin Mares [Mon, 1 Mar 1999 20:13:54 +0000 (20:13 +0000)]
Renamed struct rtattr to struct rta to make things more consistent and
avoid namespace clashes with <linux/rtnetlink.h>. Other files should
not be affected since they use 'rta' directly.
Martin Mares [Sat, 13 Feb 1999 21:58:53 +0000 (21:58 +0000)]
Parameter order for the proto->if_notify hook was different in the include
file and different in reality. Decided to use the same order as we do
for proto->rt_notify (i.e., first new value and second the old one).
Martin Mares [Sat, 13 Feb 1999 21:29:01 +0000 (21:29 +0000)]
Implemented garbage collection of routing tables to delete orphaned network
nodes having no routes attached. Such cleanup must be done from event handler
since most functions manipulating the routing tables expect network entries
won't disappear from under their hands and it's also probably faster when
done asynchronously.
Martin Mares [Thu, 11 Feb 1999 22:59:06 +0000 (22:59 +0000)]
Real implementation of protocol state machines. Delayed startup/shutdown
should work now. Initial feeding of protocols by interfaces/routes is
done from the event queue to prevent unwanted recursion.
Martin Mares [Thu, 11 Feb 1999 21:18:26 +0000 (21:18 +0000)]
Added simple event scheduling system to avoid recursive calling
of various callbacks.
Events are just another resource type objects (thus automatically freed
and unlinked when the protocol using them shuts down). Each event can
be linked in at most one event list. For most purposes, just use the
global event list handled by the following functions:
ev_schedule Schedule event to be called at the next event
scheduling point. If the event was already
scheduled, it's just re-linked to the end of the list.
ev_postpone Postpone an already scheduled event, so that it
won't get called. Postponed events can be scheduled
again by ev_schedule().
You can also create custom event lists to build your own synchronization
primitives. Just use:
ev_init_list to initialize an event list
ev_enqueue to schedule event on specified event list
ev_postpone works as well for custom lists
ev_run_list to run all events on your custom list
ev_run to run a specific event and dequeue it
Martin Mares [Sat, 9 Jan 1999 15:02:11 +0000 (15:02 +0000)]
First step of "autoconfization". Created a configure script which
guesses most system-dependent parameters and determines name of system
configuration file (sysdep/cf/...) with the remaining ones.
To compile BIRD, you now need to do:
autoconf # Create configure from configure.in
./configure # Run configure script
make # Compile everything
Configuration files:
sysdep/config.h Master config file
sysdep/autoconf.h Parameters determined by configure script
sysdep/cf/*.h Fixed system configuration we're unable
to guess.
Makefiles are still the original ones, but this will change soon.
Introduced bug() which is like die(), but with level L_BUG. Protocols
should _never_ call die() as it should be used only during initialization
and on irrecoverable catastrophic events like out of memory.
Also introduced ASSERT() which behaves like normal assert(), but it calls
bug() when assertion fails. When !defined(DEBUGGING), it gets ignored.
Martin Mares [Sun, 20 Dec 1998 14:01:20 +0000 (14:01 +0000)]
Rewrote fib functions to make them insert/delete/asynchronous-walk safe.
This is implemented in a way similar to lib/slists.h, but it took some
more effort to make rehashing not disturb the readers. We do it by just
taking _highest_ k bits of ipa_hash as our hash value and sorting each
box by whole ipa_hash().
Consult FIB_ITERATE_* macros in nest/route.h.
Implemented fib_check() debugging function and also rewrote the rehashing
algorithm to use better thresholds and not to waste time by rehashing
forth and back.
Martin Mares [Sun, 20 Dec 1998 13:57:49 +0000 (13:57 +0000)]
New hash functions according to benchmarks posted yesterday. (The IPv6
version has not been benchmarked yet due to insufficient test data.)
Now ipa_hash() returns a uniformely distributed 16-bit value.
Martin Mares [Sat, 19 Dec 1998 11:51:47 +0000 (11:51 +0000)]
Added several tools for fib hashing function analysis. It turned out
we can use very simple function which is monotonic with respect
to re-hashing:
n ^= n >> 16;
n ^= n << 10;
h = (n >> (16 - o)) & ((1 << o) - 1);
where o is table order. Statistical analysis for both backbone routing
table and local OSPF routing tables gives values near theoretical
optimum for uniform distribution (see ips.c for formulae).
The trick is very simple: We always calculate a 16-bit hash value n and
use o most significant bits (this gives us monotonity wrt. rehashing
if we sort the chains by the value of n). The first shift/xor pair
reduces the IP address to a 16-bit one, the second pair makes higher
bits of the 16-bit value uniformly distributed even for tables containing
lots of long prefixes (typical interior routing case with 24-bit or even
longer prefixes).
Martin Mares [Tue, 8 Dec 1998 18:37:58 +0000 (18:37 +0000)]
Hopefully finished kernel syncer (krt) rewrite:
o Interface syncing is now a part of krt and it can have configurable
parameters. Actually, the only one is scan rate now :)
o Kernel routing table syncing is now synchronized with interface
syncing (we need the most recent version of the interface list
to prevent lots of routes to non-existent destinations from
appearing). Instead of its own timer, we just check if it's
route scan time after each iface list scan.
o Syncing of device routes implemented.
o CONFIG_AUTO_ROUTES should control syncing of automatic device routes.
o Rewrote krt_remove_route() to really remove routes :)
o Better diagnostics.
o Fixed a couple of bugs.
Martin Mares [Tue, 8 Dec 1998 16:20:13 +0000 (16:20 +0000)]
Rewritten kernel syncer. Now uses the rta trickery I've introduced yesterday
and does things "the right way". Few things are still missing (device
routes etc.), I'll add them later in the evening.
Martin Mares [Mon, 7 Dec 1998 21:59:15 +0000 (21:59 +0000)]
Minor rte/rta interface changes:
o rte can now contain a pointer to both cached and uncached rta. Protocols
which don't need their own attribute caching can now just fill-in a rta,
link it to rte without any calls to attribute cache and call rte_update()
which will replace rte->attrs by a cached copy.
o In order to support this, one of previously pad bytes in struct rta
now holds new attribute flags (RTAF_CACHED). If you call rte_update()
with uncached rta, you _must_ clear these flags. In other cases rta_lookup()
sets it appropriately.
o Added rte_free() which is useful when you construct a rte and then the
circumstances change and you decide not to use it for an update. (Needed
for temporary rte's in kernel syncer...)
Martin Mares [Mon, 7 Dec 1998 10:15:42 +0000 (10:15 +0000)]
KRF_* flags moved to krt.h as they are internal to kernel syncer,
fib->pad0,pad1 renamed to x0,x1 and in case of struct net x0 is reserved
for kernel syncing as well.
Martin Mares [Sun, 29 Nov 1998 22:03:58 +0000 (22:03 +0000)]
Added configuration of the device internal protocol. This is primarily
intended to serve as an example of interface pattern list use. As a side
effect, you can disable generating of device routes by disabling
this protocol.
Martin Mares [Sun, 29 Nov 1998 22:01:03 +0000 (22:01 +0000)]
Added functions for manipulating interface name pattern lists:
o iface_patt_match(list, iface) -- match interface against list
o iface_patts_equal(a, b, c) -- compare whether two pattern lists are
equal or not. c(x,y) is called for comparison of protocol-dependent
data.