Commit graph

150 commits

Author SHA1 Message Date
Martin Mares
2638249d34 Bare skeleton of the BGP. 2000-03-19 22:09:07 +00:00
Martin Mares
6a9f28b0b9 Added tracing of interface events. 2000-03-12 20:50:35 +00:00
Martin Mares
96d8e3bff2 Added protocol debugging flags (protocol.h: D_xxx), parsing of them
in configuration files and commands for manipulating them.

Current debug message policy:

   o  D_STATES, D_ROUTES and D_FILTERS are handled in generic code.
   o  Other debug flags should be handled in the protocols and whenever
      the flag is set, the corresponding messages should be printed
      using calls to log(L_TRACE, ...), each message prefixed with
      the name of the protocol instance. These messages should cover
      the whole normal operation of the protocol and should be useful
      for an administrator trying to understand what does the protocol
      behave on his network or who is attempting to diagnose network
      problems. If your messages don't fit to the categories I've defined,
      feel free to add your own ones (by adding them to protocol.h
      and on two places in nest/config.Y), but please try to keep the
      categories as general as possible (i.e., not tied to your protocol).
   o  Internal debug messages not interesting even to an experienced
      user should be printed by calling DBG() which is either void or
      a call to debug() depending on setting of the LOCAL_DEBUG symbol
      at the top of your source.
   o  Dump functions (proto->dump etc.) should call debug() to print
      their messages.
   o  If you are doing any internal consistency checks, use ASSERT
      or bug().
   o  Nobody shall ever call printf() or any other stdio functions.

Also please try to log any protocol errors you encounter and tag them
with the appropriate message category (usually L_REMOTE or L_AUTH). Always
carefully check contents of any message field you receive and verify all
IP addresses you work with (by calling ipa_classify() or by using the
neighbour cache if you want to check direct connectedness as well).
2000-03-07 20:49:48 +00:00
Martin Mares
7293c5dd81 Added proto->hash_key which contains randomly generated hash key used
for calculation of hash functions depending on proto.
2000-03-01 14:49:07 +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
54aaa89ada protocol->startup_counter no longer exists. 2000-01-18 10:42:45 +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
f14a4becbe Reworked proto lists -- each proto is now in two lists: the global one
(proto_list) and per-type one (original lists). A lot of things simplified.

Implemented `disable', `enable' and `restart' CLI commands.
2000-01-16 23:30:06 +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
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
02c1fbddd4 Added proto_get_named() to be used in CLI commands to get protocol instance
of a given protocol with optionally given name. See `show static' for an
example.
1999-12-03 11:40:45 +00:00
Martin Mares
04a60c689a Added get_route_info and show_route_data hooks to struct protocol.
Please implement them.
1999-12-01 15:08:32 +00:00
Martin Mares
9685deb910 `show protocols' now shows time of last state change and protocol-dependent
status information (obtained via newly introduced hook protocol->get_status).
1999-12-01 12:00:15 +00:00
Martin Mares
1d2664a4d4 Remember protocol instance in proto_config and use that for
`show protocols <name>'.
1999-11-30 14:04:09 +00:00
Martin Mares
0d3e6bceee show interfaces' and show protocols' works. 1999-11-30 12:57:14 +00:00
Martin Mares
ae97b946e9 Added few basic commands: show status, show interfaces [summary],
show protocols (incomplete).
1999-11-25 15:35:30 +00:00
Martin Mares
9c11ec9efc Implemented a Table-to-Table protocol a.k.a The Pipe. 1999-08-03 19:34:26 +00:00
Martin Mares
9d8856897f Protocol engine bug fixes:
o  Make proto_config->table always point to the right
      table even if it should be the default one.
   o  When shutting down, kill protocol in reverse order
      of their priority.
   o  When stopping a protocol down, disconnect it from
      routing tables immediately instead of waiting
      for the delayed protocol flush event.

Also added a protocol instance counter (used by KRT code
in very magic ways).
1999-08-03 19:31:54 +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
0e02abfd57 From now we support multiple tables. The master_table variable is
definitely gone. Both rte_update() and rte_discard() have an additional
argument telling which table should they modify.

Also, rte_update() no longer walks the whole protocol list -- each table
has a list of all protocols connected to this table and having the
rt_notify hook set. Each protocol can also freely decide (by calling
proto_add_announce_hook) to connect to any other table, but it will
be probably used only by the table-to-table protocol.

The default debugging dumps now include all routing tables and also
all their connections.
1999-05-17 20:14:52 +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
9e0e485e50 Added some new protocol hooks (look at the comments for better explanation):
make_tmp_attrs		Convert inline attributes to ea_list
	store_tmp_attrs		Convert ea_list to inline attributes
	import_control		Pre-import decisions
1999-04-05 20:17:59 +00:00
Martin Mares
69ec9087ad Added new protocol hook for dumping of protocol-dependent route
attributes.

Please implement in all protocols.
1999-04-03 13:01:58 +00:00
Martin Mares
7dc4827c96 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.
1999-03-26 21:50:43 +00:00
Martin Mares
4ba84ebc82 Slightly better generator of default protocol instance names. 1999-03-26 21:37:29 +00:00
Martin Mares
529c414953 Allow input and output filters (only accept/reject style as we didn't define
modifying filters yet) to be attached to protocol instances.
1999-03-17 14:31:26 +00:00
Martin Mares
c612a3be31 Removed the `rta_same' hook since it's no longer needed (all protocols
needing some local information should use extended attrs and cached
rta's).
1999-03-17 13:13:18 +00:00
Ondrej Filip
c1f8dc9149 Yes, joining the crew. Sorry for being late. Added dummy functions for OSPF. 1999-03-09 22:27:43 +00:00
Martin Mares
b2280748ad Introduced protocol priority (all 'normal' protocols should use the
default zero priority). No more "kernel syncer initialized before
device routes" problems.
1999-03-03 19:33:54 +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
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
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
Martin Mares
a1bf6440b5 Added skeleton of static route protocol. 1998-12-06 18:21:23 +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
bd5d0d62f1 Allow setting debug value and `disabled' flag in protocol definition. 1998-11-29 14:40:39 +00:00
Martin Mares
acc62f5e1d Insert/remove hooks return void, not int. 1998-10-20 15:17:38 +00:00
Martin Mares
f184ea6f7e Proto struct now contain (down | starting | up) state. 1998-10-19 17:45:29 +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
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
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
87d2be86e5 Adding proto_dump_all() function 1998-07-09 19:36:52 +00:00
Martin Mares
a5f1a60e02 Changed protocol declarations a bit. 1998-06-03 08:38:06 +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
2326b001d6 Added routing table and routing attribute code. 1998-05-20 11:54:33 +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
58ef912c6b First look at data structures. More to come tomorrow... 1998-04-22 12:58:34 +00:00