Commit graph

266 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) f2dd602fef Backport some minor changes from int-new 2017-09-12 16:33:29 +02:00
Ondrej Zajicek (work) 9f4908fe78 Nest: VRF support for neighbor cache and olock code
Actually much simpler than expected.
2017-09-12 15:49:36 +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) 33b6c292c3 BGP: Allow to specify interface for regular sessions
This may be useful if multple interfaces share the same network range.

Thanks to Fritz Grimpen for the original patch.
2017-03-14 12:56:47 +01:00
Ondrej Zajicek (work) 27f6ba651e BGP: Fix bug in ADD_PATH
When a BGP session with ADD_PATH is restarted and the neighbor do not
announce ADD_PATH capability during reconnect, the accept_ra_types is
still set to RA_ANY.

Thanks to Lennert Buytenhek for the bugreport
2017-03-14 12:56:12 +01:00
Ondrej Zajicek (work) 1950a479c0 BGP: Allow exchanging LOCAL_PREF with eBGP peers
Adds option 'allow bgp_local_pref' to override the usual restriction of
LOCAL_PREF on eBGP sessions.

Thanks to Lennert Buytenhek for the patch.
2017-02-23 16:32:07 +01:00
Ondrej Zajicek (work) 4e379bde60 BGP: Update RFC references 2017-02-19 12:02:39 +01:00
Ondrej Zajicek (work) ed1a908e53 BGP: Fix memory leak in graceful restart code
Prefix and bucket tables are initialized when entering established state
but not explicitly freed when leaving it (that is handled by protocol
restart). With graceful restart, BGP may enter and leave established
state multiple times without hard protocol restart causing memory leak.
2016-11-25 11:51:38 +01:00
Ondrej Zajicek (work) 261816b0d4 BGP: Cluster list item should be prepended
Commit 3c09af41... changed behavior of int_set_add() from prepend to
append, which makes more sense for community list, but prepend must be
used for cluster list. Add int_set_prepend() and use it in cluster list
handling code.
2016-11-15 16:24:39 +01:00
Jan Moskyto Matejka 3e236955c9 Build: switch on -Wextra, get rid of most of the warnings
There are several unresolved -Wmissing-field-initializers on older
versions of GCC than 5.1, all of them false positive.
2016-11-01 14:52:54 +01:00
Ondrej Filip 3213273d82 IANA assigned a different number to large BGP communities - changed. 2016-10-27 11:08:28 +02:00
Ondrej Zajicek (work) 66dbdbd993 BGP: Support for large communities
Add support for large communities (draft-ietf-idr-large-community),
96bit alternative to RFC 1997 communities.

Thanks to Matt Griswold for the original patch.
2016-10-03 12:48:56 +02:00
Ondrej Zajicek (work) ea0cb652e9 BGP: Fix extended messages
Change attribute length limit to handle extended (64 kB) messages.

Do not mix updates and withdraws (RFC 7606).
2016-07-11 20:41:32 +02:00
Ondrej Zajicek (work) 775a5a8195 BGP: Skip empty path segments in received AS_PATH
Although RFC 4271 does not forbid empty path segments, they are useless
and some implementations consider them invalid. It is clarified in RFC 7606,
specifying that AS_PATH with empty segment is considered malformed.
2016-06-29 14:24:32 +02:00
Ondrej Zajicek (work) a7baa09862 BSD: Add the IPsec SA/SP database entries control
Add code for manipulation with TCP-MD5 keys in the IPsec SA/SP database
at FreeBSD systems. Now, BGP MD5 authentication (RFC 2385) keys are
handled automatically on both Linux and FreeBSD.

Based on patches from Pavel Tvrdik.
2016-04-13 14:37:09 +02:00
Ondrej Zajicek (work) bd22d7f41d IO: Avoid multiple event cycles in one loop cycle.
Event cycle may took too much time and trigger next timer events, so
avoid cycling between timer and event cycles inside the loop cycle.
2016-04-06 11:57:28 +02:00
Ondrej Zajicek (work) 9e7b3ebdf9 IO: Replace RX priority heuristic with explicit mark
In BIRD, RX has lower priority than TX with the exception of RX from
control socket. The patch replaces heuristic based on socket type with
explicit mark and uses it for both control socket and BGP session waiting
to be established.

This should avoid an issue when during heavy load, outgoing connection
could connect (TX event), send open, but then failed to receive OPEN /
establish in time, not sending notifications between and therefore
got hold timer expired error from the neighbor immediately after it
finally established the connection.
2016-04-06 11:49:34 +02:00
Ondrej Zajicek (work) 487c6961cb BGP: Fix bug in incoming connection handling
When a BGP session was established by an outgoing connection with
Graceful Restart behavior negotiated, a pending incoming connection in
OpenSent state, and another incoming connection was received, then the
outgoing connection (and whole BGP session) was closed, but the old
incoming connection was just overwritten by the new one. That later
caused a crash when the hold timer from the old connection fired.
2016-02-11 16:38:28 +01:00
Ondrej Zajicek (work) 52e21323b6 BGP: Update capability number from IANA for extended messages 2015-11-25 15:52:58 +01:00
Ondrej Zajicek 06e0d1b692 BGP: Extended messages support
Implements draft-ietf-idr-bgp-extended-messages-10, for now
undocumented and with temporary private capability number.
2015-07-18 13:38:21 +02:00
Ondrej Zajicek 8d9eef1771 BGP multipath support
Kernel option 'merge paths' allows to merge routes exported to kernel
protocol (currently BGP and static routes) to multipath routes.
2015-06-08 02:24:08 +02:00
Pavel Tvrdík ae80a2de95 unsigned [int] -> uint 2015-06-08 02:24:08 +02:00
Ondrej Zajicek d924d5a562 BGP: Fixes serious bug in TX handling
Under some circumstances and heavy load, TX could be postponed
until the session fails with hold timer expired.

Thanks to Javor Kliachev for making the bug reproductible.
2015-04-01 00:10:00 +02:00
Ondrej Zajicek 2eadd36fa0 BGP: AS-wide unique router ID (RFC 6286) support
RFC 6286 relaxed rules for router IDs, allowing EBGP sessions between
routers with the same ID (but different ASN).
2015-03-29 21:24:47 +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 509aab5deb Fixes serious bug in BGP add-path
Temporary rta is reused in BGP, while rta_lookup() breaks it.

Thanks to Alexander Chernikov for analysing the problem.
2015-03-02 10:58:20 +01:00
Ondrej Zajicek 6cf72d7ad7 Rename BGP option 'start delay' to 'connect delay'
Also update log message for error-triggered startup delay.
2015-02-22 17:21:54 +01:00
Ondrej Zajicek a1beb8f3ee Relax BGP neighbor parameter
Permit specifying neighbor address, AS number and port independently.
Add 'interface' parameter for specifying interface for link-local
sessions independently.

Thanks to Alexander V. Chernikov for the original patch.
2015-02-22 13:50:58 +01: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 374917adcc Make BGP protocol instance search a separate function
Thanks to Alexander V. Chernikov for the patch.
2015-02-21 20:55:43 +01:00
Pavel Tvrdik 4a591d4b94 Replacing GNU old-style field designator extension 2015-02-21 19:31:36 +01:00
Ondrej Zajicek dfc7a6c6a0 Fixes potential alignment bug in BGP.
Thanks to Andrew (seti.kr.ua) for the bug report.
2015-02-21 12:24:30 +01:00
Ondrej Zajicek 523f020b5f Link state support in BGP.
Configurable fast shutdown of a BGP session when an interface loses link.
2015-02-21 12:15:56 +01:00
Ondrej Zajicek 88a183c6c9 Integrated IP functions. 2014-10-24 11:11:43 +02:00
Ondrej Zajicek 1123e70740 Implements token bucket filter for rate limiting. 2014-10-02 12:52:50 +02:00
Ondrej Zajicek dcde7ae597 Allows to configure different remote port for BGP sessions.
Thanks to João Taveira Araújo for the original patch.
2014-10-02 12:52:50 +02:00
Ondrej Zajicek 9eceab33f9 String constants could be used for string option values.
Thanks to Frederik Kriewitz for the patch.
2014-05-29 23:05:03 +02:00
Ondrej Zajicek 05476c4d04 IPv4/IPv6 integrated socket code. 2014-05-18 11:42:26 +02:00
Ondrej Zajicek 66370eac1f Fixes BGP crash when update with some attributes and empty NLRI is received.
Thanks to Charlie Allom for the bugreport.
2014-05-04 11:49:41 +02:00
Ondrej Zajicek 859cbd75e1 Fixes a bug in (mainly) IPv6 BGP.
Stack variable may be used unitialized and that would lead to spurious
rta_free(), which may cause crash. The bug was introduced in 1.4.1 from
merging add-path branch.

Thanks to Peter Andreev for reporting it and Alexander V. Chernikov for
resolving it.
2014-04-14 12:50:03 +02:00
Ondrej Zajicek 4e7c974d22 Fixes a bug in graceful restart. 2014-03-24 19:22:19 +01: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 5c200e0a4d Merge branch 'add-path' 2014-02-06 20:15:05 +01:00
Ondrej Zajicek 6601a14831 Merge branch 'add-path' 2013-12-10 22:30:46 +01:00
Ondrej Zajicek 2d0b7e24a5 Fixes problem with source address selection in BGP and BFD. 2013-12-02 11:54:32 +01:00
Ondrej Zajicek e7d2ac4401 Finishes add-path.
Fixes some bugs and uses generic hash implementation.
2013-12-01 13:49:42 +01:00
Ondrej Zajicek 283c7dfada Merge branch 'master' into add-path 2013-11-25 18:42:47 +01:00