Commit graph

67 commits

Author SHA1 Message Date
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
Martin Mares
47b793064c Solve chicken-and-egg problems with protocol startup. We now queue all inactive
protocols and don't send route/interface updates to them and when they come up,
we resend the whole route/interface tables privately.

Removed the "scan interface list after protocol start" work-around.
1998-10-17 11:05:18 +00:00
Martin Mares
8c43696da0 Route update hook now gets network prefix as well as updated
route attributes.
1998-08-31 21:13:42 +00:00
Pavel Machek
48b41d5811 Do not segfault on iface == NULL. 1998-07-28 21:42:08 +00:00
Pavel Machek
87d2be86e5 Adding proto_dump_all() function 1998-07-09 19:36:52 +00:00
Martin Mares
962ba482fd Use '%I' instead of dirty address printing hacks. 1998-06-17 14:36:02 +00:00
Martin Mares
620a355a15 Now sending IF_CHANGE_CREATE when a new interface appears and IF_CHANGE_UP
only if it's really up.
1998-06-04 20:30:11 +00:00
Martin Mares
236d4eb8ce FIB_WALK and friends are now slightly more friendly. 1998-06-04 20:29:44 +00:00
Martin Mares
66e53309ac Dumping of _static_ attributes implemented. 1998-06-04 20:29:05 +00:00
Martin Mares
b1e4f81485 We have full interface routes now. 1998-06-04 20:28:43 +00:00
Martin Mares
0cdbd3975a Handle route deletion without segfaults. A bit more debug dumps. 1998-06-04 20:28:19 +00:00
Martin Mares
c5ffa44759 Skeleton of device route protocol. As it's tightly coupled with our kernel,
it sits here instead of `proto/dev'.
1998-06-03 08:42:16 +00:00
Martin Mares
d9f330c5ff Protocol hooks. All of them may be NULL. 1998-06-03 08:40:10 +00:00
Martin Mares
7f4a39886c Basic protocol operations. 1998-06-03 08:38:53 +00:00
Martin Mares
a5f1a60e02 Changed protocol declarations a bit. 1998-06-03 08:38:06 +00:00