Commit graph

196 commits

Author SHA1 Message Date
Ondrej Zajicek (work) cd1d99611e BGP: Shutdown communication (RFC 8203)
The patch implements BGP Administrative Shutdown Communication (RFC 8203)
allowing BGP operators to pass messages related to BGP session
administrative shutdown/restart. It handles both transmit and receive of
shutdown messages. Messages are logged and may be displayed by show
protocol all command.

Thanks to Job Snijders for the basic patch.
2017-09-19 19:57:52 +02:00
Ondrej Zajicek (work) 943478b00f Basic VRF support
Add basic VRF (virtual routing and forwarding) support. Protocols can be
associated with VRFs, such protocols will be restricted to interfaces
assigned to the VRF (as reported by Linux kernel) and will use sockets
bound to the VRF. E.g., different multihop BGP instances can use diffent
kernel routing tables to handle BGP TCP connections.

The VRF support is preliminary, currently there are several limitations:

- Recent Linux kernels (4.11) do not handle correctly sockets bound
to interaces that are part of VRF, so most protocols other than multihop
BGP do not work. This will be fixed by future kernel versions.

- Neighbor cache ignores VRFs. Breaks config with the same prefix on
local interfaces in different VRFs. Not much problem as single hop
protocols do not work anyways.

- Olock code ignores VRFs. Breaks config with multiple BGP peers with the
same IP address in different VRFs.

- Incoming BGP connections are not dispatched according to VRFs.
Breaks config with multiple BGP peers with the same IP address in
different VRFs. Perhaps we would need some kernel API to read VRF of
incoming connection? Or probably use multiple listening sockets in
int-new branch.

- We should handle master VRF interface up/down events and perhaps
disable associated protocols when VRF goes down. Or at least disable
associated interfaces.

- Also we should check if the master iface is really VRF iface and
not some other kind of master iface.

- BFD session request dispatch should be aware of VRFs.

- Perhaps kernel protocol should read default kernel table ID from VRF
iface so it is not necessary to configure it.

- Perhaps we should have per-VRF default table.
2017-09-06 17:38:48 +02:00
Ondrej Zajicek (work) 734e9fb8a9 Minor cleanups and fixes 2017-05-23 13:12:25 +02:00
Ondrej Zajicek (work) b29499996b Nest: Update of show route cmd
Some code cleanup, multiple bugfixes, allows to specify also channel
for 'show route export'. Interesting how such apparenty simple thing
like show route cmd has plenty of ugly corner cases.
2017-04-25 19:02:31 +02:00
Ondrej Zajicek (work) f8aad5d5b7 Minor cleanups 2017-01-03 16:30:27 +01:00
Jan Moskyto Matejka ad88b94bca Merge branch 'int-new-rpki-squashed' (early part) into int-new 2016-12-07 15:30:46 +01:00
Ondrej Zajicek (work) d15b0b0a1b BGP redesign
Integrated and extensible BGP with generalized AFI handling,
support for IPv4+IPv6 AFI and unicast+multicast SAFI.
2016-12-07 14:20:52 +01:00
Pavel Tvrdík 65d2a88dd2 RPKI protocol with one cache server per protocol
The RPKI protocol (RFC 6810) using the RTRLib
(http://rpki.realmv6.org/) that is integrated inside
the BIRD's code.

Implemeted transports are:
 - unprotected transport over TCP
 - secure transport over SSHv2

Example configuration of bird.conf:
  ...
  roa4 table r4;
  roa6 table r6;

  protocol rpki {
    debug all;

    # Import both IPv4 and IPv6 ROAs
    roa4 { table r4; };
    roa6 { table r6; };

    # Set cache server (validator) address,
    # overwrite default port 323
    remote "rpki-validator.realmv6.org" port 8282;

    # Overwrite default time intervals
    retry   10;         # Default 600 seconds
    refresh 60;         # Default 3600 seconds
    expire 600;         # Default 7200 seconds
  }

  protocol rpki {
    debug all;

    # Import only IPv4 routes
    roa4 { table r4; };

    # Set cache server address to localhost,
    # use default ports tcp => 323 or ssh => 22
    remote 127.0.0.1;

    # Use SSH transport instead of unprotected transport over TCP
    ssh encryption {
      bird private key "/home/birdgeek/.ssh/id_rsa";
      remote public key "/home/birdgeek/.ssh/known_hosts";
      user "birdgeek";
    };
  }
  ...
2016-12-07 09:35:24 +01:00
Ondrej Zajicek (work) af678af0d5 Merge remote-tracking branch 'origin/master' into int-new 2016-05-12 18:03:23 +02:00
Ondrej Zajicek (work) 286e2011d2 Miscellaneous minor fixes 2016-05-12 16:04:47 +02:00
Pavel Tvrdik 8e433d6a52 Prog Doc: Complete several missing parameters 2016-05-12 15:49:44 +02:00
Ondrej Zajicek (work) 937e75d8f1 Add the Babel routing protocol (RFC 6126)
This patch implements the IPv6 subset of the Babel routing protocol.
Based on the patch from Toke Hoiland-Jorgensen, with some heavy
modifications and bugfixes.

Thanks to Toke Hoiland-Jorgensen for the original patch.
2016-04-28 18:01:40 +02:00
Jan Moskyto Matejka 7a7ac65682 Merge branch 'master' into int-new-channels 2016-04-08 12:28:33 +02:00
Ondrej Zajicek (work) 06edbb67ed Nest: Reset export route counter during graceful restart
Counter exp_routes is increased during initial route feed after GR
recovery, so it has to start with zero, otherwise BIRD will end with
double value in exp_routes.
2016-04-07 01:10:24 +02:00
Pavel Tvrdík 43fd8fae52 nest/proto fix local_debug mode 2016-03-10 16:07:44 +01:00
Jan Moskyto Matejka 2a013bb3a0 Fixed sigsegv for missing proto->rt_notify hook
If rt_notify is NULL, the export must always stay DOWN.
2016-02-01 16:01:18 +01:00
Ondrej Zajicek (work) f4a60a9bc4 Channels - explicit links between protocols and tables
The patch adds support for channels, structures connecting protocols and
tables and handling most interactions between them. The documentation is
missing yet.
2016-02-01 10:28:50 +01:00
Ondrej Zajicek (work) 9b9a7143c4 Conf: Fixes bug in symbol lookup during reconfiguration
Symbol lookup by cf_find_symbol() not only did the lookup but also added
new void symbols allocated from cfg_mem linpool, which gets broken when
lookups are done outside of config parsing, which may lead to crashes
during reconfiguration.

The patch separates lookup-only cf_find_symbol() and config-modifying
cf_get_symbol(), while the later is called only during parsing. Also
new_config and cfg_mem global variables are NULLed outside of parsing.
2015-11-09 00:42:02 +01:00
Pavel Tvrdík ae80a2de95 unsigned [int] -> uint 2015-06-08 02:24:08 +02:00
Ondrej Zajicek 9aed29e605 BGP: Enhanced route refresh (RFC 7313) support
Also hook feed_done is renamed to feed_end.
2015-03-29 18:29:49 +02:00
Ondrej Zajicek 2bbc308321 Store protocol config size inside protocol structure
Make proto_config_new() use this info instead of supplied size.

Thanks to Alexander V. Chernikov for the patch.
2015-02-21 21:08:23 +01:00
Ondrej Zajicek 1149aa977d Fixes a problem with undoing of deconfiguring of protocol.
Thanks to Sergey Popovich for the original patch.
2014-05-05 11:05:12 +02:00
Ondrej Zajicek 984d734944 Fixes limit verification during reconfiguration. 2014-04-27 00:46:32 +02:00
Ondrej Zajicek 1cb0f83d29 Fixes some asserts. 2014-04-07 11:48:25 +02:00
Ondrej Zajicek 227af309e5 Fixes some minor issues in graceful restart. 2014-03-24 12:32:12 +01:00
Ondrej Zajicek 6eda3f135f Documentation (and minor fixes) for BGP graceful restart. 2014-03-23 01:35:33 +01:00
Ondrej Zajicek 0c791f873a BGP graceful restart support.
Also significant core protocol state changes needed for that,
global graceful restart recovery state and kernel proto support
for recovery.
2014-03-20 14:07:12 +01:00
Ondrej Zajicek 283c7dfada Merge branch 'master' into add-path 2013-11-25 18:42:47 +01:00
Ondrej Zajicek 5ebc92935c Last state change should track protocol state change.
And not core state change, which is not much relevant
(e.g. refeed in BGP).
2013-11-24 22:22:24 +01:00
Ondrej Zajicek 736e143fa5 Merge branch 'master' into add-path
Conflicts:

	filter/filter.c
	nest/proto.c
	nest/rt-table.c
	proto/bgp/bgp.h
	proto/bgp/config.Y
2013-11-23 11:50:34 +01:00
Ondrej Zajicek 0aeac9cb7f Merge commit 'origin/bfd' 2013-11-22 02:48:44 +01:00
Ondrej Zajicek 1ec522538f BFD protocol, ready for release.
Supports OSPF and BGP and also statically configured sessions.
2013-11-19 22:33:48 +01:00
Ondrej Filip ec57bbf67f Recheck export/import/receive limits during reconfiguration. 2013-09-30 14:07:34 +02:00
Ondrej Zajicek 6a8d3f1c1f BFD work in progress.
Now it compiles and mostly works.
2013-09-16 23:57:40 +02:00
Ondrej Zajicek 9135c1f0ca Fixes bug in protocol flushing and rtable pruning.
When route was propagated to another rtable through a pipe and then the
pipe was reconfigured softly in such a way that any subsequent route
updates are filtered, then the source protocol shutdown didn't clean up
the route in the second rtable which caused stale routes and potential
crashes.
2013-07-24 14:11:12 +02:00
Ondrej Zajicek b662290f40 Separate import and receive limits.
They have different behavior w.r.t. filtered routes that are kept.
2013-01-10 13:07:33 +01:00
Ondrej Zajicek 79b4e12e60 Implements interface masks for choosing router id.
Router ID could be automatically determined based of subset of
ifaces/addresses specified by 'router id from' option. The patch also
does some minor changes related to router ID reconfiguration.

Thanks to Alexander V. Chernikov for most of the work.
2012-12-27 12:56:23 +01:00
Ondrej Zajicek a92cf57dd6 Implements undo command and optional timeout for configuration
Several new configure command variants:

configure undo - undo last reconfiguration
configure timeout - configure with scheduled undo if not confirmed in timeout
configure confirm - confirm last configuration
configure check - just parse and validate config file
2012-12-26 12:40:48 +01:00
Ondrej Zajicek 1555095795 Changes 'rejected' to 'filtered' in one of the last patches. 2012-11-15 01:29:01 +01:00
Ondrej Zajicek cf98be7b67 Allows rejected routes to be kept and examined.
When 'import keep rejected' protocol option is activated, routes
rejected by the import filter are kept in the routing table, but they
are hidden and not propagated to other protocols. It is possible to
examine them using 'show route rejected'.
2012-11-10 14:26:13 +01:00
Ondrej Zajicek 094d2bdb79 Implements ADD-PATH extension for BGP.
Allows to send and receive multiple routes for one network by one BGP
session. Also contains necessary core changes to support this (routing
tables accepting several routes for one network from one protocol).
It needs some more cleanup before merging to the master branch.
2012-08-14 16:46:43 +02:00
Ondrej Zajicek 5400c0e7f9 Fixes BGP subcode during global shutdown. 2012-08-06 02:42:24 +02:00
Ondrej Zajicek d9b77cc281 Implements generalized export limits.
And also fixes some minor bugs in limits.
2012-04-24 23:39:57 +02:00
Ondrej Zajicek 7d0a31deed Fixes in generalized import limits. 2012-04-21 21:05:36 +02:00
Ondrej Zajicek ebecb6f6a1 Implements generalized import hooks.
Thanks to Alexander V. Chernikov for the original patch.
2012-04-15 15:28:29 +02:00
Ondrej Zajicek bf2abe2f51 Merge branch 'soon'
Conflicts:

	nest/proto.c
	nest/rt-table.c
2012-03-30 11:04:12 +02:00
Ondrej Zajicek fb829de690 Fixes responsiveness for protocol shutdown.
When a protocol went down, all its routes were flushed in one step, that
may block BIRD for too much time. The patch fixes that by limiting
maximum number of routes flushed in one step.
2012-03-28 18:40:04 +02:00
Ondrej Zajicek c0adf7e9fc Better support for multitable protocols.
The nest-protocol interaction is changed to better handle multitable
protocols. Multitable protocols now declare that by 'multitable' field,
which tells nest that a protocol handles things related to proto-rtable
interaction (table locking, announce hook adding, reconfiguration of
filters) itself.

Filters and stats are moved to announce hooks, a protocol could have
different filters and stats to different tables.

The patch is based on one from Alexander V. Chernikov, thanks.
2012-03-15 12:13:04 +01:00
Ondrej Zajicek 39c028e9e9 Assign default protocol preference via proto_config_new().
The patch from Alexander V. Chernikov.
2012-01-24 11:31:00 +01:00
Ondrej Zajicek a7f23f581f Implements protocol templates.
Based on the patch from Alexander V. Chernikov.
Extended to support almost all protocols.
Uses 'protocol bgp NAME from TEMPLATE { ... }' syntax.
2011-11-07 00:31:23 +01:00
Ondrej Zajicek 23fd464447 Fixes a bug related to protocol enabling and reconfigure.
When a protocol was enabled interactively (but disabled in the config
file), then reconfigure in some cases forgets to disable it.
2011-06-20 20:35:59 +02:00
Ondrej Zajicek 4ef0950603 Fixes a problem with BGP protocols and implicit router IDs. 2011-04-01 13:55:52 +02:00
Ondrej Zajicek 93e868c730 Implements Router Advertisement protocol. 2011-03-13 11:33:50 +01:00
Ondrej Zajicek cfe34a316e Implements hostcache and recursive next hops.
Hostcache is a structure for monitoring changes in a routing table that
is used for routes with dynamic/recursive next hops. This is needed for
proper iBGP next hop handling.
2010-07-05 17:50:19 +02:00
Ondrej Zajicek acb60628f5 Implements command that shows memory usage. 2010-06-02 22:20:40 +02:00
Ondrej Filip ba13017254 Avoid warning if not compiled with pipes. 2010-04-27 11:27:54 +02:00
Ondrej Zajicek b8113a5e92 Implements BGP 'show protocols' info details. 2010-04-07 00:19:23 +02:00
Ondrej Zajicek 53434e44a9 Better flushing of interfaces.
When device protocol goes down, interfaces should be flushed
asynchronously (in the same way like routes from protocols are flushed),
when protocol goes to DOWN/HUNGRY.

This fixes the problem with static routes staying in kernel routing
table after BIRD shutdown.
2010-02-27 16:00:07 +01:00
Ondrej Zajicek ff2857b03d Many changes in (mainly) kernel syncers.
- BSD kernel syncer is now self-conscious and can learn alien routes
- important bugfix in BSD kernel syncer (crash after protocol restart)
- many minor changes and bugfixes in kernel syncers and neighbor cache
- direct protocol does not generate host and link local routes
- min_scope check is removed, all routes have SCOPE_UNIVERSE by default
- also fixes some remaining compiler warnings
2010-02-26 10:55:58 +01:00
Ondrej Zajicek e81b440f68 Fix configure to enable warnings and fix most of them. 2010-02-21 14:34:53 +01:00
Ondrej Zajicek e0a45fb421 Restricted read-only CLI.
Also adds support for executing commands using birdc <cmd>.
2010-02-21 09:57:26 +01:00
Ondrej Zajicek e304fd4bcf Implements pattern match for 'show protocols' command.
And generally consolidates protocol commands.
2010-02-20 00:08:07 +01:00
Ondrej Zajicek dca75fd7c2 Removes phantom protocol from the pipe design.
It seems that by adding one pipe-specific exception to route
announcement code and by adding one argument to rt_notify() callback i
could completely eliminate the need for the phantom protocol instance
and therefore make the code more straightforward. It will also fix some
minor bugs (like ignoring debug flag changes from the command line).
2010-02-13 12:26:26 +01:00
Ondrej Zajicek 9db74169be Fixes protocol statistics for pipes. 2010-02-13 10:44:46 +01:00
Ondrej Zajicek c83876265e Fixes a tricky bug in the pipe protocol.
When uncofiguring the pipe and the peer table, the peer table was
unlocked when pipe protocol state changed to down/flushing and not to
down/hungry. This leads to the removal of the peer table before
the routes from the pipe were flushed.

The fix leads to adding some pipe-specific hacks to the nest,
but this seems inevitable.
2010-02-11 22:27:06 +01:00
Ondrej Zajicek 5a56f27cd0 Adds asterisk to the primary route in 'show route' cmd.
And also fixes a minor bug.
2010-02-08 12:42:09 +01:00
Ondrej Zajicek 76b53a4e20 Adds some log messages related to configure.
Also fixes a bug in the previous patch.
2010-02-06 22:57:51 +01:00
Ondrej Zajicek ebae4770c9 Modifies configure to just reload protocols when filters change.
Before this change, protocols were restarted in that case.
2010-02-06 19:19:09 +01:00
Ondrej Zajicek c37e78510f Makes date/time formats configurable. 2010-02-03 00:19:24 +01:00
Ondrej Zajicek cf31112f0d Implements MRTdump feature. 2010-01-03 12:17:52 +01:00
Ondrej Zajicek 8a7fb8858f Finishes 'route reload' feature. 2009-12-14 01:32:37 +01:00
Ondrej Zajicek a421ec33cb Fixes silly bug. 2009-12-02 22:22:40 +01:00
Ondrej Zajicek 11361a1015 Implements route re-feed.
This can be used to re-feed routes to protocol after soft change in
export filters.
2009-12-02 22:19:47 +01:00
Ondrej Zajicek bf47fe4b2e Implements BGP route refresh. 2009-11-26 20:47:59 +01:00
Ondrej Zajicek e04555c045 Implement description field of protocol. 2009-11-17 15:45:05 +01:00
Ondrej Zajicek 4cdd078453 Implements protocol-specific router id and updates documentation. 2009-10-12 23:31:42 +02:00
Ondrej Zajicek ac07aacd2c Replace assert with log.
Although it is true unless there is a bug in BIRD,  this assert is not
needed (code below does not require that assumption), so we should not
crash.
2009-08-11 11:03:37 +02:00
Ondrej Zajicek bf1aec970e Adds support for soft reconfiguration. 2009-06-19 23:49:34 +02:00
Ondrej Zajicek 925fe2d3de Implements route statistics and fixes some minor bugs. 2009-06-04 01:22:56 +02:00
Ondrej Zajicek b807ef9a15 Fixes bug in protocol state machine
Scheduling flush must be done before resource pool freeing as it
frees some allocated list nodes from a global list.
2009-02-12 13:43:06 +01:00
Ondrej Zajicek d6a836f8d6 Fixes core state machine.
The core state machine was broken - it didn't free resources
in START -> DOWN transition and might freed resources after
UP -> STOP transition before protocol turned down. It leads
to deadlock on olock acquisition when lock was not freed
during previous stop.

The current behavior is that resources, allocated during
DOWN -> * transition, are freed in * -> DOWN transition,
and flushing (scheduled in UP -> *) just counteract
feeding (scheduled in * -> UP). Protocol fell down
when both flushing is done (if needed) and protocol
reports DOWN.

BTW, is thera a reason why neighbour cache item acquired
by protocol is not tracked by resource mechanism?
2008-12-08 12:24:55 +01:00
Ondrej Zajicek fbde6c3908 Fixes race condition leading to memory corruption and crash.
When protocol started, feeding was scheduled. If protocol
got down before feeding was executed, then function
responsible for connecting protocol to kernel routing
tables was called after the function responsible for
disconnecting, then resource pool of protocol was freed,
but freed linked list structures remains in the list.
2008-11-22 01:12:22 +01:00
Martin Mares 7c103b1ee1 Marked unused parameters in core code as such. 2004-06-05 09:10:56 +00:00
Martin Mares 2e9b24211a Spelling fixes to progdoc. 2000-06-07 12:29:08 +00:00
Martin Mares 3c6269b8fe Added documentation on protocols.
Protocol hooks deserve an extra chapter (to come soon).
2000-06-02 13:42:36 +00:00
Martin Mares caab3bb374 Better formatting of protocol status. 2000-05-30 21:23:49 +00:00
Martin Mares 075898dea7 No more problems when protocols gets disabled during feeding. 2000-05-19 18:03:53 +00:00
Martin Mares ac5d801217 Asynchronous feeding of protocols. 2000-05-19 10:46:26 +00:00
Martin Mares df9f0fb30a Don't log state changes if nothing user-visible has changed. 2000-05-16 13:43:26 +00:00
Martin Mares 498c33395f Cosmetic fixes. 2000-05-06 21:42:19 +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 8f6accb5bb Event handlers no longer return re-queue flag. Instead of using it, just
call ev_schedule() on the same handler which should work perfectly now.
2000-04-27 22:28:49 +00:00
Martin Mares ebd3720f83 Fixed several bugs in protocol state machine. Reconfigurations and
restarts of BGP seem to work now.
2000-04-26 12:30:41 +00:00
Martin Mares 41b26cfb55 Don't forget to set filter pointers in struct proto when reconfiguring. 2000-04-25 21:56:46 +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 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 2638249d34 Bare skeleton of the BGP. 2000-03-19 22:09:07 +00:00
Martin Mares f098e072be Fixed a bunch of FIXME's by removing them :) 2000-03-12 22:53:05 +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 839380d7ec Added debugging of protocol state transitions. 2000-03-07 21:50:21 +00:00