]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
11 months agoMerge pull request #16030 from FRRouting/mergify/bp/stable/10.0/pr-15711
Donald Sharp [Fri, 17 May 2024 15:49:00 +0000 (11:49 -0400)]
Merge pull request #16030 from FRRouting/mergify/bp/stable/10.0/pr-15711

topotests: do not check table version (backport #15711)

11 months agoMerge pull request #16025 from FRRouting/mergify/bp/stable/10.0/pr-16020
Donald Sharp [Fri, 17 May 2024 13:42:14 +0000 (09:42 -0400)]
Merge pull request #16025 from FRRouting/mergify/bp/stable/10.0/pr-16020

bgpd: fix dynamic peer graceful restart race condition (backport #16020)

11 months agotopotests: do not check table version 16030/head
Louis Scalbert [Tue, 9 Apr 2024 07:45:06 +0000 (09:45 +0200)]
topotests: do not check table version

BGP table version is variable. Don't check it.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 29f47f3debddbea7da5d39d46dbc4a659237acdc)

11 months agobgpd: fix dynamic peer graceful restart race condition 16025/head
Louis Scalbert [Thu, 16 May 2024 13:08:09 +0000 (15:08 +0200)]
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>
(cherry picked from commit e446308d76b4ac8f26149db982bf5ed5ac93d5f5)

11 months agoMerge pull request #15998 from FRRouting/mergify/bp/stable/10.0/pr-15655
Donatas Abraitis [Mon, 13 May 2024 12:04:34 +0000 (15:04 +0300)]
Merge pull request #15998 from FRRouting/mergify/bp/stable/10.0/pr-15655

isisd: fix ip/ipv6 reachability tlvs (backport #15655)

11 months agoisisd: fix ip/ipv6 reachability tlvs 15998/head
Igor Ryzhov [Mon, 1 Apr 2024 21:56:17 +0000 (00:56 +0300)]
isisd: fix ip/ipv6 reachability tlvs

Don't allocate subtlvs container if there's nothing to add to it. If the
container is allocated, the "sub-TLVs presence" bit is set in the TLVs
even if there's no actual sub-TLVs, what violates the RFC.

Fixes #14514.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit c3d34b84f3e1b789b78b6ee93068f074eb884af1)

11 months agoMerge pull request #15985 from FRRouting/mergify/bp/stable/10.0/pr-15975
Donald Sharp [Thu, 9 May 2024 17:37:36 +0000 (13:37 -0400)]
Merge pull request #15985 from FRRouting/mergify/bp/stable/10.0/pr-15975

pimd: fixes split off from #15969 (backport #15975)

11 months agoMerge pull request #15978 from FRRouting/mergify/bp/stable/10.0/pr-15965
Donald Sharp [Thu, 9 May 2024 17:04:33 +0000 (13:04 -0400)]
Merge pull request #15978 from FRRouting/mergify/bp/stable/10.0/pr-15965

bgpd: Fix SRv6 memory leaks spotted by Address Sanitizer (backport #15965)

11 months agopimd: fix order of operations for evaluating join 15985/head
David Lamparter [Mon, 12 Dec 2022 16:50:59 +0000 (17:50 +0100)]
pimd: fix order of operations for evaluating join

join_desired looks at whether up->channel_oil is empty.  up->channel_oil
is updated from pim_forward_stop(), calling pim_channel_del_oif().  But
that was being called *after* updating join_desired, so join_desired saw
a non-empty OIL.  Pull up the pim_forward_stop() call to before updating
join_desired.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit fdb1a6fed5a8e42447b5b9633ad9df0f3042d0a9)

11 months agopimd: fix null register before aging out reg-stop
David Lamparter [Mon, 17 Apr 2023 09:47:08 +0000 (11:47 +0200)]
pimd: fix null register before aging out reg-stop

It looks like the code was trying to do this with the null_register
parameter on pim_upstream_start_register_stop_timer(), but that didn't
quite work right.  Restructure a bit to get it right.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit dce38da8061a7ac62c690dbb8a89cae7f9a758d6)

11 months agopimd: fix dr-priority range
David Lamparter [Fri, 14 Apr 2023 15:17:27 +0000 (17:17 +0200)]
pimd: fix dr-priority range

0 is a valid DR priority.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit b564c1d890aef75067db22df09e608faf72b99f5)

11 months agobgpd: Move SRv6 cleanup functions 15978/head
Carmine Scarpitta [Wed, 8 May 2024 07:48:55 +0000 (09:48 +0200)]
bgpd: Move SRv6 cleanup functions

Move SRv6 cleanup operations to `bgp_srv6_cleanup` function.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit 165caaeea8b04b6ac59c9016f1d5240238200a27)

11 months agobgpd: Fix SRv6 memory leaks spotted by ASAN
Carmine Scarpitta [Wed, 8 May 2024 07:45:56 +0000 (09:45 +0200)]
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>
(cherry picked from commit 65e01119be288922deeca09f53a410ecfee1e6c2)

11 months agoMerge pull request #15970 from FRRouting/mergify/bp/stable/10.0/pr-15920
Donald Sharp [Thu, 9 May 2024 11:10:36 +0000 (07:10 -0400)]
Merge pull request #15970 from FRRouting/mergify/bp/stable/10.0/pr-15920

zebra: fix EVPN svd based remote nh neigh del (backport #15920)

11 months agozebra: fix EVPN svd based remote nh neigh del 15970/head
Chirag Shah [Fri, 3 May 2024 03:58:50 +0000 (20:58 -0700)]
zebra: fix EVPN svd based remote nh neigh del

In the context of SVD (Single VxLAN Device) for L3VNI,
the remote VTEP's nexthop is programmed neighbor entry against
SVD along with neighbor entry against SVI.

However, when L3VNI is removed or the VRF is disabled, all SVI
based remote nexthop neighbors are uninstalled and deleted.
The SVD based neigh entries remains in Zebra and the Kernel.
Subsequently, when reconfiguring L3VNI and relearning the same nexthop,
the neighbor entry is not programmed is because it is not removed
from Zebra SVD neighbor hash table, leading to the failure to
reprogram the entry.

With this fix, the SVD nexthop neigh entry is uninstalled
and deleted from Zebra and Kernel.

Ticket: #3729045

Testing:

borderleaf:# ip neigh show 2.2.2.2
2.2.2.2 dev vlan2560_l3 lladdr 00:01:00:00:1d:09 extern_learn NOARP proto zebra
2.2.2.2 dev vxlan99 lladdr 00:01:00:00:1d:09 extern_learn NOARP proto zebra

With the fix:

Zebra log shows both enties SVD (vxlan99) and SVI (vlan2560_l3)
neighbor entries are deleted.

2024/05/03 18:41:33.527125 ZEBRA: [NH6N7-54CD1] Tx RTM_DELNEIGH family
ipv4 IF vxlan99(16) Neigh 2.2.2.2 MAC  null flags 0x10 state 0x0
ext_flags 0x0
2024/05/03 18:41:33.527128 ZEBRA: [NH6N7-54CD1] Tx RTM_DELNEIGH family
ipv4 IF vlan2560_l3(18) Neigh 2.2.2.2 MAC  null flags 0x10 state 0x0
ext_flags 0x0

borderleaf:# ip neigh show 2.2.2.2
borderleaf:#

Signed-off-by: Chirag Shah <chirag@nvidia.com>
(cherry picked from commit fde6dd7bb9161cf58fdd8ca066cce77bad159c9d)

11 months agoMerge pull request #15956 from FRRouting/mergify/bp/stable/10.0/pr-15895
Donald Sharp [Wed, 8 May 2024 13:57:28 +0000 (09:57 -0400)]
Merge pull request #15956 from FRRouting/mergify/bp/stable/10.0/pr-15895

bgpd: Ignore validating the attribute flags if path-attribute is configured (backport #15895)

11 months agoMerge pull request #15958 from FRRouting/mergify/bp/stable/10.0/pr-15913
Donald Sharp [Wed, 8 May 2024 13:56:49 +0000 (09:56 -0400)]
Merge pull request #15958 from FRRouting/mergify/bp/stable/10.0/pr-15913

bgpd: Fix `no set as-path prepend ASNUM...` (backport #15913)

11 months agoMerge pull request #15952 from FRRouting/mergify/bp/stable/10.0/pr-15846
Donatas Abraitis [Wed, 8 May 2024 11:47:26 +0000 (14:47 +0300)]
Merge pull request #15952 from FRRouting/mergify/bp/stable/10.0/pr-15846

ospfd: fix the bug where ip_ospf_dead-interval_minimal_hello-multiplier did not reset hello timer (backport #15846)

11 months agoMerge pull request #15951 from FRRouting/mergify/bp/stable/10.0/pr-15883
Donatas Abraitis [Wed, 8 May 2024 03:56:24 +0000 (06:56 +0300)]
Merge pull request #15951 from FRRouting/mergify/bp/stable/10.0/pr-15883

bgpd: Apply NOOP when doing negative commands for GR operations (backport #15883)

11 months agobgpd: Allow using optional table id for negative `no set table X` command 15958/head
Donatas Abraitis [Fri, 3 May 2024 05:58:21 +0000 (08:58 +0300)]
bgpd: Allow using optional table id for negative `no set table X` command

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit e411988a86f1b719fb16ec4c30499bfc650b4ea7)

11 months agobgpd: Fix `no set as-path prepend ASNUM...`
Donatas Abraitis [Thu, 2 May 2024 20:07:19 +0000 (23:07 +0300)]
bgpd: Fix `no set as-path prepend ASNUM...`

If entering `no set as-path prepend 1 2 3`, it's warned as unknown command.

Now fixed, and the following combinations work fine:

```
no set as-path prepend
no set as-path prepend last-as
no set as-path prepend last-as 1
no set as-path prepend 1
no set as-path prepend 1 2
```

Fixes: https://github.com/FRRouting/frr/issues/15912
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit e069a1c8d52bb6e7808303df488d7ce912e4f652)

11 months agotests: Check if iBGP session can drop invalid AIGP attribute 15956/head
Donatas Abraitis [Wed, 1 May 2024 13:33:52 +0000 (16:33 +0300)]
tests: Check if iBGP session can drop invalid AIGP attribute

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit f58227c91e4aaf3b54929634b310de86c0202a6e)

11 months agobgpd: Ignore validating the attribute flags if path-attribute is configured
Donatas Abraitis [Wed, 1 May 2024 13:01:38 +0000 (16:01 +0300)]
bgpd: Ignore validating the attribute flags if path-attribute is configured

E.g. Cisco sends AIGP attribute as transitive, but it's wrong. Hence, the session
is teared down, because of this bgp_attr_flag_invalid() test.

Relax this check if we have `neighbor X path-attribute <discard|treat-as-withdraw>`
configured.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 714e5be9a0804c0da2c9429bead274bbaefc9939)

11 months agoMerge pull request #15870 from opensourcerouting/fix/1ce626aea6f1f274da92478a8e487c22...
Russ White [Tue, 7 May 2024 14:42:11 +0000 (10:42 -0400)]
Merge pull request #15870 from opensourcerouting/fix/1ce626aea6f1f274da92478a8e487c229b08f9ce_10.0

vtysh: Show `ip ospf network ...` even if it's not the same as the interface type

11 months agoospfd:fix the bug where ip_ospf_dead-interval_minimal_hello-multiplier did not reset... 15952/head
Bing Shui [Thu, 25 Apr 2024 16:02:26 +0000 (16:02 +0000)]
ospfd:fix the bug where ip_ospf_dead-interval_minimal_hello-multiplier did not reset hello timer

Signed-off-by: Bing Shui <652023330037@smail.nju.edu.cn>
(cherry picked from commit d733fe2c048cd75948d9f30ced77ed828e92ee18)

11 months agobgpd: Apply NOOP when doing negative commands for GR operations 15951/head
Donatas Abraitis [Tue, 30 Apr 2024 10:40:08 +0000 (13:40 +0300)]
bgpd: Apply NOOP when doing negative commands for GR operations

E.g.:

```
% The Graceful Restart command used is not valid at this moment.
zsh: exit 1     vtysh -c configure -c 'router bgp' -c 'no neighbor 127.0.0.1 graceful-restart
1
```

This does not make sense frr-reload to fail.

Instead, just ignore such requests if they are just NOOP.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 9ebdb8e80d83a9087deaffee93df4bc90ab6e7ee)

11 months agobgpd: Print old/new states of graceful restart FSM
Donatas Abraitis [Tue, 30 Apr 2024 10:38:54 +0000 (13:38 +0300)]
bgpd: Print old/new states of graceful restart FSM

To better debug what's going on before/after.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 7b5595b61dfbd27ba05b8f5416882514a1e2f94f)

11 months agoMerge pull request #15935 from FRRouting/mergify/bp/stable/10.0/pr-15921
Donald Sharp [Mon, 6 May 2024 14:24:02 +0000 (10:24 -0400)]
Merge pull request #15935 from FRRouting/mergify/bp/stable/10.0/pr-15921

bgpd: Fix crash when deleting the SRv6 locator (backport #15921)

11 months agobgpd: Fix the order of NULL check and ZAPI decode 15935/head
Carmine Scarpitta [Sun, 5 May 2024 05:25:57 +0000 (07:25 +0200)]
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>
(cherry picked from commit bdc2c7bc5473b5582419702211c22e5d29bf0631)

11 months agobgpd: Fix crash when deleting the SRv6 locator
Carmine Scarpitta [Fri, 3 May 2024 21:35:05 +0000 (23:35 +0200)]
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>
(cherry picked from commit ae3241b96d7be08d627f142030a41031492ffaf5)

11 months agoMerge pull request #15906 from FRRouting/mergify/bp/stable/10.0/pr-15840
Donatas Abraitis [Sun, 5 May 2024 06:15:44 +0000 (09:15 +0300)]
Merge pull request #15906 from FRRouting/mergify/bp/stable/10.0/pr-15840

ospf6d: fix interface type vs. connected routes updates (backport #15840)

11 months agoospf6d: accept CLI `no` for point-to-multipoint 15906/head
David Lamparter [Thu, 25 Apr 2024 10:20:27 +0000 (12:20 +0200)]
ospf6d: accept CLI `no` for point-to-multipoint

`point-to-multipoint` was missing on the removal variant of this CLI
command.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 52734fc8e5dad3569c3c37251f6dcc7a83c07299)

11 months agoospf6d: force recalculate on interface_up
David Lamparter [Thu, 25 Apr 2024 10:18:08 +0000 (12:18 +0200)]
ospf6d: force recalculate on interface_up

interface_up also handles changes to the interface type, i.e. broadcast
to ptp to ptmp.  Connected routes for these are different and must be
readvertised, which is done in ospf6_interface_recalculate_cost() - but
only if the cost changed.  Use the force variant here.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit d7f54c4d5692c85d0f6a5bb384b156f252b92e20)

11 months agoospf6d: fix loopback/ptp/ptmp conn. route checks
David Lamparter [Thu, 25 Apr 2024 10:16:35 +0000 (12:16 +0200)]
ospf6d: fix loopback/ptp/ptmp conn. route checks

The code emitting connected routes was checking against the interface
state (which can also be lo/ptp/ptmp) rather than the interface type.
This was causing wrong IA prefixes for connected routes getting put up
out if the interface was down intermittently.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 4aa200c7c55c84033a804d7c37847790c936e256)

11 months agoospf6d: fix DEFUN formatting wrecked by clang
David Lamparter [Thu, 25 Apr 2024 09:45:19 +0000 (11:45 +0200)]
ospf6d: fix DEFUN formatting wrecked by clang

clang-format doesn't understand `DEFUN` and formats it rather ugly.
Standard approach was to skip these in clang-format, which hasn't
happened here sadly.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit b47657600b4f6975aaaadf860b233d432d325d38)

11 months agoMerge pull request #15916 from FRRouting/mergify/bp/stable/10.0/pr-15837
Donald Sharp [Sat, 4 May 2024 13:41:42 +0000 (09:41 -0400)]
Merge pull request #15916 from FRRouting/mergify/bp/stable/10.0/pr-15837

fix use of deprecated c-ares api (backport #15837)

11 months agolib: replace deprecated ares_gethostbyname 15916/head
Andrew Cooks [Thu, 25 Apr 2024 07:18:39 +0000 (17:18 +1000)]
lib: replace deprecated ares_gethostbyname

c-ares has deprecated ares_gethostbyname() in version 1.28.0
Replace it with ares_getaddrinfo().

This fixes a build error on Fedora 40.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
(cherry picked from commit 89a2e4d8257a91d115fa29e02261c33312da5cba)

11 months agolib: replace deprecated ares_process()
Andrew Cooks [Wed, 24 Apr 2024 05:01:28 +0000 (15:01 +1000)]
lib: replace deprecated ares_process()

ares_process(...) has been deprecated.
Replace it with ares_process_fd(...)

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
(cherry picked from commit 4540fa0a3e702f577d378b3fa1f5f26591a0a5ad)

11 months agoMerge pull request #15886 from FRRouting/mergify/bp/stable/10.0/pr-15851
Donatas Abraitis [Wed, 1 May 2024 09:12:28 +0000 (12:12 +0300)]
Merge pull request #15886 from FRRouting/mergify/bp/stable/10.0/pr-15851

tools: Handle seq num for BGP as-path in frr-reload.py (backport #15851)

11 months agotools: Handle seq num for BGP as-path in frr-reload.py 15886/head
Chirag Shah [Fri, 26 Apr 2024 01:52:31 +0000 (18:52 -0700)]
tools: Handle seq num for BGP as-path in frr-reload.py

If frr.conf has bgp as-path access-list clause without sequence number
then upon performing frr-rleoad, the running config clause with sequence
number will always be deleted and the new ones without sequence will
be re-added.
This could lead to blackholing until the config gets reapplied.

Testing:

frr.conf:
bgp as-path access-list important_internet_bgp_as_numbers permit _16509_

Running config:
bgp as-path access-list important_internet_bgp_as_numbers seq 5 permit
_16509_
!

Before fix
Upon frr-reload it deletes and readd line as without seq

2024-04-26 03:16:45,772  INFO: Executed "no bgp as-path access-list
important_internet_bgp_as_numbers seq 5 permit _16509_"

'bgp as-path access-list important_internet_bgp_as_numbers permit
_16509_\n'

After fix:
no form is not executed and no delta determine between frr.conf
and running-config.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
(cherry picked from commit 439c6f70b5bf7c8d92719458a37c9cce70b241c9)

12 months agovtysh: Show `ip ospf network ...` even if it's not the same as the interface type 15870/head
Donatas Abraitis [Tue, 23 Apr 2024 14:13:46 +0000 (17:13 +0300)]
vtysh: Show `ip ospf network ...` even if it's not the same as the interface type

ospfv3 shows this unconditionally, and ospfv2 does not show `ip ospf network ...` if the type of the interface matches the specified network.

Fixes: https://github.com/FRRouting/frr/issues/15817
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
12 months agoMerge pull request #15856 from FRRouting/mergify/bp/stable/10.0/pr-15848
Donatas Abraitis [Sat, 27 Apr 2024 18:15:29 +0000 (21:15 +0300)]
Merge pull request #15856 from FRRouting/mergify/bp/stable/10.0/pr-15848

pimd: fix crash unconfiguring rp keepalive timer (backport #15848)

12 months agopimd: fix crash unconfiguring rp keepalive timer 15856/head
Vijayalaxmi Basavaraj [Mon, 22 Apr 2024 17:55:23 +0000 (10:55 -0700)]
pimd: fix crash unconfiguring rp keepalive timer

pimd crashs while unconfigure of rp ka timer as we are trying to access
a yand dnode(suppress timer) which does not exist at the moment.

User just configured rp keepalive timer and not suppress timer,
the yang dnode would not be present. Instead of directly accessing
yang_dnode_get_unit16, first check the yang node exist using
the xpath.

Ticket: #3874971

Testing:

Before:
------
tor-11(config)# no ip pim rp keep-alive-timer 3000
vtysh: error reading from pimd: Success (0)Warning: closing connection to pimd because of an I/O error!

Broadcast message from root@tor-11 (somewhere) (Mon Apr 22 17:29:12 2024):

cumulus-core: Running cl-support for core files "pimd.25467.1713806952.core"

After:
-----
tor-11(config)# no ip pim rp keep-alive-timer 3000
tor-11(config)#

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Vijayalaxmi Basavaraj <vbasavaraj@nvidia.com>
(cherry picked from commit 0c4b7c1f1f359c1d7647fea34f62378af8b640a5)

12 months agoMerge pull request #15830 from FRRouting/mergify/bp/stable/10.0/pr-15819
Donatas Abraitis [Thu, 25 Apr 2024 05:01:04 +0000 (08:01 +0300)]
Merge pull request #15830 from FRRouting/mergify/bp/stable/10.0/pr-15819

bgpd, ospfd: fix non increasing SNMP OID (backport #15819)

12 months agoMerge pull request #15832 from FRRouting/mergify/bp/stable/10.0/pr-15766
Donatas Abraitis [Thu, 25 Apr 2024 05:00:46 +0000 (08:00 +0300)]
Merge pull request #15832 from FRRouting/mergify/bp/stable/10.0/pr-15766

bgpd: fix show run of network route-distinguisher (backport #15766)

12 months agoMerge pull request #15828 from opensourcerouting/fix/backport_inherit_flags
Donald Sharp [Wed, 24 Apr 2024 14:15:43 +0000 (10:15 -0400)]
Merge pull request #15828 from opensourcerouting/fix/backport_inherit_flags

bgpd: Inherit some peer flags from the peer-group

12 months agobgpd: fix show run of network route-distinguisher 15832/head
Louis Scalbert [Tue, 16 Apr 2024 14:41:51 +0000 (16:41 +0200)]
bgpd: fix show run of network route-distinguisher

Route-distinguisher (RD) is not printed properly in show run:

>  address-family ipv6 vpn
>   network ff01::/64 rd (null) label 7
>   network ff01::/64 rd (null) label 8

ad151f66aa ("bgpd: Refactor bgp_static_set/bgp_static_set_safi") merged
bgp_static_set_safi into bgp_static_set but inadvertently omitted the
handling of prd_pretty.

Copy the pretty RD string if available.

> address-family ipv6 vpn
>  network ff01::/64 rd 75:5 label 7
>  network ff01::/64 rd 85:5 label 8

Fixes: ad151f66aa ("bgpd: Refactor bgp_static_set/bgp_static_set_safi")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 3d3a138f5a177a2ef5996c17c76c4f7778f9c3aa)

12 months agoRevert "bgpd: fix pointer arithmetic in bgp snmp module" 15830/head
Louis Scalbert [Tue, 23 Apr 2024 09:39:29 +0000 (11:39 +0200)]
Revert "bgpd: fix pointer arithmetic in bgp snmp module"

This reverts commit d9bd9ebbf1c3ab902133e7f47c4b8c073e2df3d4.

The previous code was correct even if the coverity scanner was
complaining.

Fixes: https://github.com/FRRouting/frr/issues/15680
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit c1124a44c34f5fdce5fd06a6441ea78f8b5f352b)

12 months agoRevert "ospfd: fix some dicey pointer arith in snmp module"
Louis Scalbert [Tue, 23 Apr 2024 09:36:14 +0000 (11:36 +0200)]
Revert "ospfd: fix some dicey pointer arith in snmp module"

This reverts commit 438ef98701e9922e81a451f87ad053268a1a557e.

The previous code was correct even if the coverity scanner was
complaining.

Fixes: https://github.com/FRRouting/frr/issues/15680
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit c7895ba3202db2d99a3d9b688dc15424b8df35bd)

12 months agobgpd: Inherit `capability software-version` flag from the peer-group 15828/head
Donatas Abraitis [Sun, 21 Apr 2024 11:18:39 +0000 (14:18 +0300)]
bgpd: Inherit `capability software-version` flag from the peer-group

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
12 months agobgpd: Inherit `enforce-first-as` flag from the peer-group
Donatas Abraitis [Sun, 21 Apr 2024 11:16:49 +0000 (14:16 +0300)]
bgpd: Inherit `enforce-first-as` flag from the peer-group

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
12 months agoMerge pull request #15820 from FRRouting/mergify/bp/stable/10.0/pr-15815
Donald Sharp [Tue, 23 Apr 2024 16:53:22 +0000 (12:53 -0400)]
Merge pull request #15820 from FRRouting/mergify/bp/stable/10.0/pr-15815

lib, zebra: Check for not being a blackhole route (backport #15815)

12 months agolib, zebra: Check for not being a blackhole route 15820/head
Donald Sharp [Fri, 19 Apr 2024 16:13:32 +0000 (12:13 -0400)]
lib, zebra: Check for not being a blackhole route

In zebra_interface_nhg_reinstall zebra is checking that the
nhg is a singleton and not a blackhole nhg.  This was originally
done with checking that the nexthop is a NEXTHOP_TYPE_IFINDEX,
NEXTHOP_TYPE_IPV4_IFINDEX and NEXTHOP_TYPE_IPV6_IFINDEX.  This
was excluding NEXTHOP_TYPE_IPV4 and NEXTHOP_TYPE_IPV6.  These
were both possible to be received and maintained from the upper
level protocol for when a route is being recursively resolved.
If we have gotten to this point in zebra_interface_nhg_reinstall
the nexthop group has already been installed at least once
and we *know* that it is actually a valid nexthop.  What the
test is really trying to do is ensure that we are not reinstalling
a blackhole nexthop group( Which is not possible to even be
here by the way, but safety first! ).  So let's change
to test for that instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 29c1ff446e581fc403d155fd1d00b7c944cba56a)

12 months agoMerge pull request #15804 from FRRouting/mergify/bp/stable/10.0/pr-15798
Igor Ryzhov [Sun, 21 Apr 2024 10:04:16 +0000 (13:04 +0300)]
Merge pull request #15804 from FRRouting/mergify/bp/stable/10.0/pr-15798

vtysh: Fix `show route-map` command when calling via `do` (backport #15798)

12 months agovtysh: Fix `show route-map` command when calling via `do` 15804/head
Donatas Abraitis [Fri, 19 Apr 2024 16:17:11 +0000 (19:17 +0300)]
vtysh: Fix `show route-map` command when calling via `do`

Before:

```
ton(config)# do sh route-map
% [ZEBRA] Unknown command: show route-map
% [BGP] Unknown command: show route-map
% [ISIS] Unknown command: show route-map
```

Fixes: 570fdc55fd65899cd4376193e833594af6bca093 ("lib,vtysh: fix show route map JSON output")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 9b8f18a66cd53c506255c19829e5aada822e4ac8)

12 months agoMerge pull request #15785 from FRRouting/mergify/bp/stable/10.0/pr-15770
Donatas Abraitis [Thu, 18 Apr 2024 19:11:47 +0000 (22:11 +0300)]
Merge pull request #15785 from FRRouting/mergify/bp/stable/10.0/pr-15770

lib, zebra: fix exit commands (backport #15770)

12 months agoMerge pull request #15760 from FRRouting/mergify/bp/stable/10.0/pr-15726
Donatas Abraitis [Thu, 18 Apr 2024 08:51:03 +0000 (11:51 +0300)]
Merge pull request #15760 from FRRouting/mergify/bp/stable/10.0/pr-15726

bgpd: Fix display when using `missing-as-worst` (backport #15726)

12 months agolib, zebra: fix exit commands 15785/head
Igor Ryzhov [Tue, 16 Apr 2024 19:10:45 +0000 (22:10 +0300)]
lib, zebra: fix exit commands

If a command is not marked as `YANG`-converted, the current command
batching buffer is flushed before executing the command. We shouldn't
flush the buffer when executing an `exit` command. It should only be
flushed if the next command is not `YANG`-converted, which is checked by
the command itself, not the previous `exit`.

Fixes #15706.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 57811a53ba65f755cb2ff9cdc682b8a249144ffa)

12 months agoMerge pull request #15763 from FRRouting/mergify/bp/stable/10.0/pr-15733
Jafar Al-Gharaibeh [Thu, 18 Apr 2024 06:33:55 +0000 (01:33 -0500)]
Merge pull request #15763 from FRRouting/mergify/bp/stable/10.0/pr-15733

bgpd: Drop newline in JSON output for `show bgp afi safi json detail` (backport #15733)

12 months agoMerge pull request #15779 from FRRouting/mergify/bp/stable/10.0/pr-15758
Igor Ryzhov [Wed, 17 Apr 2024 21:35:06 +0000 (00:35 +0300)]
Merge pull request #15779 from FRRouting/mergify/bp/stable/10.0/pr-15758

debian, redhat, snapcraft: Libyang min version is 2.1.128 (backport #15758)

12 months agodebian, redhat, snapcraft: Libyang min version is 2.1.128 15779/head
Martin Winter [Tue, 16 Apr 2024 11:40:52 +0000 (13:40 +0200)]
debian, redhat, snapcraft: Libyang min version is 2.1.128

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
(cherry picked from commit 81d63e476a133b00deff0a6c72d8cdb0b8ccdadb)

12 months agoMerge pull request #15773 from FRRouting/mergify/bp/stable/10.0/pr-15709
Donald Sharp [Wed, 17 Apr 2024 13:17:55 +0000 (09:17 -0400)]
Merge pull request #15773 from FRRouting/mergify/bp/stable/10.0/pr-15709

tools: frr-reload strip interface vrf ctx line (backport #15709)

12 months agoMerge pull request #15764 from FRRouting/mergify/bp/stable/10.0/pr-15755
Donald Sharp [Wed, 17 Apr 2024 13:17:37 +0000 (09:17 -0400)]
Merge pull request #15764 from FRRouting/mergify/bp/stable/10.0/pr-15755

vtysh: Check if bgpd is enabled before installing vtysh commands for RPKI (backport #15755)

12 months agotools: frr-reload strip interface vrf ctx line 15773/head
Chirag Shah [Tue, 9 Apr 2024 00:14:48 +0000 (17:14 -0700)]
tools: frr-reload strip interface vrf ctx line

if frr.conf file contains 'interface x vrf <name> config
it causes protocol (like ospf) neighbor session flap,
as it deletes interface base config line ('interface x') from
running config and readds with 'interface x vrf <name>'
line from frr.conf.
This deletion and readdition of lines leads to neighborship
flaps.

This issue is by product of (PR-10411 | https://github.com/FRRouting/frr/pull/10411)
(commit id: 788a036fdb)
where running config for interface config no loger displays associated
vrf line.

Ticket: #3858146
Testing:

frr.conf
interface swp1.2 vrf vrf1012
ip ospf network point-to-point

running-config:
interface swp1.2
 ip ospf network point-to-point
 exit

Before fix:
frr-reload logs:

2024-04-09 00:28:31,096  INFO: Executed "interface swp1.2  no ip ospf
network point-to-point exit"

 'interface swp1.2 vrf vrf1012\n ip ospf network
 point-to-point\nexit\n',

After fix:
frr-reload strips vrf line, thus no config change between
frr.conf and running config.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
(cherry picked from commit c1356f0e85e7b8480295d38b843a729d4a491d41)

12 months agovtysh: Check if bgpd is enabled before installing vtysh commands for RPKI 15764/head
Donatas Abraitis [Tue, 16 Apr 2024 08:56:39 +0000 (11:56 +0300)]
vtysh: Check if bgpd is enabled before installing vtysh commands for RPKI

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit d9d6db45825308c6e461b4be91736b67ee625b96)

12 months agobgpd: Drop newline in JSON output for `show bgp afi safi json detail` 15763/head
Donatas Abraitis [Sat, 13 Apr 2024 19:17:01 +0000 (22:17 +0300)]
bgpd: Drop newline in JSON output for `show bgp afi safi json detail`

Before:

```
{
 "vrfId": 0,
 "vrfName": "default",
 "tableVersion": 2,
 "routerId": "1.1.1.1",
 "defaultLocPrf": 100,
 "localAS": 65001,
 "routes": { "192.168.1.0/24": {
"prefix": "192.168.1.0/24",
"version": "1",

"paths": [{"aspath":{"string":"Local","segments":[],"length":0},"origin":"IGP","metric":0,"weight":32768,"valid":true,"version":1,"sourced":true,"local":true,"bestpath":{"overall":true,"selectionReason":"First path received"},"lastUpdate":{"epoch":1713035588,"string":"Sat Apr 13 22:13:08 2024\n"},"nexthops":[{"ip":"0.0.0.0","hostname":"donatas.net","afi":"ipv4","metric":0,"accessible":true,"used":true}],"peer":{"peerId":"0.0.0.0","routerId":"1.1.1.1"}}]
} ,"192.168.11.0/24": {
"prefix": "192.168.11.0/24",
"version": "2",

"paths": [{"aspath":{"string":"Local","segments":[],"length":0},"origin":"IGP","metric":0,"weight":32768,"valid":true,"version":2,"sourced":true,"local":true,"bestpath":{"overall":true,"selectionReason":"First path received"},"lastUpdate":{"epoch":1713035588,"string":"Sat Apr 13 22:13:08 2024\n"},"nexthops":[{"ip":"0.0.0.0","hostname":"donatas.net","afi":"ipv4","metric":0,"accessible":true,"used":true}],"peer":{"peerId":"0.0.0.0","routerId":"1.1.1.1"}}]
}  }  }
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 1dc28e1d735614715bab5d438bddcb2def6c8f3c)

12 months agobgpd: Fix display when using `missing-as-worst` 15760/head
Donald Sharp [Thu, 11 Apr 2024 14:46:46 +0000 (10:46 -0400)]
bgpd: Fix display when using `missing-as-worst`

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)

12 months agoMerge pull request #15751 from FRRouting/mergify/bp/stable/10.0/pr-15749
Donatas Abraitis [Tue, 16 Apr 2024 09:01:02 +0000 (12:01 +0300)]
Merge pull request #15751 from FRRouting/mergify/bp/stable/10.0/pr-15749

zebra: fix encoded DNSSL length (backport #15749)

12 months agozebra: fix encoded DNSSL length 15751/head
Igor Ryzhov [Mon, 15 Apr 2024 20:31:26 +0000 (23:31 +0300)]
zebra: fix encoded DNSSL length

The encoded DNSSL length is not set so the value is missing from RA
packet.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 8d6f7a43974633abb15a57b24bc30f462bd8841e)

12 months agoFRR Release 10.0 docker/10.0 docker/10.0.0 frr-10.0
Jafar Al-Gharaibeh [Mon, 8 Apr 2024 16:43:17 +0000 (11:43 -0500)]
FRR Release 10.0

Major highlights:
-   Introduce local host routes
-   Require libyang 2.1.128
-   Add suport to configure a log file per daemon
-   BGP BMP Loc-RIB (RFC9069) support
-   eBGP-OAD (One Administrative Domain) support
-   BGP RPKI VRF support
-   BGP SNMP traps for BGP4-MIBV2
-   Management (mgmtd) daemon "replace" operation support
-   BGP dynamic capabilities for addpath, fqdn, orf capabilities
-   SRv6 encapsulation source address feature
-   OSPFv3 Point-To-Multipoint mode
-   bgpd
    * Add clear bgp capabilities command to resend some dynamic capabilities link
    * bgpd: Add debug bgp updates detail command link
    * Add debug bgp updates <in|out> <X.Y.Z.W> prefix-list <NAME> command link
    * Add neighbor capability fqdn command link
    * Add redistribute table-direct support link
    * Fix match ip address ... + match evpn ... commands for EVPN
    * Remove aggregated (summary-only) suppressed routes from EVPN
-   mgmtd
    * Implement full XPATH 1.0 predicate functionality
    * Output staticd configuration from mgmtd
-   ospfd
    * Fix crash in OSPF TE parsing
-   ospf6d
    * Advertise local addresses with la bit
    * Set loopback interface cost to 0
    * Let the user override interface cost for a loopback
-   pathd
    * Add dynamic candidate path metric [computed] keyword link
    * Add no msd command in the pcc context
    * Add no pcep command
-   vtysh
    * Send interface commands to mgmtd
-   watchfrr
    * Extend the ignore option to the daemon being killed
-   zebrad
    * Add mpls label dynamic-block command link
    * Add JSON support to show debugging label-table link
    * Add zebra to mgmtd oper-state
    * Allow longer prefix matches for the next hops
    * Push all configured IP addresses when the interface comes up
    * Remove static ARP entries on interface-down events
    * Support to listen teamd netlink message as bond type
    * Fix crash when macvlan link-interface is in another netns

Breaking Changes:
-   Enable enforce-first-as by default for BGP
-   noprefixroute flag for interface prefixes with NetworkManager
-   Deprecate confd

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
12 months agodebian,redhat: update for 10.0 release
Jafar Al-Gharaibeh [Mon, 8 Apr 2024 16:44:04 +0000 (11:44 -0500)]
debian,redhat: update for 10.0 release

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
12 months agoMerge pull request #15689 from FRRouting/mergify/bp/dev/10.0/pr-15640
Donatas Abraitis [Sun, 7 Apr 2024 15:37:03 +0000 (18:37 +0300)]
Merge pull request #15689 from FRRouting/mergify/bp/dev/10.0/pr-15640

bgpd: Fix errors handling for MP/GR capabilities as dynamic capability (backport #15640)

12 months agoMerge pull request #15683 from opensourcerouting/fix/revert_0325116a27258e1df773a046e...
Donald Sharp [Fri, 5 Apr 2024 23:28:17 +0000 (19:28 -0400)]
Merge pull request #15683 from opensourcerouting/fix/revert_0325116a27258e1df773a046e8668a029bead60c_10.0

Revert [10.0] bgpd: fix 6vpe nexthop

12 months agobgpd: Fix errors handling for MP/GR capabilities as dynamic capability 15689/head
Donatas Abraitis [Sat, 30 Mar 2024 13:35:18 +0000 (15:35 +0200)]
bgpd: Fix errors handling for MP/GR capabilities as dynamic capability

When receiving a MP/GR capability as dynamic capability, but malformed, do not
forget to advance the pointer to avoid hitting infinity loop.

After:
```
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [GS0AQ-HKY0X] 127.0.0.1 rcv CAPABILITY
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 5, length 0
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 0, length 0
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [HFHDS-QT71N][EC 33554494] 127.0.0.1(donatas-pc): unrecognized capability code: 0 - ignored
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 0, code: 0, length 0
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [HFHDS-QT71N][EC 33554494] 127.0.0.1(donatas-pc): unrecognized capability code: 0 - ignored
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 0, code: 0, length 0
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [HFHDS-QT71N][EC 33554494] 127.0.0.1(donatas-pc): unrecognized capability code: 0 - ignored
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 0, code: 0, length 1
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [HFHDS-QT71N][EC 33554494] 127.0.0.1(donatas-pc): unrecognized capability code: 0 - ignored
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
```

Before:
```
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
```

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 30a332dad86fafd2b0b6c61d23de59ed969a219b)

12 months agoMerge pull request #15662 from FRRouting/mergify/bp/dev/10.0/pr-15634
Donatas Abraitis [Thu, 4 Apr 2024 21:18:44 +0000 (00:18 +0300)]
Merge pull request #15662 from FRRouting/mergify/bp/dev/10.0/pr-15634

Suppress fib funny business (backport #15634)

12 months agoRevert "topotests: add an ebgp 6vpe test" 15683/head
Donatas Abraitis [Thu, 4 Apr 2024 17:07:55 +0000 (20:07 +0300)]
Revert "topotests: add an ebgp 6vpe test"

This reverts commit 4d7df91752d7414d9719a361a2fd4cc30943dc96.

12 months agoRevert "bgpd: fix 6vpe nexthop"
Donatas Abraitis [Thu, 4 Apr 2024 17:07:53 +0000 (20:07 +0300)]
Revert "bgpd: fix 6vpe nexthop"

This reverts commit 0325116a27258e1df773a046e8668a029bead60c.

12 months agobgpd: Arrange peer notification to after zebra announce 15662/head
Donald Sharp [Thu, 28 Mar 2024 16:27:38 +0000 (12:27 -0400)]
bgpd: Arrange peer notification to after zebra announce

Currently BGP attempts to send route change information
to it's peers *before* the route is installed into zebra.
This creates a bug in suppress-fib-pending in the following
scenario:

a) bgp suppress-fib-pending and bgp has a route with
2 way ecmp.
b) bgp receives a route withdraw from peer 1.  BGP
will send the route to zebra and mark the route as
FIB_INSTALL_PENDING.
c) bgp receives a route withdraw from peer 2.  BGP
will see the route has the FIB_INSTALL_PENDING and
not send the withdrawal of the route to the peer.
bgp will then send the route deletion to zebra and
clean up the bgp_path_info's.

At this point BGP is stuck where it has not sent
a route withdrawal to downstream peers.

Let's modify the code in bgp_process_main_one to
send the route notification to zebra first before
attempting to announce the route.  The route withdrawal
will remove the FIB_INSTALL_PENDING flag from the dest
and this will allow group_announce_route to believe
it can send the route withdrawal.

For the master branch this is ok because the recent
backpressure commits are in place and nothing is going
to change from an ordering perspective in that regards.
Ostensibly this fix is also for operators of Sonic and
will be backported to the 8.5 branch as well.  This will
change the order of the send to peers to be after the
zebra installation but sonic users are using suppress-fib-pending
anyways so updates won't go out until rib ack has been
received anyways.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 329d5a5cbba23ec740b6ee3e223be5b13a631eb8)

12 months agobgpd: Note when receiving but not understanding a route notification
Donald Sharp [Thu, 28 Mar 2024 16:25:05 +0000 (12:25 -0400)]
bgpd: Note when receiving but not understanding a route notification

When BGP has been asked to wait for FIB installation, on route
removal a return call is likely to not have the dest since BGP
will have cleaned up the node, entirely.  Let's just note that
the prefix cannot be found if debugs are turned on and move on.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 7c603146529dc90f2d948e1943750efb1911c8ba)

12 months agoMerge pull request #15656 from FRRouting/mergify/bp/dev/10.0/pr-15628
Donatas Abraitis [Tue, 2 Apr 2024 19:29:11 +0000 (22:29 +0300)]
Merge pull request #15656 from FRRouting/mergify/bp/dev/10.0/pr-15628

bgpd: Fix error handling when receiving BGP Prefix SID attribute (backport #15628)

12 months agobgpd: Prevent from one more CVE triggering this place 15656/head
Donatas Abraitis [Wed, 27 Mar 2024 17:08:38 +0000 (19:08 +0200)]
bgpd: Prevent from one more CVE triggering this place

If we receive an attribute that is handled by bgp_attr_malformed(), use
treat-as-withdraw behavior for unknown (or missing to add - if new) attributes.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit babb23b74855e23c987a63f8256d24e28c044d07)

12 months agobgpd: Fix error handling when receiving BGP Prefix SID attribute
Donatas Abraitis [Wed, 27 Mar 2024 16:42:56 +0000 (18:42 +0200)]
bgpd: Fix error handling when receiving BGP Prefix SID attribute

Without this patch, we always set the BGP Prefix SID attribute flag without
checking if it's malformed or not. RFC8669 says that this attribute MUST be discarded.

Also, this fixes the bgpd crash when a malformed Prefix SID attribute is received,
with malformed transitive flags and/or TLVs.

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit ba6a8f1a31e1a88df2de69ea46068e8bd9b97138)

12 months agoMerge pull request #15650 from FRRouting/mergify/bp/dev/10.0/pr-15647
Mark Stapp [Tue, 2 Apr 2024 12:41:02 +0000 (08:41 -0400)]
Merge pull request #15650 from FRRouting/mergify/bp/dev/10.0/pr-15647

zebra: don't deref vxlan-vni array (backport #15647)

12 months agozebra: don't deref vxlan-vni array 15650/head
Mark Stapp [Mon, 1 Apr 2024 17:00:04 +0000 (13:00 -0400)]
zebra: don't deref vxlan-vni array

Null-check the vxlan-vni array info coming into zebra from
the dataplane.

Signed-off-by: Mark Stapp <mjs@cisco.com>
(cherry picked from commit 75ef259b1dd9273478414ea0684243f535ec8f33)

12 months agoMerge pull request #15641 from FRRouting/mergify/bp/dev/10.0/pr-15635
Jafar Al-Gharaibeh [Mon, 1 Apr 2024 04:42:48 +0000 (23:42 -0500)]
Merge pull request #15641 from FRRouting/mergify/bp/dev/10.0/pr-15635

bgpd: fix srv6 memory leak detection (backport #15635)

12 months agoMerge pull request #15644 from FRRouting/mergify/bp/dev/10.0/pr-15632
Jafar Al-Gharaibeh [Mon, 1 Apr 2024 04:42:09 +0000 (23:42 -0500)]
Merge pull request #15644 from FRRouting/mergify/bp/dev/10.0/pr-15632

vtysh, zebra: fix malformed json output for multiple vrfs in command 'show ip route vrf all json' (backport #15632)

12 months agovtysh, zebra: Fix malformed json output for multiple vrfs in command 'show ip route... 15644/head
Piotr Suchy [Thu, 28 Mar 2024 11:55:35 +0000 (12:55 +0100)]
vtysh, zebra: Fix malformed json output for multiple vrfs in command 'show ip route vrf all json'

Command 'show ip route vrf <vrf_name> json' returns a valid json object,
however if instead of <vrf_name> we specify 'all', we get an invalid json
object, like:

{//vrf1 routes}{//vrf2 routes}{vrf3 routes}

After the fix:

{"vrf1":{//vrf1 routes},"vrf2:{//vrf2 routes},"vrf3":{//vrf3 routes}}

Which is a valid json object, that can be parsed effectively using built-in
modules. The rest of the commands remains unaffected and behave the same.

Signed-off-by: Piotr Suchy <psuchy@akamai.com>
(cherry picked from commit 0e2fc3d67f1d358896a764373f41cb59c095eda9)

13 months agobgpd: fix srv6 memory leak detection 15641/head
Philippe Guibert [Fri, 29 Mar 2024 07:35:34 +0000 (08:35 +0100)]
bgpd: fix srv6 memory leak detection

The asan memory leak has been detected:
> Direct leak of 16 byte(s) in 1 object(s) allocated from:
>     #0 0x7f9066dadd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
>     #1 0x7f9066779b5d in qcalloc lib/memory.c:105
>     #2 0x556d6ca527c2 in vpn_leak_zebra_vrf_sid_update_per_af bgpd/bgp_mplsvpn.c:389
>     #3 0x556d6ca530e1 in vpn_leak_zebra_vrf_sid_update bgpd/bgp_mplsvpn.c:451
>     #4 0x556d6ca64b3b in vpn_leak_postchange bgpd/bgp_mplsvpn.h:311
>     #5 0x556d6ca64b3b in vpn_leak_postchange_all bgpd/bgp_mplsvpn.c:3751
>     #6 0x556d6cb9f116 in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3337
>     #7 0x7f906685a6b6 in zclient_read lib/zclient.c:4490
>     #8 0x7f9066826a32 in event_call lib/event.c:2011
>     #9 0x7f906675c444 in frr_run lib/libfrr.c:1217
>     #10 0x556d6c980d52 in main bgpd/bgp_main.c:545
>     #11 0x7f9065784c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Fix this by freeing the previous memory chunk.

Fixes: b72c9e14756f ("bgpd: cli for SRv6 SID alloc to redirect to vrf (step4)")
Fixes: 527588aa78b2 ("bgpd: add support for per-VRF SRv6 SID")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit eea8a8ae248ed726449878c7a74705d779469fda)

13 months agoMerge pull request #15606 from FRRouting/mergify/bp/dev/10.0/pr-15602
Igor Ryzhov [Mon, 25 Mar 2024 12:37:06 +0000 (14:37 +0200)]
Merge pull request #15606 from FRRouting/mergify/bp/dev/10.0/pr-15602

mgmtd: fix a couple of log messages (backport #15602)

13 months agoMerge pull request #15601 from FRRouting/mergify/bp/dev/10.0/pr-15010
Donatas Abraitis [Mon, 25 Mar 2024 06:23:32 +0000 (08:23 +0200)]
Merge pull request #15601 from FRRouting/mergify/bp/dev/10.0/pr-15010

zebra: Fix crash on macvlan link down/up (backport #15010)

13 months agomgmtd: fix a couple of log messages 15606/head
Igor Ryzhov [Fri, 22 Mar 2024 14:35:52 +0000 (16:35 +0200)]
mgmtd: fix a couple of log messages

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 988d4444d44814fa3325795154911f420319ac76)

13 months agoMerge pull request #15596 from FRRouting/mergify/bp/dev/10.0/pr-15587
Igor Ryzhov [Fri, 22 Mar 2024 13:37:55 +0000 (15:37 +0200)]
Merge pull request #15596 from FRRouting/mergify/bp/dev/10.0/pr-15587

grpc: fix grpc for various failures (backport #15587)

13 months agozebra: Fix crash on macvlan link down/up 15601/head
Tomi Salminen [Wed, 13 Dec 2023 09:37:21 +0000 (11:37 +0200)]
zebra: Fix crash on macvlan link down/up

Whenever a link up change was detected on a macvlan device where
the linked device wasn't visible in the namespace zebra was
running in, the linked zebra interface was NULL. This was already
handled in the event of a link down, but was ommitted from the
upside. Added the same null check to the up-side.

Signed-off-by: Tomi Salminen <tlsalmin@gmail.com>
(cherry picked from commit bdf6a9ba810b58146371e8a0000397d2ae9ea956)

13 months agogrpc: fix grpc for various failures 15596/head
Christian Hopps [Wed, 20 Mar 2024 19:20:18 +0000 (19:20 +0000)]
grpc: fix grpc for various failures

lib: don't define a `fallthrough` in c++ to avoid conflict with protobuf c++

check: add link libs required by some versions of grpc++ or it's dependent
linked libs

tests: don't fail the test due to known at exit memleaks
Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 043a4183c2f10e6117695dec7a0373c1b0a63808)

13 months agoMerge pull request #15576 from FRRouting/mergify/bp/dev/10.0/pr-15558
Russ White [Tue, 19 Mar 2024 18:43:55 +0000 (14:43 -0400)]
Merge pull request #15576 from FRRouting/mergify/bp/dev/10.0/pr-15558

bgpd: Update default-originate route-map actual map structure (backport #15558)

13 months agobgpd: Update default-originate route-map actual map structure 15576/head
Donatas Abraitis [Fri, 15 Mar 2024 11:49:06 +0000 (13:49 +0200)]
bgpd: Update default-originate route-map actual map structure

If using with `bgp listen range ... peer-group x`, default_rmap[afi][safi] is not
updated, and after the hard-reset in other side, this is flushed and never updated
again without restarting the sender BGP daemon.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 4f1e2dcd7a6616c74042657ddcec693de4f10586)

13 months agoMerge pull request #15521 from opensourcerouting/fix/backport_1818186432569d2bc3e4113...
Russ White [Tue, 19 Mar 2024 14:10:59 +0000 (10:10 -0400)]
Merge pull request #15521 from opensourcerouting/fix/backport_1818186432569d2bc3e4113945ff958c3ac4796b_10.0

bgpd: [10.0] Unset advertised capabilities if capability is disabled

13 months agoMerge pull request #15569 from FRRouting/mergify/bp/dev/10.0/pr-15424
Mark Stapp [Mon, 18 Mar 2024 17:06:18 +0000 (13:06 -0400)]
Merge pull request #15569 from FRRouting/mergify/bp/dev/10.0/pr-15424

zebra: fix route deletion during zebra shutdown (backport #15424)

13 months agozebra: fix route deletion during zebra shutdown 15569/head
Alexander Skorichenko [Wed, 28 Feb 2024 19:34:06 +0000 (20:34 +0100)]
zebra: fix route deletion during zebra shutdown

Split zebra's vrf_terminate() into disable() and delete() stages.
The former enqueues all events for the dplane thread.
Memory freeing is performed in the second stage.

Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com>
(cherry picked from commit 444ce317b2af491b5cdc321286772627a5d4c8ea)

13 months agoMerge pull request #15547 from FRRouting/mergify/bp/dev/10.0/pr-15466
Donatas Abraitis [Fri, 15 Mar 2024 05:29:06 +0000 (07:29 +0200)]
Merge pull request #15547 from FRRouting/mergify/bp/dev/10.0/pr-15466

Bgp filter fun (backport #15466)