summaryrefslogtreecommitdiff
path: root/proto/bgp/packets.c
AgeCommit message (Collapse)Author
2022-07-11BGP: Implement BGP rolesEugene Bogomazov
Implement BGP roles as described in RFC 9234. It is a mechanism for route leak prevention and automatic route filtering based on common BGP topology relationships. It defines role capability (controlled by 'local role' option) and OTC route attribute, which is used for automatic route filtering and leak detection. Minor changes done by commiter.
2022-02-06Merge branch 'oz-trie-table'Ondrej Zajicek (work)
2022-02-06BGP: Implement flowspec validation procedureOndrej Zajicek (work)
Implement flowspec validation procedure as described in RFC 8955 sec. 6 and RFC 9117. The Validation procedure enforces that only routers in the forwarding path for a network can originate flowspec rules for that network. The patch adds new mechanism for tracking inter-table dependencies, which is necessary as the flowspec validation depends on IP routes, and flowspec rules must be revalidated when best IP routes change. The validation procedure is disabled by default and requires that relevant IP table uses trie, as it uses interval queries for subnets.
2022-01-28BGP: Make routing loops silentOndrej Zajicek (work)
One of previous commits added error logging of invalid routes. This also inadvertently caused error logging of route loops, which should be ignored silently. Fix that.
2022-01-28BGP: Use proper class in attribute error messagesOndrej Zajicek (work)
Most error messages in attribute processing are in rx/decode step and these use L_REMOTE log class. But there are few that are in tx/export step and these should use L_ERR log class. Use tx-specific macro (REJECT()) in tx/export code and rename field err_withdraw to err_reject in struct bgp_export_state to ensure that appropriate error reporting macros are called in proper contexts.
2022-01-28BGP: Improve 'invalid next hop' error reportingOndrej Zajicek (work)
Distinguish multiple causes of 'invalid next hop' message and report the relevant next hop address. Thanks to Simon Ruderich for the original patch.
2022-01-24BGP: Log route updates that were changed to withdrawsOndrej Zajicek (work)
Typical BGP error handling is treat-as-withdraw, where an invalid route is replaced with a withdraw. Log route network when it happens.
2021-06-01BGP: Ensure that freed neighbor entry is not accessedOndrej Zajicek (work)
Routes from downed protocols stay in rtable (until next rtable prune cycle ends) and may be even exported to another protocol. In BGP case, source BGP protocol is examined, although dynamic parts (including neighbor entries) are already freed. That may lead to crash under some race conditions. Ensure that freed neighbor entry is not accessed to avoid this issue.
2021-02-10BGP: Add support for BGP hostname capabilityVincent Bernat
This is an implementation of draft-walton-bgp-hostname-capability-02. It is implemented since quite some time for FRR and in datacenter, this gives a nice output to avoid using IP addresses. It is disabled by default. The hostname is retrieved from uname(2) and can be overriden with "hostname" option. The domain name is never set nor displayed. Minor changes by committer.
2020-04-29BGP: Fix handling of strange IPv6 link-local-only next hopsOndrej Zajicek (work)
There are three common ways how to encode IPv6 link-local-only next hops: (:: ll), (ll), and (ll ll). We use the first one but we should accept all three. The patch fixes handling of the last one. Thanks to Sebastian Hahn for the bugreport.
2020-03-03BGP: Handle flowspec rules without dst partOndrej Zajicek (work)
The RFC 5575 does not explicitly reject flowspec rules without dst part, it just requires dst part in validation procedure for feasibility, which we do not implement anyway. Thus flow without dst prefix is syntactically valid, but unfeasible (if feasibilty testing is done). Thanks to Alex D. for the bugreport.
2019-12-03BGP: Add some statisticsOndrej Zajicek (work)
Add some statistic counters to BGP consistent with BGP MIB (RFC 4273), including persistent 'FSM established transitions'.
2019-11-18BGP: Fix processing of IPv6 FlowspecOndrej Zajicek (work)
During NLRI parsing of IPv6 Flowspec, dst prefix was not properly extracted from NLRI, therefore a received flow was stored in a different position in flowspec routing table, and was not reachable by command 'show route <flow>'. Add proper prefix part accessors to flowspec code and use them from BGP NLRI parsing code. Thanks to Alex D. for the bugreport.
2019-10-09BGP: AIGP metric support (RFC 7311)Ondrej Zajicek (work)
2019-09-09BGP: Fix bugs in handling of shutdown messagesOndrej Zajicek (work)
There is an improper check for valid message size, which may lead to stack overflow and buffer leaks to log when a large message is received. Thanks to Daniel McCarney for bugreport and analysis.
2019-08-21BGP: Use reallocation for capability structureOndrej Zajicek (work)
Instead of having large stack buffer for max amount of AFI/SAFI pairs. The old code is not correct w.r.t. extendeded option length, as more AFI/SAFI pairs may fit into the capability option.
2019-08-20BGP: Implement extended optional parameters lengthOndrej Zajicek (work)
Extends BGP options/capabilities data length to 16bit, to avoid issues with too many capabilities. See draft-ietf-idr-ext-opt-param-07
2019-07-03Merge branch 'master' into mq-filter-stackMaria Matejka
2019-07-01BGP: split tx explicitlyMaria Jan Matejka
If BGP has too many data to send and BIRD is slower than the link, TX is always possible until all data is sent. This patch limits maximum number of generated BGP messages in one iteration of TX hook.
2019-04-30BGP: Compliance with RFC8203bisAlexander Azimov
2019-04-08BGP: Handle corner cases in event orderingOndrej Zajicek (work)
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-03BGP: Promiscuous ASN modeOndrej Zajicek (work)
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-02BGP: Separate runtime and config usage of local/remote ip and as fieldsOndrej Zajicek (work)
2019-03-19BGP: Mandatory option for channelsOndrej Zajicek (work)
Allow to mark channel to be mandatory, and do not allow BGP sessions if no common AFI/SAFI is established.
2019-03-18BGP: Handle case where capabilites are not usedOndrej Zajicek (work)
If peer does not announce capabilities at all, or when we have capabilities disabled, handle that as implicit IPv4 unicast.
2019-02-20Filter refactoring: dropped the recursion from the interpreterMaria Matejka
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.
2018-12-16BGP: Extend 'next hop keep' and 'next hop self' optionsOndrej Zajicek (work)
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-16BGP: Better handling of non-matching AFI in nexthopsOndrej Zajicek (work)
2018-12-12BGP: implement Adj-RIB-InOndrej Zajicek (work)
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-11-20The MRT protocolOndrej Zajicek (work)
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-07-31BGP: Long-lived graceful restartOndrej Zajicek (work)
The patch implements long-lived graceful restart for BGP, namely draft-uttaro-idr-bgp-persistence-03.
2018-07-01BGP: Use implicit-NULL label when announcing MPLS routes with local next-hopOndrej Zajicek (work)
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-01BGP: Fix parsing of MPLS withdrawalsOndrej Zajicek (work)
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-06-27Nest: Neighbor cache cleanupsOndrej Zajicek (work)
Simplify neighbor cache code, fix several minor bugs, and improve handling of ONLINK flag.
2018-01-23Merge branch 'master' into int-newOndrej Zajicek (work)
2018-01-16BGP: Implement 'disable after cease' optionOndrej Zajicek (work)
The option allows to specify that some cease subcodes should disable the protocol when received.
2018-01-02BGP: Fix unknown attribute handlingOndrej Zajicek (work)
2017-12-10Several minor fixesOndrej Zajicek (work)
2017-12-08BGP: Fix IPv6 MPLS/VPN multicast SAFIOndrej Zajicek (work)
2017-12-07Merge commit '1e8721e2aeccfbc3f533e8b8abc07582cee77e9a' into int-newOndrej Zajicek (work)
2017-09-19BGP: Shutdown communication (RFC 8203)Ondrej Zajicek (work)
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-04-12BGP: Add support for SAFI 129 (VPN multicast)Ondrej Zajicek (work)
Which, in contrast to SAFI 128, does not use MPLS labels.
2017-03-29BGP: Update list of supported standardsOndrej Zajicek (work)
2017-03-26BGP: Support for routes with mixed-AF next hopsOndrej Zajicek (work)
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-23BGP: Bugfix in VPN NLRI encodingOndrej Zajicek (work)
2017-03-22BGP: Support for MPLS labels and VPN SAFIOndrej Zajicek (work)
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-17Nexthop: Fixed recursive route mpls label mergingJan Moskyto Matejka
2017-03-14BGP: Fix bug in ADD_PATHOndrej Zajicek (work)
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-02-24Nexthop: Fixed hostentryJan Moskyto Matejka
2017-02-22Merge branch 'int-new' into nexthop-mergedJan Moskyto Matejka