Commit graph

87 commits

Author SHA1 Message Date
Martin Mares ed6081502a Added skeleton of the client. Does nothing, but at least compiles. 1999-10-29 09:44:44 +00:00
Martin Mares f782b72c53 Failure to set socket TOS is not a fatal error. 1999-10-02 11:06:44 +00:00
Martin Mares f651941402 Added a function for generating 32-bit random numbers. 1999-08-17 20:47:40 +00:00
Martin Mares 4532a89e31 Taught Netlink how to behave in IPv6 world. 1999-08-03 19:37:37 +00:00
Martin Mares 4f22c98185 Support for IPv6 sockets. How nice one doesn't have to ifdef around
ten years of API evolution :-)
1999-08-03 19:36:51 +00:00
Martin Mares dce267832a Basic support for IPv6. The system-dependent part doesn't work yet,
but the core routines are there and seem to be working.

   o  lib/ipv6.[ch] written
   o  Lexical analyser recognizes IPv6 addresses and when in IPv6
      mode, treats pure IPv4 addresses as router IDs.
   o  Router ID must be configured manually on IPv6 systems.
   o  Added SCOPE_ORGANIZATION for org-scoped IPv6 multicasts.
   o  Fixed few places where ipa_(hton|ntoh) was called as a function
      returning converted address.
1999-08-03 19:36:06 +00:00
Martin Mares 7de45ba4a0 Kernel route syncer supports multiple tables.
The changes are just too extensive for lazy me to list them
there, but see the comment at the top of sysdep/unix/krt.c.
The code got a bit more ifdeffy than I'd like, though.

Also fixed a bunch of FIXME's and added a couple of others. :)
1999-08-03 19:33:22 +00:00
Martin Mares 9273035403 Changes to interface handling on traditional Unices:
o  Aliases are interpreted as secondary addresses.
  o  When the system doesn't supply interface indices, generate
     our ones.
1999-08-03 19:30:20 +00:00
Martin Mares 913f7dc9f2 Added functions for parsing and formatting of dates. 1999-08-03 19:29:27 +00:00
Martin Mares bd7f1081f2 Grrr, the "obvious fix" to multicasting code from yesterday was
fundamentally wrong. Reversed.
1999-06-01 15:31:43 +00:00
Martin Mares c7208da0b7 Fix potential multicasting bug. 1999-05-31 20:28:46 +00:00
Martin Mares bb027be1e2 Added extra argument to rt_update hook which contains a pointer to the
temporary attribute list.
1999-05-31 18:55:35 +00:00
Martin Mares 1c3c9dceb3 Removed one unused structure field. 1999-05-21 14:29:23 +00:00
Martin Mares 4f1a6d27b9 Kill remaining master_table relics in KRT code.
Make all protocols pass routing table to rte_update and rte_discard.
1999-05-17 20:16:53 +00:00
Martin Mares 9a158361da I rewrote the interface handling code, so that it supports multiple
addresses per interface (needed for example for IPv6 support).

Visible changes:

o  struct iface now contains a list of all interface addresses (represented
   by struct ifa), iface->addr points to the primary address (if any).
o  Interface has IF_UP set iff it's up and it has a primary address.
o  IF_UP is now independent on IF_IGNORED (i.e., you need to test IF_IGNORED
   in the protocols; I've added this, but please check).
o  The if_notify_change hook has been simplified (only one interface pointer
   etc.).
o  Introduced a ifa_notify_change hook. (For now, only the Direct protocol
   does use it -- it's wise to just listen to device routes in all other
   protocols.)
o  Removed IF_CHANGE_FLAGS notifier flag (it was meaningless anyway).
o  Updated all the code except netlink (I'll look at it tomorrow) to match
   the new semantics (please look at your code to ensure I did it right).

Things to fix:

o  Netlink.
o  Make krt-iface interpret "eth0:1"-type aliases as secondary addresses.
1999-05-06 21:38:11 +00:00
Martin Mares 4c5e5e3a1c Multicasts once again: When using SO_BINDTODEVICE, don't specify IP address
of the interface.
1999-04-14 12:29:47 +00:00
Martin Mares 1b50a1e4be Next attempt to get SO_BINDTODEVICE work :) 1999-04-14 11:39:07 +00:00
Martin Mares 36154beb70 Use SO_BINDTODEVICE if we're using old multicast API (i.e., struct ip_mreq
and not ip_mreqn). This should get multicasts on unnumbered PtP links work.
1999-04-14 11:21:02 +00:00
Martin Mares 01bd7759b2 Ignore alias interfaces (some day, we will treat them as pure secondary
interface addresses).
1999-04-12 18:07:05 +00:00
Martin Mares 08e2d6259a Removed TOS support. This simplifies many things a lot. 1999-04-12 18:01:07 +00:00
Martin Mares 61fb537c62 Use struct ip_mreqn' instead of struct ip_mreq' for multicast
operations on 2.1/2.2 kernels. This allows passing of real interface
indexes instead of referencing interfaces by their IP addresses which
fails badly in presence of unnumbered interfaces.

Unfortunately, this structure is not visible with glibc 2.0 as it provides
its own networking headers :-(  Both libc5 and glibc 2.1 should be OK.
1999-04-12 15:27:56 +00:00
Martin Mares 5a99ade413 Fixed a couple of bugs in handling of multicast sockets.
See comments in lib/socket.h for a detailed guide on how to use them.
1999-04-12 14:57:46 +00:00
Martin Mares 49ed70b48e Portability fixes. 1999-04-07 14:25:56 +00:00
Martin Mares c10421d3d4 More changes to the kernel syncer.
o  Now compatible with filtering.
o  Learning of kernel routes supported only on CONFIG_SELF_CONSCIOUS
   systems (on the others it's impossible to get it semantically correct).
o  Learning now stores all of its routes in a separate fib and selects
   the ones the kernel really uses for forwarding packets.
o  Better treatment of CONFIG_AUTO_ROUTES ports.
o  Lots of internal changes.
1999-04-03 13:05:18 +00:00
Martin Mares fe662dfd78 Fixed `too many interfaces' cases. 1999-04-02 13:38:54 +00:00
Pavel Machek 0498d92f95 Believe it or not, printf()'s does not work too much without this one. 1999-04-02 11:45:55 +00:00
Martin Mares 8cda9cdbcf Argh, the fix was wrong. 1999-04-01 19:23:59 +00:00
Martin Mares e4241f24f2 Portability fixes. 1999-04-01 15:35:15 +00:00
Martin Mares abae6e9cd3 First few FreeBSD portability fixes. 1999-04-01 15:33:52 +00:00
Martin Mares 5bc512aa3a Clarify resource dumps and include them in the main debugging dump. 1999-03-29 20:14:33 +00:00
Martin Mares 3f2a21fd34 Don't try to delete interface routes on CONFIG_AUTO_ROUTES systems. 1999-03-29 20:14:00 +00:00
Martin Mares f54801ffed Moved all system-dependent #include's containing endianity conversion
functions to sysdep header endian.h.
1999-03-29 19:14:43 +00:00
Martin Mares 7e5f5ffdda 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.
1999-03-26 21:44:38 +00:00
Martin Mares 111213f0b6 Fixed processing of !krt_capable() routes. Converted device route decisions
to the krt_capable mechanism as well.
1999-03-04 19:00:31 +00:00
Martin Mares e16155ae4a KRT: Implemented asynchronous route / interface state notifications
(via Netlink). Tweaked kernel synchronization rules a bit. Discovered
locking bug in kernel Netlink :-)

Future plans: Hunt all the bugs and solve all the FIXME's.
1999-03-04 18:36:18 +00:00
Martin Mares 7a2105becd 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().
1999-03-04 11:36:26 +00:00
Martin Mares 53b7a2982a Fix several things I broke today. 1999-03-03 20:55:35 +00:00
Martin Mares 2d14045224 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.
1999-03-03 19:49:56 +00:00
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 b4b3b39e20 Added SK_MAGIC type sockets for internal use by system dependent code,
especially for netlink communication.
1999-03-01 22:30:33 +00:00
Martin Mares 025d14cd5a Use traditional Unix route/iface interface only when CONFIG_NETLINK
is not defined. Also moved declarations of Unix iface logic to krt.h.
1999-03-01 19:05:58 +00:00
Martin Mares 013a9b91fe When shutting down, remove all routes (except for RTS_INHERIT and RTS_DEVICE
routes) from kernel routing tables unless the "persist" switch is set.
1999-02-13 20:46:03 +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 4c9dd1e4b9 Synchronize signals to the main select/event/timer loop.
Parse command line options.
1999-02-13 19:43:21 +00:00
Martin Mares 4e9498cbb1 config->router_id works again. 1999-02-13 18:42:00 +00:00
Martin Mares 14dea0ed25 Run the event queue before writing SIGUSR dumps. 1999-02-11 22:51:15 +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
Martin Mares 10d807d000 Synced kernel interface to new interface. 1999-02-05 21:38:50 +00:00