Commit graph

111 commits

Author SHA1 Message Date
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
4b0d57e531 Added CONFIG_MULTIPLE_TABLES whereever appropriate. 1999-05-21 14:29:44 +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
a2697f02ac Netlink support for secondary interface addresses. 1999-05-07 13:46:16 +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
73c7bed168 Defined CONFIG_SELF_CONSCIOUS whenever the kernel scanner is able
to distinguish between our own routes and alien ones.
1999-04-03 13:00:52 +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
fb71b23e60 Remember that we can run device syncer without kernel syncer
and vice versa now.
1999-03-29 20:33:45 +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
1127ac6ec7 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.
1999-03-27 22:51:05 +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
f79a749d0b Removed our declaration of RTPROT_BIRD since Alexey has assigned
us a real protocol number in 2.2.4 kernel.
1999-03-24 09:23:34 +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
2253c9e239 Although there are still heaps of FIXME's, Netlink works.
To build BIRD with Netlink support, just configure it with

	./configure --with-sysconfig=linux-21

After it will be tested well enough, I'll probably make it a default
for 2.2 kernels (and rename it to linux-22 :)).
1999-03-04 14:23:32 +00:00
Martin Mares
f81dc8564a Converted some mb_alloc/bzero pairs to mb_allocz. 1999-03-04 11:40:05 +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
aa64578641 Netlink scans routes... 1999-03-03 20:57:29 +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
7972248d5d Netlink module supports interface scan on startup. Working on more. 1999-03-02 18:37:02 +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
b982b6db2b Implemented netlink protocol parsing functions. More to come tomorrow. 1999-03-01 22:31:27 +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