Commit graph

204 commits

Author SHA1 Message Date
Martin Mares 1a54b1c6ac Implemented real cleanup and pruning of routing table on protocol shutdown. 1999-02-13 19:15:28 +00:00
Martin Mares ab749558a2 Pass new argument to FIB_ITERATE_END. 1999-02-13 19:14:16 +00:00
Martin Mares 2569bc4073 Fixed bug in FIB_ITERATE_END: it assumed the control variable is named
"z". I've added an argument specifying name of the variable.

Renamed "again" label in FIB_ITERATE_* to "fis_again" to avoid name
clashes.
1999-02-13 19:13:51 +00:00
Martin Mares 4e9498cbb1 config->router_id works again. 1999-02-13 18:42:00 +00:00
Martin Mares 67bd949a52 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.
1999-02-11 22:59:06 +00:00
Martin Mares 14dea0ed25 Run the event queue before writing SIGUSR dumps. 1999-02-11 22:51:15 +00:00
Martin Mares 64011f898c struct proto again contains instance name (a copy of proto->cf->name). 1999-02-11 22:45:54 +00:00
Martin Mares 3b15402fd4 Grrr, forgot to commit the event routines themselves :| 1999-02-11 22:18:36 +00:00
Martin Mares e8f73195fa 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
1999-02-11 21:18:26 +00:00
Pavel Machek edf62ba13f Propagate depend into all subdirectories; make rip compile after
latest mj's changes.
1999-02-08 22:50:32 +00:00
Martin Mares ed245f967f Synced Linux sysdeps to new interface. 1999-02-05 21:39:21 +00:00
Martin Mares 10d807d000 Synced kernel interface to new interface. 1999-02-05 21:38:50 +00:00
Martin Mares e9e3dc2659 Modified static router to use new interface. 1999-02-05 21:38:22 +00:00
Martin Mares 31b3e1bbf5 Implemented new configuration/reconfiguration interface and defined protocol
state machines. Full explanation will follow soon.
1999-02-05 21:37:34 +00:00
Martin Mares c4c63eecc3 Added several parentheses to MIN/MAX macros. 1999-02-05 21:29:19 +00:00
Pavel Machek 292099d55f Few fixes in parsing of filters 1999-02-03 12:28:16 +00:00
Martin Mares 294c182eb1 Replaced the old ugly ipv6 compilation hack by a conditional in Modules. 1999-01-23 21:08:59 +00:00
Martin Mares 2c2f67bd83 Filter all `Modules' files through C preprocessor, so that they can
reference BIRD configuration.

By the way: Do you know GCC by default does `#define unix 1'?
1999-01-23 21:08:36 +00:00
Pavel Machek ca3d562b24 filters_init() renamed to filters_postconfig(). 1999-01-15 18:13:55 +00:00
Martin Mares c9b6670608 Original expr' is back, filter expressions renamed to term'.
In the future, we'll allow any filter term in place of `expr' and we'll
just evaluate it immediately, but not now as we have no evaluation
routines.
1999-01-15 18:04:28 +00:00
Martin Mares 3169cf6991 Added bird.conf to .cvsignore and created an example configuration file.
If you want to run bird now, just copy doc/bird.conf.example as bird.conf
and edit it to suit your needs.
1999-01-15 17:18:41 +00:00
Martin Mares e3a39a9ee7 Killed duplicate %type for expr. 1999-01-15 16:59:26 +00:00
Pavel Machek ca6dfded2c Make filters actually compiled. 1999-01-15 16:52:14 +00:00
Pavel Machek b9d70dc84e Filters, second try. This time they have their own directory. 1999-01-15 16:49:17 +00:00
Martin Mares b79f9215b9 Propagate "depend" target to real top-level Makefile. 1999-01-15 16:40:14 +00:00
Pavel Machek 489b6b5e00 #if 1 that creeped into cvs killed. 1999-01-15 16:13:51 +00:00
Pavel Machek eeb05158ac Be a tiny bit more verbose. 1999-01-15 14:42:55 +00:00
Pavel Machek 72380a3447 Filters added. They are unable to do anything interesting for now
(with exception of printing integers to screen), but they exist.
1999-01-15 14:41:51 +00:00
Pavel Machek 41183888ee Properly initialize filters. Also bumped version to 0.0.0 as it
actually does something.
1999-01-15 14:40:50 +00:00
Martin Mares cceb3e7d2f Fixed trivial bug in naming of `depend' file. Argh. 1999-01-12 20:36:18 +00:00
Pavel Machek 663683a575 Make it compile again (stupid makefiles!), make quiet option work
(multicast/broadcast options are currently unimplemented).
1999-01-12 16:50:38 +00:00
Pavel Machek 77cedad1f6 Keep protocol data out of iface_patt. 1999-01-12 16:41:34 +00:00
Pavel Machek 50e89a6ea2 Patterns expanded in the right way 1999-01-12 16:40:55 +00:00
Martin Mares 18fff6a197 Initialize only protocols which are compiled in :) 1999-01-10 00:26:11 +00:00
Martin Mares b296730cb6 Few last-minute bug fixes. 1999-01-10 00:25:50 +00:00
Martin Mares 49e7e5ee0b New makefiles. Includes support for out-of-source-tree builds. 1999-01-10 00:18:32 +00:00
Martin Mares 2f9bcf9713 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.
1999-01-09 15:02:11 +00:00
Pavel Machek 6996f459c6 Bird now uses fib structure instead of linklist. 1998-12-22 19:41:04 +00:00
Pavel Machek 1d7c44b711 Oops, previous modification for passing NULL to fib_init() did not
compile :-(.
1998-12-22 19:20:43 +00:00
Pavel Machek ce45fc1287 Allow NULL to init_fib(). 1998-12-22 18:55:49 +00:00
Martin Mares 852fc0af31 log(), die() and bug() messages shound NOT contain trailing newlines. 1998-12-20 14:29:06 +00:00
Martin Mares 08c69a7720 die() -> bug() where appropriate. 1998-12-20 14:27:37 +00:00
Martin Mares ee969ea7f4 Added #if 0 to rip_postconfig(), so that it doesn't crash whole daemon
when RIP is unconfigured.

die() -> bug()
1998-12-20 14:26:57 +00:00
Martin Mares 98e87c8628 Finer grained logging levels:
#define L_DEBUG "\001"   /* Debugging messages */
#define L_INFO "\002"    /* Informational messages */
#define L_WARN "\003"    /* Warnings */
#define L_ERR "\004"     /* Errors */
#define L_AUTH "\005"    /* Authorization failed etc. */
#define L_FATAL "\006"   /* Fatal errors */
#define L_TRACE "\002"   /* Protocol tracing */
#define L_INFO "\003"    /* Informational messages */
#define L_REMOTE "\004"  /* Remote protocol errors */
#define L_WARN "\004"    /* Local warnings */
#define L_ERR "\005"     /* Local errors */
#define L_AUTH "\006"    /* Authorization failed etc. */
#define L_FATAL "\007"   /* Fatal errors */
#define L_BUG "\010"     /* BIRD bugs */

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.
1998-12-20 14:24:35 +00:00
Martin Mares e440395d7d When printing a routing table, fib_check() it. 1998-12-20 14:01:37 +00:00
Martin Mares 3ab001b974 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.
1998-12-20 14:01:20 +00:00
Martin Mares a6f250f5c6 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.
1998-12-20 13:57:49 +00:00
Martin Mares a05406e69c Implemented deletion/insertion/asynchronous-walk lists.
For example of their use, look at comments in lib/slists.h.
1998-12-20 13:56:27 +00:00
Martin Mares 29ad2c9ee1 Variance estimation fixed. 1998-12-19 21:53:28 +00:00
Martin Mares 87b60bf7e8 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).
1998-12-19 11:51:47 +00:00