Commit Graph

7735 Commits

Author SHA1 Message Date
Donatas Abraitis
637ab53f75 bgpd: Send End-of-RIB not only if Graceful Restart capability is received
Before we checked for received Graceful Restart capability, but that was also
incorrect, because we SHOULD HAVE checked it per AFI/SAFI instead.

https://datatracker.ietf.org/doc/html/rfc4724 says:

Although the End-of-RIB marker is specified for the purpose of BGP
   graceful restart, it is noted that the generation of such a marker
   upon completion of the initial update would be useful for routing
   convergence in general, and thus the practice is recommended.

Thus, it might be reasonable to send EoR regardless of whether the Graceful Restart
capability is received or not from the peer.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-31 15:03:55 +03:00
Donald Sharp
33e01b663e
Merge pull request #16097 from opensourcerouting/fix/safety_check_for_extcommunities
bgpd: Make sure we have enough data to handle extended link bandwidth
2024-05-29 08:55:08 -04:00
Russ White
57b472153c
Merge pull request #16083 from opensourcerouting/fix/overflow_bgp_dynamic_capability
BGP dynamic capability some fixes
2024-05-28 10:31:42 -04:00
Russ White
ffaddf36a6
Merge pull request #16023 from opensourcerouting/fix/rpki_show_stuff
bgpd: Split `rpki cache` command into separate per SSH/TCP
2024-05-28 10:23:10 -04:00
Donatas Abraitis
0f5834d499 bgpd: Make sure we have enough data to handle extended link bandwidth
Extended link bandwidth is encoded inside extended community as a ipv6-address
specific extended community, but with a malformed packet we should do the
sanity check here to have enough data. Especially before doing ptr_get_be64().

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-26 18:49:22 +03:00
Donatas Abraitis
3d21e3ebf1 bgpd: Add a safety check for ecommunity_ecom2str
Just in case we have enough data according to the community unit size. It
should be 8 or 20 (for now).

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-26 18:45:01 +03:00
Donatas Abraitis
496ede2495 bgpd: Convert unk_ecom to boolean
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-26 18:43:43 +03:00
Donatas Abraitis
ebdbb0e3fe
Merge pull request #16070 from Pdoijode/pdoijode/lcomm-not-found-fix
bgpd: Return success if lcomm/comm/extcomm name or entry is not found
2024-05-26 17:51:29 +03:00
Pooja Jagadeesh Doijode
a7c3317aba bgpd: Removed unused COMMUNITY_LIST_ERR_CANT_FIND_LIST
Removed the unused COMMUNITY_LIST_ERR_CANT_FIND_LIST

Ticket:#3900813
Testing Done: precommit

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2024-05-24 11:25:16 -07:00
Pooja Jagadeesh Doijode
773a45ef29 bgpd: Return success if lcomm/comm/extcomm name or entry is not found
Problem:
Currently bgp prints `Can't find community-list` and returns CMD_WARNING_CONFIG_FAILED
error if name or an entry for community, large-community and ext-community is not found. This
causes frr-reload to fail.

Fix:
Return success if community, large-community and ext-community name or
an entry is not found.

Ticket:#3900813
Testing Done:

Before fix:
```
root@tor-4:mgmt:/var/home/cumulus# cat /etc/frr/frr.conf
<SNIP>
bgp large-community-list standard lc22 seq 10 permit 4200857911:011:01 4200857911:011:011555
no bgp large-community-list standard lc22 seq 10 permit 4200857911:011:01
<SNIP>

root@tor-4:mgmt:/var/home/cumulus# systemctl reload frr
Job for frr.service failed.
See "systemctl status frr.service" and "journalctl -xeu frr.service" for details.

Syslog:
<SNIP>
2024-05-21T21:02:51.525965+00:00 tor-4 frrinit.sh[2349145]: % Can't find community-list
2024-05-21T21:02:51.526487+00:00 tor-4 staticd[6167]: [VTVCM-Y2NW3] Configuration Read in Took: 00:00:00
2024-05-21T21:02:51.526595+00:00 tor-4 frrinit.sh[2349155]: [2349155|staticd] done
2024-05-21T21:02:51.526826+00:00 tor-4 frrinit.sh[2349145]: line 176: Failure to communicate[13] to bgpd, line: no bgp large-community-list standard lc22 seq 10 permit 4200857911:011:01
2024-05-21T21:02:51.527928+00:00 tor-4 frrinit.sh[2349153]: [2349153|watchfrr] done
2024-05-21T21:02:51.528382+00:00 tor-4 frrinit.sh[2349145]: [2349145|bgpd] Configuration file[/etc/frr/frr.conf] processing failure: 13
<SNIP>
```

After fix:
```
root@tor-4:mgmt:/var/home/cumulus# cat /etc/frr/frr.conf
<SNIP>
bgp large-community-list standard lc22 seq 10 permit 4200857911:011:01 4200857911:011:011555
no bgp large-community-list standard lc22 seq 10 permit 4200857911:011:01
<SNIP>

root@tor-4:mgmt:/var/home/cumulus# systemctl reload frr
root@tor-4:mgmt:/var/home/cumulus#

root@tor-4:mgmt:/var/home/cumulus# vtysh -c "show run" | grep lc22
bgp large-community-list standard lc22 seq 10 permit 4200857911:11:1 4200857911:11:11555
root@tor-4:mgmt:/var/home/cumulus#
```

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-05-24 11:25:00 -07:00
Donatas Abraitis
0d079e01e5 bgpd: Check if FQDN capability length is in valid ranges
If FQDN capability comes as dynamic capability we should check if the encoding
is proper.

Before this patch we returned an error if the hostname/domainname length check
was > end. But technically, if the length is also == end, this is
a malformed capability, because we use the data incorrectly after we check the
length.

This causes heap overflow (when compiled with address-sanitizer).

Signed-off-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-24 10:38:49 +03:00
Donatas Abraitis
150eb73054 bgpd: Send a notification if we receive CAPABILITY message if not exepected
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-24 10:35:43 +03:00
Donatas Abraitis
048609103c bgpd: Add sanity check for capability lengths before processing them
This is for CAPABILITY messages, not for OPEN message capabilities.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-24 10:35:42 +03:00
Donatas Abraitis
c362af18e9
Merge pull request #16044 from louis-6wind/fix-loopback-leak
bgpd: fix route leaking from the default l3vrf
2024-05-24 10:13:01 +03:00
Donatas Abraitis
d536fb675b bgpd: Rename SERVER_PUBKEY to KNOWN_HOSTS_PATH
SERVER_PUBKEY is not the best name to describe what it really is.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-21 14:23:16 +03:00
Donatas Abraitis
043cff5286 bgpd: Split rpki cache command into separate per SSH/TCP
Current command (bundled two into one) is absolutely wrong.

When you configure TCP session with the source, the command thinks, that
it's a SSH session with a username.

It's much better to split this into two separate commands where it's much
easier to do the changes in the future (if more options comes in).

Yes, this is a breaking change, but there is no other proper way to overcome
this.

Bonus note how it looks, which also can lead to crashes (due to port 0x0):

```
(gdb) p *cache->tr_config.ssh_config
$11 = {host = 0x5555562f9cd0 "1.1.1.1", port = 0, bindaddr = 0x0,
  username = 0x55555629ad00 "",
  server_hostkey_path = 0x7ffff53667a0 <rpki_create_socket> "Uf\017\357\300H\211\345AWAVAUATSH\201", <incomplete sequence \354\230>, client_privkey_path = 0x0,
  data = 0x0, new_socket = 0x51, connect_timeout = 4143762592,
  password = 0x7ffff6fccca0 <main_arena+96> "\300\"0VUU"}
(gdb) p *cache->tr_config.tcp_config
$12 = {host = 0x5555562f9cd0 "1.1.1.1", port = 0x0, bindaddr = 0x0,
  data = 0x55555629ad00, new_socket = 0x7ffff53667a0 <rpki_create_socket>,
  connect_timeout = 0}
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-21 14:23:15 +03:00
Donatas Abraitis
b87d5a467e
Merge pull request #15980 from donaldsharp/agentx_update
*: Modify agentx to be allowed to be called
2024-05-20 22:33:01 +03:00
Donald Sharp
0babb933e7
Merge pull request #16022 from opensourcerouting/fix/match_peer
bgpd: Fix `match peer` when switching between IPv4/IPv6/interface
2024-05-20 09:57:20 -04:00
Donald Sharp
815e40c0c1
Merge pull request #16033 from opensourcerouting/fix/typo_soft_version_capability
bgpd: Fix logging message when receiving a software version capability
2024-05-20 09:45:41 -04:00
Louis Scalbert
31fc89b230 bgpd, tests: fix route leaking from the default l3vrf
Leaked route from the l3VRF are installed with the loopback as the
nexthop interface instead of the real interface.

> B>* 10.0.0.0/30 [20/0] is directly connected, lo (vrf default), weight 1, 00:21:01

Routing of packet from a L3VRF to the default L3VRF destined to a leak
prefix fails because of the default routing rules on Linux.

> 0:      from all lookup local
> 1000:   from all lookup [l3mdev-table]
> 32766:  from all lookup main
> 32767:  from all lookup default

When the packet is received in the loopback interface, the local rules
are checked without match, then the l3mdev-table says to route to the
loopback. A routing loop occurs (TTL is decreasing).

> 12:26:27.928748 ens37 In  IP (tos 0x0, ttl 64, id 26402, offset 0, flags [DF], proto ICMP (1), length 84)
>     10.0.0.2 > 10.0.1.2: ICMP echo request, id 47463, seq 1, length 64
> 12:26:27.928784 red   Out IP (tos 0x0, ttl 63, id 26402, offset 0, flags [DF], proto ICMP (1), length 84)
>     10.0.0.2 > 10.0.1.2: ICMP echo request, id 47463, seq 1, length 64
> 12:26:27.928797 ens38 Out IP (tos 0x0, ttl 63, id 26402, offset 0, flags [DF], proto ICMP (1), length 84)
>     10.0.0.2 > 10.0.1.2: ICMP echo request, id 47463, seq 1, length 64

Do not set the lo interface as a nexthop interface. Keep the real
interface where possible.

Fixes: db7cf73a33 ("bgpd: fix interface on leaks from redistribute connected")
Fixes: 067fbab4e4 ("bgpd: fix interface on leaks from network statement")
Fixes: 8a02d9fe1e ("bgpd: Set nh ifindex to VRF's interface, not the real")
Fixes: https://github.com/FRRouting/frr/issues/15909
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-05-20 14:12:28 +02:00
Donatas Abraitis
95b1b1d3e3
Merge pull request #16035 from raja-rajasekar/rajasekarr/backpressure_infinite_loop
bgpd: backpressure - Fix to avoid CPU hog
2024-05-20 09:54:04 +03:00
Rajasekar Raja
920bf45e10 bgpd: backpressure - Fix to avoid CPU hog
In case when bgp_evpn_free or bgp_delete is called and the announce_list
has few items where vpn/bgp does not match, we add the item back to the
list. Because of this the list count is always > 0 thereby hogging CPU or
infinite loop.

Ticket: #3905624

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-05-17 15:43:59 -07:00
Rajasekar Raja
f4ba47238e bgpd: backpressure - Fix to withdraw evpn type-5 routes immediately
As part of backpressure changes, there is a bug where immediate withdraw
is to be sent for evpn imported type-5 prefix to clear the nh neigh and
RMAC entry.

Fixing this by sending withdraw immediately to keep it inline with the
code today

Ticket: #3905571

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-05-17 12:42:30 -07:00
Donatas Abraitis
d50730ba48 bgpd: Fix logging message when receiving a software version capability
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-17 22:04:40 +03:00
Donatas Abraitis
edfc03614f bgpd: Fix match peer when switching between IPv4/IPv6/interface
Without this patch we MUST follow this sequence:

```
no match peer 10.0.0.1
match peer 2a01::1
```

Otherwise, both IPv4/IPv6 values are set/compiled, thus when printing the
configuration in show running, we see the first one (IPv4).

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-16 20:49:56 +03:00
Louis Scalbert
e446308d76 bgpd: fix dynamic peer graceful restart race condition
bgp_llgr topotest sometimes fails at step 8:

> topo: STEP 8: 'Check if we can see 172.16.1.2/32 after R4 (dynamic peer) was killed'

R4 neighbor is deleted on R2 because it fails to re-connect:

> 14:33:40.128048 BGP: [HKWM3-ZC5QP] 192.168.3.1 fd -1 went from Established to Clearing
> 14:33:40.128154 BGP: [MJ1TJ-HEE3V] 192.168.3.1(r4) graceful restart timer expired
> 14:33:40.128158 BGP: [ZTA2J-YRKGY] 192.168.3.1(r4) graceful restart stalepath timer stopped
> 14:33:40.128162 BGP: [H917J-25EWN] 192.168.3.1(r4) Long-lived stale timer (IPv4 Unicast) started for 20 sec
> 14:33:40.128168 BGP: [H5X66-NXP9S] 192.168.3.1(r4) Long-lived set stale community (LLGR_STALE) for: 172.16.1.2/32
> 14:33:40.128220 BGP: [H5X66-NXP9S] 192.168.3.1(r4) Long-lived set stale community (LLGR_STALE) for: 192.168.3.0/24
> [...]
> 14:33:41.138869 BGP: [RGGAC-RJ6WG] 192.168.3.1 [Event] Connect failed 111(Connection refused)
> 14:33:41.138906 BGP: [ZWCSR-M7FG9] 192.168.3.1 [FSM] TCP_connection_open_failed (Connect->Active), fd 23
> 14:33:41.138912 BGP: [JA9RP-HSD1K] 192.168.3.1 (dynamic neighbor) deleted (bgp_connect_fail)
> 14:33:41.139126 BGP: [P98A2-2RDFE] 192.168.3.1(r4) graceful restart stalepath timer stopped

af8496af08 ("bgpd: Do not delete BGP dynamic peers if graceful restart
kicks in") forgot to modify bgp_connect_fail()

Do not delete the peer in bgp_connect_fail() if Non-Stop-Forwarding is
in progress.

Fixes: af8496af08 ("bgpd: Do not delete BGP dynamic peers if graceful restart kicks in")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-05-16 15:19:11 +02:00
Russ White
93b68f6128
Merge pull request #16006 from pguibert6WIND/fix_colored_nexthop_2
bgpd: fix colored routes not installed after a switchover
2024-05-14 16:28:31 -04:00
Philippe Guibert
cd001c5ac0 bgpd: fixes bmp stats send-experimental configuration
Unconfiguring the send-experimental stats in BMP has no effect
on the current behavior.

Fixes this by swapping the configuration boolean.

Fixes: 7ba991cf96 ("bgpd: add 'bmp stat send-experimental' command")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-05-14 14:54:19 +02:00
Philippe Guibert
e265b16f83 bgpd: fix colored routes not installed after a switchover
On a multihomed setup with colored bgp updates, when the primary
PE goes offline, only a small subset of colored bgp routes are
not switching to the secondary pe.

When a switchover happens, due to a remote IP becoming unreachable,
some nexthop tracking down notifications are sent, but those messages
are completely ignored for colored bgp updates.

The original code has been thought for mounting up the SR-TE service,
when IP reachability is ok, but not when services goes offline.

Fix this by extending the down notification mechanism for colored routes
too.

Fixes: 545aeef1d1 ("bgpd: extend the NHT code to understand SR-TE colors")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-05-14 13:51:24 +02:00
Russ White
281c891f16
Merge pull request #16003 from pguibert6WIND/fix_colored_nexthop
bgpd: fix colored nexthops resolution
2024-05-13 15:31:44 -04:00
Russ White
2e0208602b
Merge pull request #15911 from opensourcerouting/feature/bgpd_dampening_per_neighbor
bgpd: per-neighbor dampening support
2024-05-13 13:55:24 -04:00
Philippe Guibert
42c497dec0 bgpd: fix colored nexthops resolution
When the SR-TE service is off, colored BGP routes are not
selected if it is recursively resolved over routes that are
colored only.

Actually, a BGP nexthop context includes the color attribute;
when an update from ZEBRA is received, there is no color, and
the colored BGP nexthop contexts are parsed, only if there
is a non colored BGP nexthop context. The actual setup shows
this may not be the case every time.

Fix this by parsing all the colored BGP nexthop contexts.

Fixes: b8210849b8 ("bgpd: Make bgp ready to remove distinction between 2 nh tracking types")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-05-13 18:00:50 +02:00
Donatas Abraitis
b3600d82dc
Merge pull request #15614 from louis-6wind/fix-6pe-address
bgpd: fix ipv4-mapped ipv6 on non 6pe
2024-05-10 22:55:12 +03:00
Donald Sharp
73ad64a6f4 *: Modify agentx to be allowed to be called
If you had a situation where an operator turned on
ospfd with snmp but not ospf6d and agentx was configured
then you get into a situation where ospf6d would complain
that the config for agentx did not exist.  Let's modify
the code to allow this situation to happen.

Fixes: #15896
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-05-10 10:16:29 -04:00
Donald Sharp
861d3758fa
Merge pull request #15965 from cscarpitta/bugfix/bgp-srv6-memleaks
bgpd: Fix SRv6 memory leaks spotted by Address Sanitizer
2024-05-09 07:11:56 -04:00
Carmine Scarpitta
165caaeea8 bgpd: Move SRv6 cleanup functions
Move SRv6 cleanup operations to `bgp_srv6_cleanup` function.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-05-09 08:14:34 +02:00
Carmine Scarpitta
65e01119be bgpd: Fix SRv6 memory leaks spotted by ASAN
Fix a couple of memory leaks spotted by Address Sanitizer:

```

=================================================================
==970960==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 592 byte(s) in 2 object(s) allocated from:
    #0 0xfeb98b28a4b4 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0xfeb98ae572f8 in qcalloc lib/memory.c:105
    #2 0xfeb98ae76138 in srv6_locator_chunk_alloc lib/srv6.c:138
    #3 0xb7f3c8508fa0 in ensure_vrf_tovpn_sid_per_vrf bgpd/bgp_mplsvpn.c:831
    #4 0xb7f3c8509494 in ensure_vrf_tovpn_sid bgpd/bgp_mplsvpn.c:866
    #5 0xb7f3c85028a8 in vpn_leak_postchange bgpd/bgp_mplsvpn.h:289
    #6 0xb7f3c851a7c0 in vpn_leak_postchange_all bgpd/bgp_mplsvpn.c:3769
    #7 0xb7f3c86f6ef0 in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3378
    #8 0xfeb98afa6e14 in zclient_read lib/zclient.c:4608
    #9 0xfeb98af3d684 in event_call lib/event.c:2011
    #10 0xfeb98ae2788c in frr_run lib/libfrr.c:1217
    #11 0xb7f3c83cbf0c in main bgpd/bgp_main.c:545
    #12 0xfeb98a8973f8 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #13 0xfeb98a8974c8 in __libc_start_main_impl ../csu/libc-start.c:392
    #14 0xb7f3c83c832c in _start (/usr/lib/frr/bgpd+0x2d832c)

Direct leak of 32 byte(s) in 2 object(s) allocated from:
    #0 0xfeb98b28a4b4 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0xfeb98ae572f8 in qcalloc lib/memory.c:105
    #2 0xb7f3c8508fd8 in ensure_vrf_tovpn_sid_per_vrf bgpd/bgp_mplsvpn.c:832
    #3 0xb7f3c8509494 in ensure_vrf_tovpn_sid bgpd/bgp_mplsvpn.c:866
    #4 0xb7f3c85028a8 in vpn_leak_postchange bgpd/bgp_mplsvpn.h:289
    #5 0xb7f3c851a7c0 in vpn_leak_postchange_all bgpd/bgp_mplsvpn.c:3769
    #6 0xb7f3c86f6ef0 in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3378
    #7 0xfeb98afa6e14 in zclient_read lib/zclient.c:4608
    #8 0xfeb98af3d684 in event_call lib/event.c:2011
    #9 0xfeb98ae2788c in frr_run lib/libfrr.c:1217
    #10 0xb7f3c83cbf0c in main bgpd/bgp_main.c:545
    #11 0xfeb98a8973f8 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #12 0xfeb98a8974c8 in __libc_start_main_impl ../csu/libc-start.c:392
    #13 0xb7f3c83c832c in _start (/usr/lib/frr/bgpd+0x2d832c)

Direct leak of 32 byte(s) in 2 object(s) allocated from:
    #0 0xfeb98b28a4b4 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0xfeb98ae572f8 in qcalloc lib/memory.c:105
    #2 0xb7f3c8506520 in vpn_leak_zebra_vrf_sid_update_per_vrf bgpd/bgp_mplsvpn.c:439
    #3 0xb7f3c85068d8 in vpn_leak_zebra_vrf_sid_update bgpd/bgp_mplsvpn.c:459
    #4 0xb7f3c86f6aec in bgp_ifp_create bgpd/bgp_zebra.c:3345
    #5 0xfeb98adfd3f8 in hook_call_if_real lib/if.c:48
    #6 0xfeb98adfe750 in if_new_via_zapi lib/if.c:181
    #7 0xfeb98af98084 in zclient_interface_add lib/zclient.c:2592
    #8 0xfeb98afa6d24 in zclient_read lib/zclient.c:4606
    #9 0xfeb98af3d684 in event_call lib/event.c:2011
    #10 0xfeb98ae2788c in frr_run lib/libfrr.c:1217
    #11 0xb7f3c83cbf0c in main bgpd/bgp_main.c:545
    #12 0xfeb98a8973f8 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #13 0xfeb98a8974c8 in __libc_start_main_impl ../csu/libc-start.c:392
    #14 0xb7f3c83c832c in _start (/usr/lib/frr/bgpd+0x2d832c)

SUMMARY: AddressSanitizer: 656 byte(s) leaked in 6 allocation(s).

```

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-05-09 08:14:34 +02:00
Donatas Abraitis
a8db605731 bgpd: Remove redundant recursion flag variable
Reuse an existing one.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-08 17:02:15 +03:00
Donatas Abraitis
351716bfa6
Merge pull request #15950 from mxyns/draft-bmp-peer-up
bgpd: bmp rename tlv types
2024-05-08 14:50:26 +03:00
Russ White
048cd0c6a5
Merge pull request #15913 from opensourcerouting/fix/bgpd_no_set_as_prepend
bgpd: Fix `no set as-path prepend ASNUM...`
2024-05-07 10:51:48 -04:00
Russ White
ee853851bd
Merge pull request #15895 from opensourcerouting/fix/ignore_attributes_if_discard_is_configured
bgpd: Ignore validating the attribute flags if path-attribute is configured
2024-05-07 10:44:38 -04:00
Russ White
827badc53c
Merge pull request #15883 from opensourcerouting/fix/bgpd_gr_fsm
bgpd: Apply NOOP when doing negative commands for GR operations
2024-05-07 09:56:51 -04:00
Maxence Younsi
94f902fddb bgpd: bmp rename tlv types
renamed BMP_INFO_TYPE_SYSDESCR to BMP_INIT_INFO_TYPE_SYSDESCR
renamed BMP_INFO_TYPE_SYSNAME to BMP_INIT_INFO_TYPE_SYSNAME
added BMP_PEERUP_INFO_STRING

Signed-off-by: Maxou <maxence.younsi@insa-lyon.fr>
2024-05-07 15:53:51 +02:00
Donatas Abraitis
af6eeccd75
Merge pull request #15924 from chiragshah6/fdev5
bgpd: [GR] fix mode change vtysh return code
2024-05-06 10:12:27 +03:00
Carmine Scarpitta
bdc2c7bc54 bgpd: Fix the order of NULL check and ZAPI decode
When BGP receives an SRV6_LOCATOR_ADD message from zebra, it calls the
`bgp_zebra_process_srv6_locator_add()` function to process the message.
`bgp_zebra_process_srv6_locator_add()` decodes the message first, and
then if the pointer to the default BGP instance is NULL (i.e. the
default BGP instance is not configured yet), it returns early without
doing anything and without using the decoded message information.

This commit fixes the order of the operations executed by
`bgp_zebra_process_srv6_locator_add()`. We first ensure that the default
BGP instance is ready and we return early if it is not. Then, we decode
the message and do something with the information contained in it.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-05-05 07:25:57 +02:00
Chirag Shah
0a8d85aacf bgpd: [GR] fix mode change vtysh return code
When a bgp neighbor graceful-restart config mode change
is applied, after accepting the config if it does not
take effect instead of throwing vtysh error code,
return the success to vtysh and warn the user.
The debug log is already present at critical code point
where GR failure is seen during config apply.

Ticket: #3761481
Testing Done:

root@tor-1:# vtysh -c 'config t' -c 'router bgp 65564
vrf VRF2' -c 'neighbor 20.1.1.1 graceful-restart'
As part of configuring graceful-restart, capability send to zebra failed
root@tor-1:# echo $?
0

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-05-04 20:33:49 -07:00
Carmine Scarpitta
ae3241b96d bgpd: Fix crash when deleting the SRv6 locator
When BGP receives a `SRV6_LOCATOR_DEL` from zebra, it invokes
`bgp_zebra_process_srv6_locator_delete` to process the message.

`bgp_zebra_process_srv6_locator_delete` obtains a pointer to the default
BGP instance and then dereferences this pointer.

If the default BGP instance is not ready / not configured yet, this
pointer this pointer is `NULL` and dereferencing it causes BGP to crash.

This commit fix the issue by adding a a check to verify if the pointer
is `NULL` and returning early if it is.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-05-03 23:40:29 +02:00
Donatas Abraitis
bf37877103 bgpd: Reduce the nesting level for bgp_clear_damp_route()
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-03 09:30:33 +03:00
Donatas Abraitis
3921324346 bgpd: Put dest into work queue when the path is really withdrawn by dampening
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-03 09:30:33 +03:00
Donatas Abraitis
70ac630b39 bgpd: Pass the right reuse_list when handling it via bgp_reuse_timer thread
This fixes the crash:

```
==14759== Invalid read of size 8
==14759==    at 0x31032B: bgp_reuselist_del (bgp_damp.c:51)
==14759==    by 0x310392: bgp_damp_info_unclaim (bgp_damp.c:69)
==14759==    by 0x310CD6: bgp_damp_info_free (bgp_damp.c:387)
==14759==    by 0x311016: bgp_reuse_timer (bgp_damp.c:230)
==14759==    by 0x4F227CC: thread_call (thread.c:2008)
==14759==    by 0x4EDB7D7: frr_run (libfrr.c:1216)
==14759==    by 0x1EF748: main (bgp_main.c:525)
==14759==  Address 0x48 is not stack'd, malloc'd or (recently) free'd
==14759==
==14759==
==14759== Process terminating with default action of signal 11 (SIGSEGV)
==14759==    at 0x59CC7F5: raise (raise.c:46)
==14759==    by 0x4F10CEB: core_handler (sigevent.c:261)
==14759==    by 0x59CC97F: ??? (in /lib/x86_64-linux-gnu/libpthread-2.27.so)
==14759==    by 0x31032A: bgp_reuselist_del (bgp_damp.c:51)
==14759==    by 0x310392: bgp_damp_info_unclaim (bgp_damp.c:69)
==14759==    by 0x310CD6: bgp_damp_info_free (bgp_damp.c:387)
==14759==    by 0x311016: bgp_reuse_timer (bgp_damp.c:230)
==14759==    by 0x4F227CC: thread_call (thread.c:2008)
==14759==    by 0x4EDB7D7: frr_run (libfrr.c:1216)
==14759==    by 0x1EF748: main (bgp_main.c:525)
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-03 09:30:33 +03:00