Commit graph

81 commits

Author SHA1 Message Date
Martin Mares f4aabcee62 Perform gracious shutdown upon receipt of SIGTERM. Finally we can
test the whole protocol shutdown code... :)
1999-02-13 20:15:36 +00:00
Martin Mares 1a54b1c6ac Implemented real cleanup and pruning of routing table on protocol shutdown. 1999-02-13 19:15:28 +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 64011f898c struct proto again contains instance name (a copy of proto->cf->name). 1999-02-11 22:45:54 +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
Pavel Machek 77cedad1f6 Keep protocol data out of iface_patt. 1999-01-12 16:41:34 +00:00
Martin Mares 18fff6a197 Initialize only protocols which are compiled in :) 1999-01-10 00:26:11 +00:00
Martin Mares 49e7e5ee0b New makefiles. Includes support for out-of-source-tree builds. 1999-01-10 00:18:32 +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 08c69a7720 die() -> bug() where appropriate. 1998-12-20 14:27:37 +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 618533af91 Added source RTS_DUMMY for temporary routes. They should never appear
in the main table.
1998-12-08 18:30:35 +00:00
Martin Mares 04925e9040 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...)
1998-12-07 21:59:15 +00:00
Martin Mares 12df4d909b 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.
1998-12-07 10:15:42 +00:00
Martin Mares 78d06cf2bc Removed protocol-specific data in rte for protocol static since no
such data ever existed.
1998-12-06 23:11:47 +00:00
Martin Mares 436965d25e Aesthetic fix for neighbor cache debug dump. 1998-12-06 23:11:18 +00:00
Martin Mares a1bf6440b5 Added skeleton of static route protocol. 1998-12-06 18:21:23 +00:00
Martin Mares b35d72ac66 Name cleanups as suggested by Pavel:
- cfg_strcpy() -> cfg_strdup()
- mempool -> linpool, mp_* -> lp_*  [to avoid confusion with memblock, mb_*]

Anyway, it might be better to stop ranting about names and do some *real* work.
1998-12-06 11:59:18 +00:00
Pavel Machek 2d9290e973 Rip now has configurable per-interface metric (please rewiev), and few
more configurable parameters. To do that, union was added into iface_patt.
1998-12-04 11:45:51 +00:00
Martin Mares 50d8424ad1 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.
1998-11-29 22:03:58 +00:00
Martin Mares 66efdf962a Handle disabled protocol instances. 1998-11-29 22:01:33 +00:00
Martin Mares ed45f2e126 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.
1998-11-29 22:01:03 +00:00
Martin Mares bd5d0d62f1 Allow setting debug value and `disabled' flag in protocol definition. 1998-11-29 14:40:39 +00:00
Martin Mares 0cf86f0fc3 Renamed DEBUG' symbol to DEBUGGING' to prevent collisions with token
names and include files.
1998-11-29 14:38:34 +00:00
Martin Mares 7af99789c7 Oops, forgot to remove a debugging kludge. 1998-11-27 21:34:03 +00:00
Martin Mares 0b62c3a7c7 Trivial 15-line bison excercise: Implemented expressions including
user-defined numeric symbols. Whenever possible, use `expr' instead
of `NUM' to get full express ion power :-)
1998-11-27 21:32:45 +00:00
Martin Mares c74c0e3cdf First attempt at protocol configuration (now done only for RIP). 1998-11-27 21:09:57 +00:00
Martin Mares da87782278 Parser fragment for the core. Now handles only router ID setting. 1998-11-27 19:37:57 +00:00
Martin Mares fe7cec12e8 Replaced nest/confile.h by conf/conf.h, added a lot of new definitions. 1998-11-27 19:35:10 +00:00
Martin Mares dafd580ed9 Previous fix was wrong. 1998-10-26 15:24:32 +00:00
Martin Mares db6984c43c rte_update: Doesn't loop forever when multiple routes point to the same
destination.
1998-10-26 15:01:04 +00:00
Pavel Machek feb6abe009 RIP now actually talks to itself. 1998-10-20 16:12:43 +00:00
Martin Mares 8ca8683c70 Beware the NULL route, my son... The bugs that bite, the BIRDs that crash :-) 1998-10-20 15:47:02 +00:00
Martin Mares acc62f5e1d Insert/remove hooks return void, not int. 1998-10-20 15:17:38 +00:00
Martin Mares a0762910a6 Added pointer to network to RTE. The complications with passing NET separately
aren't worth 4 bytes per RTE.

rte_discard and rte_dump don't need net * as parameter.
1998-10-20 15:13:18 +00:00
Martin Mares 7d83290780 Generate router_id automatically if possible (standard "smallest of local
regular interface addresses" rule).

Protocols should NOT rely on router_id existence -- when router ID is not
available, the router_id variable is set to zero and protocols requiring
valid router ID should just refuse to start, reporting such error to the log.
1998-10-19 18:13:36 +00:00
Martin Mares 36f2caf147 Fixed generation of device routes for unnumbered point-to-point links. 1998-10-19 17:46:45 +00:00
Martin Mares f184ea6f7e Proto struct now contain (down | starting | up) state. 1998-10-19 17:45:29 +00:00
Martin Mares 4c45595e3b o FIB flags now available for FIB users.
o  struct network: FIB flags used for kernel syncing.
o  struct network: `next' field deleted (historical relic).
1998-10-18 22:24:41 +00:00
Martin Mares 3629bcf0c7 Preconfig, postconfig and init hooks can be NULL. 1998-10-18 12:26:02 +00:00
Martin Mares 0432c0173b Split protocol init to building of protocol list and real protocol init.
Added kernel route table syncer skeleton.
1998-10-18 11:53:21 +00:00
Martin Mares 05e56feb57 Removed global pointer to proto_dev. 1998-10-18 11:50:36 +00:00
Martin Mares 5b22683d2f After contemplating about RIP route timeouts for a long time, I've implemented
protocol callbacks for route insertion and deletion from the central table.
RIP should maintain its own per-protocol queue of existing routes, scan it
periodically and call rte_discard() for routes that have timed out.
1998-10-18 11:13:16 +00:00
Martin Mares 570ce189d7 Implemented `route last modified' time. 1998-10-18 10:49:46 +00:00
Martin Mares 2a900b1b15 Fixed misleading comment. 1998-10-17 11:26:28 +00:00
Martin Mares 7f3d198df1 Each protocol now hears even its own routes and needs to make its own
loop detection. This is needed since both RIP and OSPF handle multiple
neighbors and they need to redistribute routes learned from each neighbor
to the remaining ones.
1998-10-17 11:24:13 +00:00