Commit graph

539 commits

Author SHA1 Message Date
Martin Mares
e35ef181a4 o The if_change_too_big_p change was too high-spirited. Fixed.
o  Introduced if_find_by_index()
o  Recognizing two types of interface updates: full update (starting with
   if_start_update(), ending with if_end_update(), guaranteed to see
   all existing interfaces) and a partial update (only if_update(),
   usually due to asynchronous interface notifications).
1999-03-02 18:36:09 +00:00
Martin Mares
bcbd8cc3be Interface logic changes:
o  Introduced IF_LINK_UP flag corresponding to real link state.
o  Allowed addressless interfaces.
o  IF_UP is now automatically calculated and set iff the interface
   is administratively up, has link up and has an IP address assigned.
   It may be IF_IGNORED, though (as in case of the loopback).
o  Any changes which include up/down transition are considered small
   enough to not provoke artificial upping and downing of the interface.
o  When an interface disappears (i.e., it wasn't seen in the last scan),
   we announce this change only once.
o  IF_LOOPBACK implies IF_IGNORE.
1999-03-02 17:28:06 +00:00
Martin Mares
1b769b08c1 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.
1999-03-01 20:13:54 +00:00
Martin Mares
d1f7eab6b5 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).
1999-02-13 21:58:53 +00:00
Martin Mares
5996da6a1d 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.
1999-02-13 21:29:01 +00:00
Martin Mares
3fb4ca2ce2 Don't send any neighbor notifications to protocols being flushed. 1999-02-13 20:57:47 +00:00
Martin Mares
783f8b689a When protocols go down, prune the neighbor list. 1999-02-13 20:55:08 +00:00
Martin Mares
0a2e9d9f56 Moved sanity check of protocol state during annoucements to rte_announce. 1999-02-13 20:19:24 +00:00
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
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
Martin Mares
33beab4f6c Added configuration pool. 1998-06-03 08:36:34 +00:00
Martin Mares
4cc78c5082 - Rewrote whole interface logic. Removed support for multiple addresses per
interface since it makes much trouble everywhere. Instead, we understand
  secondary addresses as subinterfaces.

- In case interface addresses or basic flags change, we simply convert it
  to a down/up sequence.

- Implemented the universal neighbour cache. (Just forget what did previous
  includes say of neighbour caching, this one is brand new.)
1998-06-01 21:41:11 +00:00
Martin Mares
fe82105e5d Debug messages. 1998-05-26 21:43:45 +00:00
Martin Mares
8a48ecb8b1 Implemented scanning of network interfaces. Mostly very ugly code due to
terrible kernel interface (SIOGIFCONF and friends).
1998-05-26 21:42:05 +00:00
Martin Mares
ed68a5c6a4 Resource pools are now named. 1998-05-26 21:37:37 +00:00
Martin Mares
6d45cf21be Added debug dump function, but it's still empty :( 1998-05-24 14:49:14 +00:00
Martin Mares
ded3ee6ddd protos_init, not proto_init. 1998-05-24 14:48:52 +00:00
Martin Mares
b53499cdaa Added interface index (used only by OS-dependent code since ifindexes itself
are OS-dependent).
1998-05-24 14:48:09 +00:00
Martin Mares
a2ccbb0b97 Implemented timers. Using bird_clock_t for absolute time from now... 1998-05-24 14:40:29 +00:00
Martin Mares
235562ca5a Point-to-point links: added address of the opposite end. 1998-05-24 09:20:59 +00:00
Martin Mares
2326b001d6 Added routing table and routing attribute code. 1998-05-20 11:54:33 +00:00
Martin Mares
62aa008abd Parts of routing table code. Data structure declarations should be
complete now.
1998-05-15 07:54:32 +00:00
Martin Mares
a8b6038225 Next attempt on data structures... 1998-05-03 16:42:45 +00:00
Martin Mares
1feea03e74 Changed #include <x/y> to #include "x/y" for our local includes, so that
gcc -MM can be used to separate them from the system ones.

Added automatic generation of dependencies.
1998-04-28 14:39:34 +00:00
Martin Mares
c40e05a0df Added IP address manipulation macros, interface declarations and logging. 1998-04-23 14:01:15 +00:00
Martin Mares
481f69854a Added few route attributes. 1998-04-23 08:09:39 +00:00
Martin Mares
58ef912c6b First look at data structures. More to come tomorrow... 1998-04-22 12:58:34 +00:00