Commit graph

399 commits

Author SHA1 Message Date
Ondrej Zajicek fd91ae3325 Fix problem with local time changes. 2008-11-05 22:36:49 +01:00
Ondrej Zajicek 1389f3699f Fixes bugs in IPv6 code caused by recent commits. 2008-11-05 21:39:04 +01:00
Ondrej Zajicek a39b165e45 Multihop BGP was completely broken, because listening socket has always
ttl 1.
2008-11-01 16:58:40 +01:00
Ondrej Zajicek a98fbf0f12 Merge branch 'dev' into out 2008-10-27 00:20:22 +01:00
Ondrej Zajicek 68fa95cfec Check of socket name length 2008-10-26 23:55:38 +01:00
Ondrej Zajicek 1567edea8d Bugfix for routing table breaking bug.
Here is a patch fixing a bug that causes breakage of a local routing
table during shutdown of Bird. The problem was caused by shutdown
of 'device' protocol before shutdown of 'kernel' protocol.  When
'device' protocol went down, the route (with local network prefix)
From different protocol (BGP or OSPF) became preferred and installed
to the kernel routing table. Such routes were broken (like
192.168.1.0/24 via 192.168.1.2). I think it is also the cause
of problem reported by Martin Kraus.

The patch disables updating of kernel routing table during shutdown of
Bird. I am not sure whether this is the best way to fix it, I would
prefer to forbid 'kernel' protocol to overwrite routes with
'proto kernel'.

The patch also fixes a problem that during shutdown sometimes routes
created by Bird remained in the kernel routing table.
2008-10-26 23:09:46 +01:00
Ondrej Zajicek d51aa28190 Implementation of MD5 authentication of BGP sessions. 2008-10-26 22:42:39 +01:00
Ondrej Filip 97c6fa02e0 Previous patch reverted. :-( 2008-08-25 12:06:20 +00:00
Ondrej Filip 030e3a79cb Buffer overflow fix. 2008-08-25 11:57:46 +00:00
Martin Mares 057021df0d Fix behavior of ipa_opposite().
It was giving wrong results on /30 networks.
2008-08-25 11:19:49 +00:00
Ondrej Filip 3c3271d9fc Close fd of config file after reconfiguration. 2008-08-24 23:24:14 +00:00
Martin Mares 8411a37e7d Detach from the TTY properly. 2007-06-20 07:33:26 +00:00
Ondrej Filip c025b85273 Real write is only in sk_maybe_write. Previous change partially reverted.
Thank you MJ.
2005-02-14 23:15:04 +00:00
Ondrej Filip 7c49f71559 Added s->err_hook wrapper that empties socket. 2005-02-14 21:28:51 +00:00
Ondrej Filip 030d3b387e Small changed to reduce the number of warnings. 2005-02-14 11:58:46 +00:00
Ondrej Filip 0d3effcf8c Time added in password management. 2005-02-12 22:27:55 +00:00
Ondrej Filip 09e4117cc1 sk_write bugfix for BSD. 2004-06-18 12:54:53 +00:00
Ondrej Filip b7e9c74cba Used parameter can be marked as unused. :-) Thanx MJ. 2004-06-07 16:51:23 +00:00
Ondrej Filip 19d9e30336 Marked unused parameters as unused. 2004-06-07 09:52:15 +00:00
Ondrej Filip 41c8976e29 Test old instance of BIRD. 2004-06-06 17:05:25 +00:00
Martin Mares 6578a60493 Marked unused parameters in sysdep code as such. 2004-06-05 09:11:07 +00:00
Martin Mares e98bc2ea9b Renamed log() to log_msg(), but still keeping the old name as a macro.
This is done to avoid clashes with gcc-3.3 which has built-in logarithms :)
2004-06-05 09:05:12 +00:00
Martin Mares 4da25acb0a Cleaned up sk_reallocate() and friends.
Also, removed the `if (s)' test, because I believe that as the whole
socket interface doesn't accent NULL pointers, sk_reallocate() shouldn't
be the only exception.
2004-06-05 08:56:43 +00:00
Ondrej Filip e7ef86a58c OSPF is ready for changing MTU. 2004-06-04 18:51:29 +00:00
Ondrej Filip 7d72aadb8a CONFIG_SKIP_MC_BIND added.
BSD hates it, Linux needs it.
2004-06-03 08:18:14 +00:00
Ondrej Filip cb4dd4e2f7 Deleted useless rfree. (Socked was freed by cli_free()) 2004-06-02 15:14:49 +00:00
Ondrej Filip b613b9928b #ifdef CONFIG_UNIX_DONTROUTE added. 2004-06-01 10:32:02 +00:00
Martin Mares ea0ac8f69a Move CLI socket to the newly created CLI's pool.
(thanks to Andreas for the original idea)
2004-05-31 22:00:18 +00:00
Martin Mares 38a608c55a Rewritten the I/O loop. All socket operations are now safe, meaning that
you can delete the socket from anywhere in the hooks and nothing should break.
Also, the receive/transmit buffers are now regular xmalloc()'ed buffers,
not separate resources which would need shuffling around between pools.

sk_close() is gone, use rfree() instead.
2004-05-31 21:48:19 +00:00
Martin Mares 5f2a6a9ff3 Fix handling on full pipe to client in bird. Prevent packet overflows
for even only medium sized route table output. Fix a strange garbled
output problem in the client. The latter seems to be caused by some
library doing tcflush while there is still command output pending. So
the best fix here is to do fflush and then tcdrain. Note that this
problem occurs only under certain load situations and is not too easy to
reproduce.

(by Andreas)
2004-05-31 17:55:30 +00:00
Ondrej Filip c222500d8e Previous change was mistake. 2004-05-31 17:00:22 +00:00
Ondrej Filip b1a1fabac7 *BSD port added. (Tested on FreeBSD and NetBSD) 2004-05-31 13:25:00 +00:00
Martin Mares c197d44e17 This probably IS the memory leak we're looking for. Alien routes weren't
correctly disposed of.
2003-08-13 22:07:55 +00:00
Martin Mares 7d875e094b Added missing includes. 2002-11-13 08:47:06 +00:00
Martin Mares a19cd81100 Added missing #include and wondering how could it ever compile. 2002-11-13 08:30:56 +00:00
Martin Mares 01b776e117 Fixed <time.h> vs. <sys/time.h> problems. 2001-03-06 13:40:39 +00:00
Martin Mares f9eb8f7e06 If compiled with --enable-debug, don't even try to log to syslog unless
the user forces it in the config file.
2000-06-19 23:50:02 +00:00
Martin Mares 4daf03e513 Use our own SUN_LEN if libc doesn't provide it. 2000-06-16 23:12:47 +00:00
Martin Mares 5ddf4a58f9 During initialization, log to both syslog and stderr. When a configuration
file has been read and it doesn't specify any logging, log to syslog only
(if syslog is not available, then stderr).
2000-06-09 07:32:57 +00:00
Martin Mares 0b3bf4b1d8 Use SUN_LEN() for length of UNIX domain addresses. This should fix problems
with connection to clients on libc5 machines.
2000-06-09 07:30:22 +00:00
Martin Mares 725270cb1d Fixes for the programmer's manual. 2000-06-08 12:37:21 +00:00
Martin Mares c62d1c19a9 ... as well there. 2000-06-08 10:48:51 +00:00
Martin Mares ec423cc725 Updated CLI helps. 2000-06-08 10:25:02 +00:00
Martin Mares 58f7d004fd Fixes to the progdoc. 2000-06-07 13:25:53 +00:00
Martin Mares 2e9b24211a Spelling fixes to progdoc. 2000-06-07 12:29:08 +00:00
Martin Mares 73275d855d Documented all the sysdeps (only briefly, I admit).
Except for Filters, RIP and OSPF, the progdocs are complete.
2000-06-05 12:49:04 +00:00
Martin Mares 525fa2c1f0 Documented sockets, events and timers. 2000-06-05 12:19:12 +00:00
Martin Mares 10304bed43 Split random number functions off io.c, so that they can be documented
separately.
2000-06-05 11:46:40 +00:00
Martin Mares b594ad2386 tm_format_reltime() works with both past and future timestamps. 2000-06-01 15:13:23 +00:00
Martin Mares 4a91150175 Updated for new scope handling.
Also, provide proper address scopes in struct ifa.
2000-06-01 12:58:41 +00:00
Martin Mares 2f5e5ff9d6 Before configuration file is read, log to _both_ syslog and stderr. 2000-05-31 22:28:36 +00:00
Martin Mares fcb5f4a725 Updated all the Doc files to new format. 2000-05-31 11:30:18 +00:00
Martin Mares 4761efdb43 Tracing of CLI connections/commands can be now controlled
by `debug commands <level>' in the configuration. Level 0 means
no tracing, 1 means connections only, 2 includes all commands.
2000-05-29 22:10:18 +00:00
Martin Mares e67af42805 Support --version and --help. 2000-05-29 21:58:35 +00:00
Martin Mares f990fc61e0 When in persist mode, don't delete routes from kernel tables even if
they cease to exist in our routing tables due to protocols having shut down.
2000-05-16 13:36:38 +00:00
Martin Mares 02bd064ab7 Adapted to new rt_notify semantics. 2000-05-13 11:02:02 +00:00
Martin Mares 5ff0a270cb In non-debug mode, set default logging to syslog only, not stderr. 2000-05-08 22:31:58 +00:00
Martin Mares 4524331a3d Fixed type in daemonization code. 2000-05-08 22:31:34 +00:00
Martin Mares 0bcba21e89 When not debugging, daemonize automatically. 2000-05-08 19:10:36 +00:00
Martin Mares 818ff1e2b7 When reporting a bug(), call abort() instead of exit(), so that we
can analyse the core.
2000-05-08 12:38:00 +00:00
Martin Mares c304392e65 Some less socket error messages. 2000-05-08 12:37:39 +00:00
Martin Mares 9cbf43eb8a Don't report refused connections. 2000-05-08 12:09:10 +00:00
Martin Mares 916c8c0aba Use preferences properly. 2000-05-08 10:40:00 +00:00
Martin Mares 1151401e2b Don't crash when reporting deleted routes.
Set preferences correctly.
2000-05-08 10:38:51 +00:00
Martin Mares ab1129c1bd Added skeleton Doc files for the whole developer's documentation. 2000-05-05 17:17:42 +00:00
Martin Mares 9a220cabbc #ifdef out lots of debugging information.
The long resource/routing table dump printed upon startup is gone now
and if you wish to see it, just send bird SIGUSR1 or use the `debug'
commands.
2000-05-04 20:52:28 +00:00
Martin Mares 93a786cb03 Removed a lot of unused variables.
Please try compiling your code with --enable-warnings to see them. (The
unused parameter warnings are usually bogus, the unused variable ones
are very useful, but gcc is unable to control them separately.)
2000-05-04 20:30:36 +00:00
Martin Mares 2edb31b097 Split CF_HDR section to CF_HDR (only includes) and CF_DEFINES (defines,
C declarations etc.).
2000-04-28 15:11:10 +00:00
Martin Mares f75e3bbc01 Fixed a couple of nasty CLI bugs which were triggered on long or multi-part
outputs. It took a whole evening to hunt them down, but now the CLI seems
to work fine.

Now I run three BGP connections with several thousand routes!
2000-04-27 22:35:08 +00:00
Martin Mares e1ddd99377 Changed handling of incoming connections, so that we can send data
from the send hook without worrying about existence of socket buffers.

Also, don't forget to copy peer addresses.
2000-04-26 13:26:11 +00:00
Martin Mares 0cadd5f531 Removed several FIXME's. 2000-04-26 12:33:37 +00:00
Martin Mares 00c0c18aea Allow sk_close(NULL). 2000-04-25 23:07:47 +00:00
Martin Mares f380aa60fa IPv6 compiles with glibc 2.1. 2000-04-20 23:05:41 +00:00
Martin Mares 3991d84e8f Changed initialization of protocol list -- now we call proto_build() instead
of calling the protocols manually.

Implemented printing of dynamic attributes in `show route all'.

Each protocol can now register its own attribute class (protocol->attr_class,
set to EAP_xxx) and also a callback for naming and formatting of attributes.
The callback can return one of the following results:

	GA_UNKNOWN	Attribute not recognized.
	GA_NAME		Attribute name recognized and put to the buffer,
			generic code should format the value.
	GA_FULL		Both attribute name and value put to the buffer.

Please update protocols generating dynamic attributes to provide
the attr_class and formatting hook.
2000-04-01 10:19:47 +00:00
Martin Mares a37410cbdd Use bsprintf() instead of sprintf(). 2000-03-31 23:33:03 +00:00
Martin Mares 221135d6bf Include "lib/string.h" instead of <string.h>. It should give us bzero()
and other non-portable functions on all systems.
2000-03-31 23:30:21 +00:00
Martin Mares 320f417357 Defined sk_close() which closes the socket safely even if called from
socket hook. Replaces the SK_DELETED hack.

Squashed a couple of bugs in handling of TCP sockets.
2000-03-30 10:43:37 +00:00
Martin Mares 1cf716f075 Handle EINPROGRESS properly.
Set IP_DONTROUTE sockopt only if sk->ttl == 1.
2000-03-20 21:49:21 +00:00
Martin Mares f098e072be Fixed a bunch of FIXME's by removing them :) 2000-03-12 22:53:05 +00:00
Martin Mares 7a88832e78 Added tm_format_datetime(). 2000-03-12 22:43:13 +00:00
Martin Mares a92bebe0ec Yet another LOCAL_DEBUG turned off. 2000-03-12 21:58:51 +00:00
Martin Mares 832fa033b7 Cleaned up debugging in kernel syncer. Netlink has still LOCAL_DEBUG
turned on, but after some testing I'll gag it.
2000-03-12 21:54:39 +00:00
Martin Mares 6b9fa32080 Great cleanup of debug messages. LOCAL_DEBUG turned off in most modules,
several debug() calls converted to DBG().
2000-03-12 21:01:38 +00:00
Martin Mares c801e1fbab Renamed command shutdown' to down', so that `s' can be used as an
abbreviation for `show'.
2000-03-07 20:09:35 +00:00
Martin Mares b9626ec6ea Garbage collector events and counters are now per table and one day
they can be made configurable if it turns out to be useful.
2000-03-04 22:21:06 +00:00
Martin Mares 6a636392d3 Rewrote interface type detection logic. The `unnumbered' flag is now per
address, not per interface (hence it's ifa->flags & IA_UNNUMBERED) and
should be set reliably. IF_MULTIACCESS should be fixed now, but it isn't
wise to rely on it on interfaces configured with /30 prefix.
2000-02-29 23:19:52 +00:00
Martin Mares 9fac310d1a Put client on a stony ground. The whole client is going to be system-specific
(the current version UNIX-specific) anyway, so it's useless to try splitting it
to sysdep and generic part. Instead of this, configure script decides (based on
system type and user's wish) what (if any) client should be built and what
autoconfiguration it requires. Also, the client provides its own die/bug/...
functions.
2000-01-19 15:07:00 +00:00
Martin Mares 3ea1ba632b Killed protocol->priority. Protocol startup should be clean and hack-free now.
It seems everything still works (except for disable/enable/restart which hangs
sometimes, but it's another story).
2000-01-18 11:01:03 +00:00
Martin Mares aa8761de94 Kernel route syncer now supports dynamic reconfiguration. Also it doesn't
depend on the startup counter hack now and uses a zero-time timer instead
to make itself scheduled after normal protocol startup.
2000-01-18 10:39:30 +00:00
Martin Mares d272fe22dd Separated `official protocol names' used in status dumps from name templates
used for automatic generation of instance names.

	protocol->name is the official name
	protocol->template is the name template (usually "name%d"),
		should be all lowercase.

Updated all protocols to define the templates, checked that their configuration
grammar includes proto_name which generates the name and interns it in the
symbol table.
2000-01-17 11:52:50 +00:00
Martin Mares f7fcb75252 Reconfiguration for device protocol. 2000-01-17 11:17:33 +00:00
Martin Mares 99278e1042 Wording changes. 2000-01-16 23:36:19 +00:00
Martin Mares bf8558bc9c Converted shutdown to a kind of reconfiguration, it's no more handled
as a exception in protocol state machines. Introduced a `shutdown'
CLI command. Killed few reconfiguration bugs.
2000-01-16 17:40:26 +00:00
Martin Mares 50fe90edf3 First attempt on dynamic reconfiguration. There are still lots of bugs
and problems to solve, but the hardest part works.
2000-01-16 16:44:50 +00:00
Martin Mares 476e108425 Minor cleanups. 1999-12-16 13:51:43 +00:00
Martin Mares e693ddff87 Handle cases when SIOCGIFINDEX is defined, but doesn't work (new glibc
with 2.0 kernels).
1999-12-16 13:23:32 +00:00
Martin Mares a2867cd957 Better order of includes.
set_inaddr() moved to sysio.h.
1999-12-16 13:14:02 +00:00
Martin Mares 67ece6df42 Tried to clean up multicast handling. Now we don't try to guess
multicast abilities depending on definedness of symbols and use hard-wired
system-dependent configuration defines instead.

Please test whereever you can.
1999-12-16 13:06:13 +00:00
Martin Mares f545d38707 Added universal locking mechanism which will solve problems
with protocols wanting to use the same port on the same interface
during reconfiguration time.

How to use locks: In the if_notify hook, just order locks for the
interfaces you want to work with and do the real socket opening after the
lock hook function gets called. When you stop using the socket, close
it and rfree() the lock.

Please update your protocols to use the new locking mechanism.
1999-12-09 18:54:20 +00:00
Martin Mares 30bc402ebb Temporary work-arounds for multicast problems. Needs further investigation. 1999-12-08 15:12:54 +00:00
Martin Mares 0da472d7e8 Except for special protocols (nowadays only the kernel syncer), don't
export host and link scope routes.
1999-12-08 14:16:13 +00:00
Martin Mares dc82daaa9b - Path to control socket is selectable via command-line option.
- die() when control socket open failed.
1999-12-08 13:20:19 +00:00
Martin Mares f78056fb2c Allow logging to stderr as well. 1999-12-06 13:51:04 +00:00
Martin Mares a0c37b45e5 Logging is now configurable. You can define multiple log outputs (to both
files and syslog) and assign lists of message categories to each of them.
1999-12-06 13:45:56 +00:00
Martin Mares a9c986f981 Added tracked_fopen() which is a fopen registered in resource database.
Will be used for log files.
1999-12-06 13:43:47 +00:00
Martin Mares 34350a5270 Implemented echoing of log messages to CLI connections. Just try `echo all'. 1999-12-06 12:34:45 +00:00
Martin Mares afa8937ac8 Added tm_format_reltime() for formatting of relative time quantities. 1999-12-01 11:59:00 +00:00
Martin Mares 487d1afa52 Moved TIME_INFINITY to timer.h, so that it's publicly available. 1999-11-30 14:01:39 +00:00
Martin Mares 30770df2ab If the main event queue is not empty, call select() with zero timeout, so
that the events are ran again after the FD's are checked. This allows us
to schedule I/O checks between processing of user commands.
1999-11-17 12:04:24 +00:00
Martin Mares b9672a845f The CLI I/O functions work as desired. 1999-10-31 15:43:44 +00:00
Martin Mares 7d3aab1c16 First steps of the Command Line Interface: I/O routines. 1999-10-29 12:10:10 +00:00
Martin Mares b93abffae4 Implemented unix-domain sockets. 1999-10-29 12:09:29 +00:00
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
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 ca3d562b24 filters_init() renamed to filters_postconfig(). 1999-01-15 18:13:55 +00:00
Pavel Machek b9d70dc84e Filters, second try. This time they have their own directory. 1999-01-15 16:49:17 +00:00
Pavel Machek 41183888ee Properly initialize filters. Also bumped version to 0.0.0 as it
actually does something.
1999-01-15 14:40:50 +00:00
Martin Mares 08c69a7720 die() -> bug() where appropriate. 1998-12-20 14:27:37 +00:00
Martin Mares 98e87c8628 Finer grained logging levels:
#define L_DEBUG "\001"   /* Debugging messages */
#define L_INFO "\002"    /* Informational messages */
#define L_WARN "\003"    /* Warnings */
#define L_ERR "\004"     /* Errors */
#define L_AUTH "\005"    /* Authorization failed etc. */
#define L_FATAL "\006"   /* Fatal errors */
#define L_TRACE "\002"   /* Protocol tracing */
#define L_INFO "\003"    /* Informational messages */
#define L_REMOTE "\004"  /* Remote protocol errors */
#define L_WARN "\004"    /* Local warnings */
#define L_ERR "\005"     /* Local errors */
#define L_AUTH "\006"    /* Authorization failed etc. */
#define L_FATAL "\007"   /* Fatal errors */
#define L_BUG "\010"     /* BIRD bugs */

Introduced bug() which is like die(), but with level L_BUG. Protocols
should _never_ call die() as it should be used only during initialization
and on irrecoverable catastrophic events like out of memory.

Also introduced ASSERT() which behaves like normal assert(), but it calls
bug() when assertion fails. When !defined(DEBUGGING), it gets ignored.
1998-12-20 14:24:35 +00:00
Martin Mares 8e66a0ebb9 Hopefully finished kernel syncer (krt) rewrite:
o  Interface syncing is now a part of krt and it can have configurable
     parameters. Actually, the only one is scan rate now :)
  o  Kernel routing table syncing is now synchronized with interface
     syncing (we need the most recent version of the interface list
     to prevent lots of routes to non-existent destinations from
     appearing). Instead of its own timer, we just check if it's
     route scan time after each iface list scan.
  o  Syncing of device routes implemented.
  o  CONFIG_AUTO_ROUTES should control syncing of automatic device routes.
  o  Rewrote krt_remove_route() to really remove routes :)
  o  Better diagnostics.
  o  Fixed a couple of bugs.
1998-12-08 18:37:58 +00:00
Martin Mares f39e4713c2 Rewritten kernel syncer. Now uses the rta trickery I've introduced yesterday
and does things "the right way". Few things are still missing (device
routes etc.), I'll add them later in the evening.
1998-12-08 16:20:13 +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 980ffedbb0 Kernel syncer is now configurable. It will probably need some more
options, but at least basic tuning is possible now.
1998-12-06 17:40:42 +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 70591fa064 Compile and use the new configuration code by default. 1998-11-27 19:37:07 +00:00
Martin Mares 9158ca99f7 Complain loudly if the logging buffer would overflow. 1998-11-16 21:41:21 +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 0804525255 Basic kernel routing table syncing implemented. Learning of routes installed
by other programs or the kernel itself is not supported yet, but it's not
needed for development of other protocols.
1998-10-19 17:52:29 +00:00
Martin Mares 567e6c6220 Use (SOCK_DGRAM,IPPROTO_IP) socket instead of (SOCK_STREAM,IPPROTO_TCP).
This is exactly what Linux ifconfig does and seems to be the preferred way.
1998-10-19 17:48:45 +00:00
Martin Mares 4cf45766ba Exporting fill_in_sockaddr() for use by other unix-dependent code. 1998-10-19 17:47:50 +00:00
Martin Mares 7e7790c61f Since almost every UNIX system requires different techniques for reading
the kernel routing table as opposed to modifying it which is approximately
the same on non-netlink systems, I've split the kernel routing table
routines to read and write parts. To be implemented later ;-)
1998-10-18 12:50:43 +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 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 93f1c532e9 Moved scanning of interfaces, so that they get initialized after all
routing protocol instances.
1998-10-14 13:38:17 +00:00
Martin Mares c93214d442 o There are cases when SIOCGIFINDEX is defined, but it doesn't work. When
this happens, don't reject the whole interface, just mark it as index 0.
o  Removed Pavel's comment about EFAULT and SIGSEGV. EFAULT is a valid return
   code for cases where the buffer is too small.
o  Commented out the smart interface list size logic temporarily as it seems
   Linux 2.0 SIOCGIFCONF doesn't react to ifc_req==NULL sanely. Replaced it
   by exponential stepping.
1998-10-13 19:57:33 +00:00
Pavel Machek fdf33cde1c Strange, on atrey ioctl() does not fill structure, and bird segfaults
on it. Now we "only" die().
1998-10-13 14:59:46 +00:00
Martin Mares c25e90efed Added comment explaining `now'. 1998-07-15 19:42:23 +00:00
Martin Mares 28a9a189d7 Replaced remaining references of clock_t by bird_clock_t. 1998-07-10 08:32:18 +00:00
Pavel Machek 86b0023033 Making SIGUSR1 dump also all protocols. 1998-07-09 19:37:39 +00:00
Martin Mares 9556f22585 debug() and log() use the new printf. Feel free to use new formatting
sequences for all output.
1998-06-17 14:33:29 +00:00
Martin Mares 5331da6a4d Fixed processing of timers. 1998-06-04 20:27:49 +00:00
Martin Mares fd50083df4 Killed socket debug code. Initialize config pool and protocols.
More to come later...
1998-06-03 08:43:44 +00:00
Martin Mares 869c695998 Synced to new interface code. 1998-06-01 21:41:32 +00:00
Martin Mares af847acc27 Whee, multicast sockets work!
Implemented recurrent timers.
1998-05-26 21:46:38 +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 b5d9ee5c87 Added UNIX implementation of both timers and sockets. Timers should work,
sockets were tested only in TCP mode. main.c now contains some test
cases for socket code.
1998-05-24 14:50:18 +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 2326b001d6 Added routing table and routing attribute code. 1998-05-20 11:54:33 +00:00
Martin Mares 25697773b5 The library is now glued together from generic and OS-dependent parts
by the `mergedirs' script. Few more IP address manipulation functions
and some fixes.
1998-05-15 07:56:13 +00:00
Martin Mares 6032aa6ade Added new subdir for UNIX-dependent files.
Now contains only functions for logging, but it will change soon.
1998-05-03 16:42:08 +00:00