]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
7 months agoFRR Release 9.1.2 rc/9.1.2
Donatas Abraitis [Wed, 11 Sep 2024 08:29:29 +0000 (11:29 +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

9 months agoldpd: fix wrong gtsm count 16337/head
anlan_cs [Sat, 15 Jun 2024 12:34:20 +0000 (20:34 +0800)]
ldpd: fix wrong gtsm count

In linux networking stack, the received mpls packets will be processed
by the host *twice*, one as mpls packet, the other as ip packet, so
its ttl decreased 1.

So, we need release the `IP_MINTTL` value if gtsm is enabled, it is for the
mpls packets of neighbor session caused by the command:
`label local advertise explicit-null`.

This change makes the gtsm mechanism a bit deviation.

Fix PR #8313

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

9 months agoMerge pull request #16320 from FRRouting/mergify/bp/stable/9.1/pr-16233
Donald Sharp [Tue, 2 Jul 2024 16:25:11 +0000 (12:25 -0400)]
Merge pull request #16320 from FRRouting/mergify/bp/stable/9.1/pr-16233

ripd/ripd.c - rip_auth_md5 : Change the start value of sequence 1 to 0 (backport #16233)

9 months agobgpd: Ignore RFC8212 for BGP Confederations 16322/head
Donatas Abraitis [Thu, 27 Jun 2024 19:46:58 +0000 (22:46 +0300)]
bgpd: Ignore RFC8212 for BGP Confederations

RFC 8212 should be restricted for eBGP peers.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
9 months agoripd: Change the start value of sequence 1 to 0 16320/head
T-Nicolas [Mon, 17 Jun 2024 13:05:58 +0000 (15:05 +0200)]
ripd: Change the start value of sequence 1 to 0

Signed-off-by: T-Nicolas <github@toselli.email>
(cherry picked from commit 1a64fe4254759245a67fb279d67478922e00255e)

10 months agoMerge pull request #16293 from FRRouting/mergify/bp/stable/9.1/pr-16214
Russ White [Tue, 25 Jun 2024 11:40:43 +0000 (07:40 -0400)]
Merge pull request #16293 from FRRouting/mergify/bp/stable/9.1/pr-16214

bgpd: A couple more fixes for Tunnel encapsulation handling (backport #16214)

10 months agobgpd: Check if we have real stream data for tunnel encapsulation sub-tlvs 16293/head
Donatas Abraitis [Thu, 13 Jun 2024 06:00:21 +0000 (09:00 +0300)]
bgpd: Check if we have real stream data for tunnel encapsulation sub-tlvs

When the packet is malformed it can use whatever values it wants. Let's check
what the real data we have in a stream instead of relying on malformed values.

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

10 months agobgpd: Adjust the length of tunnel encap sub-tlv by sub-tlv type
Donatas Abraitis [Thu, 13 Jun 2024 05:43:21 +0000 (08:43 +0300)]
bgpd: Adjust the length of tunnel encap sub-tlv by sub-tlv type

Fixes: 79563af564ad0fe5b9c8d95bf080d570f87b1859 ("bgpd: Get 1 or 2 octets for Sub-TLV length (Tunnel Encap attr)")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 34b209f0ae2caca0d1ebcde9d4095375ac31b562)

10 months agoMerge pull request #16276 from FRRouting/mergify/bp/stable/9.1/pr-16242
Donatas Abraitis [Tue, 25 Jun 2024 10:46:49 +0000 (13:46 +0300)]
Merge pull request #16276 from FRRouting/mergify/bp/stable/9.1/pr-16242

bgpd: Set last reset reason to admin shutdown if it was manually (backport #16242)

10 months agoMerge pull request #16280 from FRRouting/mergify/bp/stable/9.1/pr-16211
Jafar Al-Gharaibeh [Tue, 25 Jun 2024 05:26:28 +0000 (01:26 -0400)]
Merge pull request #16280 from FRRouting/mergify/bp/stable/9.1/pr-16211

bgpd: Check if we have really enough data before doing memcpy for software version (backport #16211)

10 months agobgpd: Check if we have really enough data before doing memcpy for software version 16280/head
Donatas Abraitis [Wed, 12 Jun 2024 19:54:45 +0000 (22:54 +0300)]
bgpd: Check if we have really enough data before doing memcpy for software version

If we receive CAPABILITY message (software-version), we SHOULD check if we really
have enough data before doing memcpy(), that could also lead to buffer overflow.

(data + len > end) is not enough, because after this check we do data++ and later
memcpy(..., data, len). That means we have one more byte.

Hit this through fuzzing by

```
    0 0xaaaaaadf872c in __asan_memcpy (/home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/.libs/bgpd+0x35872c) (BuildId: 9c6e455d0d9a20f5a4d2f035b443f50add9564d7)
    1 0xaaaaab06bfbc in bgp_dynamic_capability_software_version /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:3713:3
    2 0xaaaaab05ccb4 in bgp_capability_msg_parse /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:3839:4
    3 0xaaaaab05c074 in bgp_capability_receive /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:3980:9
    4 0xaaaaab05e48c in bgp_process_packet /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:4109:11
    5 0xaaaaaae36150 in LLVMFuzzerTestOneInput /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_main.c:582:3
```

Hit this again by Iggy \m/

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

10 months agobgpd: Remove redundant whitespace before printing the reason of the failed peer 16276/head
Donatas Abraitis [Wed, 19 Jun 2024 11:32:16 +0000 (14:32 +0300)]
bgpd: Remove redundant whitespace before printing the reason of the failed peer

Before:

```
Neighbor        EstdCnt DropCnt ResetTime Reason
127.0.0.1             0       0     never  Waiting for peer OPEN (n/a)
```

After:

```
Neighbor        EstdCnt DropCnt ResetTime Reason
127.0.0.1             0       0     never Waiting for peer OPEN (n/a)
```

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

10 months agobgpd: Set last reset reason to admin shutdown if it was manually
Donatas Abraitis [Wed, 19 Jun 2024 11:09:00 +0000 (14:09 +0300)]
bgpd: Set last reset reason to admin shutdown if it was manually

Before this patch, we always printed the last reason "Waiting for OPEN", but
if it's a manual shutdown, then we technically are not waiting for OPEN.

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

10 months agoMerge pull request #16266 from FRRouting/mergify/bp/stable/9.1/pr-16252
Donatas Abraitis [Fri, 21 Jun 2024 14:51:03 +0000 (17:51 +0300)]
Merge pull request #16266 from FRRouting/mergify/bp/stable/9.1/pr-16252

zebra: fix evpn mh bond member proto reinstall (backport #16252)

10 months agozebra: fix evpn mh bond member proto reinstall 16266/head
Chirag Shah [Wed, 19 Jun 2024 00:21:49 +0000 (17:21 -0700)]
zebra: fix evpn mh bond member proto reinstall

In case of EVPN MH bond, a member port going in
protodown state due to external reason (one case being linkflap),
frr updates the state correctly but upon manually
clearing external reason trigger FRR to reinstate
protodown without any reason code.

Fix is to ensure if the protodown reason was external
and new state is to have protodown 'off' then do no reinstate
protodown.

Ticket: #3947432
Testing:
switch:#ip link show swp1
4: swp1: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 9216 qdisc
   pfifo_fast master bond1 state DOWN mode DEFAULT group default qlen
   1000
       link/ether 1c:34:da:2c:aa:68 brd ff:ff:ff:ff:ff:ff protodown on
       protodown_reason <linkflap>

switch:#ip link set swp1 protodown off protodown_reason linkflap off
switch:#ip link show swp1
 4: swp1: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 9216 qdisc
    pfifo_fast master bond1 state DOWN mode DEFAULT group default qlen
    1000
        link/ether 1c:34:da:2c:aa:68 brd ff:ff:ff:ff:ff:ff

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

10 months agoMerge pull request #16204 from FRRouting/mergify/bp/stable/9.1/pr-16191
Jafar Al-Gharaibeh [Thu, 13 Jun 2024 19:57:30 +0000 (14:57 -0500)]
Merge pull request #16204 from FRRouting/mergify/bp/stable/9.1/pr-16191

lib: fix copy srte_color from zapi_nexthop structure (backport #16191)

10 months agolib: fix copy srte_color from zapi_nexthop structure 16204/head
Philippe Guibert [Sun, 17 Dec 2023 20:04:31 +0000 (21:04 +0100)]
lib: fix copy srte_color from zapi_nexthop structure

When switching from nexthop to zapi_nexthop, the srte color
is copied. Do the same in reverse.

Fixes: 31f937fb43f4 ("lib, zebra: Add SR-TE policy infrastructure to zebra")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit 49bc1b6c21e8da0da82746373a7257aeb2c9fa4a)

10 months agoFRR Release 9.1.1 docker/9.1.1 frr-9.1.1
Jafar Al-Gharaibeh [Thu, 6 Jun 2024 05:02:14 +0000 (00:02 -0500)]
FRR Release 9.1.1

Changelog:

bgpd
    "default-originate" shouldn't withdraw non-default routes
    Aggr summary-only suppressed export to evpn
    Allow using optional table id for negative `no set table x` command
    Arrange peer notification to after zebra announce
    Check bgp evpn instance presence in soo
    Convert the bgp_advertise_attr->adv to a fifo
    Do not show tcp mss if the socket is broken
    Ensure bgp does not stop monitoring nexthops
    Ensure community data is freed in some cases.
    Ensure that the correct aspath is free'd
    Fix `match peer` when switching between ipv4/ipv6/interface
    Fix `no set as-path prepend asnum...`
    Fix bgp_best_selection heap-use-after-free
    Fix crash when deleting the srv6 locator
    Fix display when using `missing-as-worst`
    Fix dynamic peer graceful restart race condition
    Fix ecommunity_fill_pbr_action heap-buffer-overflow
    Fix error handling when receiving bgp prefix sid attribute
    Fix errors handling for mp/gr capabilities as dynamic capability
    Fix format overflow for graceful-restart debug logs
    Fix logging message when receiving a software version capability
    Fix no bgp as-path access-list  issue
    Fix route-map match probability deconfiguration callback
    Fix srv6 memory leak detection
    Fix the order of null check and zapi decode
    Fix vrf leaking with 'no bgp network import-check
    Free memory for srv6 functions and locator chunks
    Ignore validating the attribute flags if path-attribute is configured
    Include unsuppress-map as a valid outgoing policy
    Lttng tp add evpn route events
    Make `suppress-fib-pending` clear peering
    Note when receiving but not understanding a route notification
    Prevent from one more cve triggering this place
    Set correct ttl for the dynamic neighbor peers
    Update default-originate route-map actual map structure
    Revert "Fix pointer arithmetic in bgp snmp module"

doc
    Add param range for graceful-restart helper supported-grace-time
    Remove duplicated show route-map

isisd
    Fix _isis_spftree_del heap-use-after-free
    Fix dislaying lsp id
    Fix heap-after-free with prefix sid
    Fix ip/ipv6 reachability tlvs

lib
    Check for not being a blackhole route
    Fix show route map json output
    Do not convert evpn prefixes into ipv4/ipv6 if not needed
    Replace deprecated ares_gethostbyname
    Replace deprecated ares_process()

nhrpd
    Fix nhrp_peer leak
    Fix race condition
    Fix core dump on shutdown

ospf6d
    Ospfv3 route change comparision fixed for asbr-only change
    Prevent heap-buffer-overflow with unknown type

ospfd
    Add support for "no router-info [<area|as>] command"
    Can not delete "segment-routing node-msd" when sr if off
    Correct lsa parser which fulfill the ted
    Correct opaque lsa extended parser
    Correct sid check size
    Fix ospf dead-interval minimal hello-multiplier param range
    Fix the bug where ip_ospf_dead-interval_minimal_hello-multiplier did not reset hello timer
    Protect call to get_edge() in ospf_te.c
    Solved crash in ospf te parsing
    Solved crash in ri parsing with ospf te
    Revert "Fix some dicey pointer arith in snmp module"

pbrd
    Fix map seq installed flag in json
    Fix pbr handling for last rule deletion

pimd
    Fix crash unconfiguring rp keepalive timer
    Fix crash when configuring ssmpingd
    Fix dr-priority range
    Fix null register before aging out reg-stop
    Fix order of operations for evaluating join
    Re-evaluated s,g oils upon rp changes and for empty sg upstream oils
    Fix crash when mixing ssm/any-source joins

staticd
    Fix changing to source auto in bfd monitor

tests
    Check for 0.0.0.0/1 in bgp_default_route
    Check if ibgp session can drop invalid aigp attribute
    Extend tests for aspath exclude
    Update ospf te topotests

tools
    Apply black formatting for tools/frr-reload.py
    Fix frr-reload interface desc cmd
    Fix frr-reload multiple no description cmds
    Fix frr-reload multiple no description cmds
    Use error log level when failing to execute commands via frr-reload.py

topotests
    Do not check table version
    Redispatch tests in bfd_topo3
    Test wrong bfd source in bfd_topo3
    Vpnv4 route leaking with no import-check

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

zebra
    Add missing whitespace when printing route entry status
    Deny the routes if ip protocol cli refers to an undefined rmap
    Don't deref vxlan-vni array
    Fix crash if macvlan link in another netns
    Fix crash on macvlan link down/up
    Fix evpn svd based remote nh neigh del
    Fix mpls command
    Fix route deletion during zebra shutdown
    The dplane_fpm_nl return path leaks memory

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
10 months agoMerge pull request #16166 from opensourcerouting/fix/backport_627fb271f0a5103141f2ecc...
Donald Sharp [Wed, 5 Jun 2024 17:06:45 +0000 (13:06 -0400)]
Merge pull request #16166 from opensourcerouting/fix/backport_627fb271f0a5103141f2eccda53dd2fa08ed0819_9.1

nhrpd: Fix nhrp_peer leak

10 months agonhrpd: Fix nhrp_peer leak 16166/head
Keelan10 [Wed, 5 Jun 2024 10:34:18 +0000 (13:34 +0300)]
nhrpd: Fix nhrp_peer leak

- Addressed memory leak by removing `&c->peer_notifier` from the notifier list on termination. Retaining it caused the notifier list to stay active, preventing the deletion of `c->cur.peer`
  thereby causing a memory leak.

- Reordered termination steps to call `vrf_terminate` before `nhrp_vc_terminate`, preventing a heap-use-after-free issue when `nhrp_vc_notify_del` is invoked in `nhrp_peer_check_delete`.

- Added an if statement to avoid passing NULL as hash to `hash_release`, which leads to a SIGSEGV.

The ASan leak log for reference:

```
***********************************************************************************
Address Sanitizer Error detected in nhrp_topo.test_nhrp_topo/r1.asan.nhrpd.20265

=================================================================
==20265==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x7f80270c9b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f8026ac1eb8 in qmalloc lib/memory.c:100
    #2 0x560fd648f0a6 in nhrp_peer_create nhrpd/nhrp_peer.c:175
    #3 0x7f8026a88d3f in hash_get lib/hash.c:147
    #4 0x560fd6490a5d in nhrp_peer_get nhrpd/nhrp_peer.c:228
    #5 0x560fd648a51a in nhrp_nhs_resolve_cb nhrpd/nhrp_nhs.c:297
    #6 0x7f80266b000f in resolver_cb_literal lib/resolver.c:234
    #7 0x7f8026b62e0e in event_call lib/event.c:1969
    #8 0x7f8026aa5437 in frr_run lib/libfrr.c:1213
    #9 0x560fd6488b4f in main nhrpd/nhrp_main.c:166
    #10 0x7f8025eb2c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 112 byte(s) leaked in 1 allocation(s).
***********************************************************************************

***********************************************************************************
Address Sanitizer Error detected in nhrp_topo.test_nhrp_topo/r2.asan.nhrpd.20400

=================================================================
==20400==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x7fb6e3ca5b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7fb6e369deb8 in qmalloc lib/memory.c:100
    #2 0x562652de40a6 in nhrp_peer_create nhrpd/nhrp_peer.c:175
    #3 0x7fb6e3664d3f in hash_get lib/hash.c:147
    #4 0x562652de5a5d in nhrp_peer_get nhrpd/nhrp_peer.c:228
    #5 0x562652de1e8e in nhrp_packet_recvraw nhrpd/nhrp_packet.c:325
    #6 0x7fb6e373ee0e in event_call lib/event.c:1969
    #7 0x7fb6e3681437 in frr_run lib/libfrr.c:1213
    #8 0x562652dddb4f in main nhrpd/nhrp_main.c:166
    #9 0x7fb6e2a8ec86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 112 byte(s) leaked in 1 allocation(s).
***********************************************************************************
```

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agoMerge pull request #16141 from LabNConsulting/dleroy/nhrpd-shutdown-backport-fix
Donald Sharp [Sat, 1 Jun 2024 14:05:09 +0000 (10:05 -0400)]
Merge pull request #16141 from LabNConsulting/dleroy/nhrpd-shutdown-backport-fix

nhrpd: core dump on shutdown (backport #15879)

10 months agoMerge pull request #16135 from FRRouting/mergify/bp/stable/9.1/pr-16111
Donald Sharp [Sat, 1 Jun 2024 14:04:54 +0000 (10:04 -0400)]
Merge pull request #16135 from FRRouting/mergify/bp/stable/9.1/pr-16111

ospf6d: Prevent heap-buffer-overflow with unknown type (backport #16111)

10 months agoMerge pull request #16132 from FRRouting/mergify/bp/stable/9.1/pr-16115
Donald Sharp [Sat, 1 Jun 2024 14:03:19 +0000 (10:03 -0400)]
Merge pull request #16132 from FRRouting/mergify/bp/stable/9.1/pr-16115

pimd: fix crash when mixing ssm/any-source joins (backport #16115)

10 months agonhrpd: core dump on shutdown backport fix 16141/head
Dave LeRoy [Fri, 31 May 2024 17:05:10 +0000 (10:05 -0700)]
nhrpd: core dump on shutdown backport fix

This fixes a merge conflict encountered when backporting PR 15879

Signed-off-by: Dave LeRoy <dleroy@labn.net>
10 months agoospf6d: Prevent heap-buffer-overflow with unknown type 16135/head
Iggy Frankovic [Thu, 30 May 2024 11:59:54 +0000 (07:59 -0400)]
ospf6d: Prevent heap-buffer-overflow with unknown type

When parsing a osf6 grace lsa field and we receive an
unknown tlv type, ospf6d was not incrementing the pointer
to get beyond the tlv.  Leaving a situation where ospf6d
would parse the packet incorrectly.

Signed-off-by: Iggy Frankovic <iggy07@gmail.com>
(cherry picked from commit 826f2510e67711045e52cf4b5e3ddef514ed556e)

10 months agopimd: fix crash when mixing ssm/any-source joins 16132/head
Jafar Al-Gharaibeh [Thu, 30 May 2024 17:46:47 +0000 (12:46 -0500)]
pimd: fix crash when mixing ssm/any-source joins

There is no reason to call `igmp_anysource_forward_stop()` inside a call to
`igmp_get_source_by_addr()`; not only it is not expected for a "get" function
to perform such an action, but also the decision to start/stop forwarding is
already handled correctly by pim outside `igmp_get_source_by_addr()`.
That call was left there from the days pim was initially imported into the sources.

The problem/crash was happening because `igmp_find_source_by_addr()` would fail to
find the group/source combo when mixing `(*, G)` and `(S, G)`. When having an existing
flow `(*, G)`, and a new `(S, G)` igmp is received, a new entry is correctly created.
`igmp_anysource_forward_stop(group)` always stops and eventually frees `(*, G)`, even
when the new igmp is `(S, G)`, leaving a bad state. I.e, the new entry for `(S, G)`
causes `(*, G)` to be deleted.

Tested the fix with multiple receivers on the same interface with several ssm and
any source senders and receivers with various combination of start/stop orders and
they all worked correctly.

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

11 months agoMerge pull request #16105 from FRRouting/mergify/bp/stable/9.1/pr-16098
Donald Sharp [Wed, 29 May 2024 16:16:24 +0000 (12:16 -0400)]
Merge pull request #16105 from FRRouting/mergify/bp/stable/9.1/pr-16098

ospf6d: OSPFv3 route change comparision fixed for ASBR-only change (backport #16098)

11 months agoospf6d: OSPFv3 route change comparision fixed for ASBR-only change 16105/head
Acee [Tue, 28 May 2024 14:02:27 +0000 (10:02 -0400)]
ospf6d: OSPFv3 route change comparision fixed for ASBR-only change

When a router route already exists in the area border routers table
as an ABR and it solely changes its ABR or ASBR status, the change
was missed and border route is not updated. This fixes the comparison
for the router_bits in the ospf6_path structure.

This fixes issue https://github.com/FRRouting/frr/issues/16053 although
the actual problem is not the computing router (r2) and not the OSPFv3
redistribution (r3).

Signed-off-by: Acee <aceelindem@gmail.com>
(cherry picked from commit 772688d2d3c03d8eeeb711c2fe3735c9e0885498)

11 months agoMerge pull request #16085 from FRRouting/mergify/bp/stable/9.1/pr-15674
Donald Sharp [Sat, 25 May 2024 14:51:35 +0000 (10:51 -0400)]
Merge pull request #16085 from FRRouting/mergify/bp/stable/9.1/pr-15674

ospfd: Solved crash in RI parsing with OSPF TE (backport #15674)

11 months agoospfd: protect call to get_edge() in ospf_te.c 16085/head
Olivier Dugeon [Tue, 16 Apr 2024 14:42:06 +0000 (16:42 +0200)]
ospfd: protect call to get_edge() in ospf_te.c

During fuzzing, Iggy Frankovic discovered that get_edge() function in ospf_te.c
could return null pointer, in particular when the link_id or advertised router
IP addresses are fuzzed. As the null pointer returned by get_edge() function is
not handlei by calling functions, this could cause ospfd crash.

This patch introduces new verification of returned pointer by get_edge()
function and stop the processing in case of null pointer. In addition, link ID
and advertiser router ID are validated before calling ls_find_edge_by_key() to
avoid the creation of a new edge with an invalid key.

CVE-2024-34088

Co-authored-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
(cherry picked from commit 8c177d69e32b91b45bda5fc5da6511fa03dc11ca)

11 months agoospfd: Correct Opaque LSA Extended parser
Olivier Dugeon [Fri, 5 Apr 2024 10:57:11 +0000 (12:57 +0200)]
ospfd: Correct Opaque LSA Extended parser

Iggy Frankovic discovered another ospfd crash when performing fuzzing of OSPF
LSA packets. The crash occurs in ospf_te_parse_ext_link() function when
attemping to read Segment Routing Adjacency SID subTLVs. The original code
doesn't check if the size of the Extended Link TLVs and subTLVs have the correct
length. In presence of erronous LSA, this will cause a buffer overflow and ospfd
crashes.

This patch introduces new verification of the subTLVs size for Extended Link
TLVs and subTLVs. Similar check has been also introduced for the Extended
Prefix TLV.

Co-authored-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
(cherry picked from commit 5557a289acdaeec8cc63ffc97b5c2abf6dee7b3a)

11 months agoospfd: Solved crash in RI parsing with OSPF TE
Olivier Dugeon [Wed, 3 Apr 2024 14:28:23 +0000 (16:28 +0200)]
ospfd: Solved crash in RI parsing with OSPF TE

Iggy Frankovic discovered another ospfd crash when performing fuzzing of OSPF
LSA packets. The crash occurs in ospf_te_parse_ri() function when attemping to
read Segment Routing subTLVs. The original code doesn't check if the size of
the SR subTLVs have the correct length. In presence of erronous LSA, this will
cause a buffer overflow and ospfd crash.

This patch introduces new verification of the subTLVs size for Router
Information TLV.

Co-authored-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
(cherry picked from commit f69d1313b19047d3d83fc2b36a518355b861dfc4)

11 months agoMerge pull request #16078 from FRRouting/mergify/bp/stable/9.1/pr-16021
Donald Sharp [Fri, 24 May 2024 14:06:38 +0000 (10:06 -0400)]
Merge pull request #16078 from FRRouting/mergify/bp/stable/9.1/pr-16021

isisd: fix heap-after-free with prefix sid (backport #16021)

11 months agoisisd: fix heap-after-free with prefix sid 16078/head
Louis Scalbert [Thu, 16 May 2024 14:44:03 +0000 (16:44 +0200)]
isisd: fix heap-after-free with prefix sid

> ==2334217==ERROR: AddressSanitizer: heap-use-after-free on address 0x61000001d0a0 at pc 0x563828c8de6f bp 0x7fffbdaee560 sp 0x7fffbdaee558
> READ of size 1 at 0x61000001d0a0 thread T0
>     #0 0x563828c8de6e in prefix_sid_cmp isisd/isis_spf.c:187
>     #1 0x7f84b8204f71 in hash_get lib/hash.c:142
>     #2 0x7f84b82055ec in hash_lookup lib/hash.c:184
>     #3 0x563828c8e185 in isis_spf_prefix_sid_lookup isisd/isis_spf.c:209
>     #4 0x563828c90642 in isis_spf_add2tent isisd/isis_spf.c:598
>     #5 0x563828c91cd0 in process_N isisd/isis_spf.c:824
>     #6 0x563828c93852 in isis_spf_process_lsp isisd/isis_spf.c:1041
>     #7 0x563828c98dde in isis_spf_loop isisd/isis_spf.c:1821
>     #8 0x563828c998de in isis_run_spf isisd/isis_spf.c:1983
>     #9 0x563828c99c7b in isis_run_spf_with_protection isisd/isis_spf.c:2009
>     #10 0x563828c9a60d in isis_run_spf_cb isisd/isis_spf.c:2090
>     #11 0x7f84b835c72d in event_call lib/event.c:2011
>     #12 0x7f84b8236d93 in frr_run lib/libfrr.c:1217
>     #13 0x563828c21918 in main isisd/isis_main.c:346
>     #14 0x7f84b7e4fd09 in __libc_start_main ../csu/libc-start.c:308
>     #15 0x563828c20df9 in _start (/usr/lib/frr/isisd+0xf5df9)
>
> 0x61000001d0a0 is located 96 bytes inside of 184-byte region [0x61000001d040,0x61000001d0f8)
> freed by thread T0 here:
>     #0 0x7f84b88a9b6f in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:123
>     #1 0x7f84b8263bae in qfree lib/memory.c:130
>     #2 0x563828c8e433 in isis_vertex_del isisd/isis_spf.c:249
>     #3 0x563828c91c95 in process_N isisd/isis_spf.c:811
>     #4 0x563828c93852 in isis_spf_process_lsp isisd/isis_spf.c:1041
>     #5 0x563828c98dde in isis_spf_loop isisd/isis_spf.c:1821
>     #6 0x563828c998de in isis_run_spf isisd/isis_spf.c:1983
>     #7 0x563828c99c7b in isis_run_spf_with_protection isisd/isis_spf.c:2009
>     #8 0x563828c9a60d in isis_run_spf_cb isisd/isis_spf.c:2090
>     #9 0x7f84b835c72d in event_call lib/event.c:2011
>     #10 0x7f84b8236d93 in frr_run lib/libfrr.c:1217
>     #11 0x563828c21918 in main isisd/isis_main.c:346
>     #12 0x7f84b7e4fd09 in __libc_start_main ../csu/libc-start.c:308
>
> previously allocated by thread T0 here:
>     #0 0x7f84b88aa037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
>     #1 0x7f84b8263a6c in qcalloc lib/memory.c:105
>     #2 0x563828c8e262 in isis_vertex_new isisd/isis_spf.c:225
>     #3 0x563828c904db in isis_spf_add2tent isisd/isis_spf.c:588
>     #4 0x563828c91cd0 in process_N isisd/isis_spf.c:824
>     #5 0x563828c93852 in isis_spf_process_lsp isisd/isis_spf.c:1041
>     #6 0x563828c98dde in isis_spf_loop isisd/isis_spf.c:1821
>     #7 0x563828c998de in isis_run_spf isisd/isis_spf.c:1983
>     #8 0x563828c99c7b in isis_run_spf_with_protection isisd/isis_spf.c:2009
>     #9 0x563828c9a60d in isis_run_spf_cb isisd/isis_spf.c:2090
>     #10 0x7f84b835c72d in event_call lib/event.c:2011
>     #11 0x7f84b8236d93 in frr_run lib/libfrr.c:1217
>     #12 0x563828c21918 in main isisd/isis_main.c:346
>     #13 0x7f84b7e4fd09 in __libc_start_main ../csu/libc-start.c:308
>
> SUMMARY: AddressSanitizer: heap-use-after-free isisd/isis_spf.c:187 in prefix_sid_cmp
> Shadow bytes around the buggy address:
>   0x0c207fffb9c0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
>   0x0c207fffb9d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa
>   0x0c207fffb9e0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
>   0x0c207fffb9f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa
>   0x0c207fffba00: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
> =>0x0c207fffba10: fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd fa
>   0x0c207fffba20: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
>   0x0c207fffba30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa
>   0x0c207fffba40: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
>   0x0c207fffba50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa
>   0x0c207fffba60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
> Shadow byte legend (one shadow byte represents 8 application bytes):
>   Addressable:           00
>   Partially addressable: 01 02 03 04 05 06 07
>   Heap left redzone:       fa
>   Freed heap region:       fd
>   Stack left redzone:      f1
>   Stack mid redzone:       f2
>   Stack right redzone:     f3
>   Stack after return:      f5
>   Stack use after scope:   f8
>   Global redzone:          f9
>   Global init order:       f6
>   Poisoned by user:        f7
>   Container overflow:      fc
>   Array cookie:            ac
>   Intra object redzone:    bb
>   ASan internal:           fe
>   Left alloca redzone:     ca
>   Right alloca redzone:    cb
>   Shadow gap:              cc
> ==2334217==ABORTING

Fixes: 2f7cc7bcd3 ("isisd: detect Prefix-SID collisions and handle them appropriately")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit e697de58431474cdb06eff79bcbc70de4215e222)

11 months agoMerge pull request #16061 from FRRouting/mergify/bp/stable/9.1/pr-16032
Donald Sharp [Tue, 21 May 2024 18:47:36 +0000 (14:47 -0400)]
Merge pull request #16061 from FRRouting/mergify/bp/stable/9.1/pr-16032

zebra: Deny the routes if ip protocol CLI refers to an undefined rmap (backport #16032)

11 months agozebra: Deny the routes if ip protocol CLI refers to an undefined rmap 16061/head
Pooja Jagadeesh Doijode [Thu, 16 May 2024 23:36:18 +0000 (16:36 -0700)]
zebra: Deny the routes if ip protocol CLI refers to an undefined rmap

Currently zebra does not deny the routes if `ip protocol <proto> route-map
FOO`
commmand is configured with reference to an undefined route-map (FOO in
this case).
However, on FRR restart, in zebra_route_map_check() routes get denied
if route-map name is available but the route-map is not defined. This
change was introduced in fd303a4ba14c762550db972317e1e88528768005.

Fix:
When `ip protocol <proto> route-map FOO` CLI is configured with reference to an
undefined route-map FOO, let the processing in ip_protocol_rm_add() and
ip_protocol_rm_del() go through so that zebra can deny the routes instead
of simply returning. This will result in consistent behavior.

Testing Done:

Before fix:
```
spine-1# configure
spine-1(config)# ip protocol bgp route-map rmap7

root@spine-1:mgmt:/var/home/cumulus# vtysh -c "show run" | grep rmap7
ip protocol bgp route-map rmap7
root@spine-1:mgmt:/var/home/cumulus#

spine-1(config)# do show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, A - Babel, D - SHARP, F - PBR, f - OpenFabric,
       Z - FRR,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

C>* 27.0.0.1/32 is directly connected, lo, 02:27:45
B>* 27.0.0.3/32 [20/0] via fe80::202:ff:fe00:21, downlink_1, weight 1, 02:27:35
B>* 27.0.0.4/32 [20/0] via fe80::202:ff:fe00:29, downlink_2, weight 1, 02:27:40
B>* 27.0.0.5/32 [20/0] via fe80::202:ff:fe00:31, downlink_3, weight 1, 02:27:40
B>* 27.0.0.6/32 [20/0] via fe80::202:ff:fe00:39, downlink_4, weight 1, 02:27:40
```

After fix:
```
spine-1(config)# ip protocol bgp route-map route-map67
spine-1(config)# do show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, A - Babel, D - SHARP, F - PBR, f - OpenFabric,
       Z - FRR,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

C>* 27.0.0.1/32 is directly connected, lo, 00:35:03
B   27.0.0.3/32 [20/0] via fe80::202:ff:fe00:21, downlink_1 inactive, weight 1, 00:34:58
B   27.0.0.4/32 [20/0] via fe80::202:ff:fe00:29, downlink_2 inactive, weight 1, 00:34:57
B   27.0.0.5/32 [20/0] via fe80::202:ff:fe00:31, downlink_3 inactive, weight 1, 00:34:57
B   27.0.0.6/32 [20/0] via fe80::202:ff:fe00:39, downlink_4 inactive, weight 1, 00:34:58
spine-1(config)#

root@spine-1:mgmt:/var/home/cumulus# ip route show
root@spine-1:mgmt:/var/home/cumulus#
```

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
(cherry picked from commit 705e8ef78f84dea3af5943a74571f968ad076c8d)

11 months agoMerge pull request #16046 from FRRouting/mergify/bp/stable/9.1/pr-16033
Donald Sharp [Mon, 20 May 2024 19:20:51 +0000 (15:20 -0400)]
Merge pull request #16046 from FRRouting/mergify/bp/stable/9.1/pr-16033

bgpd: Fix logging message when receiving a software version capability (backport #16033)

11 months agoMerge pull request #16048 from FRRouting/mergify/bp/stable/9.1/pr-16022
Donald Sharp [Mon, 20 May 2024 19:19:35 +0000 (15:19 -0400)]
Merge pull request #16048 from FRRouting/mergify/bp/stable/9.1/pr-16022

bgpd: Fix `match peer` when switching between IPv4/IPv6/interface (backport #16022)

11 months agobgpd: Fix `match peer` when switching between IPv4/IPv6/interface 16048/head
Donatas Abraitis [Thu, 16 May 2024 17:49:56 +0000 (20:49 +0300)]
bgpd: Fix `match peer` when switching between IPv4/IPv6/interface

Without this patch we MUST follow this sequence:

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

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

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

11 months agobgpd: Fix logging message when receiving a software version capability 16046/head
Donatas Abraitis [Fri, 17 May 2024 19:04:40 +0000 (22:04 +0300)]
bgpd: Fix logging message when receiving a software version capability

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

11 months agoMerge pull request #16039 from FRRouting/mergify/bp/stable/9.1/pr-16019
Jafar Al-Gharaibeh [Sun, 19 May 2024 05:50:06 +0000 (00:50 -0500)]
Merge pull request #16039 from FRRouting/mergify/bp/stable/9.1/pr-16019

zebra: fix mpls command (backport #16019)

11 months agozebra: fix mpls command 16039/head
anlan_cs [Thu, 16 May 2024 08:44:45 +0000 (16:44 +0800)]
zebra: fix mpls command

Configured with "mpls label bind 1.1.1.1/32 explicit-null", the running
configuration is:
```
!
mpls label bind 1.1.1.1/32 IPv4 Explicit Null
!
```

After this commit, the running configuration is:
```
!
mpls label bind 1.1.1.1/32 explicit-null
!
```

And add the support for the "no" form:
```
anlan(config)# mpls label bind 1.1.1.1/32 explicit-null
anlan(config)# no mpls label bind 1.1.1.1/32 explicit-null
```

Signed-off-by: anlan_cs <anlan_cs@tom.com>
(cherry picked from commit 05ad3ccb034c174d2e853e88b826ca0db1e77f45)

11 months agoMerge pull request #16031 from FRRouting/mergify/bp/stable/9.1/pr-15711
Donald Sharp [Fri, 17 May 2024 15:49:10 +0000 (11:49 -0400)]
Merge pull request #16031 from FRRouting/mergify/bp/stable/9.1/pr-15711

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

11 months agotopotests: do not check table version 16031/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 agoMerge pull request #16026 from FRRouting/mergify/bp/stable/9.1/pr-16020
Donald Sharp [Fri, 17 May 2024 11:23:51 +0000 (07:23 -0400)]
Merge pull request #16026 from FRRouting/mergify/bp/stable/9.1/pr-16020

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

11 months agobgpd: fix dynamic peer graceful restart race condition 16026/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 #15997 from FRRouting/mergify/bp/stable/9.1/pr-15655
Donatas Abraitis [Mon, 13 May 2024 12:04:27 +0000 (15:04 +0300)]
Merge pull request #15997 from FRRouting/mergify/bp/stable/9.1/pr-15655

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

11 months agoisisd: fix ip/ipv6 reachability tlvs 15997/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 #15984 from FRRouting/mergify/bp/stable/9.1/pr-15975
Jafar Al-Gharaibeh [Thu, 9 May 2024 17:03:03 +0000 (12:03 -0500)]
Merge pull request #15984 from FRRouting/mergify/bp/stable/9.1/pr-15975

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

11 months agopimd: fix order of operations for evaluating join 15984/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 agoMerge pull request #15971 from FRRouting/mergify/bp/stable/9.1/pr-15920
Donald Sharp [Thu, 9 May 2024 11:10:49 +0000 (07:10 -0400)]
Merge pull request #15971 from FRRouting/mergify/bp/stable/9.1/pr-15920

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

11 months agozebra: fix EVPN svd based remote nh neigh del 15971/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 #15957 from FRRouting/mergify/bp/stable/9.1/pr-15895
Donald Sharp [Wed, 8 May 2024 13:57:39 +0000 (09:57 -0400)]
Merge pull request #15957 from FRRouting/mergify/bp/stable/9.1/pr-15895

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

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

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

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

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

11 months agobgpd: Allow using optional table id for negative `no set table X` command 15959/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 15957/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 #15871 from opensourcerouting/fix/1ce626aea6f1f274da92478a8e487c22...
Russ White [Tue, 7 May 2024 14:42:31 +0000 (10:42 -0400)]
Merge pull request #15871 from opensourcerouting/fix/1ce626aea6f1f274da92478a8e487c229b08f9ce_9.1

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... 15953/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 agoMerge pull request #15936 from FRRouting/mergify/bp/stable/9.1/pr-15921
Donatas Abraitis [Tue, 7 May 2024 07:58:19 +0000 (10:58 +0300)]
Merge pull request #15936 from FRRouting/mergify/bp/stable/9.1/pr-15921

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

11 months agobgpd: Fix the order of NULL check and ZAPI decode 15936/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 #15937 from FRRouting/mergify/bp/stable/9.1/pr-15837
Donald Sharp [Mon, 6 May 2024 14:07:51 +0000 (10:07 -0400)]
Merge pull request #15937 from FRRouting/mergify/bp/stable/9.1/pr-15837

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

11 months agolib: replace deprecated ares_gethostbyname 15937/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)

12 months agovtysh: Show `ip ospf network ...` even if it's not the same as the interface type 15871/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 #15857 from FRRouting/mergify/bp/stable/9.1/pr-15848
Donatas Abraitis [Sat, 27 Apr 2024 18:15:20 +0000 (21:15 +0300)]
Merge pull request #15857 from FRRouting/mergify/bp/stable/9.1/pr-15848

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