0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-09-20 12:25:20 +00:00
Commit Graph

190 Commits

Author SHA1 Message Date
Maria Matejka
d607205486 Not calling memcpy with n=0. 2020-04-28 16:21:06 +02:00
Maria Matejka
fd9f0c0640 Configuration strings are constant.
This is merely a const propagation. There was no problem in there.
2020-04-09 15:37:14 +02:00
Ondrej Zajicek (work)
21d09632a5 BGP: Add some statistics
Add some statistic counters to BGP consistent with BGP MIB (RFC 4273),
including persistent 'FSM established transitions'.
2019-12-03 18:05:41 +01:00
Ondrej Zajicek (work)
0b228fca04 BGP: Add option to enforce first AS in AS_PATH
This is optional check described in RFC 4271. Although this can be also
done by filters, it is widely implemented option in BGP implementations.

Thanks to Eugene Bogomazov for the original patch.
2019-11-10 02:06:07 +01:00
Ondrej Zajicek (work)
a52476c9be BGP: Add option to reject AS_SETs
There is a pending draft to make them obsolete
2019-11-04 22:09:35 +01:00
Ondrej Zajicek (work)
09ee846d92 BGP: AIGP metric support (RFC 7311) 2019-10-09 17:53:23 +02:00
Ondrej Zajicek (work)
b7d7599ce3 BGP: implement Adj-RIB-Out
The patch implements optional internal export table to a channel and
hooks it to BGP so it can be used as Adj-RIB-Out. When enabled, all
exported (post-filtered) routes are stored there. An export table can be
examined using e.g. 'show route export table bgp1.ipv4'.
2019-08-14 06:02:33 +02:00
Ondrej Zajicek (work)
e2b530aa72 BGP: Improve reconfiguration
Several BGP channel options (including 'next hop self') could be
reconfigured without session reset, with just route refeed/refresh.
The patch improves reconfiguration code to do it that way.
2019-08-06 15:29:06 +02:00
Maria Matejka
eac9250fd5 Merge branch 'master' into mq-filter-stack 2019-07-03 11:12:25 +02:00
Ondrej Zajicek (work)
8a68316eb9 Nest: Add command to request graceful restart
When 'graceful down' command is entered, protocols are shut down
with regard to graceful restart. Namely Kernel protocol does
not remove routes and BGP protocol does not send notification,
just closes the connection.
2019-06-30 21:29:24 +02:00
Ondrej Zajicek (work)
e0835db4f1 BGP: Dynamic BGP
Support for dynamically spawning BGP protocols for incoming connections.
Use 'neighbor range' to specify range of valid neighbor addresses, then
incoming connections from these addresses spawn new BGP instances.
2019-04-30 13:32:39 +02:00
Ondrej Zajicek (work)
4a50c8bd03 BGP: Handle corner cases in event ordering
When BGP connection is opened, it may happen that rx hook (with remote
OPEN) is called before tx hook (for local OPEN). Therefore, we need to do
internal changes (like setting local_caps) synchronously with OPENSENT
transition and we need to ensure that OPEN is sent before KEEPALIVE.
2019-04-08 16:56:56 +02:00
Ondrej Zajicek (work)
23ee6b1cd6 BGP: Promiscuous ASN mode
Allow to specify just 'internal' or 'external' for remote neighbor
instead of specific ASN. In the second case that means BGP peers with
any non-local ASNs are accepted.
2019-04-03 15:54:50 +02:00
Ondrej Zajicek (work)
a22c3e5968 BGP: Separate runtime and config usage of local/remote ip and as fields 2019-04-02 17:22:31 +02:00
Ondrej Zajicek (work)
3c3605818f BGP: Mandatory option for channels
Allow to mark channel to be mandatory, and do not allow BGP sessions if
no common AFI/SAFI is established.
2019-03-19 17:44:50 +01:00
Ondrej Zajicek (work)
7e5f769d91 BGP: Handle case where capabilites are not used
If peer does not announce capabilities at all, or when we have
capabilities disabled, handle that as implicit IPv4 unicast.
2019-03-18 14:29:12 +01:00
Maria Matejka
4c553c5a5b Filter refactoring: dropped the recursion from the interpreter
This is a major change of how the filters are interpreted. If everything
works how it should, it should not affect you unless you are hacking the
filters themselves.

Anyway, this change should make a huge improvement in the filter performance
as previous benchmarks showed that our major problem lies in the
recursion itself.

There are also some changes in nest and protocols, related mostly to
spreading const declarations throughout the whole BIRD and also to
refactored dynamic attribute definitions. The need of these came up
during the whole work and it is too difficult to split out these
not-so-related changes.
2019-02-20 22:30:54 +01:00
Ondrej Zajicek (work)
b8a3608aa5 BGP: Cleanup channels when going down
When going up, uncleaned old channel state may trigger unexpected
conditions crashing bird.
2019-01-26 19:48:16 +01:00
Ondrej Zajicek (work)
1cab2b4a7c BGP: Extend 'next hop keep' and 'next hop self' options
Extend 'next hop keep' and 'next hop self' options to have boolean values
(enabled / disabled) and also values 'ibgp'/ 'ebgp' to restrict it to
routes received from IBGP / EBGP. This allows to have it enabled by
default in some cases, matches features of other implementations, and
allows to handle some strange cases like EBGP border router with 'next
hop self' also doing IBGP route reflecting.

Change default of 'next hop keep' to enabled for route servers, and
'ibgp' for route reflectors.

Update documentation for these options.
2018-12-16 23:44:24 +01:00
Ondrej Zajicek (work)
682d3f7de0 BGP: implement Adj-RIB-In
The patch implements optional internal import table to a channel and
hooks it to BGP so it can be used as Adj-RIB-In. When enabled, all
received (pre-filtered) routes are stored there and import filters can
be re-evaluated without explicit route refresh. An import table can be
examined using e.g. 'show route import table bgp1.ipv4'.
2018-12-12 14:46:24 +01:00
Jan Maria Matejka
14375237f6 Terminology cleanup: The import_control hook is now called preexport.
Once upon a time, far far away, there were the old Bird developers
discussing what direction of route flow shall be called import and
export. They decided to say "import to protocol" and "export to table"
when speaking about a protocol. When speaking about a table, they
spoke about "importing to table" and "exporting to protocol".

The latter terminology was adopted in configuration, then also the
bird CLI in commit ea2ae6dd0 started to use it (in year 2009). Now
it's 2018 and the terminology is the latter. Import is from protocol to
table, export is from table to protocol. Anyway, there was still an
import_control hook which executed right before route export.

One thing is funny. There are two commits in April 1999 with just two
minutes between them. The older announces the final settlement
on config terminology, the newer uses the other definition. Let's see
their commit messages as the git-log tool shows them (the newer first):

    commit 9e0e485e50
    Author: Martin Mares <mj@ucw.cz>
    Date:   Mon Apr 5 20:17:59 1999 +0000

	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

    commit 5056c559c4
    Author: Martin Mares <mj@ucw.cz>
    Date:   Mon Apr 5 20:15:31 1999 +0000

	Changed syntax of attaching filters to protocols to hopefully the final
	version:

		EXPORT <filter-spec>    for outbound routes (i.e., those announced
					by BIRD to the rest of the world).
		IMPORT <filter-spec>    for inbound routes (i.e., those imported
					by BIRD from the rest of the world).

	where <filter-spec> is one of:

		ALL                     pass all routes
		NONE                    drop all routes
		FILTER <name>           use named filter
		FILTER { <filter> }     use explicitly defined filter

	For all protocols, the default is IMPORT ALL, EXPORT NONE. This includes
	the kernel protocol, so that you need to add EXPORT ALL to get the previous
	configuration of kernel syncer (as usually, see doc/bird.conf.example for
	a bird.conf example :)).

Let's say RIP to this almost 19-years-old inconsistency. For now, if you
import a route, it is always from protocol to table. If you export a
route, it is always from table to protocol.

And they lived happily ever after.
2018-12-04 10:53:01 +01:00
Ondrej Zajicek (work)
863ecfc785 The MRT protocol
The new MRT protocol is responsible for periodic RIB table dumps in the
MRT format (RFC 6396). Also the existing code for BGP4MP MRT dumps is
refactored and splitted between BGP to MRT protocols, will be more
integrated into MRT in the future.

Example:

protocol mrt {
        table "*";
        filename "%N_%F_%T.mrt";
        period 60;
}

It is partially based on the old MRT code from Pavel Tvrdik.
2018-11-20 17:45:35 +01:00
Ondrej Zajicek (work)
5bd734317c BGP: Long-lived graceful restart
The patch implements long-lived graceful restart for BGP, namely
draft-uttaro-idr-bgp-persistence-03.
2018-07-31 18:40:38 +02:00
Jan Maria Matejka
13c0be19d3 Nest: Removing separate tmpa from route propagation
This is a fundamental change of an original (1999) concept of route
processing inside BIRD. During import/export, there was a temporary
ea_list created which was to be used instead of the another one inside
the route itself.

This led to some confusion, quirks, and strange filter code that handled
extended route attributes. Dropping it now.

The protocol interface has changed in an uniform way -- the
`struct ea_list *attrs` argument has been removed from store_tmp_attrs(),
import_control(), rt_notify() and get_route_info().
2018-05-30 17:08:49 +02:00
Jan Maria Matejka
ee7e2ffd26 Protocol: Introducing an enum protocol_class
This supersedes the EAP_* constants.
2018-05-29 12:35:06 +02:00
Ondrej Zajicek (work)
75d98b6013 Merge branch 'master' into int-new 2018-01-23 18:29:32 +01:00
Ondrej Zajicek (work)
63472779ad BGP: Implement 'disable after cease' option
The option allows to specify that some cease subcodes should
disable the protocol when received.
2018-01-16 19:17:04 +01:00
Ondrej Zajicek (work)
7fc55925be Several minor fixes 2017-12-10 00:55:34 +01:00
Ondrej Zajicek (work)
830ba75e6d Merge commit '1e8721e2aeccfbc3f533e8b8abc07582cee77e9a' into int-new 2017-12-07 21:54:47 +01:00
Ondrej Zajicek (work)
cc881bd155 BGP: Update to new timers 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work)
025525266f Timers: Replace old timers with microsecond timers
The old timer interface is still kept, but implemented by new timers. The
plan is to switch from the old inteface to the new interface, then clean
it up.
2017-12-07 13:49:27 +01:00
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)
e919601aaf Merge master into int-new 2017-04-28 11:19:12 +02:00
Ondrej Zajicek (work)
711d617dc1 BGP: Add support for SAFI 129 (VPN multicast)
Which, in contrast to SAFI 128, does not use MPLS labels.
2017-04-12 16:04:22 +02:00
Ondrej Zajicek (work)
c49e4a6565 BGP: Update list of supported standards 2017-03-29 13:48:23 +02:00
Ondrej Zajicek (work)
ef57b70fa5 BGP: Support for routes with mixed-AF next hops
Covers IPv4/VPNv4 routes with IPv6 next hop (RFC 5549), IPv6 routes with
IPv4 next hop (RFC 4798) and VPNv6 routes with IPv4 next hop (RFC 4659).
Unfortunately it also makes next hop hooks more messy.

Each BGP channel now could have two IGP tables, one for IPv4 next hops,
the other for IPv6 next hops.
2017-03-26 19:20:15 +02:00
Ondrej Zajicek (work)
1e37e35c3e BGP: Support for MPLS labels and VPN SAFI
Basic support for SAFI 4 and 128 (MPLS labeled IP and VPN) for IPv4 and
IPv6. Should work for route reflector, but does not properly handle
originating routes with next hop self.

Based on patches from Jan Matejka.
2017-03-22 18:16:49 +01:00
Jan Moskyto Matejka
3c74416465 Nexthop: Fixed recursive route mpls label merging 2017-03-17 15:48:32 +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)
2be9218a3b BGP: Update RFC references 2017-02-20 02:28:04 +01:00
Ondrej Zajicek (work)
4e379bde60 BGP: Update RFC references 2017-02-19 12:02:39 +01:00
Ondrej Zajicek (work)
82f42ea091 BGP: Minor cleanups 2017-02-07 15:55:51 +01:00
Ondrej Zajicek (work)
d8022d26fc BGP: Partial support for IPv4 routes with IPv6 next hop (RFC 5549)
Mostly capability signalling
2017-01-24 02:00:35 +01:00
Ondrej Zajicek (work)
f8aad5d5b7 Minor cleanups 2017-01-03 16:30:27 +01:00
Ondrej Zajicek (work)
256cc8ee08 BGP: Report capabilities in show protocols all 2016-12-20 17:39:59 +01:00
Ondrej Zajicek (work)
ac3ad139f6 BGP: Add support for flowspec (RFC 5575) 2016-12-07 18:29:34 +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
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
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)
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
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
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
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
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
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
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
e7d2ac4401 Finishes add-path.
Fixes some bugs and uses generic hash implementation.
2013-12-01 13:49:42 +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
77e43c8b72 Minor fixes. 2013-11-22 22:49:04 +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 Zajicek
a15dab76f9 Implements 'allow local as' option.
Similar to allowas-in option on other routers.
2013-10-21 14:59:35 +02:00
Ondrej Zajicek
ac57451348 Implements RFC 6608 Subcodes for BGP FSM Error. 2013-07-25 13:55:24 +02:00
Ondrej Zajicek
48bc232f08 Implements 'next hop keep' option for BGP.
This option allows to keep the received next hop even in cases when
the route is sent to an interface with a different subnet.
2013-04-16 17:27:34 +02: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
abced4a914 Merge branch 'rt-accepted'
Conflicts:

	nest/config.Y
	nest/rt-table.c
	proto/bgp/bgp.c
2012-07-16 14:44:45 +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
00a09f3c36 Implement RA_ACCEPTED mode of route propagation. 2012-04-15 15:07:58 +02:00
Ondrej Zajicek
53ffbff39f Implements support for link-local addresses in BGP.
Thanks Matthias Schiffer for the original patch.
2012-01-08 15:31:34 +01:00
Ondrej Zajicek
be4cd99a36 Implements deterministic MED handling.
Thanks to Alexander V. Chernikov for many suggestions.
2011-12-22 13:20:29 +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
b1b1943360 The generalized TTL security mechanism (RFC 5082) support.
Thanks to Alexander V. Chernikov for the patch.
2011-08-16 23:13:05 +02:00
Ondrej Zajicek
42a0c05408 BGP Extended communities. 2011-08-14 13:55:02 +02:00
Ondrej Zajicek
73272f04af Adds BGP option related to MED handling.
Adds option 'med metric' allows to compare MEDs
between routes received from different neighbors.
2011-04-22 16:13:27 +02:00
Ondrej Zajicek
d1e146f2f8 Implements IGP metric comparison for BGP routes. 2010-07-31 01:04:32 +02:00
Ondrej Zajicek
087cecd0e2 Adds some options and documentation related to recursive next hops. 2010-07-13 12:48:23 +02:00
Ondrej Zajicek
9be9a26413 Implements proper multihop BGP.
Also does some incompatible changes to config file syntax,
like removing 'via IP' from multihop option.
2010-07-12 17:39:39 +02: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
a34b09349e Disable BGP protocol when cannot open listening socket. 2010-05-31 11:35:29 +02:00
Ondrej Zajicek
b8113a5e92 Implements BGP 'show protocols' info details. 2010-04-07 00:19:23 +02: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
41677025ee Changes 'ignore communities' to 'interpret communities'. 2010-01-28 15:59:18 +01:00
Ondrej Zajicek
6cb8f742f1 Better handling of well-known communities.
Process well-known communities before the export filter (old behavior is
to process these attributes after, which does not allow to send route
with such community) and just for routes received from other BGP
protocols. Also fixes a bug in next_hop check.
2010-01-27 17:22:57 +01:00
Ondrej Zajicek
cf31112f0d Implements MRTdump feature. 2010-01-03 12:17:52 +01:00
Ondrej Zajicek
43c1ceccb9 Remove bgp_as4_support variable. 2009-12-14 23:31:25 +01:00
Ondrej Zajicek
bf47fe4b2e Implements BGP route refresh. 2009-11-26 20:47:59 +01:00
Ondrej Zajicek
3f9b7bfe9f Implements option that controls IPv6 BGP next hops when lladdr is missing. 2009-11-18 20:32:36 +01:00
Ondrej Zajicek
3228c72cc0 Implements RFC 5004 - prefer older external routes. 2009-11-17 11:41:29 +01:00
Ondrej Zajicek
be6e39ebbf Passive option. 2009-09-24 22:12:11 +02:00
Ondrej Zajicek
46eb80d5d5 Fixes headers for uintptr_t (and build on NetBSD). 2009-09-17 17:52:36 +02:00
Ondrej Zajicek
b99d378698 Minor BGP changes related to error wait time. 2009-06-07 00:38:38 +02:00
Ondrej Zajicek
dd91e46765 Differentiate between error delay and connect/reconnect delay.
The difference is here to reject incoming connections in the
first case.
2009-06-06 18:16:22 +02:00
Ondrej Zajicek
72b28a041d Implements import route limits. 2009-06-04 13:31:09 +02:00
Ondrej Zajicek
4827b69ff4 Fixes BGP IPv6 link local next hop handling.
When sending 'third party' BGP update, Bird used bogus link local
addresses instead of addresses it received before.
2009-04-29 18:58:24 +02:00
Ondrej Zajicek
ad440a570b Fixes handling of 'next hop self' and 'source address' configuration
options.
2009-04-28 18:11:56 +02:00