]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
2 years agoMerge pull request #13168 from FRRouting/mergify/bp/stable/8.5/pr-13153
Donatas Abraitis [Fri, 31 Mar 2023 09:19:31 +0000 (12:19 +0300)]
Merge pull request #13168 from FRRouting/mergify/bp/stable/8.5/pr-13153

bgpd: increase buffer size used for dumping BGP to MRT files (backport #13153)

2 years agobgpd: increase buffer size used for dumping BGP to MRT files 13168/head
jeclarke [Thu, 30 Mar 2023 13:23:48 +0000 (14:23 +0100)]
bgpd: increase buffer size used for dumping BGP to MRT files

Signed-off-by: James Clarke (jamclar2) <jamclar2@cisco.com>
(cherry picked from commit 461b6cd4d7f27624569f7a557f9abf91a85ab3cc)

2 years agoMerge pull request #13137 from FRRouting/mergify/bp/stable/8.5/pr-13124
Donatas Abraitis [Thu, 30 Mar 2023 09:38:16 +0000 (12:38 +0300)]
Merge pull request #13137 from FRRouting/mergify/bp/stable/8.5/pr-13124

bgpd: Do not announce routes immediatelly on prefix/distribute/filter changes (backport #13124)

2 years agobgpd: Do not call bgp_soft_reconfig_in() twice in a row on policy change 13137/head
Donatas Abraitis [Wed, 29 Mar 2023 20:21:35 +0000 (23:21 +0300)]
bgpd: Do not call bgp_soft_reconfig_in() twice in a row on policy change

Just realized it was a stupid copy/paste.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agobgpd: Do not announce routes immediatelly on filter updates
Donatas Abraitis [Tue, 28 Mar 2023 13:18:47 +0000 (16:18 +0300)]
bgpd: Do not announce routes immediatelly on filter updates

If we set `bgp route-map delay-timer X`, we should ignore starting to announce
routes immediately, and wait for delay timer to expire (or ignore at all if set
to zero).

f1aa49293a4a8302b70989aaa9ceb715385c3a7e broke this because we always sent
route refresh and on receiving BoRR before sending back EoRR.

Let's get fix this.

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

2 years agoMerge pull request #13129 from FRRouting/mergify/bp/stable/8.5/pr-13118
Donatas Abraitis [Wed, 29 Mar 2023 07:31:18 +0000 (10:31 +0300)]
Merge pull request #13129 from FRRouting/mergify/bp/stable/8.5/pr-13118

bgpd: Copy the password from the previous peer on peer_xfer_config() (backport #13118)

2 years agoMerge pull request #13134 from FRRouting/mergify/bp/stable/8.5/pr-13120
Donatas Abraitis [Wed, 29 Mar 2023 07:05:51 +0000 (10:05 +0300)]
Merge pull request #13134 from FRRouting/mergify/bp/stable/8.5/pr-13120

ospfd: Fix for vitual-link crash in signal handler (backport #13120)

2 years agoMerge pull request #13126 from FRRouting/mergify/bp/stable/8.5/pr-13123
Donatas Abraitis [Wed, 29 Mar 2023 06:54:18 +0000 (09:54 +0300)]
Merge pull request #13126 from FRRouting/mergify/bp/stable/8.5/pr-13123

bgpd: Fix debug output for route-map names when using a unsuppress-map (backport #13123)

2 years agoospfd: Fix for vitual-link crash in signal handler 13134/head
Pooja Jagadeesh Doijode [Mon, 27 Mar 2023 17:31:00 +0000 (10:31 -0700)]
ospfd: Fix for vitual-link crash in signal handler

Whenever OSPF virtual-link is created, a virtual interface is
associated with it. Name of the virtual interface is derived by
combining "VLINK" string with the value of vlink_count, which is a global
variable.

Problem:
Consider a scenario where 2 virtual links A and B are created in OSPF with
virtual interfaces VLINK0 and VLINK1 respectively. When virtual-link A is unconfigured
and reconfigured, new interface name derived for it will be VLINK1, which is already
associated with virtual-link B. Due to this, both virtual-links A and B will
point to the same interface, VLINK1.

During FRR restart when signal handler is called, OSPF goes through all the virtual
links and deletes the interface(oi) associated with it. During the deletion of interface
for virtual-link B,it accesses the interface which was deleted already(which was deleted
during deletion of virual-link A) and whose fields were set to NULL. This
leads to OSPF crash.

Fixed it by not decrementing vlink_count during unconfig/deletion for virtual-link.

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

2 years agobgpd: Copy the password from the previous peer on peer_xfer_config() 13129/head
Donatas Abraitis [Mon, 27 Mar 2023 19:03:03 +0000 (22:03 +0300)]
bgpd: Copy the password from the previous peer on peer_xfer_config()

We copy the password only if an existing peer structure didn't have it.

But it might be the case when it exists, and we skip here.

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

2 years agobgpd: Fix debug output for route-map names when using a unsuppress-map 13126/head
Donald Sharp [Tue, 28 Mar 2023 11:47:22 +0000 (07:47 -0400)]
bgpd: Fix debug output for route-map names when using a unsuppress-map

Log is printing this with this config:

2023-03-28 07:36:47.007 [DEBG] bgpd: [Q9J6Z-09HRR] 192.168.119.120 [Update:SEND] 1.2.3.33/32 is filtered by route-map '(null)'

Here's the config:

 address-family ipv4 unicast
  network 1.2.3.33/32
  network 1.2.3.34/32
  aggregate-address 1.2.3.0/24 summary-only
  redistribute table 33 route-map foo
  neighbor 192.168.119.120 route-map DENY in
  neighbor 192.168.119.120 unsuppress-map UNSUPPRESS

ip prefix-list UNSUPPRESS seq 5 permit 1.2.3.4/32
ip prefix-list UNSUPPRESS seq 10 permit 1.2.3.5/32
ip prefix-list UNSUPPRESS seq 15 permit 1.2.3.6/32

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

2 years agoMerge pull request #13112 from FRRouting/mergify/bp/stable/8.5/pr-13101
Jafar Al-Gharaibeh [Sun, 26 Mar 2023 16:03:37 +0000 (11:03 -0500)]
Merge pull request #13112 from FRRouting/mergify/bp/stable/8.5/pr-13101

tools: Set correct directory of vtysh for frr-reload.py (backport #13101)

2 years agotools: Set correct directory of vtysh for frr-reload.py 13112/head
Donatas Abraitis [Thu, 23 Mar 2023 18:55:14 +0000 (20:55 +0200)]
tools: Set correct directory of vtysh for frr-reload.py

Before it was setting SDIR, which is /usr/lib/frr, but the vtysh binary is put
under bindir (which is /usr/local by default). And running `/usr/lib/frr/frr reload`
failed.

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

2 years agoMerge pull request #13105 from FRRouting/mergify/bp/stable/8.5/pr-13100
Donald Sharp [Sun, 26 Mar 2023 12:19:20 +0000 (08:19 -0400)]
Merge pull request #13105 from FRRouting/mergify/bp/stable/8.5/pr-13100

bgpd: Check 7 bytes for Long-lived Graceful-Restart capability (backport #13100)

2 years agoMerge pull request #13102 from FRRouting/mergify/bp/stable/8.5/pr-13088
Donald Sharp [Fri, 24 Mar 2023 16:00:06 +0000 (12:00 -0400)]
Merge pull request #13102 from FRRouting/mergify/bp/stable/8.5/pr-13088

pimd: Fix use after free issue for ifp's moving vrfs (backport #13088)

2 years agobgpd: Check 7 bytes for Long-lived Graceful-Restart capability 13105/head
Donatas Abraitis [Fri, 24 Mar 2023 07:55:23 +0000 (09:55 +0200)]
bgpd: Check 7 bytes for Long-lived Graceful-Restart capability

It's not 4 bytes, it was assuming the same as Graceful-Restart tuples.

LLGR has more 3 bytes (Long-lived Stale Time).

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

2 years agoMerge pull request #13096 from FRRouting/mergify/bp/stable/8.5/pr-13065
Donald Sharp [Fri, 24 Mar 2023 13:16:00 +0000 (09:16 -0400)]
Merge pull request #13096 from FRRouting/mergify/bp/stable/8.5/pr-13065

ospfd: Fixing Summary origination after range configuration (backport #13065)

2 years agopimd: Fix use after free issue for ifp's moving vrfs 13102/head
Donald Sharp [Wed, 22 Mar 2023 22:24:56 +0000 (18:24 -0400)]
pimd: Fix use after free issue for ifp's moving vrfs

We have this valgrind trace:

==1125== Invalid read of size 4
==1125==    at 0x170A7D: pim_if_delete (pim_iface.c:203)
==1125==    by 0x170C01: pim_if_terminate (pim_iface.c:80)
==1125==    by 0x174F34: pim_instance_terminate (pim_instance.c:68)
==1125==    by 0x17535B: pim_vrf_terminate (pim_instance.c:260)
==1125==    by 0x1941CF: pim_terminate (pimd.c:161)
==1125==    by 0x1B476D: pim_sigint (pim_signals.c:44)
==1125==    by 0x4910C22: frr_sigevent_process (sigevent.c:133)
==1125==    by 0x49220A4: thread_fetch (thread.c:1777)
==1125==    by 0x48DC8E2: frr_run (libfrr.c:1222)
==1125==    by 0x15E12A: main (pim_main.c:176)
==1125==  Address 0x6274d28 is 1,192 bytes inside a block of size 1,752 free'd
==1125==    at 0x48369AB: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1125==    by 0x174FF1: pim_vrf_delete (pim_instance.c:181)
==1125==    by 0x4925480: vrf_delete (vrf.c:264)
==1125==    by 0x4925480: vrf_delete (vrf.c:238)
==1125==    by 0x49332C7: zclient_vrf_delete (zclient.c:2187)
==1125==    by 0x4934319: zclient_read (zclient.c:4003)
==1125==    by 0x492249C: thread_call (thread.c:2008)
==1125==    by 0x48DC8D7: frr_run (libfrr.c:1223)
==1125==    by 0x15E12A: main (pim_main.c:176)
==1125==  Block was alloc'd at
==1125==    at 0x4837B65: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1125==    by 0x48E80AF: qcalloc (memory.c:116)
==1125==    by 0x1750DA: pim_instance_init (pim_instance.c:90)
==1125==    by 0x1750DA: pim_vrf_new (pim_instance.c:161)
==1125==    by 0x4924FDC: vrf_get (vrf.c:183)
==1125==    by 0x493334C: zclient_vrf_add (zclient.c:2157)
==1125==    by 0x4934319: zclient_read (zclient.c:4003)
==1125==    by 0x492249C: thread_call (thread.c:2008)
==1125==    by 0x48DC8D7: frr_run (libfrr.c:1223)
==1125==    by 0x15E12A: main (pim_main.c:176)

and you do this series of events:

a) Create a vrf, put an interface in it
b) Turn on pim on that interface and turn on pim in that vrf
c) Delete the vrf
d) Do anything with the interface, in this case shutdown the system

The move of the interface to a new vrf is leaving the pim_ifp->pim pointer pointing
at the old pim instance, which was just deleted, so the instance pointer was freed.

Let's clean up the pim pointer in the interface pointer as well.

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

2 years agoospfd: Fixing Summary origination after range configuration 13096/head
rgirada [Mon, 20 Mar 2023 11:22:26 +0000 (11:22 +0000)]
ospfd: Fixing Summary origination after range configuration

Description:
After area range config, summary lsas are aggerated to configured
route but later it was being flushed instead of the actual summary
lsa. This was seen when prefix-id of the aggregated route is same
as one of the actual summary route.
Here, aggregated summary lsa need to be returned to set the flag
SUMMARY_APPROVE after originating aggregated summary lsa but its not.
Which is being cleaned up as part of unapproved summary cleanup.
Corrected this now.

Issue: #13028

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
(cherry picked from commit c8c1a240ab9653d74b3af009f850e150909f784e)

2 years agoMerge pull request #13077 from FRRouting/mergify/bp/stable/8.5/pr-13073
Jafar Al-Gharaibeh [Wed, 22 Mar 2023 01:36:05 +0000 (20:36 -0500)]
Merge pull request #13077 from FRRouting/mergify/bp/stable/8.5/pr-13073

staticd: Tell bfd that we are shutting down (backport #13073)

2 years agostaticd: Tell bfd that we are shutting down 13077/head
Donald Sharp [Tue, 21 Mar 2023 12:55:35 +0000 (08:55 -0400)]
staticd: Tell bfd that we are shutting down

Prevent a use after free and tell the bfd subsystem
we are shutting down in staticd.

./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460:==2264460==ERROR: AddressSanitizer: heap-use-after-free on address 0x61f000004698 at pc 0x7f65d1eb11b2 bp 0x7ffdbface490 sp 0x7ffdbface488
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-READ of size 4 at 0x61f000004698 thread T0
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #0 0x7f65d1eb11b1 in zclient_bfd_command lib/bfd.c:307
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #1 0x7f65d1eb20f5 in _bfd_sess_send lib/bfd.c:507
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #2 0x7f65d20510aa in thread_call lib/thread.c:1989
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #3 0x7f65d2051f0a in _thread_execute lib/thread.c:2081
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #4 0x7f65d1eb271b in _bfd_sess_remove lib/bfd.c:544
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #5 0x7f65d1eb278d in bfd_sess_free lib/bfd.c:553
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #6 0x7f65d1eb5400 in bfd_protocol_integration_finish lib/bfd.c:1029
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #7 0x7f65d1f42f77 in hook_call_frr_fini lib/libfrr.c:41
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #8 0x7f65d1f494a1 in frr_fini lib/libfrr.c:1199
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #9 0x563b7abefd76 in sigint staticd/static_main.c:70
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #10 0x7f65d200ef91 in frr_sigevent_process lib/sigevent.c:115
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #11 0x7f65d204fac6 in thread_fetch lib/thread.c:1758
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #12 0x7f65d1f49377 in frr_run lib/libfrr.c:1184
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #13 0x563b7abefed1 in main staticd/static_main.c:160
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #14 0x7f65d1b92d09 in __libc_start_main ../csu/libc-start.c:308
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-    #15 0x563b7abefa99 in _start (/usr/lib/frr/staticd+0x15a99)
./bfd_topo3.test_bfd_topo3/r4.staticd.asan.2264460-

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

2 years agoMerge pull request #13072 from FRRouting/mergify/bp/stable/8.5/pr-13062
Donatas Abraitis [Tue, 21 Mar 2023 13:31:18 +0000 (15:31 +0200)]
Merge pull request #13072 from FRRouting/mergify/bp/stable/8.5/pr-13062

zebra: Fix for heap-use-after-free in EVPN (backport #13062)

2 years agozebra: Fix for heap-use-after-free in EVPN 13072/head
Pooja Jagadeesh Doijode [Mon, 20 Mar 2023 19:54:31 +0000 (12:54 -0700)]
zebra: Fix for heap-use-after-free in EVPN

Issue:
When a netns is deleted, since zebra doesn’t receive interface down/delete
notifications from kernel, it manually deletes the interface without removing
the association between zebra_l3vni and the interface that is being deleted
(i.e it deletes the interface without setting “zl3vni->vxlan_if” to NULL).

Later, during the deletion of netns, when zl3vni_rmac_uninstall() is called to
uninstall the remote RMAC from the kernel, zebra ends up accessing stale
“zl3vni->vxlan_if” pointer, which now points to freed memory.
This was causing heap use-after-free.

Fix:
Before zebra starts deleting the interfaces when it receives netns delete notification,
appropriate functions() are being called to remove the association between evpn structs
and interface and set “zl3vni->vxlan_if” to NULL. This ensures that when
zl3vni_rmac_uninstall() is called during netns deletion, it will bail because
“zl3vni->vxlan_if” is NULL.

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

2 years agoMerge pull request #13067 from FRRouting/mergify/bp/stable/8.5/pr-13064
Donald Sharp [Tue, 21 Mar 2023 10:59:44 +0000 (06:59 -0400)]
Merge pull request #13067 from FRRouting/mergify/bp/stable/8.5/pr-13064

lib: fix clear route-map command (backport #13064)

2 years agoMerge pull request #13069 from FRRouting/mergify/bp/stable/8.5/pr-13061
Donald Sharp [Tue, 21 Mar 2023 10:58:42 +0000 (06:58 -0400)]
Merge pull request #13069 from FRRouting/mergify/bp/stable/8.5/pr-13061

lib: on bfd peer shutdown actually stop event (backport #13061)

2 years agolib: Include clippy generated commands for routemap.c 13067/head
Donatas Abraitis [Tue, 21 Mar 2023 08:34:38 +0000 (10:34 +0200)]
lib: Include clippy generated commands for routemap.c

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agolib: on bfd peer shutdown actually stop event 13069/head
Donald Sharp [Mon, 20 Mar 2023 20:07:20 +0000 (16:07 -0400)]
lib: on bfd peer shutdown actually stop event

When deleting a bfd peer during shutdown, let's ensure
that any scheduled events are actually stopped.

==7759== Invalid read of size 4
==7759==    at 0x48BF700: _bfd_sess_valid (bfd.c:419)
==7759==    by 0x48BF700: _bfd_sess_send (bfd.c:470)
==7759==    by 0x492F79C: thread_call (thread.c:2008)
==7759==    by 0x48E9BD7: frr_run (libfrr.c:1223)
==7759==    by 0x1C739B: main (bgp_main.c:550)
==7759==  Address 0xfb687a4 is 4 bytes inside a block of size 272 free'd
==7759==    at 0x48369AB: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==7759==    by 0x48BFA5A: bfd_sess_free (bfd.c:535)
==7759==    by 0x2B7034: bgp_peer_remove_bfd (bgp_bfd.c:339)
==7759==    by 0x29FF8A: peer_free (bgpd.c:1160)
==7759==    by 0x29FF8A: peer_unlock_with_caller (bgpd.c:1192)
==7759==    by 0x2A0506: peer_delete (bgpd.c:2633)
==7759==    by 0x208190: bgp_stop (bgp_fsm.c:1639)
==7759==    by 0x20C082: bgp_event_update (bgp_fsm.c:2751)
==7759==    by 0x492F79C: thread_call (thread.c:2008)
==7759==    by 0x48E9BD7: frr_run (libfrr.c:1223)
==7759==    by 0x1C739B: main (bgp_main.c:550)
==7759==  Block was alloc'd at
==7759==    at 0x4837B65: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==7759==    by 0x48F53AF: qcalloc (memory.c:116)
==7759==    by 0x48BF98D: bfd_sess_new (bfd.c:397)
==7759==    by 0x2B76DC: bgp_peer_configure_bfd (bgp_bfd.c:298)
==7759==    by 0x2B76DC: bgp_peer_configure_bfd (bgp_bfd.c:279)
==7759==    by 0x29BA06: peer_group2peer_config_copy (bgpd.c:2803)
==7759==    by 0x2A3D96: peer_create_bind_dynamic_neighbor (bgpd.c:4107)
==7759==    by 0x2A4195: peer_lookup_dynamic_neighbor (bgpd.c:4239)
==7759==    by 0x21AB72: bgp_accept (bgp_network.c:422)
==7759==    by 0x492F79C: thread_call (thread.c:2008)
==7759==    by 0x48E9BD7: frr_run (libfrr.c:1223)
==7759==    by 0x1C739B: main (bgp_main.c:550)

tl;dr -> Effectively, in this test setup we have 300 dynamic bgp
sessions all of which are using bfd.  When a peer collision is detected
or we remove the peers, if an event has been scheduled but not actually
executed yet the event event was not actually being stopped, leaving
the bsp pointer on the thread->arg and causing a crash when it is
executed.

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

2 years agolib:fix clear route-map cmd using DEFPY
Sindhu Parvathi Gopinathan [Mon, 20 Mar 2023 12:15:03 +0000 (05:15 -0700)]
lib:fix clear route-map cmd using DEFPY

Due to the wrong input argv id, "argv[idx_word]->arg"
fetched in-correctly and it clears all the route-maps instead of
specific one.

Now correct argv id is passed to clear the given route-map counters.

Also, use RMAP_NAME which allows to show list of configured
route-maps in the system.

After Fix:-

Ticket:#3407773
Issue:3407773

Testing: UT done

Before:
TORC11# clear route-map counters
  <cr>
  WORD  route-map name

After:

TORC11# clear route-map counters
  <cr>
  RMAP_NAME  route-map name
     my-as

Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
(cherry picked from commit 463110f7335632d03557f1c5bfdd066b170011a8)

2 years agoMerge pull request #13058 from opensourcerouting/fix/bgp_null_deref_8.5
Donald Sharp [Mon, 20 Mar 2023 23:51:15 +0000 (19:51 -0400)]
Merge pull request #13058 from opensourcerouting/fix/bgp_null_deref_8.5

bgpd: Prevent Null pointer deref when outputting data

2 years agobgpd: Prevent Null pointer deref when outputting data 13058/head
Donald Sharp [Fri, 17 Mar 2023 19:40:33 +0000 (15:40 -0400)]
bgpd: Prevent Null pointer deref when outputting data

Crash:

(gdb) bt
0  0x00007fee27de15cb in raise () from /lib/x86_64-linux-gnu/libpthread.so.0
1  0x00007fee280ecd9c in core_handler (signo=11, siginfo=0x7ffe56001bb0, context=<optimized out>) at lib/sigevent.c:264
2  <signal handler called>
3  0x0000555e321c41b2 in prefix_rd2str (prd=0x10, buf=buf@entry=0x7ffe56002080 "27.0.0.R\340\373\062\062^U", size=size@entry=28) at bgpd/bgp_rd.c:168
4  0x0000555e321c431a in printfrr_prd (buf=0x7ffe560021a0, ea=<optimized out>, ptr=<optimized out>) at bgpd/bgp_rd.c:224
5  0x00007fee2812069b in vbprintfrr (cb_in=cb_in@entry=0x7ffe56002330, fmt0=fmt0@entry=0x555e3229a3ad " RD: %pRD\n", ap=ap@entry=0x7ffe560023d8) at lib/printf/vfprintf.c:564
6  0x00007fee28122ef7 in vasnprintfrr (mt=mt@entry=0x7fee281cb5e0 <MTYPE_VTY_OUT_BUF>, out=out@entry=0x7ffe560023f0 " RD: : R\n", outsz=outsz@entry=1024, fmt=fmt@entry=0x555e3229a3ad " RD: %pRD\n", ap=ap@entry=0x7ffe560023d8) at lib/printf/glue.c:103
7  0x00007fee28103504 in vty_out (vty=vty@entry=0x555e33f82d10, format=format@entry=0x555e3229a3ad " RD: %pRD\n") at lib/vty.c:190
8  0x0000555e32185156 in bgp_evpn_es_show_entry_detail (vty=0x555e33f82d10, es=0x555e33c38420, json=<optimized out>) at bgpd/bgp_evpn_mh.c:2655
9  0x0000555e32188fe5 in bgp_evpn_es_show (vty=vty@entry=0x555e33f82d10, uj=false, detail=true) at bgpd/bgp_evpn_mh.c:2721
notice prd=0x10 in #3.  This is because in bgp_evpn_mh.c we are sending &es->es_base_frag->prd.

There is one spot in the code where during output the es->es_base_frag is checked for non nullness
Let's just make sure it's right in all the places.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoMerge pull request #13052 from FRRouting/mergify/bp/stable/8.5/pr-13049
Donatas Abraitis [Mon, 20 Mar 2023 05:58:43 +0000 (07:58 +0200)]
Merge pull request #13052 from FRRouting/mergify/bp/stable/8.5/pr-13049

lib: IPv6 prefix-list entry handling with `any` (backport #13049)

2 years agolib: Destroy `any` flag when creating a prefix-list entry with prefix 13052/head
Donatas Abraitis [Sun, 19 Mar 2023 20:46:56 +0000 (22:46 +0200)]
lib: Destroy `any` flag when creating a prefix-list entry with prefix

The same as 61c07b9d43529f69f48ca54f4f0213cff52b5d0a, but forgot to put IPv6
in place.

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

2 years agotests: Check if prefix-lists with IPv6 any works fine
Donatas Abraitis [Sun, 19 Mar 2023 20:46:35 +0000 (22:46 +0200)]
tests: Check if prefix-lists with IPv6 any works fine

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

2 years agoMerge pull request #13041 from FRRouting/mergify/bp/stable/8.5/pr-13038
Donald Sharp [Sun, 19 Mar 2023 22:39:02 +0000 (18:39 -0400)]
Merge pull request #13041 from FRRouting/mergify/bp/stable/8.5/pr-13038

2 years agoMerge pull request #13043 from FRRouting/mergify/bp/stable/8.5/pr-13026
Donatas Abraitis [Sun, 19 Mar 2023 20:58:04 +0000 (22:58 +0200)]
Merge pull request #13043 from FRRouting/mergify/bp/stable/8.5/pr-13026

pbrd:fix mismatching in match src-dst (backport #13026)

2 years agoMerge pull request #13045 from FRRouting/mergify/bp/stable/8.5/pr-13025
Donatas Abraitis [Sun, 19 Mar 2023 20:57:53 +0000 (22:57 +0200)]
Merge pull request #13045 from FRRouting/mergify/bp/stable/8.5/pr-13025

Ospf ti lfa leaks (backport #13025)

2 years agoospfd: Free up q_space in early return path 13045/head
Donald Sharp [Fri, 17 Mar 2023 14:58:08 +0000 (10:58 -0400)]
ospfd: Free up q_space in early return path

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

2 years agoospfd: Fix ospf_ti_lfa drop of an entire table
Donald Sharp [Fri, 17 Mar 2023 14:37:40 +0000 (10:37 -0400)]
ospfd: Fix ospf_ti_lfa drop of an entire table

The new_rtrs variable was just generated and then dropped.  Let's
fix that entirely

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

2 years agopbrd:fix mismatching in match src-dst 13043/head
Chirag Shah [Fri, 17 Mar 2023 04:47:07 +0000 (21:47 -0700)]
pbrd:fix mismatching in match src-dst

upstream commit 67765a232d has incorect
address family check which prevent from
deleting src/dst config under pbr rule.

Ticket:#3405024
Issue:3405024
Testing Done:

Config:

pbr-map map6 seq 1
 match src-ip 2000::200:100:100:0/96
 match dst-ip 2000::100:100:100:0/96
 set nexthop-group group3

Before:
torc-12(config)# pbr-map map6 seq 1
torc-12(config-pbr-map)# no match src-ip 2000::200:100:100:0/96
Cannot mismatch families within match src/dst

After:
torc-12(config)# pbr-map map6 seq 1
torc-12(config-pbr-map)# no match src-ip 2000::200:100:100:0/96
torc-12(config-pbr-map)#

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

2 years agoospfd: Cleanup some memory leaks on shutdown in ospf_apiserver.c 13041/head
Donald Sharp [Sat, 18 Mar 2023 19:35:34 +0000 (15:35 -0400)]
ospfd: Cleanup some memory leaks on shutdown in ospf_apiserver.c

Clean up some memory leaks found in ospf_apiserver.c  Also
a crash in the original implementation.

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

2 years agoMerge pull request #13035 from FRRouting/mergify/bp/stable/8.5/pr-13024
Donald Sharp [Sat, 18 Mar 2023 17:14:57 +0000 (13:14 -0400)]
Merge pull request #13035 from FRRouting/mergify/bp/stable/8.5/pr-13024

lib: Adjust only any flag for prefix-list entries if destroying (backport #13024)

2 years agolib: Adjust only `any` flag for prefix-list entries if destroying 13035/head
Donatas Abraitis [Fri, 17 Mar 2023 12:48:35 +0000 (14:48 +0200)]
lib: Adjust only `any` flag for prefix-list entries if destroying

Before this patch, if we destroy `any` flag for a prefix-list entry, we always
set destination as 0.0.0.0/0 and/or ::/0.

This means that, if we switch from `ip prefix-list r1-2 seq 5 deny any` to
`ip prefix-list r1-2 seq 5 permit 10.10.10.10/32` we will have
`permit any` eventually, which broke ACLs.

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

2 years agotests: Check if route-map works correctly if modifying prefix-lists
Donatas Abraitis [Thu, 16 Mar 2023 12:39:40 +0000 (14:39 +0200)]
tests: Check if route-map works correctly if modifying prefix-lists

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

2 years agoMerge pull request #13015 from FRRouting/mergify/bp/stable/8.5/pr-13009
Donatas Abraitis [Fri, 17 Mar 2023 22:04:59 +0000 (00:04 +0200)]
Merge pull request #13015 from FRRouting/mergify/bp/stable/8.5/pr-13009

bgpd: Use interface name instead of pointer value (backport #13009)

2 years agoMerge pull request #13021 from FRRouting/mergify/bp/stable/8.5/pr-13016
Donatas Abraitis [Fri, 17 Mar 2023 22:04:22 +0000 (00:04 +0200)]
Merge pull request #13021 from FRRouting/mergify/bp/stable/8.5/pr-13016

ospfd, ospfd6: Add more logging (backport #13016)

2 years agoospfd: Log Adjacency Changes with Neighbor IP in addition to Neighbor ID 13021/head
Martin Winter [Wed, 26 Oct 2022 15:17:01 +0000 (08:17 -0700)]
ospfd: Log Adjacency Changes with Neighbor IP in addition to Neighbor ID

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 386d232a1a706310f4425d1a0ad6f08c32646e10)

2 years agoospfd, ospf6d: Add more logging details
Donatas Abraitis [Wed, 6 Apr 2022 19:15:57 +0000 (22:15 +0300)]
ospfd, ospf6d: Add more logging details

Basically just router-id or interface/IP.

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

2 years agobgpd: Use interface name instead of pointer value 13015/head
Donald Sharp [Thu, 16 Mar 2023 14:24:25 +0000 (10:24 -0400)]
bgpd: Use interface name instead of pointer value

Log message is borked in a manner that makes it unusable:
bgpd[52]: [VX6SM-8YE5W][EC 33554460] 2000:31:0:53::2: nexthop_set failed, resetting connection - intf 0x561eb9005a30

Let's print out the interface name instead.

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

2 years agoMerge pull request #13001 from FRRouting/mergify/bp/stable/8.5/pr-12996
Donatas Abraitis [Wed, 15 Mar 2023 17:20:41 +0000 (19:20 +0200)]
Merge pull request #13001 from FRRouting/mergify/bp/stable/8.5/pr-12996

tools: frr-reload fix list value not present (backport #12996)

2 years agoMerge pull request #12987 from FRRouting/mergify/bp/stable/8.5/pr-12978
Donatas Abraitis [Wed, 15 Mar 2023 12:09:34 +0000 (14:09 +0200)]
Merge pull request #12987 from FRRouting/mergify/bp/stable/8.5/pr-12978

pimd: IN_MULTICAST needs host order (backport #12978)

2 years agotools: frr-reload fix list value not present 13001/head
Chirag Shah [Wed, 15 Mar 2023 04:32:40 +0000 (21:32 -0700)]
tools: frr-reload fix list value not present

Check for value present in list before removing
as in certain python3 ValueError traceback is observed.

Traceback (most recent call last):
  File "/usr/lib/frr/frr-reload.py",
line 2278, in <module>
    (lines_to_add, lines_to_del, restart_frr)
= compare_context_objects(newconf, running)
  File "/usr/lib/frr/frr-reload.py",
line 1933, in compare_context_objects
    lines_to_add, lines_to_del
  File "/usr/lib/frr/frr-reload.py",
line 1549, in ignore_delete_re_add_lines
    lines_to_del.remove((ctx_keys, line))
ValueError: list.remove(x): x not in list

Ticket:#3389979
Issue:3389979

Testing Done:
With fix perform frr-relaod on frr.conf config where earlier
traceback was seen.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
(cherry picked from commit 1543f58b5541c0ddb5e53bb7994136dcb5f836cb)

2 years agopimd: IN_MULTICAST needs host order 12987/head
Donald Sharp [Sun, 12 Mar 2023 00:37:21 +0000 (19:37 -0500)]
pimd: IN_MULTICAST needs host order

New correct behavior:

eva# conf
eva(config)# ip pim rp 192.168.1.224 224.0.0.0/24
No Path to RP address specified: 192.168.1.224
eva(config)# ip pim rp 224.1.2.3 224.0.0.0/24
% Bad RP address specified: 224.1.2.3
eva(config)#

Fixes: #12970
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 8083e713562a44744c4c2f4a0aa5cc6e2b2170ff)

2 years agoFRR Release 8.5 frr-8.5
Jafar Al-Gharaibeh [Mon, 13 Mar 2023 14:01:47 +0000 (09:01 -0500)]
FRR Release 8.5

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2 years agodebian, redhat: updating changelog for new release
Jafar Al-Gharaibeh [Mon, 13 Mar 2023 14:01:30 +0000 (09:01 -0500)]
debian, redhat: updating changelog for new release

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2 years agoMerge pull request #12980 from FRRouting/mergify/bp/stable/8.5/pr-12974
Donatas Abraitis [Mon, 13 Mar 2023 05:11:48 +0000 (07:11 +0200)]
Merge pull request #12980 from FRRouting/mergify/bp/stable/8.5/pr-12974

bgpd: Increment version number even when no data is sent (backport #12974)

2 years agobgpd: Increment version number even when no data is sent 12980/head
Donald Sharp [Sat, 11 Mar 2023 17:05:44 +0000 (12:05 -0500)]
bgpd: Increment version number even when no data is sent

When an update group decides to not send a prefix
announcement because it has not changed, still increment
the version number.  Why?  To allow for the situation
where you have say 2 peers in 1 peer group and shortly
after they come up a 3rd peer comes up.  It will be
placed into a separate update group and could be
coalesced down, when it finishes updating all data
to it.  Now imagine that a single prefix changes at
this point in time as well.  Then first 2 peers may
decide to not send the data, since nothing has changed.
While the 3rd peer will and since the versions numbers
never match they will never coalesce.  So when the decision
is made to skip, update the version number as well.

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

2 years agoMerge pull request #12973 from FRRouting/mergify/bp/stable/8.5/pr-12962
Donatas Abraitis [Sat, 11 Mar 2023 07:38:20 +0000 (09:38 +0200)]
Merge pull request #12973 from FRRouting/mergify/bp/stable/8.5/pr-12962

bgpd: Check if the peer is configured as interface when checking NHT (backport #12962)

2 years agotests: Check if IPv6 BGP Link-Local peering works 12973/head
Donatas Abraitis [Tue, 7 Mar 2023 20:41:58 +0000 (22:41 +0200)]
tests: Check if IPv6 BGP Link-Local peering works

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

2 years agobgpd: Check if the peer is configured as interface when checking NHT
Donatas Abraitis [Tue, 7 Mar 2023 20:36:15 +0000 (22:36 +0200)]
bgpd: Check if the peer is configured as interface when checking NHT

This causes early return. peer->conf is NULL for IPv6 link-local peering,
and the session never establish.

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

2 years agoMerge pull request #12956 from FRRouting/mergify/bp/dev/8.5/pr-12951
Donatas Abraitis [Mon, 6 Mar 2023 06:53:57 +0000 (08:53 +0200)]
Merge pull request #12956 from FRRouting/mergify/bp/dev/8.5/pr-12951

bgpd: Fix use beyond end of stream of labeled unicast parsing (backport #12951)

2 years agobgpd: Fix use beyond end of stream of labeled unicast parsing 12956/head
Donald Sharp [Sat, 4 Mar 2023 02:58:33 +0000 (21:58 -0500)]
bgpd: Fix use beyond end of stream of labeled unicast parsing

Fixes a couple crashes associated with attempting to read
beyond the end of the stream.

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 7404a914b0cafe046703c8381903a80d3def8f8b)

2 years agoMerge pull request #12952 from FRRouting/mergify/bp/dev/8.5/pr-12950
Donatas Abraitis [Sun, 5 Mar 2023 18:49:09 +0000 (20:49 +0200)]
Merge pull request #12952 from FRRouting/mergify/bp/dev/8.5/pr-12950

babeld: fix #11808 to avoid infinite loops (backport #12950)

2 years agobabeld: fix #11808 to avoid infinite loops 12952/head
harryreps [Fri, 3 Mar 2023 23:17:14 +0000 (23:17 +0000)]
babeld: fix #11808 to avoid infinite loops

Replacing continue in loops to goto done so that index of packet buffer
increases.

Signed-off-by: harryreps <harryreps@gmail.com>
(cherry picked from commit ae1e0e1fed77716bc06f181ad68c4433fb5523d0)

2 years agoMerge pull request #12927 from FRRouting/mergify/bp/dev/8.5/pr-12903
Donatas Abraitis [Thu, 2 Mar 2023 10:41:30 +0000 (12:41 +0200)]
Merge pull request #12927 from FRRouting/mergify/bp/dev/8.5/pr-12903

pimd, pim6d: Don't track nexthop for RP 0.0.0.0 & 0::0 (backport #12903)

2 years agoMerge pull request #12926 from FRRouting/mergify/bp/dev/8.5/pr-12921
Donatas Abraitis [Thu, 2 Mar 2023 09:21:04 +0000 (11:21 +0200)]
Merge pull request #12926 from FRRouting/mergify/bp/dev/8.5/pr-12921

pimd: Prevent crash when pimreg already exists. (backport #12921)

2 years agoMerge pull request #12925 from FRRouting/mergify/bp/dev/8.5/pr-12008
Donatas Abraitis [Thu, 2 Mar 2023 08:36:37 +0000 (10:36 +0200)]
Merge pull request #12925 from FRRouting/mergify/bp/dev/8.5/pr-12008

pimd, pim6d: Fix RPF check (backport #12008)

2 years agopimd, pim6d: Don't track nexthop for RP 0.0.0.0 & 0::0 12927/head
Sarita Patra [Sat, 25 Feb 2023 08:33:13 +0000 (00:33 -0800)]
pimd, pim6d: Don't track nexthop for RP 0.0.0.0 & 0::0

Topology:
========
FHR----Source

Problem:
=======
When FHR receives multicast traffic, there is no RP configured,
PIMD does NHT register for RP address 0.0.0.0 and group 224.0.0.0/4
PIM6D does NHT register for RP address 0::0 and group FF00::0/8

frr# show ip pim nexthop
Number of registered addresses: 1
Address         Interface        Nexthop
---------------------------------------------

frr# show ipv6 pim nexthop
Number of registered addresses: 1
Address         Interface        Nexthop
---------------------------------------------

Fix:
====
Dont track nexthop for RP 0.0.0.0 & 0::0.

frr# show ip pim nexthop
Number of registered addresses: 0

frr# show ipv6 pim nexthop
Number of registered addresses: 0

Issue: #12104

Signed-off-by: Sarita Patra <saritap@vmware.com>
(cherry picked from commit 201a31b9773f1c7b091a07b38dd5cbb55e7bdeab)

2 years agopimd: Prevent crash when pimreg already exists. 12926/head
Donald Sharp [Wed, 1 Mar 2023 19:41:21 +0000 (14:41 -0500)]
pimd: Prevent crash when pimreg already exists.

If the pimreg device exists but it has not been set to the pim->pimreg pointer we can have
a crash.  Just prevent the crash since it's some sort of startup / re-org the network
issue.

(gdb) bt
0  0x00007f0485b035cb in raise () from /lib/x86_64-linux-gnu/libpthread.so.0
1  0x00007f0485c0fbec in core_handler (signo=6, siginfo=0x7ffdc0198030, context=<optimized out>) at lib/sigevent.c:264
2  <signal handler called>
3  0x00007f04859668eb in raise () from /lib/x86_64-linux-gnu/libc.so.6
4  0x00007f0485951535 in abort () from /lib/x86_64-linux-gnu/libc.so.6
5  0x00007f0485c3af76 in _zlog_assert_failed (xref=xref@entry=0x55692269b940 <_xref.23164>, extra=extra@entry=0x0) at lib/zlog.c:680
6  0x00005569226150d0 in pim_if_new (ifp=0x556922c82900, gm=gm@entry=false, pim=pim@entry=false, ispimreg=ispimreg@entry=true,
    is_vxlan_term=is_vxlan_term@entry=false) at pimd/pim_iface.c:124
7  0x0000556922615140 in pim_if_create_pimreg (pim=pim@entry=0x556922cc11e0) at pimd/pim_iface.c:1549
8  0x0000556922616bc8 in pim_if_create_pimreg (pim=0x556922cc11e0) at pimd/pim_iface.c:1613
9  pim_ifp_create (ifp=0x556922cc0e70) at pimd/pim_iface.c:1641
10 0x00007f0485c32cf9 in zclient_interface_add (cmd=<optimized out>, zclient=<optimized out>, length=<optimized out>, vrf_id=77) at lib/zclient.c:2214
11 0x00007f0485c3346a in zclient_read (thread=<optimized out>) at lib/zclient.c:4003
12 0x00007f0485c215ed in thread_call (thread=thread@entry=0x7ffdc0198880) at lib/thread.c:2008
13 0x00007f0485bdbbc8 in frr_run (master=0x556922a10470) at lib/libfrr.c:1223
14 0x000055692260312b in main (argc=<optimized out>, argv=0x7ffdc0198b98, envp=<optimized out>) at pimd/pim_main.c:176

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

2 years agopimd, pim6d: Fix join prune handling 12925/head
Sarita Patra [Fri, 24 Feb 2023 10:03:34 +0000 (02:03 -0800)]
pimd, pim6d: Fix join prune handling

When upstream RPF address is secondary address, and
neighborship is built with primary address,
then pim_neighbor_find() fails.

Verify the upstream  RPF address is present in the
neighbor primary and secondary address list.

Signed-off-by: Sarita Patra <saritap@vmware.com>
(cherry picked from commit d77da853f0f055244f5442e37b690809ab951a5a)

2 years agopimd, pim6d: Fix pim upstream rpf change
Sarita Patra [Wed, 19 Oct 2022 00:32:11 +0000 (17:32 -0700)]
pimd, pim6d: Fix pim upstream rpf change

When upstream RPF address is secondary, and
neighborship is built with primary address,
then pim_neighbor_find() fails, due to which when there
is upstream change it wont send prune.

Verify the nexthop is present in the neighbor primary
and secondary address list.

Signed-off-by: Sarita Patra <saritap@vmware.com>
(cherry picked from commit 689b9f10fc33387414c8077cd8cacd2eb2fc7198)

2 years agopimd, pim6d: fix pim neighbor check in pim_nexthop_lookup
Sarita Patra [Tue, 18 Oct 2022 23:31:00 +0000 (16:31 -0700)]
pimd, pim6d: fix pim neighbor check in pim_nexthop_lookup

When there is a mismatch in nexthop address (secondary address)
and neighborship address(primary address) on the same interface,
RPF check fails.

This is fixed now.

Signed-off-by: Sarita Patra <saritap@vmware.com>
(cherry picked from commit e14ba248742cd56b903ccd965576ac18ad41d310)

2 years agopimd, pim6d: Fix RP Unknown IIF
Sarita Patra [Tue, 18 Oct 2022 23:27:14 +0000 (16:27 -0700)]
pimd, pim6d: Fix RP Unknown IIF

When route to RP is having nexthop secndary address,
neighborship is built with primary address,
then pim_neighbor_find() fails, which causes RP IIF
Unknown.

Fix:
Verify pim neighborship on the RP connected interface.

Issue: #11526

Signed-off-by: Sarita Patra <saritap@vmware.com>
(cherry picked from commit ae5bcac0aee80d99d2fd2adba75733d86d36226f)

2 years agopimd, pim6d: Fix BSM packet process
Sarita Patra [Tue, 18 Oct 2022 23:06:12 +0000 (16:06 -0700)]
pimd, pim6d: Fix BSM packet process

Problem 1:
When route to BSR is having nexthop secondary address,
neighborship is built with primary address,
then pim_neighbor_find() fails, which cause drop of BSM
packet.

Fix 1:
Verify pim neighborship on the BSM received interface.
Problem 2:

Problem 2:
Source IP BSM address is primary address, where
as nexthop also can be primary or secondary address.

Fix 2:
Avoiding the check (nhaddr == src_ip) for PIMV6

Issue: #11957

Signed-off-by: Sarita Patra <saritap@vmware.com>
(cherry picked from commit 2c6a32f9be3c687fe5c52d055f21912da8364ec6)

2 years agopimd,pim6d: Modify pim_neighbor_find() API
Sarita Patra [Mon, 23 Jan 2023 05:10:45 +0000 (21:10 -0800)]
pimd,pim6d: Modify pim_neighbor_find() API

Modify pim_neighbor_find() API to find the neighbor
in neighbor secondary list.

Signed-off-by: Sarita Patra <saritap@vmware.com>
(cherry picked from commit 3dbf370ac0a7cb0f10c56c37286adf971215dff1)

2 years agozebra: Send nexthop ifindex for type NEXTHOP_TYPE_IPV6
Sarita Patra [Mon, 10 Oct 2022 18:06:10 +0000 (11:06 -0700)]
zebra: Send nexthop ifindex for type NEXTHOP_TYPE_IPV6

Once RP/BSR address is learned in PIMD, PIMD does nexthop tracking
in Zebra.
For IPV6 address, the nexthop type is either NEXTHOP_TYPE_IPV6
or NEXTHOP_TYPE_IPV6_IFINDEX.
Zebra should send nexthop ifindex information along with nexthop address
to the client (PIMD).

Issue: #11526
Issue: #11957

Signed-off-by: Sarita Patra <saritap@vmware.com>
(cherry picked from commit ed9323604af55590d81900af2d6953c9db565ab3)

2 years agoMerge pull request #12910 from FRRouting/mergify/bp/dev/8.5/pr-12899 frr-8.5-rc
Donatas Abraitis [Tue, 28 Feb 2023 08:26:14 +0000 (10:26 +0200)]
Merge pull request #12910 from FRRouting/mergify/bp/dev/8.5/pr-12899

pim6d: Fix display issue in "show ipv6 mld interface" command (backport #12899)

2 years agoMerge pull request #12909 from FRRouting/mergify/bp/dev/8.5/pr-12906
Donatas Abraitis [Mon, 27 Feb 2023 21:30:42 +0000 (23:30 +0200)]
Merge pull request #12909 from FRRouting/mergify/bp/dev/8.5/pr-12906

pimd, pim6d: Upstream IIF pointing towards PIM and IGMP disabled source conn… (backport #12906)

2 years agopim6d: Fix missing parameters in "show ipv6 mld interface" command 12910/head
Sarita Patra [Fri, 24 Feb 2023 15:13:30 +0000 (07:13 -0800)]
pim6d: Fix missing parameters in "show ipv6 mld interface" command

Before fix:
==========
frr# show ipv6 mld interface
Interface         State  V  Querier                    Timer               Uptime
ens224            up     1  fe80::250:56ff:feb7:a7e3   query 00:00:24.219  00:00:07.031

After fix:
=========
frr(config-if)# do show ipv6 mld interface
 Interface  State  Address                   V  Querier  QuerierIp                 Query Timer   Uptime
 ens224     up     fe80::250:56ff:feb7:a7e3  1  local    fe80::250:56ff:feb7:a7e3  00:01:22.263  00:08:00.237

Issue: #11241

Signed-off-by: Sarita Patra <saritap@vmware.com>
(cherry picked from commit cbb1e51311ca710540d752c9d6c7689f8fc65dc4)

2 years agopim6d: Display primary address in "show ipv6 mld interface json" cmd
Sarita Patra [Fri, 24 Feb 2023 15:11:57 +0000 (07:11 -0800)]
pim6d: Display primary address in "show ipv6 mld interface json" cmd

Signed-off-by: Sarita Patra <saritap@vmware.com>
(cherry picked from commit 3ab119a4bb79c46c8cce99c8a6ee860c43e378dd)

2 years agopim6d: Don't display MLD disabled or down interfaces in "show ipv6 mld interface...
Sarita Patra [Fri, 24 Feb 2023 15:01:22 +0000 (07:01 -0800)]
pim6d: Don't display MLD disabled or down interfaces in "show ipv6 mld interface" cmd

We should not display down interfaces or MLD disabled interfaces in
"show ipv6 mld interface" command.

Before fix:
==========
frr# show ipv6 mld interface
Interface         State  V  Querier                    Timer               Uptime
ens192            up     2  fe80::250:56ff:feb7:d04    query 00:00:25.432  00:00:07.038
ens224            up     1  fe80::250:56ff:feb7:a7e3   query 00:00:24.219  00:00:07.031
pim6reg            down

After fix:
=========
frr# show ipv6 mld interface
Interface         State  V  Querier                    Timer               Uptime
ens192            up     2  fe80::250:56ff:feb7:d04    query 00:00:25.432  00:00:07.038
ens224            up     1  fe80::250:56ff:feb7:a7e3   query 00:00:24.219  00:00:07.031

Issue: #11241

Signed-off-by: Sarita Patra <saritap@vmware.com>
(cherry picked from commit fe4db62c3dbc7a2ab1b27ae879bf0a76dcfe5b4d)

2 years agopimd, pim6d: Upstream IIF pointing towards PIM and IGMP disabled source connected... 12909/head
Sarita Patra [Mon, 27 Feb 2023 06:25:05 +0000 (22:25 -0800)]
pimd, pim6d: Upstream IIF pointing towards PIM and IGMP disabled source connected interface

Topology:
=========
RP---FHR<ens224>---Source

Problem Statement:
=================
Step 1:
Enable PIM and IGMP on source connected interface ens224

Step 2:
Start multicast traffic. (s,g) mroute and upstream will be created as expected.

dev# show ip mroute
IP Multicast Routing Table
Flags: S - Sparse, C - Connected, P - Pruned
       R - SGRpt Pruned, F - Register flag, T - SPT-bit for SSM FHR
 Source    Group      Flags  Proto  Input   Output  TTL  Uptime
 50.0.0.4  225.1.1.1  SF     PIM    ens224  pimreg  1    00:37:55

dev# show ip pim upstream
 Iif     Source    Group      State      Uptime    JoinTimer  RSTimer   KATimer   RefCnt
 ens224  50.0.0.4  225.1.1.1  NotJ,RegJ  00:37:57  --:--:--   --:--:--  00:02:43  1

Step 3:
Disable PIM on source connected interafce ens224

dev# show ip mroute
IP Multicast Routing Table
Flags: S - Sparse, C - Connected, P - Pruned
       R - SGRpt Pruned, F - Register flag, T - SPT-bit for SSM FHR
 Source    Group      Flags  Proto  Input   Output  TTL  Uptime
 50.0.0.4  225.1.1.1  SF     PIM    ens224  pimreg  1    00:38:05

dev# show ip pim upstream
 Iif     Source    Group      State      Uptime    JoinTimer  RSTimer   KATimer   RefCnt
 ens224  50.0.0.4  225.1.1.1  NotJ,RegJ  00:38:08  --:--:--   --:--:--  00:02:32  1

Step 4:
Disable IGMP on source connected interface ens224

dev# show ip pim upstream
 Iif     Source    Group      State      Uptime    JoinTimer  RSTimer   KATimer   RefCnt
 ens224  50.0.0.4  225.1.1.1  NotJ,RegJ  00:38:15  --:--:--   --:--:--  00:03:27  1

dev# show ip mroute
IP Multicast Routing Table
Flags: S - Sparse, C - Connected, P - Pruned
       R - SGRpt Pruned, F - Register flag, T - SPT-bit for SSM FHR
 Source    Group      Flags  Proto  Input   Output  TTL  Uptime
 50.0.0.4  225.1.1.1  SF     PIM    <iif?>  pimreg  1    00:38:18

Pim upstream IIF is still pointing towards the source connected
interface which is not pim enabled and not IGMP enabled and
Mroute is still present in the kernel and KAT timer is still running
on the interface, where ifp->info is already set to NULL.
This leads to crash.

Root Cause:
==========
When "no ip pim" commands get executed on source connected interface,
we are updating upstream IIF only when IGMP is not enabled on the same
interface.

Fix:
===
When PIM is disabled on source connected interface, update upstream IIF
no matter if IGMP is enabled or not on the same interface.

Issue: #12848
Issue: #10782

Signed-off-by: Sarita Patra <saritap@vmware.com>
(cherry picked from commit 9e01548593d1b8a612eacf49bdcf690d2860d941)

2 years agoMerge pull request #12898 from FRRouting/mergify/bp/dev/8.5/pr-12888
Donald Sharp [Mon, 27 Feb 2023 18:40:06 +0000 (13:40 -0500)]
Merge pull request #12898 from FRRouting/mergify/bp/dev/8.5/pr-12888

bgpd: Flags fixes (backport #12888)

2 years agotests: Increase flags from uint32_t to uint64_t 12898/head
Donatas Abraitis [Fri, 27 Jan 2023 11:49:16 +0000 (13:49 +0200)]
tests: Increase flags from uint32_t to uint64_t

Missed this part when increasing in the past.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agotests: Cover all enum values for unit tests
Donatas Abraitis [Mon, 20 Feb 2023 15:59:09 +0000 (17:59 +0200)]
tests: Cover all enum values for unit tests

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12902 from FRRouting/mergify/bp/dev/8.5/pr-12900
Donatas Abraitis [Sun, 26 Feb 2023 12:22:02 +0000 (14:22 +0200)]
Merge pull request #12902 from FRRouting/mergify/bp/dev/8.5/pr-12900

bgpd: Avoid double aspath_dup() for confederation when remote-as != AS_SPECIFIED (backport #12900)

2 years agobgpd: Avoid double aspath_dup() for confederation when remote-as != AS_SPECIFIED 12902/head
Donatas Abraitis [Fri, 24 Feb 2023 20:01:15 +0000 (22:01 +0200)]
bgpd: Avoid double aspath_dup() for confederation when remote-as != AS_SPECIFIED

Just was blind when not seing it's already dup'ed above:

``` if (peer->sort == BGP_PEER_EBGP
    && (!CHECK_FLAG(peer->af_flags[afi][safi],
    PEER_FLAG_AS_PATH_UNCHANGED)
|| attr->aspath->segments == NULL)
    && (!CHECK_FLAG(peer->af_flags[afi][safi],
    PEER_FLAG_RSERVER_CLIENT))) {
aspath = aspath_dup(attr->aspath); <<<<<<<<<<<<<<<
```

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

2 years agotests: Check if peer->af_flags can be higher than uint32_t
Donatas Abraitis [Thu, 23 Feb 2023 21:10:26 +0000 (23:10 +0200)]
tests: Check if peer->af_flags can be higher than uint32_t

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

2 years agobgpd: Renumber peer->af_flags to be without any gaps
Donatas Abraitis [Thu, 23 Feb 2023 21:51:10 +0000 (23:51 +0200)]
bgpd: Renumber peer->af_flags to be without any gaps

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

2 years agobgpd: Convert missing uint32_t to uint64_t for for af_flags/flags
Donatas Abraitis [Thu, 23 Feb 2023 21:02:35 +0000 (23:02 +0200)]
bgpd: Convert missing uint32_t to uint64_t for for af_flags/flags

It was hard to catch those unless using higher values than uint32_t, but
already hit, it's time to fix completely.

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

2 years agobgpd: Convert peer_af_flag_check() to bool
Donatas Abraitis [Thu, 23 Feb 2023 20:54:12 +0000 (22:54 +0200)]
bgpd: Convert peer_af_flag_check() to bool

Since we increased peer->af_flags from uint32_t to uint64_t,
peer_af_flag_check() was historically returning integer, and not bool
as should be.

The bug was that if we have af_flags higher than uint32_t it will never
returned a right value.

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

2 years agoMerge pull request #12891 from FRRouting/mergify/bp/dev/8.5/pr-12884
Donatas Abraitis [Fri, 24 Feb 2023 13:42:10 +0000 (15:42 +0200)]
Merge pull request #12891 from FRRouting/mergify/bp/dev/8.5/pr-12884

bgpd: Flowspec overflow issue (backport #12884)

2 years agoMerge pull request #12896 from FRRouting/mergify/bp/dev/8.5/pr-12885
Donatas Abraitis [Fri, 24 Feb 2023 13:16:12 +0000 (15:16 +0200)]
Merge pull request #12896 from FRRouting/mergify/bp/dev/8.5/pr-12885

lib, bgpd: bmp was not specifying l2vpn afi (backport #12885)

2 years agoMerge pull request #12883 from FRRouting/mergify/bp/dev/8.5/pr-12878
Donatas Abraitis [Fri, 24 Feb 2023 09:40:13 +0000 (11:40 +0200)]
Merge pull request #12883 from FRRouting/mergify/bp/dev/8.5/pr-12878

pimd: bughunting improvements (backport #12878)

2 years agolib, bgpd: bmp was not specifying l2vpn afi 12896/head
Donald Sharp [Thu, 23 Feb 2023 19:22:33 +0000 (14:22 -0500)]
lib, bgpd: bmp was not specifying l2vpn afi

The l2vpn afi was not being properly displayed
when a show run was being issued.  Add a
afi2str_lower function and use it.

Fixes: #12867
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 0884f1644b19dd6e70a48a6c29fd5d201b264d6d)

2 years agobgpd: Flowspec overflow issue 12891/head
Donald Sharp [Thu, 23 Feb 2023 18:29:32 +0000 (13:29 -0500)]
bgpd: Flowspec overflow issue

According to the flowspec RFC 8955 a flowspec nlri is <length, <nlri data>>
Specifying 0 as a length makes BGP get all warm on the inside.  Which
in this case is not a good thing at all.  Prevent warmth, stay cold
on the inside.

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 0b999c886e241c52bd1f7ef0066700e4b618ebb3)

2 years agoMerge pull request #12886 from FRRouting/mergify/bp/dev/8.5/pr-12876
Christian Hopps [Fri, 24 Feb 2023 07:51:57 +0000 (02:51 -0500)]
Merge pull request #12886 from FRRouting/mergify/bp/dev/8.5/pr-12876

bgpd: Align `show bgp ...` output with the header for wide option (backport #12876)

2 years agobgpd: Align `show bgp ...` output with the header for wide option 12886/head
Donatas Abraitis [Wed, 22 Feb 2023 20:22:28 +0000 (22:22 +0200)]
bgpd: Align `show bgp ...` output with the header for wide option

Before:

```
r1# sh ip bgp wide
BGP table version is 1, local router ID is 192.168.2.1, vrf id 0
Default local pref 100, local AS 65001
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

   Network                                      Next Hop                                  Metric LocPrf Weight Path
 *  172.16.255.254/32                            192.168.2.2                                    0             0 (65003) i
 *>                                              192.168.1.2                                    0             0 (65002) i

Displayed  1 routes and 2 total paths
r1#
```

After:

```
r1# sh ip bgp wide
BGP table version is 1, local router ID is 192.168.2.1, vrf id 0
Default local pref 100, local AS 65001
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

    Network                                      Next Hop                                  Metric LocPrf Weight Path
 *  172.16.255.254/32                            192.168.2.2                                    0             0 (65003) i
 *>                                              192.168.1.2                                    0             0 (65002) i

Displayed  1 routes and 2 total paths
r1#
```

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

2 years agopimd: try to reinstall MFC when we get NOCACHE 12883/head
David Lamparter [Wed, 1 Jun 2022 07:54:31 +0000 (09:54 +0200)]
pimd: try to reinstall MFC when we get NOCACHE

Whether due to a pimd bug, some expiry, or someone just deleting MFC
entries, when we're in NOCACHE we *know* there's no MFC entry.  Add an
install call to make sure pimd's MFC view aligns with the actual kernel
MFC.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2 years agopimd: make logs useful for input drops
David Lamparter [Thu, 10 Mar 2022 12:59:26 +0000 (13:59 +0100)]
pimd: make logs useful for input drops

This path here is pretty far on top of the list of issues that operators
will run into and have to debug when setting up PIM.  Make the log
messages actually tell what's going on.  Also escalate some from
`debug mroute detail` to `debug mroute`.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2 years agoMerge pull request #12877 from FRRouting/mergify/bp/dev/8.5/pr-12869
Jafar Al-Gharaibeh [Thu, 23 Feb 2023 04:50:23 +0000 (22:50 -0600)]
Merge pull request #12877 from FRRouting/mergify/bp/dev/8.5/pr-12869

bgpd: Give better debug message when configuration is being read in (backport #12869)