Commit graph

345 commits

Author SHA1 Message Date
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) 470740f97b BGP: Better dispatch of incoming connections
Since v2 we have multiple listening BGP sockets, and each BGP protocol
has associated one of them. Use listening socket that accepted the
incoming connection as a key in the dispatch process so only BGP
protocols assocaited with that listening socket can be selected.
This is necesary for proper dispatch when VRFs are used.
2019-01-02 16:01:21 +01:00
Ondrej Zajicek (work) e16b0aef31 BGP: Postpone setting link_addr
It may happen that the LLv6 address for given iface is not defined during
BGP start, so we postpone the check to the the session establishment.
2019-01-02 15:57:14 +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) cb311b441a BGP: Better handling of non-matching AFI in nexthops 2018-12-16 15:43:58 +01:00
Ondrej Zajicek (work) 3a2a3c7325 Doc: Rename code documentation files back to Doc 2018-12-14 02:03:42 +01:00
Ondrej Zajicek (work) 532116e7e3 BGP: Do not prepend ASN in export from non-RS EBGP to RS EBGP
When route is exported to regular EBGP, local ASN should be prepended to
AS_PATH. When route is propagated by route server (between RS-marked
EBGP peers), it should not change AS_PATH. Question is what to do in
other cases (from non-RS EBGP, IBGP, or locally originated to RS EBGP).

In 1.6.x, we did not prepend ASN in non-RS EBGP or IBGP to RS EBGP, but
we prepended in local to RS EBGP.

In 2.0.x, we changed that so only RS-EBGP to RS-EBGP is not prepended.
We received some negative responses (thanks to heisenbug and Alexander
Zubkov), we decided to change it back. One reason is that it is simple
to modify the AS_PATH by filters, but not possible to un-modify
changes done by BGP itself. Also, as 1.6.x behavior was not really
consistent, the final behavior is that ASN is never prepended when
exported to RS EBGP, like to IBGP.

Note that i do not express an opinion about whether such configurations
are even reasonable.
2018-12-12 17:36:54 +01:00
Ondrej Zajicek (work) 0f40405fc9 Update RFC references
Progdoc comments do not allow SGML tags
2018-12-12 16:38:30 +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
Ondrej Zajicek (work) d506263da7 Nest: Forbid adding channels during reconfiguration
When a new channel is found during reconfiguration, do force restart
of the protocol, like with any other un-reconfigurable change.

The old behavior was that the new channel was added but remained in down
state, even if the protocol was up, so a manual protocol restart was
often necessary.

In the future this should be improved such that a reconfigurable
channel addition (e.g. direct) is accepted and channel is started,
while an un-reconfigurable addition forces protocol restart.
2018-12-11 17:57:14 +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) e19d08055a BGP: Fix VRF for listening socket
Listening socket should be bound to specified interface and VRF.

Thanks to Alexander Zubkov for the bugreport.
2018-10-26 19:11:33 +02:00
Ondrej Zajicek (work) 961671c0f5 Lib: Add and use ev_new_init() 2018-10-01 15:55:23 +02:00
Ondrej Zajicek (work) 0db7a1d69c BGP: Fix bug in show protocol related to LLGR
When channel is not active due to not be negotiated during sessino
establishment, the LLGR timer is not allocated, so we should not show it.
2018-10-01 15:35:43 +02: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
Ondrej Zajicek (work) 8e86ffce82 BGP: Use implicit-NULL label when announcing MPLS routes with local next-hop
We currently cannot assing local labels, but we can still be LSP egress
router. Therefore when we announce labeled route with local next-hop, we
should announce implicit-NULL label instead of rejecting it completely.
2018-07-01 01:03:16 +02:00
Ondrej Zajicek (work) 93c1defdb0 BGP: Fix parsing of MPLS withdrawals
RFC 3107 was bit vague with regard to labeled withdrawals, RFC 8277
clarified that. The old code was incompatible with some implementations,
namely with Juniper.

Thanks to Vadim Fedorenko for the original patch.
2018-07-01 00:43:24 +02:00
Maria Jan Matejka daf113ac66 BGP: Attribute set function merged with its common counterpart 2018-06-29 17:26:28 +02:00
Ondrej Zajicek (work) 586c1800c4 Nest: Neighbor cache cleanups
Simplify neighbor cache code, fix several minor bugs, and improve
handling of ONLINK flag.
2018-06-27 16:57:07 +02:00
Maria Matejka c2fc4c10ac Doc: renamed progdoc files Doc -> progdoc to fix collision with doc/ folder on case-insensitive filesystems 2018-06-26 17:09:12 +02:00
Jan Maria Matejka f851f0d7e3 Config: Dropping CF_ADDTO. 2018-06-26 14:29:03 +02:00
Jan Maria Matejka 1ef23f05ee Merge branch 'int-new' into HEAD 2018-06-19 14:32:16 +02:00
Ondrej Zajicek (work) 9c9050ff12 BGP: Handle missing NEXT_HOP attribute properly
RFC 7606 specifies handle-as-withdraw instead of session reset.
2018-06-13 14:47:37 +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) f3a8cf050e BGP: Fix extended next hop handling
For IPv4 with extended next hop, we use MP-BGP format and therefore no
independent NEXT_HOP attribute.

Thanks to Arvin Gan for the bugreport.
2018-04-12 16:55:56 +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) 3831b61966 BGP: Require explicit import and export policies for EBGP channels
To comply with RFC 8212 requirements.
2018-01-16 04:14:49 +01:00
Ondrej Zajicek (work) 72163bd5f3 Nest: Allow modification of channels inherited from templates
Multiple definitions of same channels are forbidden, but inherited
channel can be redefined. In such case channel options are merged.
2018-01-09 18:42:22 +01:00
Ondrej Zajicek (work) d493d0f180 BGP: Fix unknown attribute handling 2018-01-02 16:57:45 +01:00
Ondrej Zajicek (work) e62cd03307 BGP: Fix graceful restart timer
Should use remote value, not local value.
2018-01-02 14:30:08 +01:00
Ondrej Zajicek (work) d807ea087f BGP: Fix non-transitive ext communities 2017-12-13 15:57:44 +01:00
Ondrej Zajicek (work) 7fc55925be Several minor fixes 2017-12-10 00:55:34 +01:00
Ondrej Zajicek (work) dea9886454 BGP: Link check just for single-hop 2017-12-08 17:04:59 +01:00
Ondrej Zajicek (work) 517d05dff1 Enable ECMP and Link detection by default
ECMP is not enabled on BSD, where it is not supported by BIRD.
2017-12-08 16:00:33 +01:00
Ondrej Zajicek (work) 49c7ef3b21 BGP: Fix IPv6 MPLS/VPN multicast SAFI 2017-12-08 14:00:36 +01:00
Ondrej Zajicek (work) ccee67ca3b BGP: Autoconfigure BGP next hops from preferred addresses 2017-12-08 02:26:17 +01:00
Ondrej Zajicek (work) 830ba75e6d Merge commit '1e8721e2aeccfbc3f533e8b8abc07582cee77e9a' into int-new 2017-12-07 21:54:47 +01:00
Ondrej Zajicek (work) 46434a3cad Merge commit '7b2c5f3d2826e3175bf31b1c36056c9efc587a2b' into int-new 2017-12-07 18:35:46 +01:00
Ondrej Zajicek (work) a6f79ca57f Timers: Revert temporary names and remove old timer.h 2017-12-07 13:54:59 +01:00
Ondrej Zajicek (work) cc881bd155 BGP: Update to new timers 2017-12-07 13:53:42 +01:00
Ondrej Zajicek (work) d3fa9e84e9 Timers: Show sub-second times in some protocol outputs 2017-12-07 13:49:27 +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) 153f02da3b Nest: Maintain separate IPv4, IPv6 and LLv6 preferred addresses
Also redesign preferred address selection and update protocols to use
appropriate preferred address.

Based on a previous work by Jan Maria Matejka.
2017-12-07 13:06:01 +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) 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