Martin Mares [Mon, 29 Mar 1999 19:35:47 +0000 (19:35 +0000)]
Added lp_flush() which flushes contents of a linear pool, leaving all the
memory available for subsequent allocations from the same pool. Both flushing
and re-using the memory costs just few instructions.
Martin Mares [Mon, 29 Mar 1999 19:04:14 +0000 (19:04 +0000)]
After today's lengthy discussions about filter syntax, let's clean up
whitespace/semicolon rules for whole config file:
o All non-zero amounts of whitespace are equivalent to single space
(aka `all the whitespace has been born equal' ;-)).
o Comments count as whitespace.
o Whitespace has no syntactic signifance (it can only separate lexical
elements).
o Consequence: line ends are no longer treated as `;'s.
o Every declaration must be terminated by an explicit `;' unless
or by a group enclosed in `{' and `}'.
Martin Mares [Sat, 27 Mar 1999 22:51:05 +0000 (22:51 +0000)]
Cleaned up system configuration files -- removed few obsolete parameters,
documented the remaining ones (sysdep/cf/README).
Available configurations:
o linux-20: Old Linux interface via /proc/net/route (selected by default
on pre-2.1 kernels).
o linux-21: Old Linux interface, but device routes handled by the
kernel (selected by default for 2.1 and newer kernels).
o linux-22: Linux with Netlink (I play with it a lot yet, so it isn't
a default).
o linux-ipv6: Prototype config for IPv6 on Linux. Not functional yet.
Martin Mares [Fri, 26 Mar 1999 21:50:43 +0000 (21:50 +0000)]
Added everything protocols need to know about multiple routing tables,
i.e. struct proto now contains field 'table' pointing to routing table
the protocol is attached to. Use this instead of &master_table.
Modified all protocols except the kernel syncer to use this field.
Martin Mares [Fri, 26 Mar 1999 21:44:38 +0000 (21:44 +0000)]
Moved to a much more systematic way of configuring kernel protocols.
o Nothing is configured automatically. You _need_ to specify
the kernel syncer in config file in order to get it started.
o Syncing has been split to route syncer (protocol "Kernel") and
interface syncer (protocol "Device"), device routes are generated
by protocol "Direct" (now can exist in multiple instances, so that
it will be possible to feed different device routes to different
routing tables once multiple tables get supported).
See doc/bird.conf.example for a living example of these shiny features.
Martin Mares [Wed, 17 Mar 1999 14:29:39 +0000 (14:29 +0000)]
A couple of filter tweaks:
o Introduced struct filter which serves as an external reference
to filter. Using struct symbol for this is unwise since it doesn't
allow extra information attached to the filter and it also forces
all filters to be named.
o Implemented config rule 'filter' which matches either named filter
or an embedded unnamed filter (`{ <filter> }').
o Fixed totally bogus comment at the top of filter.h.
o Added a missing prototype for f_run() to filter.h.
Martin Mares [Thu, 4 Mar 1999 11:36:26 +0000 (11:36 +0000)]
Use dmalloc instead of EFence when available (dmalloc has lot of improvements
over EFence and also hopefully smaller memory overhead, but sadly it's non-free
for commercial use).
If the DMALLOC_OPTIONS environment variable is not set, switch on `reasonable'
checks by default.
Also introduced mb_allocz() for cleared mb_alloc().
Martin Mares [Wed, 3 Mar 1999 19:49:56 +0000 (19:49 +0000)]
Rewrote the kernel syncer. The old layering was horrible.
The new kernel syncer is cleanly split between generic UNIX module
and OS dependent submodules:
- krt.c (the generic part)
- krt-iface (low-level functions for interface handling)
- krt-scan (low-level functions for routing table scanning)
- krt-set (low-level functions for setting of kernel routes)
krt-set and krt-iface are common for all BSD-like Unices, krt-scan is heavily
system dependent (most Unices require /dev/kmem parsing, Linux uses /proc),
Netlink substitues all three modules.
We expect each UNIX port supports kernel routing table scanning, kernel
interface table scanning, kernel route manipulation and possibly also
asynchronous event notifications (new route, interface state change;
not implemented yet) and build the KRT protocol on the top of these
primitive operations.
Martin Mares [Wed, 3 Mar 1999 19:33:54 +0000 (19:33 +0000)]
Introduced protocol priority (all 'normal' protocols should use the
default zero priority). No more "kernel syncer initialized before
device routes" problems.
Martin Mares [Tue, 2 Mar 1999 18:36:09 +0000 (18:36 +0000)]
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).
Martin Mares [Tue, 2 Mar 1999 17:28:06 +0000 (17:28 +0000)]
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.
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