summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_addpath.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Revert "bgpd: Handle Addpath capability using dynamic capabilities"Donatas Abraitis5 days1-31/+1
| | | | | | | | | | | | | | | | | | | | This reverts commit 05cf9d03b345393b8d63ffe9345c42debd8362b6. TL;DR; Handling BGP AddPath capability is not trivial (possible) dynamically. When the sender is AddPath-capable and sends NLRIs encoded with AddPath ID, and at the same time the receiver sends AddPath capability "disable-addpath-rx" (flag update) via dynamic capabilities, both peers are out of sync about the AddPath state. The receiver thinks already he's not AddPath-capable anymore, hence it tries to parse NLRIs as non-AddPath, while they are actually encoded as AddPath. AddPath capability itself does not provide (in RFC) any mechanism on backward compatible way to handle NLRIs if they come mixed (AddPath + non-AddPath). This explains why we have failures in our CI periodically. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* *: Allow 16 bit size for nexthopsDonald Sharp2024-10-081-4/+2
| | | | | | | | | Currently FRR is limiting the nexthop count to a uint8_t not a uint16_t. This leads to issues when the nexthop count is 256 which results in the count to overflow to 0 causing problems in the code. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd: Handle Addpath capability using dynamic capabilitiesDonatas Abraitis2023-10-031-1/+32
| | | | | | | Changing Addpath type, and or disabling RX (receiving) flag, we can do this without tearing down the session, and using dynamic capabilities. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* bgpd: Implement `neighbor X addpath-tx-best-selected` commandDonatas Abraitis2023-06-071-6/+17
| | | | | | | | | | | | When using `addpath-tx-all` BGP announces all known paths instead of announcing only an arbitrary number of best paths. With this new command we can send N best paths to the neighbor. That means, we send the best path, then send the second best path excluding the previous one, and so on. In other words, we run best path selection algorithm N times before we finish. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* *: auto-convert to SPDX License IDsDavid Lamparter2023-02-091-14/+1
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: Add missing enum's to case statementDonald Sharp2023-01-311-1/+3
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd: Print out useful information about peerDonald Sharp2022-12-161-2/+2
| | | | | | | | | I am seeing this output: 2022/12/16 09:16:00.206 BGP: [MNE5N-K0G4Z] Resetting peer (null) due to change in addpath config Switch over to %pBP Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd: Adopt addpath functionality for labeled-unicastDonatas Abraitis2022-12-061-1/+21
| | | | | | | The same as for RIB, labeled-unicast allocations should live in unicast space. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* bgpd, lib, staticd, tests: Convert to using FOREACH_AFI_SAFIDonald Sharp2020-11-151-7/+5
| | | | | | | | | Move the FOREACH_AFI_SAFI macro from bgpd.h to zebra.h( GLOBAL's YOUALL ) Then convert all the places that have the two level for loop to iterate over all afi/safis Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgp: rename bgp_node to bgp_destDonald Sharp2020-06-231-23/+23
| | | | | | | | | This is the bulk part extracted from "bgpd: Convert from `struct bgp_node` to `struct bgp_dest`". It should not result in any functional change. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bgpd: Convert lots of int type functions to bool/voidDonatas Abraitis2020-03-211-13/+12
| | | | | | | Some were converted to bool, where true/false status is needed. Converted to void only those, where the return status was only false or true. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* bgpd: Replace bgp_flag_* to [UN]SET/CHECK_FLAG macrosDonatas Abraitis2020-02-061-2/+4
| | | | | | Most of the code uses macros, thus let's keep the code unified. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: generously apply constDavid Lamparter2019-12-021-3/+3
| | | | | | const const const your boat, merrily down the stream... Signed-off-by: David Lamparter <equinox@diac24.net>
* bgpd: Fix per afi/safi addpath peer countingMitch Skiba2019-11-181-0/+2
| | | | | | | | | | | | The total_peercount table was created as a short cut for queries about if addpath was enabled at all on a particular afi/safi. However, the values weren't updated, so BGP would act as if addpath wasn't enabled when determining if updates should be sent out. The error in behavior was much more noticeable in tx-all than best-per-as, since changes in what is sent by best-per-as would often trigger updates even if addpath wasn't enabled. Signed-off-by: Mitchell Skiba <mskiba@amazon.com>
* *: config.h or zebra.h is the first #includeDavid Lamparter2019-06-131-0/+4
| | | | | | | | This is mostly relevant for Solaris, where config.h sets up some #define that affect overall header behaviour, so it needs to be before anything else. Signed-off-by: David Lamparter <equinox@diac24.net>
* *: remove trailing newlines from zlog messagesQuentin Young2019-03-141-1/+1
| | | | | | Zlog puts its own newlines on, and doing this makes logs look nasty. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bgpd: fix the add-path code to understand the mpls-vpn safiRenato Westphal2019-02-211-22/+61
| | | | | | | | | | | | In order to iterate over MPLS VPN routes, it's necessary to use two nested loops (the outer loop iterates over the MPLS VPN RDs, and the inner loop iterates over the VPN routes from that RD). The add-path code wasn't doing this, which was leading to lots of crashes when add-path was enabled for the MPLS VPN SAFI. This patch fixes the problem. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* bgpd: Abstract bgp_info retrieving/setting from info pointerDonald Sharp2018-11-161-4/+4
| | | | | | | | | The bgp_info data is stored as a void pointer in `struct bgp_node`. Abstract retrieval of this data and setting of this data into functions so that in the future we can move around what is stored in bgp_node. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd: Re-use TX Addpath IDs where possibleMitch Skiba2018-11-101-0/+422
The motivation for this patch is to address a concerning behavior of tx-addpath-bestpath-per-AS. Prior to this patch, all paths' TX ID was pre-determined as the path was received from a peer. However, this meant that any time the path selected as best from an AS changed, bgpd had no choice but to withdraw the previous best path, and advertise the new best-path under a new TX ID. This could cause significant network disruption, especially for the subset of prefixes coming from only one AS that were also communicated over a bestpath-per-AS session. The patch's general approach is best illustrated by txaddpath_update_ids. After a bestpath run (required for best-per-AS to know what will and will not be sent as addpaths) ID numbers will be stripped from paths that no longer need to be sent, and held in a pool. Then, paths that will be sent as addpaths and do not already have ID numbers will allocate new ID numbers, pulling first from that pool. Finally, anything left in the pool will be returned to the allocator. In order for this to work, ID numbers had to be split by strategy. The tx-addpath-All strategy would keep every ID number "in use" constantly, preventing IDs from being transferred to different paths. Rather than create two variables for ID, this patch create a more generic array that will easily enable more addpath strategies to be implemented. The previously described ID manipulations will happen per addpath strategy, and will only be run for strategies that are enabled on at least one peer. Finally, the ID numbers are allocated from an allocator that tracks per AFI/SAFI/Addpath Strategy which IDs are in use. Though it would be very improbable, there was the possibility with the free-running counter approach for rollover to cause two paths on the same prefix to get assigned the same TX ID. As remote as the possibility is, we prefer to not leave it to chance. This ID re-use method is not perfect. In some cases you could still get withdraw-then-add behaviors where not strictly necessary. In the case of bestpath-per-AS this requires one AS to advertise a prefix for the first time, then a second AS withdraws that prefix, all within the space of an already pending MRAI timer. In those situations a withdraw-then-add is more forgivable, and fixing it would probably require a much more significant effort, as IDs would need to be moved to ADVs instead of paths. Signed-off-by Mitchell Skiba <mskiba@amazon.com>