]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
5 months agobgpd: Clear all paths including addpath once GR expires
Donatas Abraitis [Thu, 7 Nov 2024 11:04:54 +0000 (13:04 +0200)]
bgpd: Clear all paths including addpath once GR expires

We iterated over all bgp_path_info's, but once we remove the path, we didn't
check for other paths under the same bgp_dest.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
5 months agoMerge pull request #17350 from FRRouting/mergify/bp/stable/9.1/pr-17305
Donald Sharp [Tue, 5 Nov 2024 19:26:50 +0000 (14:26 -0500)]
Merge pull request #17350 from FRRouting/mergify/bp/stable/9.1/pr-17305

bgpd: Treat numbered community-list only if it's in a range 1-500 (backport #17305)

5 months agobgpd: Treat numbered community-list only if it's in a range 1-500 17350/head
Donatas Abraitis [Wed, 30 Oct 2024 08:45:28 +0000 (10:45 +0200)]
bgpd: Treat numbered community-list only if it's in a range 1-500

Before this patch, if we set something like:

```
bgp extcommunity-list expanded 1234 permit admin
```

In running config we have:

```
bgp extcommunity-list 1234 seq 5 permit admin
```

That leads to incorrect rendering, even more the line can't be deleted.

With this fix we treat numbered community-list only if it's inside the range
1-500, otherwise it's a non-numbered clist.

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

5 months agoMerge pull request #17324 from FRRouting/mergify/bp/stable/9.1/pr-17318
Jafar Al-Gharaibeh [Thu, 31 Oct 2024 15:42:39 +0000 (10:42 -0500)]
Merge pull request #17324 from FRRouting/mergify/bp/stable/9.1/pr-17318

zebra: Add missing new line for help string (backport #17318)

5 months agozebra: Add missing new line for help string 17324/head
Donatas Abraitis [Thu, 31 Oct 2024 08:47:48 +0000 (10:47 +0200)]
zebra: Add missing new line for help string

```
  -A, --asic-offload        FRR is interacting with an asic underneath the linux kernel
      --v6-with-v4-nexthops Underlying dataplane supports v6 routes with v4 nexthops  -s, --nl-bufsize          Set netlink receive buffer size
```

Fixes: 1f5611c06d1c243b42279748788f0627793ead9c ("zebra: Allow zebra cli to accept v6 routes with v4 nexthops")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 25ae643996d338b8230fb15a9064843fe85de224)

5 months agoMerge pull request #17289 from opensourcerouting/16354-bp-9.1
Russ White [Tue, 29 Oct 2024 14:28:04 +0000 (10:28 -0400)]
Merge pull request #17289 from opensourcerouting/16354-bp-9.1

(9.1 backport) bgpd: add `bgp ipv6-auto-ra` command

5 months agoMerge pull request #17285 from FRRouting/mergify/bp/stable/9.1/pr-17278
Russ White [Tue, 29 Oct 2024 14:26:42 +0000 (10:26 -0400)]
Merge pull request #17285 from FRRouting/mergify/bp/stable/9.1/pr-17278

bgpd: fix blank line in running-config with bmp listener cmd (backport #17278)

5 months agoMerge pull request #17294 from FRRouting/mergify/bp/stable/9.1/pr-17245
Russ White [Tue, 29 Oct 2024 14:22:34 +0000 (10:22 -0400)]
Merge pull request #17294 from FRRouting/mergify/bp/stable/9.1/pr-17245

bgpd:  fix crash when polling bgp4v2PathAttrTable (backport #17245)

5 months agobgpd: fix crash when polling bgp4v2PathAttrTable 17294/head
Francois Dumontet [Mon, 21 Oct 2024 10:49:50 +0000 (12:49 +0200)]
bgpd:  fix crash when polling bgp4v2PathAttrTable

we have

(gdb) p *path->attr->aspath
$1 = {refcnt = 3, segments = 0x0, json = 0x0, str = 0x55723d0b7470 "", str_len = 0, asnotation = ASNOTATION_PLAIN}

It looks like this aspath is empty, resulting in a size 0 and NULL pointer for path->attr->aspath->segments which leads to the SIGSEGV

fixe: return 0 when segments is null.

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
(cherry picked from commit ee2f1b85cf95fcbfd0a54dc15b911f525e96b163)

5 months agobgpd: add `bgp ipv6-auto-ra` command 17289/head
Mikhail Sokolovskiy [Tue, 24 Sep 2024 16:00:11 +0000 (19:00 +0300)]
bgpd: add `bgp ipv6-auto-ra` command

Introduce a command to stop bgpd from enabling IPv6 router advertisement
messages sending on interfaces.

Signed-off-by: Mikhail Sokolovskiy <sokolmish@gmail.com>
6 months agobgpd: fix blank line in running-config with bmp listener cmd 17285/head
Philippe Guibert [Mon, 28 Oct 2024 15:04:45 +0000 (16:04 +0100)]
bgpd: fix blank line in running-config with bmp listener cmd

An extra blank line is added in show running-config with BMP:

> ubuntu2204hwe(config)# router bgp 65500
> ubuntu2204hwe(config-router)# bmp targets tgt
> ubuntu2204hwe(config-bgp-bmp)# bmp monitor ipv4 unicast pre-policy
> ubuntu2204hwe(config-bgp-bmp)# bmp listener 192.0.2.100 port 44
> ubuntu2204hwe(config-bgp-bmp)# do show running-config
>
> router bgp 65500
> [..]
>  bmp targets tgt
>   bmp monitor ipv4 unicast pre-policy
>                                       <-- blank line
>   bmp listener 192.0.2.100 port 44
>  exit

Remove the blank line.

Fixes: ed18356f1f2d ("bgpd/bmp: BMP implementation")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit 9a33ee18bfe2769e173911d69cee64b78143184b)

6 months agoMerge pull request #17275 from FRRouting/mergify/bp/stable/9.1/pr-17243
Jafar Al-Gharaibeh [Mon, 28 Oct 2024 17:38:56 +0000 (12:38 -0500)]
Merge pull request #17275 from FRRouting/mergify/bp/stable/9.1/pr-17243

bgpd: fix display of local label in show bgp (backport #17243)

6 months agoMerge pull request #17263 from opensourcerouting/fix/backport_1fe1f8d87c4ab46ae18536a...
Jafar Al-Gharaibeh [Mon, 28 Oct 2024 17:38:34 +0000 (12:38 -0500)]
Merge pull request #17263 from opensourcerouting/fix/backport_1fe1f8d87c4ab46ae18536a2418c05ae5fd95185_9.1

lib, zebra: Keep `zebra on-rib-process script` in frr.conf (backport #17160)

6 months agobgpd: fix display of local label in show bgp 17275/head
Louis Scalbert [Fri, 25 Oct 2024 15:54:07 +0000 (17:54 +0200)]
bgpd: fix display of local label in show bgp

Fix the display of the local label in show bgp.

> r1# show bgp ipv4 labeled-unicast 172.16.2.2/32
> BGP routing table entry for 172.16.2.2/32, version 2
> Local label: 16 <---- MISSING
> Paths: (1 available, best #1, table default, vrf (null))
>   Advertised to non peer-group peers:
>  192.168.1.2
>  65501
>    192.168.1.2 from 192.168.1.2 (172.16.2.2)
>      Origin IGP, metric 0, valid, external, best (First path received)
>      Remote label: 3
>      Last update: Fri Oct 25 17:55:45 2024

Fixes: 67f67ba481 ("bgpd: Drop label_ntop/label_pton functions")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit e7b3276ace65d59edb4d614158d4f2959f12f868)

6 months agolib, zebra: Keep `zebra on-rib-process script` in frr.conf 17263/head
Donatas Abraitis [Fri, 18 Oct 2024 12:36:52 +0000 (15:36 +0300)]
lib, zebra: Keep `zebra on-rib-process script` in frr.conf

After the change:

```
$ grep on-rib-process /etc/frr/frr.conf
zebra on-rib-process script script4

$ systemctl restart frr

$ vtysh -c 'show run' | grep on-rib-process
zebra on-rib-process script script4
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
6 months agoMerge pull request #17249 from FRRouting/mergify/bp/stable/9.1/pr-17217
Jafar Al-Gharaibeh [Sat, 26 Oct 2024 18:58:04 +0000 (13:58 -0500)]
Merge pull request #17249 from FRRouting/mergify/bp/stable/9.1/pr-17217

pimd: allow resolving bsr via directly connected secondary address (backport) (backport #17217)

6 months agopimd: allow resolving bsr via directly connected secondary address 17249/head
Jafar Al-Gharaibeh [Wed, 23 Oct 2024 04:09:53 +0000 (23:09 -0500)]
pimd: allow resolving bsr via directly connected secondary address

This only matters to single hop nodes that are adjacent to the bsr. More common
with IPv6 where LL address is used in PIM as the primary address. If the BSR IP
happens to be an address on the same interface, the receiving pim router
rejects the BSR address because it expects the BSR IP to resolve via the LL address
even if we have a connected route for the same BSR IP subnet. Effectively, we want to
allow rpf to be resolved via secondary IPs with connected routes on the same interface,
and not limit them to primary addresses.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
(cherry picked from commit d23a7d0949aaa9aa95d6d3ae293ac4eea81e19f5)

6 months agoMerge pull request #17241 from opensourcerouting/fix/backport_d46511d4456ccaccfdac34b...
Jafar Al-Gharaibeh [Fri, 25 Oct 2024 15:19:08 +0000 (10:19 -0500)]
Merge pull request #17241 from opensourcerouting/fix/backport_d46511d4456ccaccfdac34b456c1c225a29609c8_9.1

bgpd: compare aigp after local route check in bgp_path_info_cmp()

6 months agobgpd: compare aigp after local route check in bgp_path_info_cmp() 17241/head
Enke Chen [Thu, 24 Oct 2024 17:50:37 +0000 (10:50 -0700)]
bgpd: compare aigp after local route check in bgp_path_info_cmp()

For consistency between RIB and BGP, the aigp comparison should
be made after the local route check in bgp bestpath selection.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
6 months agoMerge pull request #17210 from cscarpitta/fix/backport_add-sid-structure-to-seg6local...
Donatas Abraitis [Thu, 24 Oct 2024 14:33:26 +0000 (17:33 +0300)]
Merge pull request #17210 from cscarpitta/fix/backport_add-sid-structure-to-seg6local-nh_for_9.1

bgpd, lib: Include SID structure in seg6local nexthop (backport for 9.1)

6 months agobgpd: Include structure when removing End.DT46 SID 17210/head
Carmine Scarpitta [Sun, 15 Sep 2024 16:56:48 +0000 (18:56 +0200)]
bgpd: Include structure when removing End.DT46 SID

Include SID structure information when removing an SRv6 End.DT46 SID
from the forwarding plane.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
6 months agobgpd: Include structure when removing End.DT4/6 SID
Carmine Scarpitta [Sun, 15 Sep 2024 16:56:21 +0000 (18:56 +0200)]
bgpd: Include structure when removing End.DT4/6 SID

Include SID structure information when removing an SRv6 End.DT4 or End.DT6 SID
from the forwarding plane.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
6 months agobgpd: Include structure when installing End.DT46 SID
Carmine Scarpitta [Sun, 15 Sep 2024 16:54:55 +0000 (18:54 +0200)]
bgpd: Include structure when installing End.DT46 SID

Include SID structure information when installing an SRv6 End.DT46 SID
in the forwarding plane.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
6 months agobgpd: Include structure when installing End.DT4/6 SID
Carmine Scarpitta [Sun, 15 Sep 2024 16:53:35 +0000 (18:53 +0200)]
bgpd: Include structure when installing End.DT4/6 SID

Include SID structure information when installing an SRv6 End.DT6 or End.DT4 SID
in the forwarding plane.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
6 months agolib: Include SID structure in seg6local nexthop
Carmine Scarpitta [Sun, 15 Sep 2024 15:23:34 +0000 (17:23 +0200)]
lib: Include SID structure in seg6local nexthop

Include SID structure information in seg6local nexthop data structure.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
6 months agoMerge pull request #17204 from FRRouting/mergify/bp/stable/9.1/pr-17198
Donatas Abraitis [Wed, 23 Oct 2024 06:19:07 +0000 (09:19 +0300)]
Merge pull request #17204 from FRRouting/mergify/bp/stable/9.1/pr-17198

Revert "lib: Attach stdout to child only if --log=stdout and stdout F… (backport #17198)

6 months agoRevert "lib: Attach stdout to child only if --log=stdout and stdout FD is a tty" 17204/head
Donald Sharp [Tue, 22 Oct 2024 15:13:07 +0000 (11:13 -0400)]
Revert "lib: Attach stdout to child only if --log=stdout and stdout FD is a tty"

This reverts commit 0e3c5e8e5907321b35201f0985c1d3f4a1b0e639.

(cherry picked from commit 6a36b9ef49bfce59a7e674df233265da6d275257)

6 months agoMerge pull request #17178 from FRRouting/mergify/bp/stable/9.1/pr-17169
Jafar Al-Gharaibeh [Tue, 22 Oct 2024 14:39:18 +0000 (09:39 -0500)]
Merge pull request #17178 from FRRouting/mergify/bp/stable/9.1/pr-17169

bgpd: allow value 0 in aigp-metric setting (backport #17169)

6 months agobgpd: allow value 0 in aigp-metric setting 17178/head
Enke Chen [Sun, 20 Oct 2024 19:25:46 +0000 (12:25 -0700)]
bgpd: allow value 0 in aigp-metric setting

The value of 0 is accepted from peers, and can also be set by the
route-map "set aigp-metric igp-metric". For coonsistency, it should
be allowed in "set aigp-metric <value>" as well.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
(cherry picked from commit e07f38a43f0b176fcfb96403db71291c04f76cfb)

6 months agoMerge pull request #17149 from FRRouting/mergify/bp/stable/9.1/pr-17091
Jafar Al-Gharaibeh [Thu, 17 Oct 2024 16:30:13 +0000 (11:30 -0500)]
Merge pull request #17149 from FRRouting/mergify/bp/stable/9.1/pr-17091

bgpd: fix several issues in sourcing AIGP attribute (backport #17091)

6 months agotests: add a new topotest to bgp_aigp 17149/head
Enke Chen [Wed, 16 Oct 2024 18:19:28 +0000 (11:19 -0700)]
tests: add a new topotest to bgp_aigp

Add a new topotest for getting the aigp from the "igp-metric"
for a redistributed route (ospf route in the test).

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
(cherry picked from commit 51612593f7f747d0003a48a41367be87d3ea5361)

6 months agobgpd: fix several issues in sourcing AIGP attribute
Enke Chen [Wed, 16 Oct 2024 18:15:28 +0000 (11:15 -0700)]
bgpd: fix several issues in sourcing AIGP attribute

Fix several issues in sourcing AIGP attribute:

1) AIGP should not be set as default for a redistributed route or a
   static network. It should be set by config instead.

2) AIGP sourced by "set aigp-metric igp-metric" in a route-map does
   not set the correct value for a redistributed route.

3) When redistribute a connected route like loopback, the AGIP (with
   value 0) is sourced by "set aigp-metric igp-metric", but the
   attribute is not propagated as the attribute flag is not set.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
(cherry picked from commit f65356d8bb9a43b1725fafdbd30aba0de9d214fa)

6 months agoMerge pull request #17132 from FRRouting/mergify/bp/stable/9.1/pr-17116
Jafar Al-Gharaibeh [Wed, 16 Oct 2024 14:25:00 +0000 (09:25 -0500)]
Merge pull request #17132 from FRRouting/mergify/bp/stable/9.1/pr-17116

zebra: unlock node only after operation in zebra_free_rnh() (backport #17116)

6 months agozebra: unlock node only after operation in zebra_free_rnh() 17132/head
Enke Chen [Tue, 15 Oct 2024 17:23:10 +0000 (10:23 -0700)]
zebra: unlock node only after operation in zebra_free_rnh()

Move route_unlock_node() after rnh_list_del().

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
(cherry picked from commit 5b6ff51b8ae7f8c7348cea4de9543956f32641a7)

6 months agoMerge pull request #17111 from FRRouting/mergify/bp/stable/9.1/pr-17093
Donald Sharp [Tue, 15 Oct 2024 20:27:45 +0000 (16:27 -0400)]
Merge pull request #17111 from FRRouting/mergify/bp/stable/9.1/pr-17093

bgpd: fix route selection with AIGP (backport #17093)

6 months agotests: fix and adjust topotest/bgp_aigp 17111/head
Enke Chen [Tue, 15 Oct 2024 01:47:59 +0000 (18:47 -0700)]
tests: fix and adjust topotest/bgp_aigp

Fix and adjust the topotest post the fix for route selection with
AIGP.

When there are multiple IGP domains (OSPF in this case), the nexthop
for a BGP route with the AIGP attribute must be resolved in its own
IGP domain.

The changes in r2/bgpd.conf and r3/bgpd.conf are needed as incorrect
IGP metrics are received from NHT for the recursive nexthops. Once
the issue is resolved, the changes can be reverted.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
(cherry picked from commit 1ee7e63a6c432662ef3a9a2bd0e1c41298bdf196)

6 months agobgpd: fix route selection with AIGP
Enke Chen [Tue, 15 Oct 2024 01:42:15 +0000 (18:42 -0700)]
bgpd: fix route selection with AIGP

The nexthop metric should be added to AIGP when calculating the
bestpath in bgp_path_info_cmp().

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
(cherry picked from commit 081422e8e71085d3a3d4d2ff0bc1e1abaff0d52e)

6 months agoMerge pull request #16927 from FRRouting/mergify/bp/stable/9.1/pr-16913
Donatas Abraitis [Mon, 14 Oct 2024 05:28:21 +0000 (08:28 +0300)]
Merge pull request #16927 from FRRouting/mergify/bp/stable/9.1/pr-16913

bgpd: EVPN fix per rd specific type-2 json output (backport #16913)

6 months agoMerge pull request #17069 from FRRouting/mergify/bp/stable/9.1/pr-17059
Donald Sharp [Fri, 11 Oct 2024 16:14:22 +0000 (12:14 -0400)]
Merge pull request #17069 from FRRouting/mergify/bp/stable/9.1/pr-17059

bgpd: Move some non BGP-specific route-map functions to lib (backport #17059)

6 months agobgpd: Move some non BGP-specific route-map functions to lib 17069/head
Donatas Abraitis [Thu, 10 Oct 2024 13:50:38 +0000 (16:50 +0300)]
bgpd: Move some non BGP-specific route-map functions to lib

They are managed under `frr-route-map`, not under `frr-bgp-route-map`.

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

6 months agoMerge pull request #17035 from FRRouting/mergify/bp/stable/9.1/pr-17022
Donatas Abraitis [Thu, 10 Oct 2024 06:37:20 +0000 (09:37 +0300)]
Merge pull request #17035 from FRRouting/mergify/bp/stable/9.1/pr-17022

vrrpd: iterate over all ancillary messages (backport #17022)

6 months agovrrpd: iterate over all ancillary messages 17035/head
Rafael Zalamena [Mon, 7 Oct 2024 16:02:44 +0000 (13:02 -0300)]
vrrpd: iterate over all ancillary messages

Assign the return of `CMSG_NXTHDR` so we can really iterate over the
ancillary data.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
(cherry picked from commit 5e1a3cd2ad1148f60f5a59474bcf3d176b9ab789)

6 months agoMerge pull request #17005 from FRRouting/mergify/bp/stable/9.1/pr-17000
Donatas Abraitis [Tue, 8 Oct 2024 05:13:02 +0000 (08:13 +0300)]
Merge pull request #17005 from FRRouting/mergify/bp/stable/9.1/pr-17000

zebra: Fix crash during reconnect (backport #17000)

6 months agoMerge pull request #16981 from FRRouting/mergify/bp/stable/9.1/pr-16971
Donatas Abraitis [Mon, 7 Oct 2024 08:27:43 +0000 (11:27 +0300)]
Merge pull request #16981 from FRRouting/mergify/bp/stable/9.1/pr-16971

bgpd: Actually make ` --v6-with-v4-nexthops` it work (backport #16971)

6 months agoMerge pull request #16975 from FRRouting/mergify/bp/stable/9.1/pr-16968
Donatas Abraitis [Mon, 7 Oct 2024 08:27:27 +0000 (11:27 +0300)]
Merge pull request #16975 from FRRouting/mergify/bp/stable/9.1/pr-16968

bfdd: add no variants to interval configurations (backport #16968)

6 months agozebra: Fix crash during reconnect 17005/head
Igor Zhukov [Fri, 4 Oct 2024 06:16:02 +0000 (13:16 +0700)]
zebra: Fix crash during reconnect

fpm_enqueue_rmac_table expects an fpm_rmac_arg* as its argument.

The issue can be reproduced by dropping the TCP session using:

ss -K dst 127.0.0.1 dport = 2620

I used Fedora 40 and frr 9.1.2 and I got the gdb backtrace:

(gdb) bt
0  0x00007fdd7d6997ea in fpm_enqueue_rmac_table (bucket=0x2134dd0, arg=0x2132b60) at zebra/dplane_fpm_nl.c:1217
1  0x00007fdd7dd1560d in hash_iterate (hash=0x21335f0, func=0x7fdd7d6997a0 <fpm_enqueue_rmac_table>, arg=0x2132b60) at lib/hash.c:252
2  0x00007fdd7dd1560d in hash_iterate (hash=0x1e5bf10, func=func@entry=0x7fdd7d698900 <fpm_enqueue_l3vni_table>,
    arg=arg@entry=0x7ffed983bef0) at lib/hash.c:252
3  0x00007fdd7d698b5c in fpm_rmac_send (t=<optimized out>) at zebra/dplane_fpm_nl.c:1262
4  0x00007fdd7dd6ce22 in event_call (thread=thread@entry=0x7ffed983c010) at lib/event.c:1970
5  0x00007fdd7dd20758 in frr_run (master=0x1d27f10) at lib/libfrr.c:1213
6  0x0000000000425588 in main (argc=10, argv=0x7ffed983c2e8) at zebra/main.c:492

Signed-off-by: Igor Zhukov <fsb4000@yandex.ru>
(cherry picked from commit a3877e4444dc3a1253135d3b9479935fc9a966f8)

6 months agoMerge pull request #16998 from FRRouting/mergify/bp/stable/9.1/pr-16934
Donald Sharp [Fri, 4 Oct 2024 11:41:46 +0000 (07:41 -0400)]
Merge pull request #16998 from FRRouting/mergify/bp/stable/9.1/pr-16934

*: Modify clang-format column limit to 100 (backport #16934)

6 months ago*: Modify clang-format column limit to 100 16998/head
Donald Sharp [Thu, 26 Sep 2024 13:57:28 +0000 (09:57 -0400)]
*: Modify clang-format column limit to 100

A bunch of recent discussion has gone on about this.  Let's see
if we are actually interested in making a change.

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

6 months agoMerge pull request #16984 from FRRouting/mergify/bp/stable/9.1/pr-16977
Donatas Abraitis [Thu, 3 Oct 2024 06:28:16 +0000 (09:28 +0300)]
Merge pull request #16984 from FRRouting/mergify/bp/stable/9.1/pr-16977

bgpd: fix printfrr_bp for non initialized peers (backport #16977)

6 months agobgpd: fix printfrr_bp for non initialized peers 16984/head
Louis Scalbert [Wed, 2 Oct 2024 12:38:15 +0000 (14:38 +0200)]
bgpd: fix printfrr_bp for non initialized peers

Fix printfrr_bp for non initialized peers. For example:

> Sep 26 17:56:44 r1 bgpd[26295]: [GJPH1-W8PZV] Resetting peer (null)(Unknown) due to change in addpath config

Is now:

> Oct 02 14:00:59 r1 bgpd[12795]: [MNE5N-K0G4Z] Resetting peer 2.2.2.2 due to change in addpath config

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

6 months agobgpd: Actually make ` --v6-with-v4-nexthops` it work 16981/head
Donatas Abraitis [Wed, 2 Oct 2024 10:57:30 +0000 (13:57 +0300)]
bgpd: Actually make ` --v6-with-v4-nexthops` it work

It was using `-v` which is actually a _version_.

Fixes: 0435b31bb8ed55377f83d0e19bc085abc3c71b44 ("bgpd: Allow bgp to specify if it will allow v6 routing with v4 nexthops")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 0495cac837ad0f6ff1082746c37e4a48c1068035)

6 months agobfdd: add no variants to interval configurations 16975/head
Rafael Zalamena [Tue, 1 Oct 2024 21:58:24 +0000 (18:58 -0300)]
bfdd: add no variants to interval configurations

Add missing no commands to various interval configurations.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
(cherry picked from commit b70835d690d98f1549202d89d9bab34297ba5bd0)

6 months agoMerge pull request #16921 from FRRouting/mergify/bp/stable/9.1/pr-16918
Donald Sharp [Tue, 1 Oct 2024 22:02:18 +0000 (18:02 -0400)]
Merge pull request #16921 from FRRouting/mergify/bp/stable/9.1/pr-16918

zebra snmp fixes (backport #16918)

6 months agoMerge pull request #16966 from FRRouting/mergify/bp/stable/9.1/pr-16738
Donald Sharp [Tue, 1 Oct 2024 21:52:38 +0000 (17:52 -0400)]
Merge pull request #16966 from FRRouting/mergify/bp/stable/9.1/pr-16738

lib: Attach stdout to child only if --log=stdout and stdout FD is a tty (backport #16738)

6 months agolib: Attach stdout to child only if --log=stdout and stdout FD is a tty 16966/head
Vladislav Odintsov [Wed, 4 Sep 2024 11:18:35 +0000 (14:18 +0300)]
lib: Attach stdout to child only if --log=stdout and stdout FD is a tty

Prior to this commit stdout of a process started in a daemon mode was
attached to a calling process.
As a result a calling process hung for infinity.

Signed-off-by: Vladislav Odintsov <vlodintsov@k2.cloud>
(cherry picked from commit 0e3c5e8e5907321b35201f0985c1d3f4a1b0e639)

7 months agobgpd: EVPN fix per rd specific type-2 json output 16927/head
Sindhu Parvathi Gopinathan [Tue, 24 Sep 2024 17:55:09 +0000 (10:55 -0700)]
bgpd: EVPN fix per rd specific type-2 json output

Current Issue:

paths key is not there for
'show bgp l2vpn evpn route rd <rd-id> mac <mac> json' uses
evpn prefix as key for each path.
Replace the evpn prefix with "paths".
This aligned with overall EVPN RIB json output like
'show bgp l2vpn evpn route json'
'show bgp l2vpn evpn route rd <> type 2 json'

Fix:

paths key is added instead of prefix info.

Ticket:#4087461

Issue:4087461

Testing:

Before fix:

leaf22# show bgp l2vpn evpn route rd 6.0.0.17:2 mac 00:02:00:00:00:12 json
{
  "prefix":"[2]:[0]:[48]:[00:02:00:00:00:12]",
  "prefixLen":352,
  "rd":"6.0.0.17:2",
  "routeType":2,
  "ethTag":0,
  "macLen":48,
  "mac":"00:02:00:00:00:12",
  "advertisedTo":{
    "220.20.0.33":{
      "hostname":"spine21"
    },
    "220.21.0.33":{
      "hostname":"spine22"
    }
  },
  "[2]:[0]:[48]:[00:02:00:00:00:12]":[ <=====  Prefix info instead of "paths" key
    [
      {
        "vni":"101101",
        "aspath":{
          "string":"65202 65024",
          "segments":[
            {
              "type":"as-sequence",
              "list":[
                65202,
                65024
              ]
            }
          ],
          "length":2
        },
        "esi":"03:00:00:00:77:02:04:00:00:18",
        "es_info":{
          "localEs":true
        },
        "origin":"IGP",
        "valid":true,
        "version":5,
        "bestpath":{
          "bestpathFromAs":65202,
          "overall":true,
          "selectionReason":"Older Path"
        },
        "extendedCommunity":{
          "string":"RT:65024:101101 ET:8"
        },
        "lastUpdate":{
          "epoch":1726803218,
          "string":"Fri Sep 20 03:33:38 2024\n"
        },
        "nexthops":[
          {
            "ip":"6.0.0.17",
            "hostname":"spine21",
            "afi":"ipv4",
            "metric":0,
            "accessible":true,
            "used":true
          }
        ],
        "peer":{
          "peerId":"220.20.0.33",
          "routerId":"6.0.0.20",
          "hostname":"spine21",
          "type":"external"
        }
      }
    ],
    [
      {
        "vni":"101101",
        "aspath":{
          "string":"65202 65024",
          "segments":[
            {
              "type":"as-sequence",
              "list":[
                65202,
                65024
              ]
            }
          ],
          "length":2
        },
        "esi":"03:00:00:00:77:02:04:00:00:18",
        "es_info":{
          "localEs":true
        },
        "origin":"IGP",
        "valid":true,
        "version":5,
        "extendedCommunity":{
          "string":"RT:65024:101101 ET:8"
        },
        "lastUpdate":{
          "epoch":1726803218,
          "string":"Fri Sep 20 03:33:38 2024\n"
        },
        "nexthops":[
          {
            "ip":"6.0.0.17",
            "hostname":"spine22",
            "afi":"ipv4",
            "metric":0,
            "accessible":true,
            "used":true
          }
        ],
        "peer":{
          "peerId":"220.21.0.33",
          "routerId":"6.0.0.21",
          "hostname":"spine22",
          "type":"external"
        }
      }
    ]
  ],
  "numPaths":2
}

After fix:

eaf22# show bgp l2vpn evpn route rd 6.0.0.17:2 mac 00:02:00:00:00:12 json
{
  "prefix":"[2]:[0]:[48]:[00:02:00:00:00:12]",
  "prefixLen":352,
  "rd":"6.0.0.17:2",
  "routeType":2,
  "ethTag":0,
  "macLen":48,
  "mac":"00:02:00:00:00:12",
  "advertisedTo":{
    "220.20.0.33":{
      "hostname":"spine21"
    },
    "220.21.0.33":{
      "hostname":"spine22"
    }
  },
  "paths":[
    [
      {
        "vni":"101101",
        "aspath":{
          "string":"65202 65024",
          "segments":[
            {
              "type":"as-sequence",
              "list":[
                65202,
                65024
              ]
            }
          ],
          "length":2
        },
        "esi":"03:00:00:00:77:02:04:00:00:18",
        "es_info":{
          "localEs":true
        },
        "origin":"IGP",
        "valid":true,
        "version":3,
        "bestpath":{
          "bestpathFromAs":65202,
          "overall":true,
          "selectionReason":"Router ID"
        },
        "extendedCommunity":{
          "string":"RT:65024:101101 ET:8"
        },
        "lastUpdate":{
          "epoch":1727175046,
          "string":"Tue Sep 24 10:50:46 2024\n"
        },
        "nexthops":[
          {
            "ip":"6.0.0.17",
            "hostname":"spine21",
            "afi":"ipv4",
            "metric":0,
            "accessible":true,
            "used":true
          }
        ],
        "peer":{
          "peerId":"220.20.0.33",
          "routerId":"6.0.0.20",
          "hostname":"spine21",
          "type":"external"
        }
      }
    ],
    [
      {
        "vni":"101101",
        "aspath":{
          "string":"65202 65024",
          "segments":[
            {
              "type":"as-sequence",
              "list":[
                65202,
                65024
              ]
            }
          ],
          "length":2
        },
        "esi":"03:00:00:00:77:02:04:00:00:18",
        "es_info":{
          "localEs":true
        },
        "origin":"IGP",
        "valid":true,
        "version":3,
        "extendedCommunity":{
          "string":"RT:65024:101101 ET:8"
        },
        "lastUpdate":{
          "epoch":1727175046,
          "string":"Tue Sep 24 10:50:46 2024\n"
        },
        "nexthops":[
          {
            "ip":"6.0.0.17",
            "hostname":"spine22",
            "afi":"ipv4",
            "metric":0,
            "accessible":true,
            "used":true
          }
        ],
        "peer":{
          "peerId":"220.21.0.33",
          "routerId":"6.0.0.21",
          "hostname":"spine22",
          "type":"external"
        }
      }
    ]
  ],
  "numPaths":2
}

Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
(cherry picked from commit ff008cee6b5b4945f6dd3e58b46b933d695c2865)

7 months agozebra: Add missing proto translations 16921/head
Donald Sharp [Wed, 25 Sep 2024 16:14:50 +0000 (12:14 -0400)]
zebra: Add missing proto translations

Add missing isis and eigrp proto translations.

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

7 months agozebra: Correctly report metrics
Donald Sharp [Wed, 25 Sep 2024 16:09:40 +0000 (12:09 -0400)]
zebra: Correctly report metrics

Report the routes metric in IPFORWARDMETRIC1 and return
-1 for the other metrics as required by the IP-FORWARD-MIB.

inetCidrRouteMetric2 OBJECT-TYPE
    SYNTAX     Integer32
    MAX-ACCESS read-create
    STATUS     current
    DESCRIPTION
           "An alternate routing metric for this route.  The
            semantics of this metric are determined by the routing-
            protocol specified in the route's inetCidrRouteProto
            value.  If this metric is not used, its value should be
            set to -1."
    DEFVAL { -1 }
    ::= { inetCidrRouteEntry 13 }

I've included metric2 but it's the same for all of them.

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

7 months agozebra: Let's use memset instead of walking bytes and setting to 0
Donald Sharp [Wed, 25 Sep 2024 16:08:03 +0000 (12:08 -0400)]
zebra: Let's use memset instead of walking bytes and setting to 0

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

7 months agozebra: Fix snmp walk of zebra rib
Donald Sharp [Wed, 25 Sep 2024 16:06:29 +0000 (12:06 -0400)]
zebra: Fix snmp walk of zebra rib

The snmp walk of the zebra rib was skipping entries
because in_addr_cmp was replaced with a prefix_cmp
which worked slightly differently causing parts
of the zebra rib tree to be skipped.

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

7 months agoMerge pull request #16844 from FRRouting/mergify/bp/stable/9.1/pr-16809
Donald Sharp [Tue, 17 Sep 2024 17:42:16 +0000 (13:42 -0400)]
Merge pull request #16844 from FRRouting/mergify/bp/stable/9.1/pr-16809

isisd: fix rcap tlv double-free crash (backport #16809)

7 months agotests: update isisd fuzz test 16844/head
Louis Scalbert [Mon, 16 Sep 2024 11:43:26 +0000 (13:43 +0200)]
tests: update isisd fuzz test

Since the previous commit, if a router capability subTLV is not
readable, the previously read subTLVs are kept.

Update of the ISIS fuzz test.

> $ wuschl rebuild tests/isisd/test_fuzz_isis_tlv
> $ gzip -9 tests/isisd/test_fuzz_isis_tlv_tests.h

> $ ./test_fuzz_isis_tlv 2>/dev/null | grep failed
> Test 139 failed, output differs.
> Test 150 failed, output differs.
> 2 of 405 tests failed.
>
> $ ./test_fuzz_isis_tlv 139 2>/dev/null
> Test 139 failed, output differs.
> Expected output:
> Unpack log:
> Unpacking 564 bytes of TLVs...
>   Unpacking TLV...
>     Found TLV of type 193 and len 13.
>     Skipping unknown TLV 193 (13 bytes)
>   Unpacking TLV...
>     Found TLV of type 0 and len 0.
>     Skipping unknown TLV 0 (0 bytes)
>   Unpacking TLV...
>     Found TLV of type 0 and len 0.
>     Skipping unknown TLV 0 (0 bytes)
>   Unpacking TLV...
>     Found TLV of type 242 and len 12.
>     Unpacking Router Capability TLV...
>     WARNING: Router Capability subTLV length too large compared to expected size
> Unpacked TLVs:
> Received output:
> Unpack log:
> Unpacking 564 bytes of TLVs...
>   Unpacking TLV...
>     Found TLV of type 193 and len 13.
>     Skipping unknown TLV 193 (13 bytes)
>   Unpacking TLV...
>     Found TLV of type 0 and len 0.
>     Skipping unknown TLV 0 (0 bytes)
>   Unpacking TLV...
>     Found TLV of type 0 and len 0.
>     Skipping unknown TLV 0 (0 bytes)
>   Unpacking TLV...
>     Found TLV of type 242 and len 12.
>     Unpacking Router Capability TLV...
>     WARNING: Router Capability subTLV length too large compared to expected size
> Unpacked TLVs:
> Router Capability: 253.212.128.242 , D:1, S:1
>
> $ ./test_fuzz_isis_tlv 150 2>/dev/null
> Test 150 failed, output differs.
> Expected output:
> Unpack log:
> Unpacking 403 bytes of TLVs...
>   Unpacking TLV...
>     Found TLV of type 129 and len 13.
>     Unpacking Protocols Supported TLV...
>       Protocols Supported: 73, 16, 255, 255, 255, 101, 10, 11, 11, 11, 11, 11, 11
>   Unpacking TLV...
>     Found TLV of type 11 and len 11.
>     Skipping unknown TLV 11 (11 bytes)
>   Unpacking TLV...
>     Found TLV of type 242 and len 12.
>     Unpacking Router Capability TLV...
>     WARNING: Router Capability subTLV length too large compared to expected size
> Unpacked TLVs:
> Protocols Supported: 73, 16, 255, 255, 255, 101, 10, 11, 11, 11, 11, 11, 11
> Received output:
> Unpack log:
> Unpacking 403 bytes of TLVs...
>   Unpacking TLV...
>     Found TLV of type 129 and len 13.
>     Unpacking Protocols Supported TLV...
>       Protocols Supported: 73, 16, 255, 255, 255, 101, 10, 11, 11, 11, 11, 11, 11
>   Unpacking TLV...
>     Found TLV of type 11 and len 11.
>     Skipping unknown TLV 11 (11 bytes)
>   Unpacking TLV...
>     Found TLV of type 242 and len 12.
>     Unpacking Router Capability TLV...
>     WARNING: Router Capability subTLV length too large compared to expected size
> Unpacked TLVs:
> Protocols Supported: 73, 16, 255, 255, 255, 101, 10, 11, 11, 11, 11, 11, 11
> Router Capability: 253.212.128.242 , D:1, S:1

Link: https://pypi.org/project/wuschl/
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit cfd050a0e5a636efae93865d982714da9dbf06a6)

7 months agoisisd: fix rcap tlv double-free crash
Louis Scalbert [Thu, 12 Sep 2024 07:31:49 +0000 (09:31 +0200)]
isisd: fix rcap tlv double-free crash

A double-free crash happens when a subTLV of the "Router Capability"
TLV is not readable and a previous "Router Capability" TLV was read.

rcap was supposed to be freed later by isis_free_tlvs() ->
free_tlv_router_cap(). In 78774bbcd5 ("isisd: add isis flex-algo lsp
advertisement"), this was not the case because rcap was not saved to
tlvs->router_cap when the function returned early because of a subTLV
length issue.

Always set tlvs->router_cap to free the memory.

Note that this patch has the consequence that in case of subTLV error,
the previously read "Router Capability" subTLVs are kept in memory.

Fixes: 49efc80d34 ("isisd: Ensure rcap is freed in error case")
Fixes: 78774bbcd5 ("isisd: add isis flex-algo lsp advertisement")
Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit d61758140d33972c10ecbb72d0a3e528049dd8d6)

7 months agoMerge pull request #16825 from FRRouting/mergify/bp/stable/9.1/pr-16818
Donald Sharp [Fri, 13 Sep 2024 23:52:17 +0000 (19:52 -0400)]
Merge pull request #16825 from FRRouting/mergify/bp/stable/9.1/pr-16818

ospfd: missing '[no]ip ospf graceful-restart hello-delay <N>' commands (backport #16818)

7 months agoospfd: fix missing '[no]ip ospf graceful-restart hello-delay <N>' commands 16825/head
Dmitrii Turlupov [Fri, 13 Sep 2024 13:22:18 +0000 (16:22 +0300)]
ospfd: fix missing '[no]ip ospf graceful-restart hello-delay <N>' commands

Signed-off-by: Dmitrii Turlupov <turlupov@bk.ru>
(cherry picked from commit 69e31a547f8520fd967cc34dc0cd3a8f915d07f8)

7 months agoMerge pull request #16821 from FRRouting/mergify/bp/stable/9.1/pr-16808
Jafar Al-Gharaibeh [Fri, 13 Sep 2024 18:11:33 +0000 (14:11 -0400)]
Merge pull request #16821 from FRRouting/mergify/bp/stable/9.1/pr-16808

nhrpd: fixes duplicate auth extension (backport #16808)

7 months agonhrpd: fixes duplicate auth extension 16821/head
Denys Haryachyy [Thu, 12 Sep 2024 07:28:28 +0000 (07:28 +0000)]
nhrpd: fixes duplicate auth extension

When an NHRP peer was forwarding a message, it was copying all
extensions from the originally received packet. The authentication
extension must be regenerated hop by hop per RFC2332.
This fix checks for the auth extension when copying extensions
and omits the original packet auth and instead regenerates a new auth extension.

Fix bug #16507

Signed-off-by: Denys Haryachyy <garyachy@gmail.com>
(cherry picked from commit 8e3c278bbcd0ced1d4058cc7a2c9aebdfbc8b651)

7 months agoMerge pull request #16804 from opensourcerouting/fix/backport_ABUILD_APK_INDEX_OPTS_9.1
Donald Sharp [Thu, 12 Sep 2024 12:22:32 +0000 (08:22 -0400)]
Merge pull request #16804 from opensourcerouting/fix/backport_ABUILD_APK_INDEX_OPTS_9.1

9.1 Backport docker ABUILD_APK_INDEX_OPTS

7 months agodocker: Set ABUILD_APK_INDEX_OPTS for frr build 16804/head
Donatas Abraitis [Fri, 14 Jun 2024 13:33:32 +0000 (16:33 +0300)]
docker: Set ABUILD_APK_INDEX_OPTS for frr build

In build() stage of abuild, it does `apk index ...` where frr* packages
are unsigned. We don't sign them here, and thus we need to specify `--allow-untrusted`.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
7 months agodocker: Set ABUILD_APK_INDEX_OPTS for libyang
Donatas Abraitis [Fri, 14 Jun 2024 08:37:23 +0000 (11:37 +0300)]
docker: Set ABUILD_APK_INDEX_OPTS for libyang

In build() stage of abuild, it does `apk index ...` where libyang* packages
are unsigned. We don't sign them here, and thus we need to specify `--allow-untrusted`.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
7 months agoFRR Release 9.1.2 docker/9.1.2 frr-9.1.2
Donatas Abraitis [Wed, 11 Sep 2024 08:32:53 +0000 (11:32 +0300)]
FRR Release 9.1.2

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
7 months agoMerge pull request #16785 from FRRouting/mergify/bp/stable/9.1/pr-16718
Jafar Al-Gharaibeh [Wed, 11 Sep 2024 04:01:30 +0000 (00:01 -0400)]
Merge pull request #16785 from FRRouting/mergify/bp/stable/9.1/pr-16718

isisd: fix crash when reading asla (backport #16718)

7 months agoisisd: fix crash when reading asla 16785/head
Louis Scalbert [Mon, 2 Sep 2024 08:26:57 +0000 (10:26 +0200)]
isisd: fix crash when reading asla

isisd is crashing when reading a ASLA sub-TLV with Application
Identifier Bit Mask length greater than 1 octet.

Set a limit of 8 bytes in accordance with RFC9479 and check that the
received value does not exceed the limit.

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Link: https://www.rfc-editor.org/rfc/rfc9479.html#name-application-identifier-bit-
Fixes: 5749ac83a8 ("isisd: add ASLA support")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit f1bc6c5d81e8cc0d31ee61abb295193f30db4f5a)

7 months agoMerge pull request #16741 from FRRouting/mergify/bp/stable/9.1/pr-16724
Donatas Abraitis [Wed, 4 Sep 2024 10:34:43 +0000 (13:34 +0300)]
Merge pull request #16741 from FRRouting/mergify/bp/stable/9.1/pr-16724

isisd: Add missing `exit` statement to `show running-config` output (backport #16724)

7 months agoisisd: Add missing `exit` statement 16741/head
Carmine Scarpitta [Mon, 2 Sep 2024 21:57:53 +0000 (23:57 +0200)]
isisd: Add missing `exit` statement

Add missing `exit` statement to `show running-config` output.

```
router isis ISIS_CORE
 is-type level-2-only
 net 49.0001.0000.0000.0004.00
 lsp-mtu 1300
 topology ipv6-unicast
 log-adjacency-changes
 segment-routing srv6
  locator ISIS_LOC
 exit   <<<<<<<<<<<<<<<<<<<<<<<<
exit
```

Fixes https://github.com/FRRouting/frr/issues/16694

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

7 months agoMerge pull request #16730 from FRRouting/mergify/bp/stable/9.1/pr-16667
Jafar Al-Gharaibeh [Tue, 3 Sep 2024 20:22:41 +0000 (16:22 -0400)]
Merge pull request #16730 from FRRouting/mergify/bp/stable/9.1/pr-16667

isisd: fix update link params after circuit is up (backport #16667)

7 months agoisisd: fix update link params after circuit is up 16730/head
Louis Scalbert [Tue, 27 Aug 2024 16:22:27 +0000 (18:22 +0200)]
isisd: fix update link params after circuit is up

If the link-params are set when the circuit not yet up, the link-params
are never updated.

isis_link_params_update() is called from isis_circuit_up() but returns
immediately because circuit->state != C_STATE_UP. circuit->state is
updated in isis_csm_state_change after isis_circuit_up().

> struct isis_circuit *isis_csm_state_change(enum isis_circuit_event event,
>     struct isis_circuit *circuit,
>     void *arg)
> {
> [...]
>  if (isis_circuit_up(circuit) != ISIS_OK) {
>  isis_circuit_deconfigure(circuit, area);
>  break;
>  }
>  circuit->state = C_STATE_UP;
>  isis_event_circuit_state_change(circuit, circuit->area,
>  1);

Do not return isis_link_params_update() if circuit->state != C_STATE_UP.

Fixes: 0fdd8b2b11 ("isisd: update link params after circuit is up")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 6ce6b7a8564f661495fec17f3ea33eeaf9e2f48c)

8 months agoMerge pull request #16624 from FRRouting/mergify/bp/stable/9.1/pr-16546
Donatas Abraitis [Thu, 22 Aug 2024 09:29:59 +0000 (12:29 +0300)]
Merge pull request #16624 from FRRouting/mergify/bp/stable/9.1/pr-16546

bgpd: fix, do not access peer->notify.data when it is null (backport #16546)

8 months agoMerge pull request #16612 from louis-6wind/fix-no-rpki-9.1
Donatas Abraitis [Thu, 22 Aug 2024 06:21:59 +0000 (08:21 +0200)]
Merge pull request #16612 from louis-6wind/fix-no-rpki-9.1

bgpd: fix crash at no rpki (backport 9.1 and lower)

8 months agotopotest: test_bgp_snmp_bgpv4v2_notification 16624/head
Dmytro Shytyi [Thu, 8 Aug 2024 13:42:40 +0000 (15:42 +0200)]
topotest: test_bgp_snmp_bgpv4v2_notification

This test checks the bgp crash on rt2 when 2 commands
launched consequently:
T0: rr, config -> router bgp 65004 -> neighbor 192.168.12.2 password 8888
T1: rt2, snmpwalk -v 2c -c public 127.0.0.1 .1.3.6.1.4.1.7336.4.2.1
T2: test if rt2 bgp is crashed.

Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
(cherry picked from commit e23005f407be4c284aaafa4c379d54581b7a8e78)

8 months agobgpd: fix, do not access peer->notify.data when it is null
Dmytro Shytyi [Thu, 8 Aug 2024 13:53:11 +0000 (15:53 +0200)]
bgpd: fix, do not access peer->notify.data when it is null

bgp crash on rt2 spotted when 2 commands
launched consequently:
T0: rr, config -> router bgp 65004 -> neighbor 192.168.12.2 password
8888
T1: rt2, snmpwalk -v 2c -c public 127.0.0.1 .1.3.6.1.4.1.7336.4.2.1
T2: rt2 bgp is crashed.

config rt2-bgp:
---------------

!
debug bgp updates
!
router bgp 65002
 no bgp ebgp-requires-policy
 no bgp network import-check
 no bgp default ipv4-unicast
 neighbor 192.168.12.4 remote-as external
 neighbor 192.168.12.4 timers 1 3
 neighbor 192.168.12.4 timers connect 1
 neighbor 2001:db8::12:4 remote-as external
 neighbor 2001:db8::12:4 timers 1 3
 neighbor 2001:db8::12:4 timers connect 1
 !
 address-family ipv4 unicast
  neighbor 192.168.12.4 activate
  neighbor 192.168.12.4 addpath-tx-all-paths

 exit-address-family
 address-family ipv6 unicast
  neighbor 2001:db8::12:4 activate
 exit-address-family
!
agentx
!

config rt2-snmpd:
agentAddress 127.0.0.1,[::1]

group public_group v1 public
group public_group v2c public
access public_group "" any noauth prefix all all none

rocommunity public default

view all included .1

iquerySecName frr
rouser frr

master agentx

agentXSocket /etc/frr/agentx
agentXPerms 777 755 root frr

config rt2-zebra:
-----------------

!
interface r2-eth0
 ip address 192.168.12.2/24
 ipv6 address 2001:db8::12:2/64
!

config rr-bgpd:
---------------

!
debug bgp updates
!
router bgp 65004
 no bgp ebgp-requires-policy
 no bgp network import-check
 no bgp default ipv4-unicast
 neighbor 192.168.12.1 remote-as external
 neighbor 192.168.12.1 timers 1 3
 neighbor 192.168.12.1 timers connect 1
 neighbor 192.168.12.2 remote-as external
 neighbor 192.168.12.2 timers 1 3
 neighbor 192.168.12.2 timers connect 1
 neighbor 192.168.12.3 remote-as external
 neighbor 192.168.12.3 timers 1 3
 neighbor 192.168.12.3 timers connect 1
 neighbor 2001:db8::12:1 remote-as external
 neighbor 2001:db8::12:1 timers 1 3
 neighbor 2001:db8::12:1 timers connect 1
 neighbor 2001:db8::12:2 remote-as external
 neighbor 2001:db8::12:2 timers 1 3
 neighbor 2001:db8::12:2 timers connect 1
 neighbor 2001:db8::12:3 remote-as external
 neighbor 2001:db8::12:3 timers 1 3
 neighbor 2001:db8::12:3 timers connect 1
 !
 address-family ipv4 unicast
  neighbor 192.168.12.1 activate
  neighbor 192.168.12.1 addpath-tx-all-paths
  neighbor 192.168.12.1 route-server-client
  neighbor 192.168.12.2 activate
  neighbor 192.168.12.2 addpath-tx-all-paths
  neighbor 192.168.12.2 route-server-client
  neighbor 192.168.12.3 activate
  neighbor 192.168.12.3 addpath-tx-all-paths
  neighbor 192.168.12.3 route-server-client
 exit-address-family
 address-family ipv6 unicast
  neighbor 2001:db8::12:1 activate
  neighbor 2001:db8::12:1 route-server-client
  neighbor 2001:db8::12:2 activate
  neighbor 2001:db8::12:2 route-server-client
  neighbor 2001:db8::12:3 activate
  neighbor 2001:db8::12:3 route-server-client
 exit-address-family
!
agentx
!

config rr-zebra:
----------------
!
interface rr-eth0
 ip address 192.168.12.4/24
 ipv6 address 2001:db8::12:4/64
!

Fixes: 2d8fff6b81bb ("bgpd: Implement BGP4V2-MIB(bgp4V2PeerErrorsTable)")
Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
(cherry picked from commit d53460554552c288831524c60dd98c303cba7c26)

8 months agobgpd: fix crash at no rpki 16612/head
Louis Scalbert [Tue, 20 Aug 2024 08:33:30 +0000 (10:33 +0200)]
bgpd: fix crash at no rpki

When 'no rpki' is requested and the rtrlib RPKI object was freed, bgpd
is crashing.

RPKI is configured in VRF red.

> ip l set red down
> ip l del red
> printf 'conf\n vrf red\n no rpki' | vtysh

> Core was generated by `/usr/bin/bgpd -A 127.0.0.1 -M snmp -M rpki -M bmp'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  __pthread_kill_implementation (no_tid=0, signo=11, threadid=140411103615424) at ./nptl/pthread_kill.c:44
> 44 ./nptl/pthread_kill.c: No such file or directory.
> [Current thread is 1 (Thread 0x7fb401f419c0 (LWP 190226))]
> (gdb) bt
> #0  __pthread_kill_implementation (no_tid=0, signo=11, threadid=140411103615424) at ./nptl/pthread_kill.c:44
> #1  __pthread_kill_internal (signo=11, threadid=140411103615424) at ./nptl/pthread_kill.c:78
> #2  __GI___pthread_kill (threadid=140411103615424, signo=signo@entry=11) at ./nptl/pthread_kill.c:89
> #3  0x00007fb4021ad476 in __GI_raise (sig=11) at ../sysdeps/posix/raise.c:26
> #4  0x00007fb4025ce22b in core_handler (signo=11, siginfo=0x7fff831b2d70, context=0x7fff831b2c40) at lib/sigevent.c:248
> #5  <signal handler called>
> #6  rtr_mgr_remove_group (config=0x55fe8789f750, preference=11) at /build/make-pkg/output/source/DIST_RTRLIB/rtrlib/rtrlib/rtr_mgr.c:607
> #7  0x00007fb40145f518 in rpki_delete_all_cache_nodes (rpki_vrf=0x55fe8789f4f0) at bgpd/bgp_rpki.c:442
> #8  0x00007fb401463098 in no_rpki_magic (self=0x7fb40146bba0 <no_rpki_cmd>, vty=0x55fe877f5130, argc=2, argv=0x55fe877fccd0) at bgpd/bgp_rpki.c:1732
> #9  0x00007fb40145c09a in no_rpki (self=0x7fb40146bba0 <no_rpki_cmd>, vty=0x55fe877f5130, argc=2, argv=0x55fe877fccd0) at ./bgpd/bgp_rpki_clippy.c:37
> #10 0x00007fb402527abc in cmd_execute_command_real (vline=0x55fe877fd150, vty=0x55fe877f5130, cmd=0x0, up_level=0) at lib/command.c:984
> #11 0x00007fb402527c35 in cmd_execute_command (vline=0x55fe877fd150, vty=0x55fe877f5130, cmd=0x0, vtysh=0) at lib/command.c:1043
> #12 0x00007fb4025281e5 in cmd_execute (vty=0x55fe877f5130, cmd=0x55fe877fb8c0 "no rpki\n", matched=0x0, vtysh=0) at lib/command.c:1209
> #13 0x00007fb4025f0aed in vty_command (vty=0x55fe877f5130, buf=0x55fe877fb8c0 "no rpki\n") at lib/vty.c:615
> #14 0x00007fb4025f2a11 in vty_execute (vty=0x55fe877f5130) at lib/vty.c:1378
> #15 0x00007fb4025f513d in vtysh_read (thread=0x7fff831b5fa0) at lib/vty.c:2373
> #16 0x00007fb4025e9611 in event_call (thread=0x7fff831b5fa0) at lib/event.c:2011
> #17 0x00007fb402566976 in frr_run (master=0x55fe871a14a0) at lib/libfrr.c:1212
> #18 0x000055fe857829fa in main (argc=9, argv=0x7fff831b6218) at bgpd/bgp_main.c:549

Fixes: 8156765abe ("bgpd: Add `no rpki` command")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 4e053d65f1c7edbcc3391026300388513d4c31b0)

There is also an issue when doing "rpki reset" and then "no rpki".

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
8 months agoMerge pull request #16562 from FRRouting/mergify/bp/stable/9.1/pr-16554
Donald Sharp [Tue, 13 Aug 2024 12:45:31 +0000 (08:45 -0400)]
Merge pull request #16562 from FRRouting/mergify/bp/stable/9.1/pr-16554

zebra: Ensure non-equal id's are not same nhg's (backport #16554)

8 months agozebra: Ensure non-equal id's are not same nhg's 16562/head
Donald Sharp [Sat, 10 Aug 2024 23:43:08 +0000 (19:43 -0400)]
zebra: Ensure non-equal id's are not same nhg's

The function zebra_nhg_hash_equal is only used
as a hash function for storage of NHG's and retrieval.
If you have say two nhg's:

31 (25/26)
32 (25/26)

This function would return them as being equal.  Which
of course leads to the problem when you attempt to
hash_release 32 but release 31 from the hash.  Then later
when you attempt to do hash comparisons 32 has actually
been freed leaving to use after free situations and shit
goes down hill fast.

This hash is only used as part of the hash comparison
function for nexthop group storage.  Since this is so
let's always return the 31/32 nhg's are not equal at all.

We possibly have a different problem where we are creating
31 and 32 ( when 31 should have just been used instead of 32 )
but we need to prevent any type of hash release problem at all.
This supercedes any other issue( that should be tracked down
on it's own ).  Since you can have use after free situation
that leads to a crash -vs- some possible nexthop group duplication
which is very minor in comparison.

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

8 months agoMerge pull request #16504 from FRRouting/mergify/bp/stable/9.1/pr-16497
Donald Sharp [Wed, 31 Jul 2024 16:34:37 +0000 (12:34 -0400)]
Merge pull request #16504 from FRRouting/mergify/bp/stable/9.1/pr-16497

bgpd: Check the actual remaining stream length before taking TLV value (backport #16497)

8 months agobgpd: Check the actual remaining stream length before taking TLV value 16504/head
Donatas Abraitis [Wed, 31 Jul 2024 05:35:14 +0000 (08:35 +0300)]
bgpd: Check the actual remaining stream length before taking TLV value

```
    0 0xb50b9f898028 in __sanitizer_print_stack_trace (/home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/.libs/bgpd+0x368028) (BuildId: 3292703ed7958b20076550c967f879db8dc27ca7)
    1 0xb50b9f7ed8e4 in fuzzer::PrintStackTrace() (/home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/.libs/bgpd+0x2bd8e4) (BuildId: 3292703ed7958b20076550c967f879db8dc27ca7)
    2 0xb50b9f7d4d9c in fuzzer::Fuzzer::CrashCallback() (/home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/.libs/bgpd+0x2a4d9c) (BuildId: 3292703ed7958b20076550c967f879db8dc27ca7)
    3 0xe0d12d7469cc  (linux-vdso.so.1+0x9cc) (BuildId: 1a77697e9d723fe22246cfd7641b140c427b7e11)
    4 0xe0d12c88f1fc in __pthread_kill_implementation nptl/pthread_kill.c:43:17
    5 0xe0d12c84a678 in gsignal signal/../sysdeps/posix/raise.c:26:13
    6 0xe0d12c83712c in abort stdlib/abort.c:79:7
    7 0xe0d12d214724 in _zlog_assert_failed /home/ubuntu/frr-public/frr_public_private-libfuzzer/lib/zlog.c:789:2
    8 0xe0d12d1285e4 in stream_get /home/ubuntu/frr-public/frr_public_private-libfuzzer/lib/stream.c:324:3
    9 0xb50b9f8e47c4 in bgp_attr_encap /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_attr.c:2758:3
    10 0xb50b9f8dcd38 in bgp_attr_parse /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_attr.c:3783:10
    11 0xb50b9faf74b4 in bgp_update_receive /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:2383:20
    12 0xb50b9faf1dcc in bgp_process_packet /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:4075:11
    13 0xb50b9f8c90d0 in LLVMFuzzerTestOneInput /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_main.c:582:3
```

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

9 months agoMerge pull request #16478 from FRRouting/mergify/bp/stable/9.1/pr-16472
Jafar Al-Gharaibeh [Thu, 25 Jul 2024 20:58:40 +0000 (16:58 -0400)]
Merge pull request #16478 from FRRouting/mergify/bp/stable/9.1/pr-16472

pimd: Fix msdp setting of sa->rp (backport #16472)

9 months agopimd: Fix msdp setting of sa->rp 16478/head
Donald Sharp [Thu, 25 Jul 2024 11:50:32 +0000 (07:50 -0400)]
pimd: Fix msdp setting of sa->rp

The code is clearly incorrect.  After consultation with
the original author this is the decided change.

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

9 months agoMerge pull request #16445 from FRRouting/mergify/bp/stable/9.1/pr-16376
Russ White [Tue, 23 Jul 2024 21:52:53 +0000 (17:52 -0400)]
Merge pull request #16445 from FRRouting/mergify/bp/stable/9.1/pr-16376

ospfd: fix internal ldp-sync state flags when feature is disabled (backport #16376)

9 months agoospfd: fix internal ldp-sync state flags when feature is disabled 16445/head
Christian Breunig [Sat, 13 Jul 2024 06:43:36 +0000 (08:43 +0200)]
ospfd: fix internal ldp-sync state flags when feature is disabled

When enabling "mpls ldp-sync" under "router ospf" ospfd configures
SET_FLAG(ldp_sync_info->flags, LDP_SYNC_FLAG_IF_CONFIG) so internally knowing
that the ldp-sync feature is enabled. However the flag is not cleared when
turning of the feature using "nompls ldp-sync"!

https://github.com/FRRouting/frr/issues/16375

Signed-off-by: Christian Breunig <christian@breunig.cc>
(cherry picked from commit 5a70378a47f541b0354fbb96770dd0a65ec552b8)

9 months agoMerge pull request #16435 from FRRouting/mergify/bp/stable/9.1/pr-16309
Donald Sharp [Tue, 23 Jul 2024 14:44:42 +0000 (10:44 -0400)]
Merge pull request #16435 from FRRouting/mergify/bp/stable/9.1/pr-16309

pimd: fix crash on non-existent interface (backport #16309)

9 months agopimd: fix crash on non-existent interface 16435/head
Louis Scalbert [Fri, 28 Jun 2024 11:22:36 +0000 (13:22 +0200)]
pimd: fix crash on non-existent interface

Fix the following crash when pim options are (un)configured on an
non-existent interface.

> r1(config)# int fgljdsf
> r1(config-if)# no ip pim unicast-bsm
> vtysh: error reading from pimd: Connection reset by peer (104)Warning: closing connection to pimd because of an I/O error!

> #0  raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1  0x00007f70c8f32249 in core_handler (signo=11, siginfo=0x7fffff88e4f0, context=0x7fffff88e3c0) at lib/sigevent.c:258
> #2  <signal handler called>
> #3  0x0000556cfdd9b16d in lib_interface_pim_address_family_unicast_bsm_modify (args=0x7fffff88f130) at pimd/pim_nb_config.c:1910
> #4  0x00007f70c8efdcb5 in nb_callback_modify (context=0x556d00032b60, nb_node=0x556cffeeb9b0, event=NB_EV_APPLY, dnode=0x556d00031670, resource=0x556d00032b48, errmsg=0x7fffff88f710 "", errmsg_len=8192)
>     at lib/northbound.c:1538
> #5  0x00007f70c8efe949 in nb_callback_configuration (context=0x556d00032b60, event=NB_EV_APPLY, change=0x556d00032b10, errmsg=0x7fffff88f710 "", errmsg_len=8192) at lib/northbound.c:1888
> #6  0x00007f70c8efee82 in nb_transaction_process (event=NB_EV_APPLY, transaction=0x556d00032b60, errmsg=0x7fffff88f710 "", errmsg_len=8192) at lib/northbound.c:2016
> #7  0x00007f70c8efd658 in nb_candidate_commit_apply (transaction=0x556d00032b60, save_transaction=true, transaction_id=0x0, errmsg=0x7fffff88f710 "", errmsg_len=8192) at lib/northbound.c:1356
> #8  0x00007f70c8efd78e in nb_candidate_commit (context=..., candidate=0x556cffeb0e80, save_transaction=true, comment=0x0, transaction_id=0x0, errmsg=0x7fffff88f710 "", errmsg_len=8192) at lib/northbound.c:1389
> #9  0x00007f70c8f03e58 in nb_cli_classic_commit (vty=0x556d00025a80) at lib/northbound_cli.c:51
> #10 0x00007f70c8f043f8 in nb_cli_apply_changes_internal (vty=0x556d00025a80,
>     xpath_base=0x7fffff893bb0 "/frr-interface:lib/interface[name='fgljdsf']/frr-pim:pim/address-family[address-family='frr-routing:ipv4']", clear_pending=false) at lib/northbound_cli.c:178
> #11 0x00007f70c8f0475d in nb_cli_apply_changes (vty=0x556d00025a80, xpath_base_fmt=0x556cfdde9fe0 "./frr-pim:pim/address-family[address-family='%s']") at lib/northbound_cli.c:234
> #12 0x0000556cfdd8298f in pim_process_no_unicast_bsm_cmd (vty=0x556d00025a80) at pimd/pim_cmd_common.c:3493
> #13 0x0000556cfddcf782 in no_ip_pim_ucast_bsm (self=0x556cfde40b20 <no_ip_pim_ucast_bsm_cmd>, vty=0x556d00025a80, argc=4, argv=0x556d00031500) at pimd/pim_cmd.c:4950
> #14 0x00007f70c8e942f0 in cmd_execute_command_real (vline=0x556d00032070, vty=0x556d00025a80, cmd=0x0, up_level=0) at lib/command.c:1002
> #15 0x00007f70c8e94451 in cmd_execute_command (vline=0x556d00032070, vty=0x556d00025a80, cmd=0x0, vtysh=0) at lib/command.c:1061
> #16 0x00007f70c8e9499f in cmd_execute (vty=0x556d00025a80, cmd=0x556d00030320 "no ip pim unicast-bsm", matched=0x0, vtysh=0) at lib/command.c:1227
> #17 0x00007f70c8f51e44 in vty_command (vty=0x556d00025a80, buf=0x556d00030320 "no ip pim unicast-bsm") at lib/vty.c:616
> #18 0x00007f70c8f53bdd in vty_execute (vty=0x556d00025a80) at lib/vty.c:1379
> #19 0x00007f70c8f55d59 in vtysh_read (thread=0x7fffff896600) at lib/vty.c:2374
> #20 0x00007f70c8f4b209 in event_call (thread=0x7fffff896600) at lib/event.c:2011
> #21 0x00007f70c8ed109e in frr_run (master=0x556cffdb4ea0) at lib/libfrr.c:1217
> #22 0x0000556cfdddec12 in main (argc=2, argv=0x7fffff896828, envp=0x7fffff896840) at pimd/pim_main.c:165
> (gdb) f 3
> #3  0x0000556cfdd9b16d in lib_interface_pim_address_family_unicast_bsm_modify (args=0x7fffff88f130) at pimd/pim_nb_config.c:1910
> 1910 pim_ifp->ucast_bsm_accept =
> (gdb) list
> 1905 case NB_EV_ABORT:
> 1906 break;
> 1907 case NB_EV_APPLY:
> 1908 ifp = nb_running_get_entry(args->dnode, NULL, true);
> 1909 pim_ifp = ifp->info;
> 1910 pim_ifp->ucast_bsm_accept =
> 1911 yang_dnode_get_bool(args->dnode, NULL);
> 1912
> 1913 break;
> 1914 }
> (gdb) p pim_ifp
> $1 = (struct pim_interface *) 0x0

Fixes: 3bb513c399 ("lib: adapt to version 2 of libyang")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 6952bea5cdd38057bf8c0a5e9c0fbe916dc73953)

9 months agoMerge pull request #16397 from FRRouting/mergify/bp/stable/9.1/pr-16365
Jafar Al-Gharaibeh [Wed, 17 Jul 2024 16:15:59 +0000 (12:15 -0400)]
Merge pull request #16397 from FRRouting/mergify/bp/stable/9.1/pr-16365

isisd: fix crash when calculating the neighbor spanning tree based on the fragmented LSP (backport #16365)

9 months agoisisd: fix crash when calculating the neighbor spanning tree based on the fragmented LSP 16397/head
zhou-run [Thu, 11 Jul 2024 03:35:34 +0000 (11:35 +0800)]
isisd: fix crash when calculating the neighbor spanning tree based on the fragmented LSP

1. When the root IS regenerates an LSP, it calls lsp_build() -> lsp_clear_data() to free the TLV memory of the first fragment and all other fragments. If the number of fragments in the regenerated LSP decreases or if no fragmentation is needed, the extra LSP fragments are not immediately deleted. Instead, lsp_seqno_update() -> lsp_purge() is called to set the remaining time to zero and start aging, while also notifying other IS nodes to age these fragments. lsp_purge() usually does not reset lsp->hdr.seqno to zero because the LSP might recover during the aging process.
2. When other IS nodes receive an LSP, they always call process_lsp() -> isis_unpack_tlvs() to allocate TLV memory for the LSP. This does not differentiate whether the received LSP has a remaining lifetime of zero. Therefore, it is rare for an LSP of a non-root IS to have empty TLVs. Of course, if an LSP with a remaining time of zero and already corrupted is received, lsp_update() -> lsp_purge() will be called to free the TLV memory of the LSP, but this scenario is rare.
3. In LFA calculations, neighbors of the root IS are traversed, and each neighbor is taken as a new root to compute the neighbor SPT. During this process, the old root IS will serve as a neighbor of the new root IS, triggering a call to isis_spf_process_lsp() to parse the LSP of the old root IS and obtain its IP vertices and neighboring IS vertices. However, isis_spf_process_lsp() only checks whether the TLVs in the first fragment of the LSP exist, and does not check the TLVs in the fragmented LSP. If the TLV memory of the fragmented LSP of the old root IS has been freed, it can lead to a null pointer access, causing the current crash.

Additionally, for the base SPT, there are only two places where the LSP of the root IS is parsed:
1. When obtaining the UP neighbors of the root IS via spf_adj_list_parse_lsp().
2. When preloading the IP vertices of the root IS via isis_lsp_iterate_ip_reach().
Both of these checks ensure that frag->tlvs is not null, and they do not subsequently call isis_spf_process_lsp() to parse the root IS's LSP. It is very rare for non-root IS LSPs to have empty TLVs unless they are corrupted LSPs awaiting deletion. If it happens, a crash will occur.

The backtrace is as follows:
(gdb) bt
#0  0x00007f3097281fe1 in raise () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f30973a2972 in core_handler (signo=11, siginfo=0x7ffce66c2870, context=0x7ffce66c2740) at ../lib/sigevent.c:261
#2  <signal handler called>
#3  0x000055dfa805512b in isis_spf_process_lsp (spftree=0x55dfa950eee0, lsp=0x55dfa94cb590, cost=10, depth=1, root_sysid=0x55dfa950ef6c "", parent=0x55dfa952fca0)
    at ../isisd/isis_spf.c:898
#4  0x000055dfa805743b in isis_spf_loop (spftree=0x55dfa950eee0, root_sysid=0x55dfa950ef6c "") at ../isisd/isis_spf.c:1688
#5  0x000055dfa805784f in isis_run_spf (spftree=0x55dfa950eee0) at ../isisd/isis_spf.c:1808
#6  0x000055dfa8037ff5 in isis_spf_run_neighbors (spftree=0x55dfa9474440) at ../isisd/isis_lfa.c:1259
#7  0x000055dfa803ac17 in isis_spf_run_lfa (area=0x55dfa9477510, spftree=0x55dfa9474440) at ../isisd/isis_lfa.c:2300
#8  0x000055dfa8057964 in isis_run_spf_with_protection (area=0x55dfa9477510, spftree=0x55dfa9474440) at ../isisd/isis_spf.c:1827
#9  0x000055dfa8057c15 in isis_run_spf_cb (thread=0x7ffce66c38e0) at ../isisd/isis_spf.c:1889
#10 0x00007f30973bbf04 in thread_call (thread=0x7ffce66c38e0) at ../lib/thread.c:1990
#11 0x00007f309735497b in frr_run (master=0x55dfa91733c0) at ../lib/libfrr.c:1198
#12 0x000055dfa8029d5d in main (argc=5, argv=0x7ffce66c3b08, envp=0x7ffce66c3b38) at ../isisd/isis_main.c:273
(gdb) f 3
#3  0x000055dfa805512b in isis_spf_process_lsp (spftree=0x55dfa950eee0, lsp=0x55dfa94cb590, cost=10, depth=1, root_sysid=0x55dfa950ef6c "", parent=0x55dfa952fca0)
    at ../isisd/isis_spf.c:898
898     ../isisd/isis_spf.c: No such file or directory.
(gdb) p te_neighs
$1 = (struct isis_item_list *) 0x120
(gdb) p lsp->tlvs
$2 = (struct isis_tlvs *) 0x0
(gdb) p lsp->hdr
$3 = {pdu_len = 27, rem_lifetime = 0, lsp_id = "\000\000\000\000\000\001\000\001", seqno = 4, checksum = 59918, lsp_bits = 1 '\001'}

The backtrace provided above pertains to version 8.5.4, but it seems that the same issue exists in the code of the master branch as well.

I have reviewed the process for calculating the SPT based on the LSP, and isis_spf_process_lsp() is the only function that does not check whether the TLVs in the fragments are empty. Therefore, I believe that modifying this function alone should be sufficient. If the TLVs of the current fragment are already empty, we do not need to continue processing subsequent fragments. This is consistent with the behavior where we do not process fragments if the TLVs of the first fragment are empty.
Of course, one could argue that lsp_purge() should still retain the TLV memory, freeing it and then reallocating it if needed. However, this is a debatable point because in some scenarios, it is permissible for the LSP to have empty TLVs. For example, after receiving an SNP (Sequence Number PDU) message, an empty LSP (with lsp->hdr.seqno = 0) might be created by calling lsp_new. If the corresponding LSP message is discarded due to domain or area authentication failure, the TLV memory wouldn't be allocated.

Test scenario:
In an LFA network, importing a sufficient number of static routes to cause LSP fragmentation, and then rolling back the imported static routes so that the LSP is no longer fragmented, can easily result in this issue.

Signed-off-by: zhou-run <zhou.run@h3c.com>
(cherry picked from commit e905177a8c9d67713682d46934c7a87a0913c250)

9 months agoMerge pull request #16389 from FRRouting/mergify/bp/stable/9.1/pr-16373
Mark Stapp [Tue, 16 Jul 2024 11:55:50 +0000 (07:55 -0400)]
Merge pull request #16389 from FRRouting/mergify/bp/stable/9.1/pr-16373

staticd: fix missing static routes (backport #16373)

9 months agozebra: fix missing static routes 16389/head
anlan_cs [Fri, 12 Jul 2024 09:03:03 +0000 (17:03 +0800)]
zebra: fix missing static routes

Use `vtysh` with this input file:
```
ip route A nh1
ip route A nh2
ip route B nh1
ip route B nh2
```

When running "ip route B" with "nh1" and "nh2", the procedure maybe is:
1) Create the two nexthops: "nh1" and "nh2".
2) Register "nh1" with `static_zebra_nht_register()`, then the states of both
   "nh1" and "nht2" are set to "STATIC_SENT_TO_ZEBRA".
3) Register "nh2" with `static_zebra_nht_register()`, then only the routes with
   nexthop of "STATIC_START" will be sent to zebra.

So, send the routes with the nexthop of "STATIC_SENT_TO_ZEBRA" to zebra.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
(cherry picked from commit 4518d386f7683289b079708fcdb0c42ced4754d9)

9 months agoMerge pull request #16381 from FRRouting/mergify/bp/stable/9.1/pr-16350
Jafar Al-Gharaibeh [Mon, 15 Jul 2024 18:43:02 +0000 (14:43 -0400)]
Merge pull request #16381 from FRRouting/mergify/bp/stable/9.1/pr-16350

zebra: Fix to avoid two Vrfs with same table ids (backport #16350)

9 months agozebra: Fix to avoid two Vrfs with same table ids 16381/head
Rajasekar Raja [Fri, 5 Jul 2024 23:02:12 +0000 (16:02 -0700)]
zebra: Fix to avoid two Vrfs with same table ids

During internal testing, when the following sequence is followed, two
non default vrfs end up pointing to the same table-id

 - Initially vrf201 has table id 1002
 - ip link add dev vrf202 type vrf table 1002
 - ip link set dev vrf202 up
 - ip link set dev <intrerface> master vrf202

This will ideally lead to zebra exit since this is a misconfiguration as
expected.

However if we perform a restart frr.service at this point, we end up
having two vrfs pointing to same table-id and bad things can happen.
This is because in the interface_vrf_change, we incorrectly check for
vrf_lookup_by_id() to evaluate if there is a misconfig. This works well
for a non restart case but not for the startup case.

root@mlx-3700-20:mgmt:/var/log/frr# sudo vtysh -c "sh vrf"
vrf mgmt id 37 table 1001
vrf vrf201 id 46 table 1002
vrf vrf202 id 59 table 1002 >>>>

Fix: in all cases of misconfiguration, exit zebra as expected.

Ticket :#3970414

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
(cherry picked from commit c77e15710d6a3a9be71f41a9ce608f06b2795dfb)

9 months agoMerge pull request #16337 from FRRouting/mergify/bp/stable/9.1/pr-16226
Donald Sharp [Wed, 3 Jul 2024 12:41:37 +0000 (08:41 -0400)]
Merge pull request #16337 from FRRouting/mergify/bp/stable/9.1/pr-16226

ldpd: fix wrong gtsm count (backport #16226)

9 months agoMerge pull request #16322 from opensourcerouting/fix/backport_fd3e0047d389569d4736853...
Donald Sharp [Wed, 3 Jul 2024 10:58:42 +0000 (06:58 -0400)]
Merge pull request #16322 from opensourcerouting/fix/backport_fd3e0047d389569d473685369acefd8e448e0e31_9.1

bgpd: Ignore RFC8212 for BGP Confederations