]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
2 years agobgpd: Do not announce routes immediatelly on filter updates 13138/head
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)
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #13135 from FRRouting/mergify/bp/stable/8.4/pr-13120
Donatas Abraitis [Wed, 29 Mar 2023 07:25:54 +0000 (10:25 +0300)]
Merge pull request #13135 from FRRouting/mergify/bp/stable/8.4/pr-13120

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

2 years agoospfd: Fix for vitual-link crash in signal handler 13135/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 agoMerge pull request #13128 from FRRouting/mergify/bp/stable/8.4/pr-13118
Jafar Al-Gharaibeh [Wed, 29 Mar 2023 04:17:47 +0000 (23:17 -0500)]
Merge pull request #13128 from FRRouting/mergify/bp/stable/8.4/pr-13118

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

2 years agoMerge pull request #13127 from FRRouting/mergify/bp/stable/8.4/pr-13123
Jafar Al-Gharaibeh [Wed, 29 Mar 2023 04:17:29 +0000 (23:17 -0500)]
Merge pull request #13127 from FRRouting/mergify/bp/stable/8.4/pr-13123

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

2 years agobgpd: Copy the password from the previous peer on peer_xfer_config() 13128/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 13127/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 #13104 from FRRouting/mergify/bp/stable/8.4/pr-13100
Donald Sharp [Sun, 26 Mar 2023 12:19:57 +0000 (08:19 -0400)]
Merge pull request #13104 from FRRouting/mergify/bp/stable/8.4/pr-13100

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

2 years agoMerge pull request #13103 from FRRouting/mergify/bp/stable/8.4/pr-13088
Donald Sharp [Fri, 24 Mar 2023 16:00:24 +0000 (12:00 -0400)]
Merge pull request #13103 from FRRouting/mergify/bp/stable/8.4/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 13104/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 #13095 from FRRouting/mergify/bp/stable/8.4/pr-13065
Donald Sharp [Fri, 24 Mar 2023 13:15:34 +0000 (09:15 -0400)]
Merge pull request #13095 from FRRouting/mergify/bp/stable/8.4/pr-13065

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

2 years agopimd: Fix use after free issue for ifp's moving vrfs 13103/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 13095/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 #13071 from FRRouting/mergify/bp/stable/8.4/pr-13062
Donatas Abraitis [Tue, 21 Mar 2023 13:24:33 +0000 (15:24 +0200)]
Merge pull request #13071 from FRRouting/mergify/bp/stable/8.4/pr-13062

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

2 years agozebra: Fix for heap-use-after-free in EVPN 13071/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 #13068 from FRRouting/mergify/bp/stable/8.4/pr-13061
Donald Sharp [Tue, 21 Mar 2023 10:58:59 +0000 (06:58 -0400)]
Merge pull request #13068 from FRRouting/mergify/bp/stable/8.4/pr-13061

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

2 years agolib: on bfd peer shutdown actually stop event 13068/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 agoMerge pull request #13057 from opensourcerouting/fix/bgp_null_deref_8.4
Donald Sharp [Mon, 20 Mar 2023 23:51:53 +0000 (19:51 -0400)]
Merge pull request #13057 from opensourcerouting/fix/bgp_null_deref_8.4

bgpd: Prevent Null pointer deref when outputting data

2 years agobgpd: Prevent Null pointer deref when outputting data 13057/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 #13051 from FRRouting/mergify/bp/stable/8.4/pr-13049
Donatas Abraitis [Mon, 20 Mar 2023 13:43:03 +0000 (15:43 +0200)]
Merge pull request #13051 from FRRouting/mergify/bp/stable/8.4/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 13051/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 #13053 from FRRouting/mergify/bp/stable/8.4/pr-12445
Donatas Abraitis [Mon, 20 Mar 2023 11:26:36 +0000 (13:26 +0200)]
Merge pull request #13053 from FRRouting/mergify/bp/stable/8.4/pr-12445

More mtype tmp (backport #12445)

2 years agobgpd: Make bgp_keepalives.c not use MTYPE_TMP 13053/head
Donald Sharp [Mon, 5 Dec 2022 17:17:00 +0000 (12:17 -0500)]
bgpd: Make bgp_keepalives.c not use MTYPE_TMP

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

2 years agoospf6d: Stop using MTYPE_TMP in some cases
Donald Sharp [Mon, 5 Dec 2022 17:10:25 +0000 (12:10 -0500)]
ospf6d: Stop using MTYPE_TMP in some cases

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

2 years agoospfd, ospfclient: Do not just include .c files in another .c
Donald Sharp [Mon, 5 Dec 2022 16:55:14 +0000 (11:55 -0500)]
ospfd, ospfclient: Do not just include .c files in another .c

ospfclient.c includes .c files directly from ospfd.  Let's separate
these out a bit.

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

2 years agoospfd: Remove MTYPE_TMP
Donald Sharp [Mon, 5 Dec 2022 16:43:57 +0000 (11:43 -0500)]
ospfd: Remove MTYPE_TMP

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

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

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

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

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

Ospf ti lfa leaks (backport #13025)

2 years agoospfd: Free up q_space in early return path 13044/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 13042/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 13040/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 #13034 from FRRouting/mergify/bp/stable/8.4/pr-13024
Donald Sharp [Sat, 18 Mar 2023 17:15:09 +0000 (13:15 -0400)]
Merge pull request #13034 from FRRouting/mergify/bp/stable/8.4/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 13034/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 #13014 from FRRouting/mergify/bp/stable/8.4/pr-13009
Donatas Abraitis [Fri, 17 Mar 2023 22:04:42 +0000 (00:04 +0200)]
Merge pull request #13014 from FRRouting/mergify/bp/stable/8.4/pr-13009

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

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

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

2 years agoospfd: Log Adjacency Changes with Neighbor IP in addition to Neighbor ID 13022/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 13014/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 agoFRR Release 8.4.3 frr-8.4.3
Jafar Al-Gharaibeh [Wed, 15 Mar 2023 21:42:09 +0000 (16:42 -0500)]
FRR Release 8.4.3

This a convenience release/tag for house keeping. We currently don't plan to publish
binary packages with this release.

Changelog:

babeld
    Fix filtering against all interfaces

bgpd
    Avoid double aspath_dup() for confederation when remote-as != as_specified
    Convert evpn output to not pretty print json
    Evpn route detail json display non prett
    Fix deterministic-med check for stale paths
    Fix use-after-free crash for evpn
    Flowspec overflow issue
    Free rfapi callback object always
    Increment version number even when no data is sent
    Intern default-originate attributes to avoid use-after-free
    Pass global asn for confederation peers if not as_specified
    Prevent multipathing among evpn and non-evpn paths

lib, bgpd
    Add ability to specify that some json output should not be pretty

lib
    Fix non-use of option
    Free dnode before returning if yang translator model is already loaded
    Release memory of yang translation module on error

ospfclient
    Bugfix and no implicit register
    Remove register "ready" requirement

ospfd
    Compare prefix values in host order
    Inc. opaque data in `show opaque info detail json` output
    Small bugfix for miscounting a[s]brs

pbrd
    Fix large tableids displayed as negative

pceplib
    Add <time.h> include for time_t

pimd
    In_multicast needs host order
    Make logs useful for input drops
    Try to reinstall mfc when we get nocache
    V6 intentionally turned off route-maps.  turn it on.

tests
    Check if bgp confederation works with as_external (!as_specified)
    Improve the ospfapi test (move to square topology)

tools
    Fix missing pbrd in rsyslog.d 45-frr.conf file
    Frr-reload fix list value not present

vrrpd
    Give null when using null ifp to lookup vr

zebrad
    Add debug for bridge capability
    Fix other table inactive when ip import-table is on

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2 years agoMerge pull request #13000 from FRRouting/mergify/bp/stable/8.4/pr-12996
Donatas Abraitis [Wed, 15 Mar 2023 17:20:26 +0000 (19:20 +0200)]
Merge pull request #13000 from FRRouting/mergify/bp/stable/8.4/pr-12996

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

2 years agotools: frr-reload fix list value not present 13000/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 agoMerge pull request #12988 from FRRouting/mergify/bp/stable/8.4/pr-12978
Donatas Abraitis [Tue, 14 Mar 2023 08:08:51 +0000 (10:08 +0200)]
Merge pull request #12988 from FRRouting/mergify/bp/stable/8.4/pr-12978

pimd: IN_MULTICAST needs host order (backport #12978)

2 years agopimd: IN_MULTICAST needs host order 12988/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 agoMerge pull request #12981 from FRRouting/mergify/bp/stable/8.4/pr-12974
Donatas Abraitis [Mon, 13 Mar 2023 05:11:21 +0000 (07:11 +0200)]
Merge pull request #12981 from FRRouting/mergify/bp/stable/8.4/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 12981/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 #12901 from FRRouting/mergify/bp/stable/8.4/pr-12900
Donatas Abraitis [Sun, 26 Feb 2023 12:22:24 +0000 (14:22 +0200)]
Merge pull request #12901 from FRRouting/mergify/bp/stable/8.4/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 12901/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 agoMerge pull request #12892 from FRRouting/mergify/bp/stable/8.4/pr-12884
Donatas Abraitis [Fri, 24 Feb 2023 14:20:30 +0000 (16:20 +0200)]
Merge pull request #12892 from FRRouting/mergify/bp/stable/8.4/pr-12884

bgpd: Flowspec overflow issue (backport #12884)

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

pimd: bughunting improvements (backport #12878)

2 years agobgpd: Flowspec overflow issue 12892/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 agopimd: try to reinstall MFC when we get NOCACHE 12882/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 #12874 from FRRouting/mergify/bp/stable/8.4/pr-12865
Jafar Al-Gharaibeh [Thu, 23 Feb 2023 04:49:25 +0000 (22:49 -0600)]
Merge pull request #12874 from FRRouting/mergify/bp/stable/8.4/pr-12865

bgpd: free rfapi callback object always (backport #12865)

2 years agoMerge pull request #12872 from FRRouting/mergify/bp/stable/8.4/pr-12861
Donatas Abraitis [Wed, 22 Feb 2023 20:42:04 +0000 (22:42 +0200)]
Merge pull request #12872 from FRRouting/mergify/bp/stable/8.4/pr-12861

bgpd: Confederation fixes with remote-as external/internal (backport #12861)

2 years agoMerge pull request #12870 from FRRouting/mergify/bp/stable/8.4/pr-12850
Donatas Abraitis [Wed, 22 Feb 2023 20:13:13 +0000 (22:13 +0200)]
Merge pull request #12870 from FRRouting/mergify/bp/stable/8.4/pr-12850

ospfd client api bugfix and refinements (backport #12850)

2 years agobgpd: free rfapi callback object always 12874/head
Mark Stapp [Wed, 22 Feb 2023 13:58:28 +0000 (08:58 -0500)]
bgpd: free rfapi callback object always

An rfapi timer callback is responsible for the memory in a
context object, even in special-case exit paths. Always
free that object.

Signed-off-by: Mark Stapp <mjs@labn.net>
(cherry picked from commit 870d3d2cb8e2fa6ff9329ec7126265d1e25a38ae)

2 years agotests: Check if BGP confederation works with AS_EXTERNAL (!AS_SPECIFIED) 12872/head
Donatas Abraitis [Tue, 21 Feb 2023 21:37:04 +0000 (23:37 +0200)]
tests: Check if BGP confederation works with AS_EXTERNAL (!AS_SPECIFIED)

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

2 years agobgpd: Pass global ASN for confederation peers if not AS_SPECIFIED
Donatas Abraitis [Tue, 21 Feb 2023 21:10:45 +0000 (23:10 +0200)]
bgpd: Pass global ASN for confederation peers if not AS_SPECIFIED

When we specify remote-as as external/internal, we need to set local_as to
bgp->as, instead of bgp->confed_id. Before this patch, (bgp->as != *as) is
always valid for such a case because *as is always 0.

Also, append peer->local_as as CONFED_SEQ to avoid other side withdrawing
the routes due to confederation own AS received and/or malformed as-path.

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

2 years agotests: improve the ospfapi test (move to square topology) 12870/head
Christian Hopps [Sun, 6 Feb 2022 14:41:12 +0000 (09:41 -0500)]
tests: improve the ospfapi test (move to square topology)

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 663a0c96d9c52895189bef7579a308a1b14120fa)

2 years agoospfclient: remove register "READY" requirement
Christian Hopps [Sun, 20 Feb 2022 08:59:41 +0000 (03:59 -0500)]
ospfclient: remove register "READY" requirement

- also add ability of the apibin to process commands on stdin

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 6efa8fd5c1653372cea1b25a9fa764269960bb91)

2 years agoospfclient: bugfix and no implicit register
Christian Hopps [Sun, 19 Feb 2023 23:55:58 +0000 (18:55 -0500)]
ospfclient: bugfix and no implicit register

- dont delete the callback on opaque data delete
- require explicit registration

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 703d2c0a3e30c18acd2426b50f97ea8c91c479f9)

2 years agoospfd: compare prefix values in host order
Christian Hopps [Sun, 6 Feb 2022 20:01:28 +0000 (15:01 -0500)]
ospfd: compare prefix values in host order

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 156a904cae87a1ea1cd51de5012c9bddc0d63747)

2 years agoospfd: small bugfix for miscounting A[S]BRs
Christian Hopps [Sun, 6 Feb 2022 14:40:24 +0000 (09:40 -0500)]
ospfd: small bugfix for miscounting A[S]BRs

- improve the debug for the second add router call.

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 1eea62bb1c439ee66d502ef808695554370032e7)

2 years agoospfd: inc. opaque data in `show opaque info detail json` output
Christian Hopps [Sat, 18 Feb 2023 17:16:18 +0000 (12:16 -0500)]
ospfd: inc. opaque data in `show opaque info detail json` output

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 1794afe01030b3111e83e26986cd004dce290049)

2 years agoMerge pull request #12858 from FRRouting/mergify/bp/stable/8.4/pr-12818
Donatas Abraitis [Wed, 22 Feb 2023 08:56:31 +0000 (10:56 +0200)]
Merge pull request #12858 from FRRouting/mergify/bp/stable/8.4/pr-12818

zebra: Fix other table inactive when ip import-table is on (backport #12818)

2 years agozebra: Fix other table inactive when ip import-table is on 12858/head
zyxwvu Shi [Wed, 15 Feb 2023 15:55:00 +0000 (23:55 +0800)]
zebra: Fix other table inactive when ip import-table is on

In `rib_link`, if is_zebra_import_table_enabled returns
true, `rib_queue_add` will not called, resulting in other
table route node never processed. This actually should not
be dependent on whether the route is imported.

In `rib_delnode`, if is_zebra_import_table_enabled returns
true, it will use `rib_unlink` instead of enqueuing the
route node for process. There is no reason that imported
route nodes should not be reprocessed. Long ago, the
behaviour was dependent on whether the route_entry comes
from a table other than main.

Signed-off-by: zyxwvu Shi <i@shiyc.cn>
(cherry picked from commit 207207c0c03e1108d1bae5cf345b7a29850e6ffd)

2 years agoMerge pull request #12825 from FRRouting/mergify/bp/stable/8.4/pr-12817
Donatas Abraitis [Fri, 17 Feb 2023 14:37:08 +0000 (16:37 +0200)]
Merge pull request #12825 from FRRouting/mergify/bp/stable/8.4/pr-12817

some missed upstream commits (backport #12817)

2 years agoMerge pull request #12745 from opensourcerouting/fix/no_pretty_picks
Igor Ryzhov [Fri, 17 Feb 2023 10:09:21 +0000 (12:09 +0200)]
Merge pull request #12745 from opensourcerouting/fix/no_pretty_picks

bgpd: Convert evpn output to not pretty print json

2 years agolib: Fix non-use of option 12745/head
Donald Sharp [Thu, 2 Feb 2023 21:28:27 +0000 (16:28 -0500)]
lib: Fix non-use of option

Commit d7c6467ba2f55d1055babbb7fe82716ca3efdc7e added the
ability to specify non pretty printing but unfortunately
forgot to use the option variable to make the whole
thing work.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agozebra: Add debug for bridge capability 12825/head
vivek [Tue, 13 Apr 2021 19:12:40 +0000 (12:12 -0700)]
zebra: Add debug for bridge capability

Signed-off-by: Vivek Venkatraman <vivek@nvidia.com>
Ticket: #2609944
(cherry picked from commit f88889ba7a48c6126e7f389b023cd232cdee5078)

2 years agobgpd: Prevent multipathing among EVPN and non-EVPN paths
vivek [Fri, 18 Dec 2020 18:55:40 +0000 (10:55 -0800)]
bgpd: Prevent multipathing among EVPN and non-EVPN paths

Ensure that a multipath set is fully comprised of EVPN paths (i.e.,
paths imported into the VRF from EVPN address-family) or non-EVPN
paths. This is actually a condition that existed already in the code
but was not properly enforced.

This change, as a side effect, eliminates the known trigger condition
for bad or missing RMAC programming in an EVPN deployment, described
in tickets CM-29043 and CM-31222. Routes (actually, paths) in a VRF
routing table that require VXLAN tunneling to the next hop currently
need some special handling in zebra to deal with the nexthop (neigh)
and RMAC programming, and this is implemented for the entire route
(prefix), not per-path. This can lead to the bad or missing RMAC
situation, which is now eliminated by ensuring all paths in the route
are 'similar'.

The longer-term solution in CL 5.x will be to deal with the special
programming by means of explicit communication between bgpd and zebra.
This is already implemented for EVPN-MH via CM-31398. These changes
will be extended to non-MH also and the special code in zebra removed
or refined.

Signed-off-by: Vivek Venkatraman <vivek@nvidia.com>
Acked-by: Trey Aspelund <taspelund@nvidia.com>
Acked-by: Anuradha Karuppiah <anuradhak@nvidia.com>
Acked-by: Chirag Shah <chirag@nvidia.com>
Ticket: CM-29043
Testing Done:
1. Manual testing
2. precommit on both MLX and BCM platforms
3. evpn-smoke - BCM and VX

Results described in the ticket

(cherry picked from commit d2d71b042edc628cb6edae0b25d0a49aa9ad2050)

2 years agobgpd: Fix deterministic-med check for stale paths
vivek [Thu, 3 Dec 2020 04:04:19 +0000 (20:04 -0800)]
bgpd: Fix deterministic-med check for stale paths

When performing deterministic MED processing, ensure that the peer
status is not checked when we encounter a stale path. Otherwise, this
path will be skipped from the DMED consideration leading to it potentially
not being installed.

Test scenario: Consider a prefix with 2 (multi)paths. The peer that
announces the path with the winning DMED undergoes a graceful-restart.
Before it comes back up, the other path goes away. Prior to the fix, a
third router that receives both these paths would have ended up not
having any path installed to the prefix after the above events.

Signed-off-by: Vivek Venkatraman <vivek@nvidia.com>
For internal use:
Ticket: CM-32032
Testing done: Multiple manual testing

(cherry picked from commit de692a4ebe0b8ea8e191d8ac1f3b41a386edd577)

2 years agoMerge pull request #12804 from FRRouting/mergify/bp/stable/8.4/pr-12790
Donald Sharp [Tue, 14 Feb 2023 20:19:44 +0000 (15:19 -0500)]
Merge pull request #12804 from FRRouting/mergify/bp/stable/8.4/pr-12790

vrrpd: give null when using null ifp to lookup vr (backport #12790)

2 years agovrrpd: give null when using null ifp to lookup vr 12804/head
Quentin Young [Mon, 28 Oct 2019 15:41:38 +0000 (15:41 +0000)]
vrrpd: give null when using null ifp to lookup vr

This is still causing crashes somehow.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
(cherry picked from commit ed331629de425914568c1d5c114018878627cdaf)

2 years agoMerge pull request #12787 from opensourcerouting/fix/backport_e9340ff429f5f1a255e89a5...
Donald Sharp [Fri, 10 Feb 2023 13:03:51 +0000 (08:03 -0500)]
Merge pull request #12787 from opensourcerouting/fix/backport_e9340ff429f5f1a255e89a50867a04a370cd56bb

bgpd: Intern default-originate attributes to avoid use-after-free

2 years agobgpd: Intern default-originate attributes to avoid use-after-free 12787/head
Donatas Abraitis [Thu, 9 Feb 2023 20:29:25 +0000 (22:29 +0200)]
bgpd: Intern default-originate attributes to avoid use-after-free

When we receive a default route from a peer and we originate default route
using `neighbor default-originate`, we do not track of struct attr we use,
and when we do `no neighbor default-originate` we withdraw our generated
default route, but we announce default-route from the peer.

After we do this, we unintern aspath (which was used for default-originate),
BUT it was used also for peer's default route we received.

And here we have a use-after-free crash, because bgp_process_main_one()
reaps old paths that are marked as BGP_PATH_REMOVED with aspath->refcnt > 0,
but here it's 0.

```
0 0x55c24bbcd022 in aspath_key_make bgpd/bgp_aspath.c:2070
1 0x55c24b8f1140 in attrhash_key_make bgpd/bgp_attr.c:777
2 0x7f52322e66c9 in hash_release lib/hash.c:220
3 0x55c24b8f6017 in bgp_attr_unintern bgpd/bgp_attr.c:1271
4 0x55c24ba0acaa in bgp_path_info_free_with_caller bgpd/bgp_route.c:283
5 0x55c24ba0a7de in bgp_path_info_unlock bgpd/bgp_route.c:309
6 0x55c24ba0af6d in bgp_path_info_reap bgpd/bgp_route.c:426
7 0x55c24ba17b9a in bgp_process_main_one bgpd/bgp_route.c:3333
8 0x55c24ba18a1d in bgp_process_wq bgpd/bgp_route.c:3425
9 0x7f52323c2cd5 in work_queue_run lib/workqueue.c:282
10 0x7f52323aab92 in thread_call lib/thread.c:2006
11 0x7f5232300dc7 in frr_run lib/libfrr.c:1198
12 0x55c24b8ea792 in main bgpd/bgp_main.c:520
13 0x7f5231c3a082 in __libc_start_main ../csu/libc-start.c:308
14 0x55c24b8ef0bd in _start (/usr/lib/frr/bgpd+0x2c90bd)
    ```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12783 from FRRouting/mergify/bp/stable/8.4/pr-12781
Donatas Abraitis [Fri, 10 Feb 2023 08:14:35 +0000 (10:14 +0200)]
Merge pull request #12783 from FRRouting/mergify/bp/stable/8.4/pr-12781

lib: Release memory of YANG translation module on error (backport #12781)

2 years agolib: Free dnode before returning if YANG translator model is already loaded 12783/head
Donatas Abraitis [Thu, 9 Feb 2023 21:14:46 +0000 (23:14 +0200)]
lib: Free dnode before returning if YANG translator model is already loaded

Seems just a missed one because at `goto error` we release dnode.

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

2 years agolib: Release memory of YANG translation module on error
Donatas Abraitis [Thu, 9 Feb 2023 15:59:11 +0000 (17:59 +0200)]
lib: Release memory of YANG translation module on error

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

2 years agoMerge pull request #12779 from FRRouting/mergify/bp/stable/8.4/pr-12773
Donatas Abraitis [Thu, 9 Feb 2023 13:12:00 +0000 (15:12 +0200)]
Merge pull request #12779 from FRRouting/mergify/bp/stable/8.4/pr-12773

pbrd: fix large tableids displayed as negative (backport #12773)

2 years agopbrd: fix large tableids displayed as negative 12779/head
Wesley Coakley [Tue, 20 Jul 2021 13:25:01 +0000 (09:25 -0400)]
pbrd: fix large tableids displayed as negative

Ticket: 2699411
Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
(cherry picked from commit 8dc2001c914956f1b493c4e04499b520362dd053)

2 years agoMerge pull request #12774 from FRRouting/mergify/bp/stable/8.4/pr-12769
Donatas Abraitis [Thu, 9 Feb 2023 07:47:01 +0000 (09:47 +0200)]
Merge pull request #12774 from FRRouting/mergify/bp/stable/8.4/pr-12769

tools: Fix missing pbrd in rsyslog.d 45-frr.conf file (backport #12769)

2 years agotools: Fix missing pbrd in rsyslog.d 45-frr.conf file 12774/head
Donald Sharp [Wed, 8 Feb 2023 18:04:01 +0000 (13:04 -0500)]
tools: Fix missing pbrd in rsyslog.d 45-frr.conf file

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

2 years agoMerge pull request #12766 from FRRouting/mergify/bp/stable/8.4/pr-12761
Donatas Abraitis [Wed, 8 Feb 2023 11:54:40 +0000 (13:54 +0200)]
Merge pull request #12766 from FRRouting/mergify/bp/stable/8.4/pr-12761

bgpd: fix use-after-free crash for evpn (backport #12761)

2 years agobgpd: fix use-after-free crash for evpn 12766/head
anlan_cs [Mon, 6 Feb 2023 01:27:05 +0000 (09:27 +0800)]
bgpd: fix use-after-free crash for evpn

```
anlan(config-router-af)# vni 33
anlan(config-router-af-vni)# route-target both 44:55
anlan(config-router-af-vni)# no route-target both 44:55
vtysh: error reading from bgpd: Resource temporarily unavailable (11)Warning: closing connection to bgpd because of an I/O error!
```

When `bgp_evpn_vni_rt_cmd` deals with "both" type, it wrongly created
only one node ( should be two nodes ) for lists of both `vpn->import_rtl` and
`vpn->export_rtl`.  At this time, the two lists are already wrong.

In `no route-target both RT`, it will free the single node from lists of both
`vpn->import_rtl` and `vpn->export_rtl`.  After freed from `vpn->import_rtl`,
it is "use-after-free" at the time of freeing it from `vpn->export_rtl`.
It causes crash sometimes, or other unexpected behaviours.

This issue is introduced by commit `3b7e8d`, which have adjusted both
`bgp_evpn_vni_rt_cmd` and `bgp_evpn_vrf_rt_cmd`.

Since `bgp_evpn_vrf_rt_cmd/no_bgp_evpn_vrf_rt_cmd` works well again
unintentionally with commit `7022da`, only `bgp_evpn_vni_rt_cmd` needs to
modify - add two nodes for "both" type and some explicit comments for this
special case of "both" type.

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

2 years agoMerge pull request #12752 from FRRouting/mergify/bp/stable/8.4/pr-12741
Donatas Abraitis [Tue, 7 Feb 2023 11:28:28 +0000 (13:28 +0200)]
Merge pull request #12752 from FRRouting/mergify/bp/stable/8.4/pr-12741

pceplib: add <time.h> include for time_t (backport #12741)

2 years agopceplib: add <time.h> include for time_t 12752/head
Sam James [Sat, 4 Feb 2023 23:29:59 +0000 (23:29 +0000)]
pceplib: add <time.h> include for time_t

Fixes build on musl. Used for time_t in the header.

Bug: https://bugs.gentoo.org/862558
Signed-off-by: Sam James <sam@gentoo.org>
(cherry picked from commit 3c8c112df4d72d98c8646df1495cf26a84c2c3b7)

2 years agoMerge pull request #12746 from FRRouting/mergify/bp/stable/8.4/pr-12740
Donatas Abraitis [Mon, 6 Feb 2023 16:34:27 +0000 (18:34 +0200)]
Merge pull request #12746 from FRRouting/mergify/bp/stable/8.4/pr-12740

babeld: Fix filtering against all interfaces (backport #12740)

2 years agobabeld: Fix filtering against all interfaces 12746/head
Yuxiang Zhu [Sat, 4 Feb 2023 17:20:43 +0000 (17:20 +0000)]
babeld: Fix filtering against all interfaces

The first argument of `access_list_lookup` and `prefix_list_lookup`
should be `AFI_` constants instead of `AF_` constants.

Signed-off-by: Yuxiang Zhu <vfreex@gmail.com>
(cherry picked from commit 0f9650ca955d4c9a5c3d9de72a9306cb429079f2)

2 years agobgpd: Convert evpn output to not pretty print json
Donald Sharp [Thu, 2 Feb 2023 15:40:07 +0000 (10:40 -0500)]
bgpd: Convert evpn output to not pretty print json

Commit: 3cdb03fba7b40240fb38469a12b7b05a11043e09
changed the vty_json output to not be pretty printing.
The previous commit in the tree added vty_json_no_pretty
let's use that instead

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agolib, bgpd: Add ability to specify that some json output should not be pretty
Donald Sharp [Thu, 2 Feb 2023 15:28:19 +0000 (10:28 -0500)]
lib, bgpd: Add ability to specify that some json output should not be pretty

Initial commit: 23b2a7ef524c9fe083b217c7f6ebaec0effc8f52
changed the json output of `show bgp <afi> <safi> json` to
not have pretty print because when under a situation where
there are a bunch of routes with a large scale ecmp show
output was taking forever and this commit cut 2 minutes out
of vtysh run time.

Subusequent commit: f4ec52f7cc99f709756d9030623a20c98a086125
changed this back.

When upgrading to latest version the long run time was noticed
due to testing.  Let's add back this functionality such that
FRR can have reduced run times with vtysh when it's really
needed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: evpn route detail json display non prett
Chirag Shah [Tue, 24 Jan 2023 06:18:24 +0000 (22:18 -0800)]
bgpd: evpn route detail json display non prett

For BGP evpn route table detail json to use
non pretty form of display.

Problem:
In scaled evpn route table detail json dump
occupies high resources (CPU + memory) of the system.
In high scale evpn route dump using pretty form
hogs CPU for a while which can trigger watchfrr
to kill bgpd.

Solution:
Avoid pretty JSON print for detail version dump

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2 years agoMerge pull request #12719 from FRRouting/mergify/bp/stable/8.4/pr-12704
Donatas Abraitis [Wed, 1 Feb 2023 12:12:29 +0000 (14:12 +0200)]
Merge pull request #12719 from FRRouting/mergify/bp/stable/8.4/pr-12704

pimd: v6 intentionally turned off route-maps.  Turn it on. (backport #12704)

2 years agopimd: v6 intentionally turned off route-maps. Turn it on. 12719/head
Donald Sharp [Sun, 29 Jan 2023 03:16:08 +0000 (22:16 -0500)]
pimd: v6 intentionally turned off route-maps.  Turn it on.

Why?

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

2 years agoFRR Release 8.4.2 docker/8.4.2 frr-8.4.2
Jafar Al-Gharaibeh [Mon, 9 Jan 2023 21:18:58 +0000 (15:18 -0600)]
FRR Release 8.4.2

Bug fixes:

- bfdd: fix ipv4 socket source selection
- bgpd : fix crash for `set ipv4/ipv6 vpn next-hop` command
- bgpd: stop overriding nexthop when bgp unnumbered
- bgpd: fix aggregated routes are withdrawn abnormally
- bgpd: fix a few memory leaks
- build: enable pim6d by default
- build: fix sed regex in lua macro
- doc : add freebsd 13 build docs
- isisd: fix memory leak
- lib:  disable vrf before terminating interfaces
- lib: do not log `echo ping` commands from watchfrr
- ospf6d:  fix infinite loop when adding asbr route
- ospfd: fix rfc conformance test cases 25.19 and 27.6
- ospfd: fix typo and report the P2P link name in the warning
- ospfd: report the router IP with opaque capability mismatch
- ospfd: fixing memory leak
- pimd: consistently ignore prefix list mask len
- staticd: do not crash when modifying an existing static route with color
- zebra: free all memory associated ctx->u.iptable.interface_name_list
- zebra: fix tracepoint changes for lttng
- zebra: free up route map name memory on vrf deletion event
- zebra: use `mpls enable`, not `mpls` when generating a config
- tools: Ignore agentx command for frr-reload.py

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2 years agoMerge pull request #12610 from FRRouting/mergify/bp/stable/8.4/pr-12606
Jafar Al-Gharaibeh [Mon, 9 Jan 2023 20:56:34 +0000 (14:56 -0600)]
Merge pull request #12610 from FRRouting/mergify/bp/stable/8.4/pr-12606

*: various build fixes (backport #12606)