summaryrefslogtreecommitdiff
path: root/bgpd/bgp_route.h
AgeCommit message (Collapse)Author
2024-04-16bgpd: Fix display when using `missing-as-worst`Donald Sharp
The usage of the `bgp bestpath med missing-as-worst` command was being accepted and applied during bestpath, but during output of the routes affected by this it would not give any indication that this was happening or what med value was being used. Fixes: #15718 Signed-off-by: Donald Sharp <sharpd@nvidia.com> (cherry picked from commit bc9885b22e79ac14fd931517582d0d6d80f68c85)
2023-11-30bgpd: aggr summary-only suppressed export to evpnChirag Shah
When exporting bgp vrf instance unicast route into EVPN as type-5, check for suppressed ones and do not export them. Ticket:#3534718 Testing Done: Config: router bgp 660000 vrf vrf1 bgp router-id 144.1.1.2 no bgp network import-check neighbor 144.1.1.1 remote-as external ! address-family ipv4 unicast aggregate-address 50.1.0.0/16 summary-only redistribute connected exit-address-family ! address-family l2vpn evpn advertise ipv4 unicast exit-address-family exit v4 suppressed route: (5 suppressed routes not exported to evpn) tor1# vtysh -c "show bgp vrf vrf1 ipv4 unicast" | grep "50.1" *> 50.1.0.0/16 0.0.0.0(bordertor-11) s> 50.1.1.212/32 6.0.0.30(leaf-11)< s> 50.1.1.222/32 6.0.0.31(leaf-11)< s> 50.1.110.0/24 0.0.0.0(bordertor-11) s> 50.1.210.214/32 6.0.0.30(leaf-11)< s> 50.1.220.224/32 6.0.0.31(leaf-11)< tor1# vtysh -c "show bgp l2vpn evpn route" | grep -A3 "*> \[5\].*\[50.1" *> [5]:[0]:[16]:[50.1.0.0] RD 144.1.1.2:7 6.0.0.1 (bordertor-11) 0 32768 ? ET:8 RT:4640:104001 Rmac:00:02:00:00:00:04 Signed-off-by: Chirag Shah <chirag@nvidia.com> (cherry picked from commit 71d08ecc9d2a43997fe92193c3bd1d1203fa6954)
2023-09-22bgpd: Use proper AFI when dumping information for dampening stuffDonatas Abraitis
Before we called IPv4 for IPv6 dampening info. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-09-19bgpd: Make debug a passed in variable for bgp_evpn_path_info_cmpDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-13Merge pull request #14383 from donaldsharp/bgp_coverity_cleanup_early_septDonatas Abraitis
Bgp coverity cleanup early sept
2023-09-11bgpd: evpn_cleanup_local_non_best_route could free destDonald Sharp
But never really does due to locking, but since it can we need to treat it like it does and ensure that FRR is not making a mistake, by using memory after it has been freed. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-07bgpd: bgp_path_info_cmp should use a bool for debugDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-22bgpd: Convert from struct bgp_node to struct bgp_destYuqing Zhao
This is based on @donaldsharp's work The current code base is the struct bgp_node data structure. The problem with this is that it creates a bunch of extra data per route_node. The table structure generates ‘holder’ nodes that are never going to receive bgp routes, and now the memory of those nodes is allocated as if they are a full bgp_node. After splitting up the bgp_node into bgp_dest and route_node, the memory of ‘holder’ node which does not have any bgp data will be allocated as the route_node, not the bgp_node, and the memory usage is reduced. The memory usage of BGP node will be reduced from 200B to 96B. The total memory usage optimization of this part is ~16.00%. Signed-off-by: Donald Sharp <sharpd@nvidia.com> Signed-off-by: Yuqing Zhao <xiaopanghu99@163.com>
2023-08-14bgpd: Refactor bgp_static_set/bgp_static_set_safiDonatas Abraitis
Those two functions are very similar, let's get a single one. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-08-08bgpd: bgp_path_info_extra memory optimizationValerian_He
Even if some of the attributes in bgp_path_info_extra are not used, their memory is still allocated every time. It cause a waste of memory. This commit code deletes all unnecessary attributes and changes the optional attributes to pointer storage. Memory will only be allocated when they are actually used. After optimization, extra info related memory is reduced by about half(~400B -> ~200B). Signed-off-by: Valerian_He <1826906282@qq.com>
2023-07-14bgpd: Drop bgp_static_withdraw_safi() functionDonatas Abraitis
Combine bgp_static_withdraw() and bgp_static_withdraw_safi() into a single one. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-06-20Merge pull request #13728 from ↵Russ White
opensourcerouting/fix/addpath_drop_non_best_addpaths bgpd: Implement neighbor X addpath-tx-best-selected command
2023-06-20Merge pull request #13524 from pguibert6WIND/mpls_vpn_lsr_redistributeRuss White
MPLS vpn LSR redistribute
2023-06-16bgpd: advertise mpls vpn routes with appropriate labelPhilippe Guibert
The advertised label value from mpls vpn routes is not modified when the advertised next-hop is modified to next-hop-self. Actually, the original label value received is redistributed as is, whereas the new_label value bound in the nexthop label bind entry should be used. Only the VPN entries that contain MPLS information, and that are redistributed between distinct peers, will have a label value to advertise. - no SRv6 attribute - no local prefix - no exported VPN prefixes from a VRF If the advertisement to a given peer has the next-hop modified, then the new label value will be picked up. The considered cases are peers configured with 'next-hop-self' option, or ebgp peerings without the 'next-hop-unchanged' option. Note that the the NLRI format will follow the rfc3107 format, as multiple label values for MPLS VPN NLRIs are not supported (the rfc8277 is not supported). Note also that the case where an outgoing route-map is applied to the outgoing neighbor is not considered in this commit. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-06-16bgpd: allocate label bound to received mpls vpn routesPhilippe Guibert
Current implementation does not offer a new label to bind to a received VPN route entry to redistribute with that new label. This commit allocates a label for VPN entries that have a valid label, and a reachable next-hop interface that is configured as follows: > interface eth0 > mpls bgp l3vpn-multi-domain-switching > exit An mplsvpn next-hop label binding entry is created in an mpls vpn nexthop label bind hash table of the current BGP instance. That mpls vpn next-hop label entry is indexed by the (next-hop, orig_label) values provided by the incoming updates, and shared with other updates having the same (next-hop, orig_label) values. A new 'LP_TYPE_BGP_L3VPN_BIND' label value is picked up from the zebra mpls label pool, and assigned to the new_label attribute. The 'bgp_path_info' appends a 'bgp_mplsvpn_nh_label_bind' structure to the 'mplsvpn' union structure. Both structures in the union are not used at the same, as the paths are either VRF updates to export, or MPLS VPN updates. Using an union gives a 24 bytes memory gain compared to if the structures had not been in an union (24 bytes compared to 48 bytes). Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-06-16bgpd: move the label per nexthop structs of bgp_path to an unionPhilippe Guibert
The label per nexthop attributes take 24 bytes per bgp path entry on AMD64 platform, and are only used for unicast paths. The current patch-set introduces a similar attributes, but that will be used only for l3vpn paths. To gain some memory on the bgp_path_info structure in the next commit, do some changes. Create an 'mplsvpn' union structure that will either include the label per nexthop structs for ipv4 paths, or the l3vpn paths structures. The 'label_nexthop_cache' and the 'label_nh_thread' attributes of the 'bgp_path_info' structure are moved into an union under a new structure called 'bgp_mplsvpn_label_nh_blnc'. The flags attribute of 'bgp_path_info' is increased from 16 bits to 32 bits, and the BGP_PATH_MPLSVPN_LABEL_NH flag is added to know the 'mplsvpn' usage. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-06-14bgpd: some safi's do not mix with bgp suppress-fibDonald Sharp
BGP cannot decide to disseminate the safi based upon the bgp suppress-fib command. Modify the code to look at the safi for the decision to communicate to a peer the particular node. Ticket: #3402926 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-07bgpd: Implement `neighbor X addpath-tx-best-selected` commandDonatas Abraitis
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>
2023-05-25bgpd: Refactor subgroup_announce_table() to reuse an existing helpersDonatas Abraitis
Reuse subgroup_process_announce_selected(). It does the same as we do here duplicating the logic. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-05-09bgpd: add support for l3vpn per-nexthop labelPhilippe Guibert
This commit introduces a new method to associate a label to prefixes to export to a VPNv4 backbone. All the methods to associate a label to a BGP update is documented in rfc4364, chapter 4.3.2. Initially, the "single label for an entire VRF" method was available. This commit adds "single label for each attachment circuit" method. The change impacts the control-plane, because each BGP update is checked to know if the nexthop has reachability in the VRF or not. If this is the case, then a unique label for a given destination IP in the VRF will be picked up. This label will be reused for an other BGP update that will have the same nexthop IP address. The change impacts the data-plane, because the MPLs pop mechanism applied to incoming labelled packets changes: the MPLS label is popped, and the packet is directly sent to the connected nexthop described in the previous outgoing BGP VPN update. By default per-vrf mode is done, but the user may choose the per-nexthop mode, by using the vty command from the previous commit. In the latter case, a per-vrf label will however be allocated to handle networks that are not directly connected. This is the case for local traffic for instance. The change also include the following: - ECMP case In case a route is learnt in a given VRF, and is resolved via an ECMP nexthop. This implies that when exporting the route as a BGP update, if label allocation per nexthop is used, then two possible MPLS values could be picked up, which is not possible with the current implementation. Actually, the NLRI for VPNv4 stores one prefix, and one single label value, not two. Today, RFC8277 with multiple label capability is not yet available. To avoid this corner case, when a route is resolved via more than one nexthop, the label allocation per nexthop will not apply, and the default per-vrf label will be chosen. Let us imagine BGP redistributes a static route using the `172.31.0.20` nexthop. The nexthop resolution will find two different nexthops fo a unique BGP update. > r1# show running-config > [..] > vrf vrf1 > ip route 172.31.0.30/32 172.31.0.20 > r1# show bgp vrf vrf1 nexthop > [..] > 172.31.0.20 valid [IGP metric 0], #paths 1 > gate 192.0.2.11 > gate 192.0.2.12 > Last update: Mon Jan 16 09:27:09 2023 > Paths: > 1/1 172.31.0.30/32 VRF vrf1 flags 0x20018 To avoid this situation, BGP updates that resolve over multiple nexthops are using the unique per-vrf label. - recursive route case Prefixes that need a recursive route to be resolved can also be eligible for mpls allocation per nexthop. In that case, the nexthop will be the recursive nexthop calculated. To achieve this, all nexthop types in bnc contexts are valid, except for the blackhole nexthops. - network declared prefixes Nexthop tracking is used to look for the reachability of the prefixes. When the the 'no bgp network import-check' command is used, network declared prefixes are maintained active, even if there is no active nexthop. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-05-03Revert "MPLS allocation mode per next hop"Donatas Abraitis
Broken tests, let's revert now. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-05-02Merge pull request #12646 from pguibert6WIND/mpls_alloc_per_nhDonatas Abraitis
MPLS allocation mode per next hop
2023-03-30bgpd : aggregate-address memory leak fixSamanvitha B Bhargav
Memory leaks are observed in the cleanup code. When “no router bgp" is executed, cleanup in that flow for aggregate-address command is not taken care. fixes the below leak: -- ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444:Direct leak of 152 byte(s) in 1 object(s) allocated from: ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #0 0x7f163e911037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #1 0x7f163e4b9259 in qcalloc lib/memory.c:105 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #2 0x562bf42ebbd5 in bgp_aggregate_new bgpd/bgp_route.c:7239 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #3 0x562bf42f14e8 in bgp_aggregate_set bgpd/bgp_route.c:8421 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #4 0x562bf42f1e55 in aggregate_addressv6_magic bgpd/bgp_route.c:8592 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #5 0x562bf42be3f5 in aggregate_addressv6 bgpd/bgp_route_clippy.c:341 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #6 0x7f163e3f1e1b in cmd_execute_command_real lib/command.c:988 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #7 0x7f163e3f219c in cmd_execute_command lib/command.c:1048 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #8 0x7f163e3f2df4 in cmd_execute lib/command.c:1215 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #9 0x7f163e5a2d73 in vty_command lib/vty.c:544 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #10 0x7f163e5a79c8 in vty_execute lib/vty.c:1307 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #11 0x7f163e5ad299 in vtysh_read lib/vty.c:2216 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #12 0x7f163e593f16 in event_call lib/event.c:1995 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #13 0x7f163e47c839 in frr_run lib/libfrr.c:1185 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #14 0x562bf414e58d in main bgpd/bgp_main.c:505 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #15 0x7f163de66d09 in __libc_start_main ../csu/libc-start.c:308 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444:Direct leak of 152 byte(s) in 1 object(s) allocated from: ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #0 0x7f163e911037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #1 0x7f163e4b9259 in qcalloc lib/memory.c:105 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #2 0x562bf42ebbd5 in bgp_aggregate_new bgpd/bgp_route.c:7239 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #3 0x562bf42f14e8 in bgp_aggregate_set bgpd/bgp_route.c:8421 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #4 0x562bf42f1cde in aggregate_addressv4_magic bgpd/bgp_route.c:8543 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #5 0x562bf42bd258 in aggregate_addressv4 bgpd/bgp_route_clippy.c:255 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #6 0x7f163e3f1e1b in cmd_execute_command_real lib/command.c:988 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #7 0x7f163e3f219c in cmd_execute_command lib/command.c:1048 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #8 0x7f163e3f2df4 in cmd_execute lib/command.c:1215 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #9 0x7f163e5a2d73 in vty_command lib/vty.c:544 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #10 0x7f163e5a79c8 in vty_execute lib/vty.c:1307 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #11 0x7f163e5ad299 in vtysh_read lib/vty.c:2216 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #12 0x7f163e593f16 in event_call lib/event.c:1995 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #13 0x7f163e47c839 in frr_run lib/libfrr.c:1185 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #14 0x562bf414e58d in main bgpd/bgp_main.c:505 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- #15 0x7f163de66d09 in __libc_start_main ../csu/libc-start.c:308 ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444- ./bgp_local_asn_dot.test_bgp_local_asn_dot_agg/r3.bgpd.asan.3410444-SUMMARY: AddressSanitizer: 304 byte(s) leaked in 2 allocation(s). Signed-off-by: Samanvitha B Bhargav <bsamanvitha@vmware.com>
2023-03-24*: Rename `struct thread` to `struct event`Donald Sharp
Effectively a massive search and replace of `struct thread` to `struct event`. Using the term `thread` gives people the thought that this event system is a pthread when it is not Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-22bgpd: add support for l3vpn per-nexthop labelPhilippe Guibert
This commit introduces a new method to associate a label to prefixes to export to a VPNv4 backbone. All the methods to associate a label to a BGP update is documented in rfc4364, chapter 4.3.2. Initially, the "single label for an entire VRF" method was available. This commit adds "single label for each attachment circuit" method. The change impacts the control-plane, because each BGP update is checked to know if the nexthop has reachability in the VRF or not. If this is the case, then a unique label for a given destination IP in the VRF will be picked up. This label will be reused for an other BGP update that will have the same nexthop IP address. The change impacts the data-plane, because the MPLs pop mechanism applied to incoming labelled packets changes: the MPLS label is popped, and the packet is directly sent to the connected nexthop described in the previous outgoing BGP VPN update. By default per-vrf mode is done, but the user may choose the per-nexthop mode, by using the vty command from the previous commit. In the latter case, a per-vrf label will however be allocated to handle networks that are not directly connected. This is the case for local traffic for instance. The change also include the following: - ECMP case In case a route is learnt in a given VRF, and is resolved via an ECMP nexthop. This implies that when exporting the route as a BGP update, if label allocation per nexthop is used, then two possible MPLS values could be picked up, which is not possible with the current implementation. Actually, the NLRI for VPNv4 stores one prefix, and one single label value, not two. Today, RFC8277 with multiple label capability is not yet available. To avoid this corner case, when a route is resolved via more than one nexthop, the label allocation per nexthop will not apply, and the default per-vrf label will be chosen. Let us imagine BGP redistributes a static route using the `172.31.0.20` nexthop. The nexthop resolution will find two different nexthops fo a unique BGP update. > r1# show running-config > [..] > vrf vrf1 > ip route 172.31.0.30/32 172.31.0.20 > r1# show bgp vrf vrf1 nexthop > [..] > 172.31.0.20 valid [IGP metric 0], #paths 1 > gate 192.0.2.11 > gate 192.0.2.12 > Last update: Mon Jan 16 09:27:09 2023 > Paths: > 1/1 172.31.0.30/32 VRF vrf1 flags 0x20018 To avoid this situation, BGP updates that resolve over multiple nexthops are using the unique per-vrf label. - recursive route case Prefixes that need a recursive route to be resolved can also be eligible for mpls allocation per nexthop. In that case, the nexthop will be the recursive nexthop calculated. To achieve this, all nexthop types in bnc contexts are valid, except for the blackhole nexthops. - network declared prefixes Nexthop tracking is used to look for the reachability of the prefixes. When the the 'no bgp network import-check' command is used, network declared prefixes are maintained active, even if there is no active nexthop. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-03-16Merge pull request #12999 from opensourcerouting/fix/bgp_leaks_random_stuffDonald Sharp
bgpd: aggregate routes memory leak for aspath
2023-03-15bgpd: Unlock dest if we return earlier for aggregate installDonatas Abraitis
If the bgp is in shutdown state or so, do not forget to unlock the dest node. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-03-14bgpd: Rename bgp_afi_node_lookup() to bgp_safi_node_lookup()Donatas Abraitis
afi not used in this function, reduce a bit. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-22bgpd: Align `show bgp ...` output with the header for wide optionDonatas Abraitis
Before: ``` r1# sh ip bgp wide BGP table version is 1, local router ID is 192.168.2.1, vrf id 0 Default local pref 100, local AS 65001 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path * 172.16.255.254/32 192.168.2.2 0 0 (65003) i *> 192.168.1.2 0 0 (65002) i Displayed 1 routes and 2 total paths r1# ``` After: ``` r1# sh ip bgp wide BGP table version is 1, local router ID is 192.168.2.1, vrf id 0 Default local pref 100, local AS 65001 Status codes: s suppressed, d damped, h history, * valid, > best, = multipath, i internal, r RIB-failure, S Stale, R Removed Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path * 172.16.255.254/32 192.168.2.2 0 0 (65003) i *> 192.168.1.2 0 0 (65002) i Displayed 1 routes and 2 total paths r1# ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-21Merge pull request #12805 from karlquan/kquan_self_origRuss White
bgpd: BGP troubleshooting - Add a keyword self-originate to display o…
2023-02-21Merge pull request #12854 from opensourcerouting/fix/bgp_withdraw_attr_not_usedRuss White
bgpd: Drop struct attr from bgp_withdraw()
2023-02-21Merge pull request #12248 from pguibert6WIND/bgpasdotRuss White
lib, bgp: add initial support for asdot format
2023-02-21bgpd: Drop struct attr from bgp_withdraw()Donatas Abraitis
It's not used at all. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-17Merge pull request #12791 from taspelund/loc_rib_json_fixDonatas Abraitis
bgpd: fix 'json detail' output structure
2023-02-16bgpd: fix 'json detail' output structureTrey Aspelund
"show bgp <afi> <safi> json detail" was incorrectly displaying header information from route_vty_out_detail_header() as an element of the "paths" array. This corrects the behavior for 'json detail' so that a route holds a dictionary with keys for "paths" and header info, which aligns with how we structure the output for a specific prefix, e.g. "show bgp <afi> <safi> <prefix> json". Before: ``` ub20# show ip bgp json detail { "vrfId": 0, "vrfName": "default", "tableVersion": 3, "routerId": "100.64.0.222", "defaultLocPrf": 100, "localAS": 1, "routes": { "2.2.2.2/32": [ { <<<<<<<<< should be outside the array "prefix":"2.2.2.2/32", "version":1, "advertisedTo":{ "192.168.122.12":{ "hostname":"ub20-2" } } }, { "aspath":{ "string":"Local", "segments":[ ], "length":0 }, <snip> ``` After: ``` ub20# show ip bgp json detail { "vrfId": 0, "vrfName": "default", "tableVersion": 3, "routerId": "100.64.0.222", "defaultLocPrf": 100, "localAS": 1, "routes": { "2.2.2.2/32": { "prefix": "2.2.2.2/32", "version": "1", "advertisedTo": { "192.168.122.12":{ "hostname":"ub20-2" } } ,"paths": [ { "aspath":{ "string":"Local", "segments":[ ], "length":0 }, ``` Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2023-02-15bgpd: BGP troubleshooting - Add a keyword self-originate to display only ↵Karl Quan
self-originated prefixes when looking at the BGP table for a given address-family Add a keyword self-originate" to extend current CLI commands to filter out self-originated routes only a\) CLI to show ipv4/ipv6 self-originated routes "show [ip] bgp [afi] [safi] [all] self-originate [wide|json]" b\) CLI to show evpn self-originated routes "show bgp l2vpn evpn route [detail] [type <ead|macip|multicast|es|prefix|1|2|3|4|5>] self-originate [json]" Signed-off-by: Karl Quan <kquan@nvidia.com>
2023-02-10bgpd: handle network rd parameter in network configurationPhilippe Guibert
The bgp network command creates static routes with an optional route-distinguisher parameter for VPN and EVPN address families. Store the rd parameter in those static routes. This will be used by the 'show running-config' later. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-30bgpd: bgp_update and bgp_withdraw never return failuresDonald Sharp
These two functions always return 0. As such any and all tests against this make no sense. Remove the return 0 to a void and follow the chain, logically, to remove all the dead code. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-27Merge pull request #12562 from ↵Russ White
opensourcerouting/fix/add_frrtrace_points_for_peer_lock_unlock bgpd: A bit more tracepoints for lttng
2022-12-23bgpd: Add lttng tracepoints for bgp_path_info_add/freeDonatas Abraitis
``` [00:05:25.690812414] (+0.000004699) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "10.0.0.6/32", peer = "10.0.0.3", dest_lock = 2, peer_lock = 8 } [00:05:25.690816732] (+0.000004318) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "10.0.0.71/32", peer = "10.0.0.3", dest_lock = 2, peer_lock = 9 } [00:05:25.690821251] (+0.000004519) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "10.0.0.72/32", peer = "10.0.0.3", dest_lock = 2, peer_lock = 10 } [00:05:25.690826050] (+0.000004799) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "192.168.13.0/24", peer = "10.0.0.3", dest_lock = 1, peer_lock = 11 } [00:05:25.690830438] (+0.000004388) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "192.168.24.0/24", peer = "10.0.0.3", dest_lock = 2, peer_lock = 12 } [00:05:25.690834666] (+0.000004228) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "192.168.35.0/24", peer = "10.0.0.3", dest_lock = 2, peer_lock = 13 } [00:05:25.690839145] (+0.000004479) donatas-pc frr_bgp:bgp_path_info_add: { cpu_id = 4 }, { caller = "bgp_update", prefix = "192.168.67.0/24", peer = "10.0.0.3", dest_lock = 2, peer_lock = 14 } [00:05:26.361779328] (+0.670940183) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.2/32", peer = "10.0.0.2", dest_lock = 3, peer_lock = 13 } [00:05:26.361790669] (+0.000011341) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.3/32", peer = "10.0.0.3", dest_lock = 3, peer_lock = 13 } [00:05:26.361792282] (+0.000001613) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.4/32", peer = "10.0.0.3", dest_lock = 5, peer_lock = 12 } [00:05:26.361912420] (+0.000120138) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.4/32", peer = "10.0.0.2", dest_lock = 4, peer_lock = 12 } [00:05:26.361914153] (+0.000001733) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.5/32", peer = "10.0.0.3", dest_lock = 5, peer_lock = 11 } [00:05:26.361915425] (+0.000001272) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.5/32", peer = "10.0.0.2", dest_lock = 4, peer_lock = 11 } [00:05:26.361916878] (+0.000001453) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.6/32", peer = "10.0.0.3", dest_lock = 5, peer_lock = 10 } [00:05:26.361920645] (+0.000003767) donatas-pc frr_bgp:bgp_path_info_free: { cpu_id = 7 }, { caller = "bgp_path_info_unlock", prefix = "10.0.0.6/32", peer = "10.0.0.2", dest_lock = 4, peer_lock = 10 } ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-20bgpd: Adopt `show bgp detail-routes` command for L3VPN outputs as wellDonatas Abraitis
``` unet> sh pe2 vtysh -c 'sh ip bgp ipv4 vpn detail-routes' BGP table version is 4, local router ID is 10.10.10.20, vrf id 0 Default local pref 100, local AS 65001 Route Distinguisher: 192.168.2.2:2 BGP routing table entry for 192.168.2.2:2:10.0.0.0/24, version 1 not allocated Paths: (1 available, best #1) Not advertised to any peer 65000 192.168.2.1 from 0.0.0.0 (10.10.10.20) vrf RED(4) announce-nh-self Origin incomplete, metric 0, localpref 50, valid, sourced, local, best (First path received) Extended Community: RT:192.168.2.2:2 Originator: 10.10.10.20 Remote label: 2222 Last update: Tue Dec 20 13:01:20 2022 BGP routing table entry for 192.168.2.2:2:172.16.255.1/32, version 2 not allocated Paths: (1 available, best #1) Not advertised to any peer 65000 192.168.2.1 from 0.0.0.0 (10.10.10.20) vrf RED(4) announce-nh-self Origin incomplete, localpref 50, valid, sourced, local, best (First path received) Extended Community: RT:192.168.2.2:2 Originator: 10.10.10.20 Remote label: 2222 Last update: Tue Dec 20 13:01:20 2022 BGP routing table entry for 192.168.2.2:2:192.168.1.0/24, version 3 not allocated Paths: (1 available, best #1) Not advertised to any peer 65000 192.168.2.1 from 0.0.0.0 (10.10.10.20) vrf RED(4) announce-nh-self Origin incomplete, localpref 50, valid, sourced, local, best (First path received) Extended Community: RT:192.168.2.2:2 Originator: 10.10.10.20 Remote label: 2222 Last update: Tue Dec 20 13:01:20 2022 BGP routing table entry for 192.168.2.2:2:192.168.2.0/24, version 4 not allocated Paths: (1 available, best #1) Not advertised to any peer 65000 192.168.2.1 from 0.0.0.0 (10.10.10.20) vrf RED(4) announce-nh-self Origin incomplete, metric 0, localpref 50, valid, sourced, local, best (First path received) Extended Community: RT:192.168.2.2:2 Originator: 10.10.10.20 Remote label: 2222 Last update: Tue Dec 20 13:01:20 2022 Displayed 4 routes and 4 total paths ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-20bgpd: Add `show ip bgp <afi> <safi> detail` command versionDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-20bgpd: Rename BGP_SHOW_OPT_DETAIL to BGP_SHOW_OPT_JSON_DETAILDonatas Abraitis
This option used only for JSON detailed output. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-11-17Merge pull request #12081 from sworleys/EMM-upstreamDonatas Abraitis
Rework of Various Handling in EVPN for Extended Mac Mobility
2022-11-08bgpd: Make calling bgp_soft_reconfig_in consistentDonald Sharp
Not all places were checking to see if soft reconfiguration was turned on before calling into it to do all that work. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-25bgpd: fixed misaligned columns in BGP routes tableWayne Morrison
Column headers in BGP routes table are not aligned with data when RPKI status is available. This was fixed to insert a space at the beginning of the header and at the beginning of lines that do not have RPKI status. This fix requires that several testing templates be adjusted to match the new output. Signed-off-by: Wayne Morrison <wmorrison@netgate.com>
2022-10-14Merge pull request #12113 from donaldsharp/network_statementDonatas Abraitis
bgpd: Allow `network XXX` to work with bgp suppress-fib-pending
2022-10-12bgpd: Allow `network XXX` to work with bgp suppress-fib-pendingDonald Sharp
When bgp is using `bgp suppress-fib-pending` and the end operator is using network statements, bgp was not sending the network'ed prefix'es to it's peers. Fix this. Also update the test cases for bgp_suppress_fib to test this new corner case( I am sure that there are going to be others that will need to be added ). Fixes: #12112 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-12bgpd: Implement ACCEPT_OWN extended communityDonatas Abraitis
TL;DR: rfc7611. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>