]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
14 months agopimd: re-evaluated S,G OILs upon RP changes and for empty SG upstream oils 15343/head
Rajesh Varatharaj [Thu, 8 Feb 2024 02:58:39 +0000 (18:58 -0800)]
pimd: re-evaluated S,G OILs upon RP changes and for empty SG upstream oils

Topology:

TOR11 (FHR) --- LEAF-11---SPINE1 (RP)MSDP SPINE-2(RP)MSDP --- LEAF-12 -- TOR12 (LHR)
        |         |                    | |       |
|         -----------------------------------------------------(ECMP)   |
|         |                                 |               |
 -----------------------------------------------------------------------(ECMP)
Issue:
In some triggers, S,G upstream is preserved even with the PP timer expiry, resulting
in S,G with NULL OILS. This could be because we create a dummy S,G upstream and
dummy channel_oif for *,G, where RPF is UNKNOWN. As a result, PIM+VXLAN traffic is never
forwarded downstream to LHR.

Fix:
when the S,G stream is running, Determine if a reevaluation of the outgoing interface
 list (OIL) is required. S,G upstream should then inherit the OIL from *,G.

Testing:
- Evpn pim tests - TestEvpnPimSingleVtepOneMdt.test_02_broadcast_traffic_spt_zero
- pim-smoke

Ticket: #
Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
(cherry picked from commit 071d43a052e04de52771b2f03461c407f0ced36f)

15 months agoMerge pull request #15232 from donaldsharp/null_argument_warning_8.4
Donald Sharp [Thu, 25 Jan 2024 14:33:54 +0000 (09:33 -0500)]
Merge pull request #15232 from donaldsharp/null_argument_warning_8.4

bgpd: fix NULL argument warning

15 months agobgpd: fix NULL argument warning 15232/head
David Lamparter [Thu, 16 Mar 2023 10:00:02 +0000 (11:00 +0100)]
bgpd: fix NULL argument warning

gcc 12.2.0 complains `error: ā€˜%s’ directive argument is null`, even
though all enum values are covered with a string.  Let's just go with a
`???` default.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
15 months agoMerge pull request #15141 from FRRouting/mergify/bp/stable/8.4/pr-14664
Donald Sharp [Tue, 16 Jan 2024 15:41:40 +0000 (10:41 -0500)]
Merge pull request #15141 from FRRouting/mergify/bp/stable/8.4/pr-14664

isisd: staticd: need to link directly against libyang (backport #14664)

15 months agoisisd: staticd: need to link directly against libyang 15141/head
Christian Hopps [Fri, 27 Oct 2023 02:51:08 +0000 (22:51 -0400)]
isisd: staticd: need to link directly against libyang

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

18 months agoMerge pull request #14587 from FRRouting/mergify/bp/stable/8.4/pr-13340
Donald Sharp [Fri, 13 Oct 2023 15:39:35 +0000 (11:39 -0400)]
Merge pull request #14587 from FRRouting/mergify/bp/stable/8.4/pr-13340

zebra: Fix connected route deletion when multiple entry exists (backport #13340)

18 months agozebra: Fix connected route deletion when multiple entry exists 14587/head
Xiao Liang [Thu, 20 Apr 2023 03:40:04 +0000 (11:40 +0800)]
zebra: Fix connected route deletion when multiple entry exists

When multiple interfaces have addresses in the same network, deleting
one of them may cause the wrong connected route being deleted.
For example:

    ip link add veth1 type veth peer veth2
    ip link set veth1 up
    ip link set veth2 up
    ip addr add dev veth1 192.168.0.1/24
    ip addr add dev veth2 192.168.0.2/24
    ip addr flush dev veth1

Zebra deletes the route of interface veth2 rather than veth1.

Should match nexthop against ere->re_nhe instead of ere->re->nhe.

Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
(cherry picked from commit a35ba7ba602f87390cc9cbce3f0ceb61977f0949)

19 months agoMerge pull request #14319 from opensourcerouting/fix/backport_530be6a4d089600f1028439...
Jafar Al-Gharaibeh [Thu, 31 Aug 2023 16:58:58 +0000 (11:58 -0500)]
Merge pull request #14319 from opensourcerouting/fix/backport_530be6a4d089600f1028439ddec420ef651b983b_8.4

ospfd: Prevent use after free( and crash of ospf ) when no router ospf

19 months agoospfd: Prevent use after free( and crash of ospf ) when no router ospf 14319/head
Donald Sharp [Wed, 30 Aug 2023 14:33:29 +0000 (10:33 -0400)]
ospfd: Prevent use after free( and crash of ospf ) when no router ospf

Consider this config:

router ospf
  redistribute kernel

Then you issue:

no router ospf

ospf will crash with a use after free.

The problem is that the event's associated with the
ospf pointer were shut off then the ospf_external_delete
was called which rescheduled the event.  Let's just move
event deletion to the end of the no router ospf.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
19 months agoMerge pull request #14295 from FRRouting/mergify/bp/stable/8.4/pr-14290
Donald Sharp [Wed, 30 Aug 2023 13:21:23 +0000 (09:21 -0400)]
Merge pull request #14295 from FRRouting/mergify/bp/stable/8.4/pr-14290

bgpd: Use treat-as-withdraw for tunnel encapsulation attribute (backport #14290)

20 months agoMerge pull request #14298 from FRRouting/mergify/bp/stable/8.4/pr-14243
Donatas Abraitis [Wed, 30 Aug 2023 08:33:01 +0000 (11:33 +0300)]
Merge pull request #14298 from FRRouting/mergify/bp/stable/8.4/pr-14243

bgpd: Do not explicitly print MAXTTL value for ebgp-multihop vty output (backport #14243)

20 months agobgpd: Do not explicitly print MAXTTL value for ebgp-multihop vty output 14298/head
Donatas Abraitis [Sun, 20 Aug 2023 21:01:42 +0000 (00:01 +0300)]
bgpd: Do not explicitly print MAXTTL value for ebgp-multihop vty output

1. Create /etc/frr/frr.conf
```
frr version 7.5
frr defaults traditional
hostname centos8.localdomain
no ip forwarding
no ipv6 forwarding
service integrated-vtysh-config
line vty
router bgp 4250001000
  neighbor 192.168.122.207 remote-as 65512
  neighbor 192.168.122.207 ebgp-multihop
```

2. Start FRR
`# systemctl start frr
`
3. Show running configuration. Note that FRR explicitly set and shows the default TTL (225)

```
Building configuration...

Current configuration:
!
frr version 7.5
frr defaults traditional
hostname centos8.localdomain
no ip forwarding
no ipv6 forwarding
service integrated-vtysh-config
!
router bgp 4250001000
 neighbor 192.168.122.207 remote-as 65512
 neighbor 192.168.122.207 ebgp-multihop 255
!
line vty
!
end
```
4. Copy initial frr.conf to frr.conf.new (no changes)
`# cp /etc/frr/frr.conf /root/frr.conf.new
`
5. Run frr-reload.sh:

```
$ /usr/lib/frr/frr-reload.py --test  /root/frr.conf.new
2023-08-20 20:15:48,050  INFO: Called via "Namespace(bindir='/usr/bin', confdir='/etc/frr', daemon='', debug=False, filename='/root/frr.conf.new', input=None, log_level='info', overwrite=False, pathspace=None, reload=False, rundir='/var/run/frr', stdout=False, test=True, vty_socket=None)"
2023-08-20 20:15:48,050  INFO: Loading Config object from file /root/frr.conf.new
2023-08-20 20:15:48,124  INFO: Loading Config object from vtysh show running

Lines To Delete
===============
router bgp 4250001000
 no neighbor 192.168.122.207 ebgp-multihop 255

Lines To Add
============
router bgp 4250001000
 neighbor 192.168.122.207 ebgp-multihop
```

Closes https://github.com/FRRouting/frr/issues/14242

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

20 months agobgpd: Use treat-as-withdraw for tunnel encapsulation attribute 14295/head
Donatas Abraitis [Thu, 13 Jul 2023 19:32:03 +0000 (22:32 +0300)]
bgpd: Use treat-as-withdraw for tunnel encapsulation attribute

Before this path we used session reset method, which is discouraged by rfc7606.

Handle this as rfc requires.

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

20 months agoMerge pull request #14212 from opensourcerouting/fix/backport_fedf9119a1964abf8e476f2...
Donald Sharp [Wed, 16 Aug 2023 13:25:00 +0000 (09:25 -0400)]
Merge pull request #14212 from opensourcerouting/fix/backport_fedf9119a1964abf8e476f239d81b3f4ce385b1d_8.4

lib: Allow unsetting walltime-warning and cpu-warning

20 months agovtysh: Print uniq lines when parsing `no service ...` 14212/head
Donatas Abraitis [Fri, 11 Aug 2023 15:21:12 +0000 (18:21 +0300)]
vtysh: Print uniq lines when parsing `no service ...`

Before this patch:

```
no service cputime-warning
no service cputime-warning
no ipv6 forwarding
no service cputime-warning
no service cputime-warning
no service cputime-warning
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agolib: Allow unsetting walltime-warning and cpu-warning
Donatas Abraitis [Fri, 11 Aug 2023 15:11:03 +0000 (18:11 +0300)]
lib: Allow unsetting walltime-warning and cpu-warning

With a negative form we get:

```
Internal CLI error [walltime_warning_str]
Internal CLI error [cputime_warning_str]
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
20 months agoMerge pull request #14191 from FRRouting/mergify/bp/stable/8.4/pr-14182
Donald Sharp [Sat, 12 Aug 2023 18:02:54 +0000 (14:02 -0400)]
Merge pull request #14191 from FRRouting/mergify/bp/stable/8.4/pr-14182

bgpd: evpn code was not properly unlocking rd_dest (backport #14182)

20 months agobgpd: evpn code was not properly unlocking rd_dest 14191/head
Donald Sharp [Fri, 11 Aug 2023 13:53:42 +0000 (09:53 -0400)]
bgpd: evpn code was not properly unlocking rd_dest

Found some code where bgp was not unlocking the dest
and rd_dest when walking the tree attempting to
find something to install.

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

20 months agoMerge pull request #14185 from FRRouting/mergify/bp/stable/8.4/pr-12524
Jafar Al-Gharaibeh [Sat, 12 Aug 2023 00:48:37 +0000 (19:48 -0500)]
Merge pull request #14185 from FRRouting/mergify/bp/stable/8.4/pr-12524

lib, zebra: Fix EVPN nexthop config order (backport #12524)

20 months agolib, zebra: Fix EVPN nexthop config order 14185/head
Xiao Liang [Thu, 15 Dec 2022 09:04:32 +0000 (17:04 +0800)]
lib, zebra: Fix EVPN nexthop config order

Delay EVPN route addition to synchronize with rib_delete(), which now
uses early route queue.

Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
(cherry picked from commit cea3f7f25a23e485d4f814b670c11c92249568e1)

20 months agoMerge pull request #14134 from FRRouting/mergify/bp/stable/8.4/pr-14129
Donatas Abraitis [Thu, 3 Aug 2023 19:36:29 +0000 (22:36 +0300)]
Merge pull request #14134 from FRRouting/mergify/bp/stable/8.4/pr-14129

bgpd: Fix for session reset issue caused by malformed core attributes  in update message (backport #14129)

20 months agobgpd: Fix session reset issue caused by malformed core attributes 14134/head
Samanvitha B Bhargav [Wed, 2 Aug 2023 06:10:35 +0000 (23:10 -0700)]
bgpd: Fix session reset issue caused by malformed core attributes

RCA:
On encountering any attribute error for core attributes in update message,
the error handling is set to 'treat as withdraw' and
further parsing of the remaining attributes is skipped.
But the stream pointer is not being correctly adjusted to
point to the next NLRI field skipping the rest of the attributes.
This leads to incorrect parsing of the NLRI field,
which causes BGP session to reset.

Fix:
The stream pointer offset is rightly adjusted to point to the NLRI field correctly
when the malformed attribute is encountered and remaining attribute parsing is skipped.

Signed-off-by: Samanvitha B Bhargav <bsamanvitha@vmware.com>
(cherry picked from commit 70ff940fd1cbf920958116c558150ca5d3200eb8)

21 months agoMerge pull request #13957 from opensourcerouting/fix/route_map_cli_8.4
Donald Sharp [Tue, 11 Jul 2023 15:27:31 +0000 (11:27 -0400)]
Merge pull request #13957 from opensourcerouting/fix/route_map_cli_8.4

lib: make cmd_element->attr a bitmask & clarify

21 months agolib: make cmd_element->attr a bitmask & clarify 13957/head
David Lamparter [Tue, 4 Oct 2022 11:30:04 +0000 (13:30 +0200)]
lib: make cmd_element->attr a bitmask & clarify

It already "looks" like a bitmask, but we currently can't flag a command
both YANG and HIDDEN at the same time.  It really should be a bitmask.

Also clarify DEPRECATED behaviour (or the absence thereof.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
21 months agoMerge pull request #13914 from opensourcerouting/fix/ospf6d_backports_8.4
Donald Sharp [Mon, 3 Jul 2023 12:34:34 +0000 (08:34 -0400)]
Merge pull request #13914 from opensourcerouting/fix/ospf6d_backports_8.4

ospf6d: Crash backports

21 months agoMerge pull request #13906 from FRRouting/mergify/bp/stable/8.4/pr-13895
Donatas Abraitis [Mon, 3 Jul 2023 07:49:58 +0000 (10:49 +0300)]
Merge pull request #13906 from FRRouting/mergify/bp/stable/8.4/pr-13895

ospfd: check for NULLs in ldp-igp sync json code (backport #13895)

21 months agoospf6d: Fix crash because neighbor structure was freed 13914/head
Donald Sharp [Sat, 1 Jul 2023 15:18:06 +0000 (11:18 -0400)]
ospf6d: Fix crash because neighbor structure was freed

The loading_done event needs a event pointer to prevent
use after free's.  Testing found this:

    ERROR: AddressSanitizer: heap-use-after-free on address 0x613000035130 at pc 0x55ad42d54e5f bp 0x7ffff1e942a0 sp 0x7ffff1e94290
    READ of size 1 at 0x613000035130 thread T0
        #0 0x55ad42d54e5e in loading_done ospf6d/ospf6_neighbor.c:447
        #1 0x55ad42ed7be4 in event_call lib/event.c:1995
        #2 0x55ad42e1df75 in frr_run lib/libfrr.c:1213
        #3 0x55ad42cf332e in main ospf6d/ospf6_main.c:250
        #4 0x7f5798133c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
        #5 0x55ad42cf2b19 in _start (/usr/lib/frr/ospf6d+0x248b19)

    0x613000035130 is located 48 bytes inside of 384-byte region [0x613000035100,0x613000035280)
    freed by thread T0 here:
        #0 0x7f57998d77a8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7a8)
        #1 0x55ad42e3b4b6 in qfree lib/memory.c:130
        #2 0x55ad42d5d049 in ospf6_neighbor_delete ospf6d/ospf6_neighbor.c:180
        #3 0x55ad42d1e1ea in interface_down ospf6d/ospf6_interface.c:930
        #4 0x55ad42ed7be4 in event_call lib/event.c:1995
        #5 0x55ad42ed84fe in _event_execute lib/event.c:2086
        #6 0x55ad42d26d7b in ospf6_interface_clear ospf6d/ospf6_interface.c:2847
        #7 0x55ad42d73f16 in ospf6_process_reset ospf6d/ospf6_top.c:755
        #8 0x55ad42d7e98c in clear_router_ospf6_magic ospf6d/ospf6_top.c:778
        #9 0x55ad42d7e98c in clear_router_ospf6 ospf6d/ospf6_top_clippy.c:42
        #10 0x55ad42dc2665 in cmd_execute_command_real lib/command.c:994
        #11 0x55ad42dc2b32 in cmd_execute_command lib/command.c:1053
        #12 0x55ad42dc2fa9 in cmd_execute lib/command.c:1221
        #13 0x55ad42ee3cd6 in vty_command lib/vty.c:591
        #14 0x55ad42ee4170 in vty_execute lib/vty.c:1354
        #15 0x55ad42eec94f in vtysh_read lib/vty.c:2362
        #16 0x55ad42ed7be4 in event_call lib/event.c:1995
        #17 0x55ad42e1df75 in frr_run lib/libfrr.c:1213
        #18 0x55ad42cf332e in main ospf6d/ospf6_main.c:250
        #19 0x7f5798133c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

    previously allocated by thread T0 here:
        #0 0x7f57998d7d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
        #1 0x55ad42e3ab22 in qcalloc lib/memory.c:105
        #2 0x55ad42d5c8ff in ospf6_neighbor_create ospf6d/ospf6_neighbor.c:119
        #3 0x55ad42d4c86a in ospf6_hello_recv ospf6d/ospf6_message.c:464
        #4 0x55ad42d4c86a in ospf6_read_helper ospf6d/ospf6_message.c:1884
        #5 0x55ad42d4c86a in ospf6_receive ospf6d/ospf6_message.c:1925
        #6 0x55ad42ed7be4 in event_call lib/event.c:1995
        #7 0x55ad42e1df75 in frr_run lib/libfrr.c:1213
        #8 0x55ad42cf332e in main ospf6d/ospf6_main.c:250
        #9 0x7f5798133c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Add an actual event pointer and just track it appropriately.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
21 months agoospf6d: Stop crash in ospf6_write
Donald Sharp [Fri, 30 Jun 2023 19:21:43 +0000 (15:21 -0400)]
ospf6d: Stop crash in ospf6_write

I'm seeing crashes in ospf6_write on the `assert(node)`.  The only
sequence of events that I see that could possibly cause this to happen
is this:

a) Someone has scheduled a outgoing write to the ospf6->t_write and
placed item(s) on the ospf6->oi_write_q
b) A decision is made in ospf6_send_lsupdate() to send an immediate
packet via a event_execute(..., ospf6_write,....).
c) ospf6_write is called and the oi_write_q is cleaned out.
d) the t_write event is now popped and the oi_write_q is empty
and FRR asserts on the `assert(node)` <crash>

When event_execute is called for ospf6_write, just cancel the t_write
event.  If ospf6_write has more data to send at the end of the function
it will reschedule itself.  I've only seen this crash one time and am
unable to reliably reproduce this at all.  But this is the only mechanism
that I can see that could make this happen, given how little the oi_write_q
is actually touched in code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
21 months agoospfd: check for NULLs in vty code 13906/head
Mark Stapp [Fri, 30 Jun 2023 13:44:00 +0000 (09:44 -0400)]
ospfd: check for NULLs in vty code

There were a couple of cli paths that NULL-checked in the
vtysh output path, but not in the json path.

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

22 months agoMerge pull request #13820 from FRRouting/mergify/bp/stable/8.4/pr-13800
Mark Stapp [Tue, 20 Jun 2023 18:22:54 +0000 (14:22 -0400)]
Merge pull request #13820 from FRRouting/mergify/bp/stable/8.4/pr-13800

fix crashes in rip and ripng (backport #13800)

22 months agoRevert "ripngd: Cleanup memory allocations on shutdown" 13820/head
Igor Ryzhov [Thu, 15 Jun 2023 14:42:05 +0000 (17:42 +0300)]
Revert "ripngd: Cleanup memory allocations on shutdown"

This reverts commit b1d29673ca16e558aea5d632da181555c83980cf.

This commit introduced a crash. When the VRF is deleted, the RIPNG
instance should not be freed, because the NB infrastructure still stores
the pointer to it. The instance should be deleted only when it's actually
deleted from the configuration.

To reproduce the crash:
```
frr# conf t
frr(config)# vrf vrf1
frr(config-vrf)# exit
frr(config)# router ripng vrf vrf1
frr(config-router)# exit
frr(config)# no vrf vrf1
frr(config)# no router ripng vrf vrf1
vtysh: error reading from ripngd: Resource temporarily unavailable (11)Warning: closing connection to ripngd because of an I/O error!
frr(config)#
```

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

22 months agoRevert "ripd: Cleanup memory allocations on shutdown"
Igor Ryzhov [Thu, 15 Jun 2023 14:35:30 +0000 (17:35 +0300)]
Revert "ripd: Cleanup memory allocations on shutdown"

This reverts commit 3d1588d8ed537e3dbf120e1b2a5ad5b3c00c7897.

This commit introduced a crash. When the VRF is deleted, the RIP instance
should not be freed, because the NB infrastructure still stores the
pointer to it. The instance should be deleted only when it's actually
deleted from the configuration.

To reproduce the crash:
```
frr# conf t
frr(config)# vrf vrf1
frr(config-vrf)# exit
frr(config)# router rip vrf vrf1
frr(config-router)# exit
frr(config)# no vrf vrf1
frr(config)# no router rip vrf vrf1
vtysh: error reading from ripd: Resource temporarily unavailable (11)Warning: closing connection to ripd because of an I/O error!
frr(config)#
```

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

22 months agoFRR Release 8.4.4 frr-8.4.4
Jafar Al-Gharaibeh [Fri, 16 Jun 2023 04:31:44 +0000 (23:31 -0500)]
FRR Release 8.4.4

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

    Changelog:

bfdd
    Fix malformed session with vrf
    Remove redundant nb destroy callbacks

bgpd
    Aggregate-address memory leak fix
    Bmp fix peer-up ports byte order
    Check 7 bytes for long-lived graceful-restart capability
    Conform bgp_packet.h with coding standards
    Copy the password from the previous peer on peer_xfer_config()
    Do not allow a `no router bgp xxx` when autoimport is happening
    Do not allow l3vni changes when shutting down
    Do not announce routes immediatelly on filter updates
    Ensure stream received has enough data
    Fix bgpd core when unintern attr
    Fix crash for `show bgp ... neighbor received-routes detail|prefix`
    Fix debug output for route-map names when using a unsuppress-map
    Fix ecommunity parsing for as4
    Fix for ain->attr corruption during path update
    Fix lcom->str string length to correctly cover aliases
    Increase buffer size used for dumping bgp to mrt files
    Limit flowspec to no attribute means a implicit withdrawal
    Make bgp_keepalives.c not use mtype_tmp
    Prevent null pointer deref when outputting data
    Treat withdraw variable as a bool
    Use interface name instead of pointer value
    Use the actual pointer type instead of a void

lib
    Adjust only `any` flag for prefix-list entries if destroying
    Destroy `any` flag when creating a prefix-list entry with prefix
    Fix link state memory leak
    Fix vtysh core when handling questionmark
    On bfd peer shutdown actually stop event

ospf6d
    Stop using mtype_tmp in some cases

ospfd, ospf6d
    Add more logging details

ospfd, ospfclient
    Do not just include .c files in another .c

ospfd
    Cleanup some memory leaks on shutdown in ospf_apiserver.c
    Fix for vitual-link crash in signal handler
    Fix interface param type update
    Fix memory leaks w/ `show ip ospf int x json` commands
    Fix ospf_lsa memory leak
    Fix ospf_ti_lfa drop of an entire table
    Fixing summary origination after range configuration
    Free up q_space in early return path
    Log adjacency changes with neighbor ip in addition to neighbor id
    Ospf opaque lsa stale processing fix and topotests.
    Remove mtype_tmp
    Respect loopback's cost that is set and set loopback costs to 0

pbrd
    Fix mismatching in match src-dst

pimd
    Fix use after free issue for ifp's moving vrfs
    Pim not sending register packets after changing from non dr to dr
    Process no-forward bsm packet

ripd
    Fix memory leak for ripd's route-map

tests
    Add test to validate 4-byte ecomm parsing
    Check if prefix-lists with ipv6 any works fine
    Check if route-map works correctly if modifying prefix-lists

tools
    Fix list value remove in frr-reload
    Fix missing remote-as configuration when reload
    Make check flag really work for reload

vtysh
    Give actual pam error messages

zebra
    Cleanup ctx leak on shutdown and turn off event
    Evpn handle del event for dup detected mac
    Fix evpn dup detected local mac del event
    Fix for heap-use-after-free in evpn
    Fix race during shutdown
    Install directly connected route after interface flap
    Reduce creation and fix memory leak of frrscripting pointers
    Unlock the route node when sending route notifications

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
22 months agoMerge pull request #13782 from FRRouting/mergify/bp/stable/8.4/pr-12454
Donald Sharp [Tue, 13 Jun 2023 19:08:00 +0000 (15:08 -0400)]
Merge pull request #13782 from FRRouting/mergify/bp/stable/8.4/pr-12454

bgpd: Ensure stream received has enough data (backport #12454)

22 months agoMerge pull request #13785 from FRRouting/mergify/bp/stable/8.4/pr-13612
Donald Sharp [Tue, 13 Jun 2023 19:06:11 +0000 (15:06 -0400)]
Merge pull request #13785 from FRRouting/mergify/bp/stable/8.4/pr-13612

ospfd: fix interface param type update (backport #13612)

22 months agoospfd: fix interface param type update 13785/head
Chirag Shah [Fri, 26 May 2023 20:43:50 +0000 (13:43 -0700)]
ospfd: fix interface param type update

interface link update event needs
to be handle properly in ospf interface
cache.

Example:
When vrf (interface) is created its default type
would be set to BROADCAST because ifp->status
is not set to VRF.
Subsequent link event sets ifp->status to vrf,
ospf interface update need to compare current type
to new default type which would be VRF (OSPF_IFTYPE_LOOPBACK).
Since ospf type param was created in first add event,
ifp vrf link event didn't update ospf type param which
leads to treat vrf as non loopback interface.

Ticket:#3459451
Testing Done:

Running config suppose to bypass rendering default
network broadcast for loopback/vrf types.

Before fix:

vrf vrf1
 vni 4001
exit-vrf
!
interface vrf1
 ip ospf network broadcast
exit

After fix: (interface vrf1 is not displayed).

vrf vrf1
 vni 4001
exit-vrf

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

22 months agobgpd: Ensure stream received has enough data 13782/head
Donald Sharp [Tue, 6 Dec 2022 15:23:11 +0000 (10:23 -0500)]
bgpd: Ensure stream received has enough data

BGP_PREFIX_SID_SRV6_L3_SERVICE attributes must not
fully trust the length value specified in the nlri.
Always ensure that the amount of data we need to read
can be fullfilled.

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

22 months agoMerge pull request #13737 from FRRouting/mergify/bp/stable/8.4/pr-13645
Donatas Abraitis [Fri, 9 Jun 2023 06:10:50 +0000 (09:10 +0300)]
Merge pull request #13737 from FRRouting/mergify/bp/stable/8.4/pr-13645

bfdd: remove redundant nb destroy callbacks (backport #13645)

22 months agobfdd: remove redundant nb destroy callbacks 13737/head
Igor Ryzhov [Wed, 31 May 2023 12:28:08 +0000 (15:28 +0300)]
bfdd: remove redundant nb destroy callbacks

Fixes warning logs:
```
2023/05/29 20:11:50 BFD: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-bfdd:bfdd/bfd/profile/minimum-ttl'
2023/05/29 20:11:50 BFD: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-bfdd:bfdd/bfd/sessions/multi-hop/minimum-ttl'
```

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

22 months agoMerge pull request #13713 from FRRouting/mergify/bp/stable/8.4/pr-13693
Donald Sharp [Wed, 7 Jun 2023 12:07:31 +0000 (08:07 -0400)]
Merge pull request #13713 from FRRouting/mergify/bp/stable/8.4/pr-13693

tools: fix list value remove in frr-reload (backport #13693)

22 months agotools: fix list value remove in frr-reload 13713/head
Chirag Shah [Tue, 6 Jun 2023 04:48:12 +0000 (21:48 -0700)]
tools: fix list value remove in frr-reload

There might be a time element(s) from
temporary list are removed more than once
which leads to valueError in certain python3
version.

commit-id 1543f58b5 did not handle valueError
properly. This caused regression where
prefix-list config leads to delete followed
by add.

The new fix should just pass the exception as
value removal from list_to_add or list_to_del
is best effort.
This allows prefix-list config has no change
then removes the lines from lines_to_del and
lines_to_add properly.

Ticket:#3490252
Testing:

Configure prefix-list in frr.conf and perform
multiple frr-reload. After first reload operatoin
subsequent ones should not result in delete followed
by add of the prefix-list but rather no-op operation.

(Pdb) lines_to_add
[(('ip prefix-list FOO permit 10.2.1.0/24',), None)]
(Pdb) lines_to_del
[(('ip prefix-list FOO seq 5 permit 10.2.1.0/24',), None),
 (('ip prefix-list FOO seq 10 permit 10.2.1.0/24',), None)]
(Pdb) lines_to_del_to_del
[(('ip prefix-list FOO seq 5 permit 10.2.1.0/24',), None),
 (('ip prefix-list FOO seq 10 permit 10.2.1.0/24',), None)]
(Pdb) lines_to_add_to_del
[(('ip prefix-list FOO permit 10.2.1.0/24',), None),
 (('ip prefix-list FOO permit 10.2.1.0/24',), None)]
(Pdb) c
> /usr/lib/frr/frr-reload.py(1562)ignore_delete_re_add_lines()
-> return (lines_to_add, lines_to_del)
(Pdb) lines_to_add
[]
(Pdb) lines_to_del
[]

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

22 months agoMerge pull request #13695 from FRRouting/mergify/bp/stable/8.4/pr-13649
Donatas Abraitis [Tue, 6 Jun 2023 08:08:04 +0000 (11:08 +0300)]
Merge pull request #13695 from FRRouting/mergify/bp/stable/8.4/pr-13649

zebra: Unlock the route node when sending route notifications (backport #13649)

22 months agozebra: Unlock the route node when sending route notifications 13695/head
Donald Sharp [Wed, 31 May 2023 15:40:07 +0000 (11:40 -0400)]
zebra: Unlock the route node when sending route notifications

When using a context to send route notifications to upper
level protocols, the code was using a locking function to
get the route node.  There is no need for this to be locked
as such FRR should free it up.

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

22 months agoMerge pull request #13663 from FRRouting/mergify/bp/stable/8.4/pr-13637
Donald Sharp [Fri, 2 Jun 2023 00:32:52 +0000 (20:32 -0400)]
Merge pull request #13663 from FRRouting/mergify/bp/stable/8.4/pr-13637

lib: fix vtysh core when handling questionmark (backport #13637)

22 months agolib: fix vtysh core when handling questionmark 13663/head
Yuan Yuan [Tue, 30 May 2023 19:20:09 +0000 (19:20 +0000)]
lib: fix vtysh core when handling questionmark

When issue vtysh command with ?, the initial buf size for the
element is 16. Then it would loop through each element in the cmd
output vector. If the required size for printing out the next
element is larger than the current buf size, realloc the buf memory
by doubling the current buf size regardless of the actual size
that's needed. This would cause vtysh core when the doubled size
is not enough for the next element.

Signed-off-by: Yuan Yuan <yyuanam@amazon.com>
(cherry picked from commit f8aa257997a6a6f69ec5d5715ab04d7cbfae1d1c)

22 months agoMerge pull request #13643 from FRRouting/mergify/bp/stable/8.4/pr-13634
Donatas Abraitis [Wed, 31 May 2023 08:10:00 +0000 (11:10 +0300)]
Merge pull request #13643 from FRRouting/mergify/bp/stable/8.4/pr-13634

bgpd: fix bgpd core when unintern attr (backport #13634)

23 months agobgpd: fix bgpd core when unintern attr 13643/head
Yuan Yuan [Tue, 30 May 2023 18:53:32 +0000 (18:53 +0000)]
bgpd: fix bgpd core when unintern attr

When the remote peer is neither EBGP nor confed, aspath is the
shadow copy of attr->aspath in bgp_packet_attribute(). Striping
AS4_PATH should not be done on the aspath directly, since
that would lead to bgpd core dump when unintern the attr.

Signed-off-by: Yuan Yuan <yyuanam@amazon.com>
(cherry picked from commit 32af4995aae647cf9d7c70347ec37b57279ea807)

23 months agoMerge pull request #13615 from FRRouting/mergify/bp/stable/8.4/pr-13608
Donatas Abraitis [Sat, 27 May 2023 17:05:17 +0000 (20:05 +0300)]
Merge pull request #13615 from FRRouting/mergify/bp/stable/8.4/pr-13608

vtysh: Give actual pam error messages (backport #13608)

23 months agovtysh: Give actual pam error messages 13615/head
Donald Sharp [Fri, 26 May 2023 11:44:11 +0000 (07:44 -0400)]
vtysh: Give actual pam error messages

Code was was written where the pam error message put out
was the result from a previous call to the pam modules
instead of the current call to the pam module.

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

23 months agoMerge pull request #13572 from FRRouting/mergify/bp/stable/8.4/pr-13506
Donatas Abraitis [Mon, 22 May 2023 19:05:56 +0000 (22:05 +0300)]
Merge pull request #13572 from FRRouting/mergify/bp/stable/8.4/pr-13506

bfdd: Fix malformed session with vrf (backport #13506)

23 months agobfdd: Fix malformed session with vrf 13572/head
anlan_cs [Wed, 10 May 2023 14:04:33 +0000 (22:04 +0800)]
bfdd: Fix malformed session with vrf

With this configuration:

```
bfd
 peer 33:33::66 local-address 33:33::88 vrf vrf8 interface enp1s0
 exit
 !
exit
```

The bfd session can't be established with error:

```
bfdd[18663]: [YA0Q5-C0BPV] control-packet: wrong vrfid. [mhop:no peer:33:33::66 local:33:33::88 port:2 vrf:61]
```

The vrf check should use the carefully adjusted `vrfid`, which is
based on globally/reliable interface.  We can't believe the
`bvrf->vrf->vrf_id` because the `/proc/sys/net/ipv4/udp_l3mdev_accept`
maybe is set "1" in VRF-lite backend even with security drawback.

Just correct the vrf check.

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

23 months agoMerge pull request #13503 from FRRouting/mergify/bp/stable/8.4/pr-13489
Jafar Al-Gharaibeh [Thu, 11 May 2023 04:00:27 +0000 (23:00 -0500)]
Merge pull request #13503 from FRRouting/mergify/bp/stable/8.4/pr-13489

ospfd: OSPF opaque LSA stale processing fix and topotests. (backport #13489)

23 months ago ospfd: OSPF opaque LSA stale processing fix and topotests. 13503/head
Acee [Tue, 9 May 2023 20:51:03 +0000 (16:51 -0400)]
    ospfd: OSPF opaque LSA stale processing fix and topotests.

        1. Fix OSPF opaque LSA processing to preserve the stale opaque
            LSAs in the Link State Database for 60 seconds consistent with
            what is done for other LSA types.
         2. Add a topotest that tests for cases where ospfd is restarted
            and a stale OSPF opaque LSA exists in the OSPF routing domain
            both when the LSA is purged and when the LSA is reoriginagted
            with a more recent instance.

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

23 months agoMerge pull request #13501 from FRRouting/mergify/bp/stable/8.4/pr-13485
Donald Sharp [Wed, 10 May 2023 18:23:47 +0000 (14:23 -0400)]
Merge pull request #13501 from FRRouting/mergify/bp/stable/8.4/pr-13485

ospfd: Respect loopback's cost that is set and set loopback costs to 0 (backport #13485)

23 months agoospfd: Respect loopback's cost that is set and set loopback costs to 0 13501/head
Donald Sharp [Tue, 9 May 2023 17:10:35 +0000 (13:10 -0400)]
ospfd: Respect loopback's cost that is set and set loopback costs to 0

When setting an loopback's cost, set the value to 0, unless the operator
has assigned a value for the loopback's cost.

RFC states:

If the state of the interface is Loopback, add a Type 3
link (stub network) as long as this is not an interface
to an unnumbered point-to-point network. The Link ID
should be set to the IP interface address, the Link Data
set to the mask 0xffffffff (indicating a host route),
and the cost set to 0.

FRR is going to allow this to be overridden if the operator specifically
sets a value too.

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

23 months agoMerge pull request #13482 from FRRouting/mergify/bp/stable/8.4/pr-13445
Donald Sharp [Tue, 9 May 2023 17:31:10 +0000 (13:31 -0400)]
Merge pull request #13482 from FRRouting/mergify/bp/stable/8.4/pr-13445

zebra: Reduce creation and fix memory leak of frrscripting pointers (backport #13445)

23 months agozebra: Reduce creation and fix memory leak of frrscripting pointers 13482/head
Donald Sharp [Fri, 5 May 2023 15:05:12 +0000 (11:05 -0400)]
zebra: Reduce creation and fix memory leak of frrscripting pointers

There are two issues being addressed:

a) The ZEBRA_ON_RIB_PROCESS_HOOK_CALL script point
was creating a fs pointer per dplane ctx in
rib_process_dplane_results().

b) The fs pointer was not being deleted and directly
leaked.

For (a) Move the creation of the fs to outside
the do while loop.

For (b) At function end ensure that the pointer
is actually deleted.

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

23 months agoMerge pull request #13443 from FRRouting/mergify/bp/stable/8.4/pr-13436
Donatas Abraitis [Fri, 5 May 2023 16:49:22 +0000 (19:49 +0300)]
Merge pull request #13443 from FRRouting/mergify/bp/stable/8.4/pr-13436

ospfd: Fix memory leaks w/ `show ip ospf int X json` commands (backport #13436)

23 months agoospfd: Fix memory leaks w/ `show ip ospf int X json` commands 13443/head
Donald Sharp [Thu, 4 May 2023 16:53:42 +0000 (12:53 -0400)]
ospfd: Fix memory leaks w/ `show ip ospf int X json` commands

FRR has a memory leak in the case when int X does not
exist and a memory leak when int X does exist.  Fix
these

Fixes: #13434
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 74e21732db129f7287d5ab227e45f305c5dbf34e)

23 months agoMerge pull request #13419 from FRRouting/mergify/bp/stable/8.4/pr-13020
Jafar Al-Gharaibeh [Thu, 4 May 2023 14:00:46 +0000 (09:00 -0500)]
Merge pull request #13419 from FRRouting/mergify/bp/stable/8.4/pr-13020

pimd: PIM not sending register packets after changing from non DR to DR (backport #13020)

23 months agopimd: PIM not sending register packets after changing from non DR to DR 13419/head
Sai Gomathi N [Fri, 17 Mar 2023 10:51:16 +0000 (03:51 -0700)]
pimd: PIM not sending register packets after changing from non DR to DR

When the router is non dr for an interface, it installs mroute to drop
the packets from directly connected source. This was done to avoid packets
coming to cpu as nocache hit. Later when it gets change from non-DR to DR,
these entries are not cleared. So the packets are still dropped.
This causes register packets not getting generated.
So cleaning up the mroute entries and channel oil without
upstream reference which was created to drop.

Co-authored-by: Saravanan K <saravanank@vmware.com>
Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
(cherry picked from commit 1c883aef96013753f5467ba5e5028dee0f0a82c5)

2 years agoMerge pull request #13372 from FRRouting/mergify/bp/stable/8.4/pr-13330
Donatas Abraitis [Mon, 24 Apr 2023 18:28:33 +0000 (21:28 +0300)]
Merge pull request #13372 from FRRouting/mergify/bp/stable/8.4/pr-13330

zebra: EVPN handle duplicate detected local mac delete event (backport #13330)

2 years agozebra:fix evpn dup detected local mac del event 13372/head
Chirag Shah [Sat, 22 Oct 2022 23:00:14 +0000 (16:00 -0700)]
zebra:fix evpn dup detected local mac del event

The current local mac delete event send to flag with force
always which breaks the duplicate detected MACs where
it requires to be resynced from bgpd to earlier state.

Ticket:#3233019
Issue:3233019

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

2 years agozebra: evpn handle del event for dup detected mac
Chirag Shah [Wed, 1 Dec 2021 04:42:01 +0000 (20:42 -0800)]
zebra: evpn handle del event for dup detected mac

Upon receiving local mobility event for MAC + NEIGH,
both are detected as duplicate upon hitting DAD threshold.

Duplicated detected ( freezed) MAC + NEIGH are not known
to bgpd.

If locally learnt MAC + NEIGH are deleted in kernel,
the MAC is marked as AUTO after sending delete event
to bgpd.

Bgpd only reinstalls best route for MAC_IP route (NEIGH)
but not for MAC event.
This puts a situation where MAC is AUTO state and
associated neigh as remote.

Fix:
DUPLICATE + LOCAL MAC deletion, set MAC delete request
as reinstall from bgpd.

Ticket:#2873307
Reviewed By:
Testing Done:

Freeze MAC + two NEIGHs in local mobility event.
Delete MAC and NEIGH from kerenl.
bgp rsync remote mac route which puts MAC to remote state.

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

2 years agoMerge pull request #13343 from FRRouting/mergify/bp/stable/8.4/pr-13341
Donald Sharp [Fri, 21 Apr 2023 11:10:23 +0000 (07:10 -0400)]
Merge pull request #13343 from FRRouting/mergify/bp/stable/8.4/pr-13341

bgpd: Fix lcom->str string length to correctly cover aliases (backport #13341)

2 years agobgpd: Fix lcom->str string length to correctly cover aliases 13343/head
Donald Sharp [Thu, 20 Apr 2023 20:27:20 +0000 (16:27 -0400)]
bgpd: Fix lcom->str string length to correctly cover aliases

If you have a very large number of large communities whose
string length happened to be greater than BUFSIZ FRR's bgpd
would crash.  This is because bgpd would write beyond
the end of the string.

Originally the code auto-calculated the string size appropriately
but commit ed0e57e3f079352714c3a3a8a5b0dddf4aadfe1d modified
the string length to be a hard coded BUFSIZ.  When a route-map
like this is added:

route-map LARGE-OUT permit 10
 set large-community 4635:0:0 4635:1:906 4635:1:2906 4635:1:4515 4635:1:4594 4635:1:4641 4635:1:4760 4635:1:7979 4635:1:9253 4635:1:9293 4635:1:9304 4635:1:9908 4635:1:13335 4635:1:16265 4635:1:17924 4635:1:18013 4635:1:20940 4635:1:22822 4635:1:24429 4635:1:24482 4635:1:32590 4635:1:32934 4635:1:36692 4635:1:38008 4635:1:38819 4635:1:41378 4635:1:45753 4635:1:46489 4635:1:49544 4635:1:51847 4635:1:54574 4635:1:54994 4635:1:55720 4635:1:56059 4635:1:57724 4635:1:65021 4635:1:134823 4635:1:136907 4635:1:146961 24115:0:24115 24115:1:906 24115:1:2906 24115:1:4515 24115:1:4594 24115:1:4641 24115:1:4760 24115:1:7979 24115:1:9253 24115:1:9293 24115:1:9304 24115:1:9908 24115:1:13335 24115:1:16265 24115:1:17924 24115:1:18013 24115:1:20940 24115:1:22822 24115:1:24429 24115:1:24482 24115:1:32590 24115:1:32934 24115:1:36692 24115:1:38008 24115:1:38819 24115:1:41378 24115:1:45753 24115:1:46489 24115:1:49544 24115:1:51847 24115:1:54574 24115:1:54994 24115:1:55720 24115:1:56059 24115:1:57724 24115:1:65021 24115:1:134823 24115:1:136907 24115:1:100000 24115:1:100001 24115:1:100002
exit

BGP would have issues and crash.

Modify the code to correctly determine the string length of the communities
and to also double check if the string has an alias and ensure that the
string is still sufficiently large enough.  If not auto size it again.

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

2 years agoMerge pull request #13339 from FRRouting/mergify/bp/stable/8.4/pr-13329
Jafar Al-Gharaibeh [Thu, 20 Apr 2023 04:06:34 +0000 (23:06 -0500)]
Merge pull request #13339 from FRRouting/mergify/bp/stable/8.4/pr-13329

bgpd: Fix for ain->attr corruption during path update (backport #13329)

2 years agobgpd: Fix for ain->attr corruption during path update 13339/head
Pooja Jagadeesh Doijode [Wed, 19 Apr 2023 01:40:06 +0000 (18:40 -0700)]
bgpd: Fix for ain->attr corruption during path update

1. Consider a established L2VPN EVPN BGP peer with soft-reconfiguartion
   inbound configured

2. When the interface of this directly connected BGP peer is shutdown,
   bgp_soft_reconfig_table_update() is called, which memsets the evpn buffer
   and calls bgp_update() with received attributes stored in ain table(ain->attr).
   In bgp_update(), evpn_overlay attribute in ain->attr (which is an interned
   attr) was modified by doing a memcpy

3. Above action causes 2 attributes in the attrhash (which were previously different)
   to match!

4. Later during fsm change event of the peer, bgp_adj_in_remove() is called
   to clean up the ain->attr. But, because 2 attrs in attrhash match, it causes
   BGP to assert in bgp_attr_unintern()

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

2 years agoMerge pull request #13316 from FRRouting/mergify/bp/stable/8.4/pr-13302
Donatas Abraitis [Sun, 16 Apr 2023 15:58:15 +0000 (18:58 +0300)]
Merge pull request #13316 from FRRouting/mergify/bp/stable/8.4/pr-13302

tools: fix missing remote-as configuration when reload (backport #13302)

2 years agotools: Make check flag really work for reload 13316/head
anlan_cs [Fri, 14 Apr 2023 22:41:41 +0000 (06:41 +0800)]
tools: Make check flag really work for reload

The check flag of `found_pg_cmd` is already there, but not used.
So, make it really work for reload.

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

2 years agotools: fix missing remote-as configuration when reload
anlan_cs [Fri, 14 Apr 2023 00:32:32 +0000 (08:32 +0800)]
tools: fix missing remote-as configuration when reload

From commit `411d1a2`, `bgp_delete_nbr_remote_as_line()` is added to
remove some specific bgp neighbors.  But, when reloading the following
configuration, it will wrongly remove some good ones:
`neighbor 66.66.66.6 remote-as internal`:

```
router bgp 66
 bgp router-id 172.16.204.6
 neighbor ANLAN peer-group
 neighbor ANLAN remote-as internal
 neighbor 66.66.66.6 remote-as internal <- LOST
 neighbor 66.66.66.60 peer-group ANLAN
```

The reason is that "66.66.66.6" is included in "66.66.66.60" literally,
then it is mistakenly thought to be a match.  Just fix it with
excat match.

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

2 years agoMerge pull request #13306 from FRRouting/mergify/bp/stable/8.4/pr-13301
Donald Sharp [Fri, 14 Apr 2023 13:54:20 +0000 (09:54 -0400)]
Merge pull request #13306 from FRRouting/mergify/bp/stable/8.4/pr-13301

bgpd: Fix crash for `show bgp ... neighbor received-routes detail|PREFIX (backport #13301)

2 years agobgpd: Fix crash for `show bgp ... neighbor received-routes detail|PREFIX` 13306/head
Donatas Abraitis [Thu, 13 Apr 2023 20:37:06 +0000 (23:37 +0300)]
bgpd: Fix crash for `show bgp ... neighbor received-routes detail|PREFIX`

BGP: Received signal 11 at 1681287514 (si_addr 0x8, PC 0x559ab42eb1d9); aborting...
BGP: /lib/libfrr.so.0(zlog_backtrace_sigsafe+0x71) [0x7f4356b19af1]
BGP: /lib/libfrr.so.0(zlog_signal+0xf9) [0x7f4356b19cf9]
BGP: /lib/libfrr.so.0(+0xf5af5) [0x7f4356b4baf5]
BGP: /lib/x86_64-linux-gnu/libpthread.so.0(+0x14420) [0x7f43568ab420]
BGP: /usr/lib/frr/bgpd(prefix_rd2str+0x29) [0x559ab42eb1d9]
BGP: /usr/lib/frr/bgpd(route_vty_out_detail_header+0x7ca) [0x559ab43061ba]
BGP: /usr/lib/frr/bgpd(+0x1771a6) [0x559ab430a1a6]
BGP: /usr/lib/frr/bgpd(+0x177f06) [0x559ab430af06]
BGP: /usr/lib/frr/bgpd(+0x178c8b) [0x559ab430bc8b]
BGP: /usr/lib/frr/bgpd(+0x179e7e) [0x559ab430ce7e]
BGP: /lib/libfrr.so.0(+0x9417e) [0x7f4356aea17e]
BGP: /lib/libfrr.so.0(cmd_execute_command+0x111) [0x7f4356aea321]
BGP: /lib/libfrr.so.0(cmd_execute+0xd0) [0x7f4356aea4c0]
BGP: /lib/libfrr.so.0(+0x10d5de) [0x7f4356b635de]
BGP: /lib/libfrr.so.0(+0x10d81d) [0x7f4356b6381d]
BGP: /lib/libfrr.so.0(+0x110b03) [0x7f4356b66b03]
BGP: /lib/libfrr.so.0(event_call+0x81) [0x7f4356b5df91]
BGP: /lib/libfrr.so.0(frr_run+0xe8) [0x7f4356b11b58]
BGP: /usr/lib/frr/bgpd(main+0x385) [0x559ab4281d55]
BGP: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f43566c9083]
BGP: /usr/lib/frr/bgpd(_start+0x2e) [0x559ab428437e]
BGP: in thread vtysh_read scheduled from lib/vty.c:2833 vty_event()

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

2 years agoMerge pull request #13294 from FRRouting/mergify/bp/stable/8.4/pr-13244
Donald Sharp [Thu, 13 Apr 2023 14:38:54 +0000 (10:38 -0400)]
Merge pull request #13294 from FRRouting/mergify/bp/stable/8.4/pr-13244

pimd: Process no-forward BSM packet (backport #13244)

2 years agopimd: Process no-forward BSM packet 13294/head
Sarita Patra [Mon, 10 Apr 2023 05:30:44 +0000 (22:30 -0700)]
pimd: Process no-forward BSM packet

Topology Used:
=============
Cisco---FRR4----FRR2

Initially PIM nbr is down between FRR4----FRR2 from FRR2 side
Cisco is sending BSR packet to FRR4.

Problem Statement:
=================
No shutdown the PIM neighbor on FRR2 towards FRR4.
FRR2, receives BSR packet immediately as the new neighbor
comes up. This BSR packet is having no-forward bit set.
FRR2 is not able to process the BSR packet, and drop the
BSR packet.

Root Cause:
==========
When PIMD comes up, we start BSM timer for 60 seconds.
Here, the value accept_nofwd_bsm is setting to false.

FRR2, when receives no-forward BSR packet, it is getting
accept_nofwd_bsm value as false.

So, it drops, the no-forward BSM packet.

Fix:
===
Set accept_nofwd_bsm as false after first BSM packet received.

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

2 years agoMerge pull request #13281 from FRRouting/mergify/bp/stable/8.4/pr-13193
Jafar Al-Gharaibeh [Thu, 13 Apr 2023 04:09:32 +0000 (23:09 -0500)]
Merge pull request #13281 from FRRouting/mergify/bp/stable/8.4/pr-13193

lib: link state leak fix (backport #13193)

2 years agoMerge pull request #13277 from FRRouting/mergify/bp/stable/8.4/pr-13269
Donald Sharp [Wed, 12 Apr 2023 18:23:39 +0000 (14:23 -0400)]
Merge pull request #13277 from FRRouting/mergify/bp/stable/8.4/pr-13269

ospfd: Fix ospf_lsa memory leak (backport #13269)

2 years agoMerge pull request #13264 from mjstapp/fix_dplane_shut_race_8_4
Donald Sharp [Wed, 12 Apr 2023 18:11:15 +0000 (14:11 -0400)]
Merge pull request #13264 from mjstapp/fix_dplane_shut_race_8_4

zebra: fix race during shutdown

2 years agoMerge pull request #13275 from FRRouting/mergify/bp/stable/8.4/pr-13249
Donald Sharp [Wed, 12 Apr 2023 17:32:06 +0000 (13:32 -0400)]
Merge pull request #13275 from FRRouting/mergify/bp/stable/8.4/pr-13249

zebra: Mark connected route as installed after interface flap event (backport #13249)

2 years agolib: Fix link state memory leak 13281/head
Keelan10 [Mon, 3 Apr 2023 07:41:04 +0000 (11:41 +0400)]
lib: Fix link state memory leak

Free link message data when a delete event is recorded.

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
(cherry picked from commit c123d2dee012620b8f43711062a10c49b9247a9c)

2 years agoospfd: Fix ospf_lsa memory leak 13277/head
Keelan10 [Wed, 12 Apr 2023 09:36:40 +0000 (13:36 +0400)]
ospfd: Fix ospf_lsa memory leak

Free translated LSA when LSA installation fails

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
(cherry picked from commit c0ccfbfd45514251bb1f91ec9138dca138f88f57)

2 years agozebra: Install directly connected route after interface flap 13275/head
Pooja Jagadeesh Doijode [Mon, 10 Apr 2023 23:03:23 +0000 (16:03 -0700)]
zebra: Install directly connected route after interface flap

Issue:
After vlan flap, zebra was not marking the selected/best route as installed.

As a result, when a static route was configured with nexthop as directly
connected interface's(vlan) IP, the static route was not being installed
in the kernel since its nexthop was unresolved. The nexthop was marked
unresolved because zebra failed to mark the best route as installed after
interface flap.

This was happening because, in dplane_route_update_internal() if the old and
new context type, and nexthop group id are the same, then zebra doesn't send
down a route replace request to kernel. But, the installed (ROUTE_ENTRY_INSTALLED)
flag is set when zebra receives a response from kernel. Since the
request to kernel was being skipped for the route entry, installed flag
was not being set

Fix:
In dplane_route_update_internal() if the old and new context type, and
nexthop group id are the same, then before returning, installed flag will
be set on the route-entry if it's not set already.

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

2 years agozebra: fix race during shutdown 13264/head
Mark Stapp [Tue, 11 Apr 2023 19:51:32 +0000 (15:51 -0400)]
zebra: fix race during shutdown

During shutdown, the main pthread stops the dplane pthread
before exiting. Don't try to clean up any events scheduled
to the dplane pthread at that point - just let the thread
exit and clean up. This is the 8.4 version.

Signed-off-by: Mark Stapp <mjs@labn.net>
2 years agoMerge pull request #13256 from FRRouting/mergify/bp/stable/8.4/pr-13226
Donatas Abraitis [Tue, 11 Apr 2023 14:19:58 +0000 (17:19 +0300)]
Merge pull request #13256 from FRRouting/mergify/bp/stable/8.4/pr-13226

ripd: Fix memory leak for ripd's route-map (backport #13226)

2 years agoMerge pull request #13252 from FRRouting/mergify/bp/stable/8.4/pr-13247
Donatas Abraitis [Tue, 11 Apr 2023 11:44:36 +0000 (14:44 +0300)]
Merge pull request #13252 from FRRouting/mergify/bp/stable/8.4/pr-13247

Evpn crashes and other ilk (backport #13247)

2 years agoripd: Fix memory leak for ripd's route-map 13256/head
anlan_cs [Thu, 6 Apr 2023 13:17:05 +0000 (21:17 +0800)]
ripd: Fix memory leak for ripd's route-map

When cleaning `ripd`, it should free `ctx->name` of `struct if_rmap_ctx`,
not `ctx` itself.  Otherwise, it will lead to memory leak.

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

2 years agobgpd: Do not allow a `no router bgp XXX` when autoimport is happening 13252/head
Donald Sharp [Mon, 10 Apr 2023 18:04:27 +0000 (14:04 -0400)]
bgpd: Do not allow a `no router bgp XXX` when autoimport is happening

When we have these sequence of events causing a crash in
evpn_type5_test_topo1:

(A) no router bgp vrf RED 100
   this schedules for deletion the vrf RED instance
(B) a l3vni change event from zebra
   this creates a bgp instance for VRF RED in some cases
   additionally it auto imports evpn routes into VRF RED
   Please note this is desired behavior to allow for the
   auto importation of evpn vrf routes
(C) no router bgp 100
   The code was allowing the deletion of the default
   instance and causing tests to crash.

Effectively the test in bgp_vty to allow/dissallow
the removal of the default instance was not correct
for the case when (B) happens.

Let's just not allow the command to succeed in this case as that
the test was wrong.

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

2 years agobgpd: Do not allow l3vni changes when shutting down
Donald Sharp [Mon, 10 Apr 2023 17:59:48 +0000 (13:59 -0400)]
bgpd: Do not allow l3vni changes when shutting down

When a `no router bgp XXX` is issued and the bgp instance
is in the process of shutting down, do not allow a l3vni
change coming up from zebra to do anything.  We can just
safely ignore it at this point in time.

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

2 years agobgpd: Use the actual pointer type instead of a void
Donald Sharp [Mon, 10 Apr 2023 18:02:18 +0000 (14:02 -0400)]
bgpd: Use the actual pointer type instead of a void

Let's cut to the chase, we know the pointer type and
it allows us to not to some gyrations.

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

2 years agoMerge pull request #13231 from FRRouting/mergify/bp/stable/8.4/pr-13222
Jafar Al-Gharaibeh [Fri, 7 Apr 2023 19:27:50 +0000 (14:27 -0500)]
Merge pull request #13231 from FRRouting/mergify/bp/stable/8.4/pr-13222

Limit scope (backport #13222)

2 years agobgpd: Treat withdraw variable as a bool 13231/head
Donald Sharp [Wed, 5 Apr 2023 19:25:57 +0000 (15:25 -0400)]
bgpd: Treat withdraw variable as a bool

Used as a bool, treated as a bool.  Make it a bool

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

2 years agobgpd: Limit flowspec to no attribute means a implicit withdrawal
Donald Sharp [Wed, 5 Apr 2023 18:57:05 +0000 (14:57 -0400)]
bgpd: Limit flowspec to no attribute means a implicit withdrawal

All other parsing functions done from bgp_nlri_parse() assume
no attributes == an implicit withdrawal.  Let's move
bgp_nlri_parse_flowspec() into the same alignment.

Reported-by: Matteo Memelli <mmemelli@amazon.it>
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit cfd04dcb3e689754a72507d086ba3b9709fc5ed8)

2 years agobgpd: Conform bgp_packet.h with coding standards
Donald Sharp [Wed, 5 Apr 2023 18:51:47 +0000 (14:51 -0400)]
bgpd: Conform bgp_packet.h with coding standards

FRR's standards state that function declarations should
have actual variable names for parameters passed in.
Let's make this so for bgp_packet.h

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

2 years agoMerge pull request #13189 from FRRouting/mergify/bp/stable/8.4/pr-13175
Donatas Abraitis [Thu, 6 Apr 2023 13:52:12 +0000 (16:52 +0300)]
Merge pull request #13189 from FRRouting/mergify/bp/stable/8.4/pr-13175

zebra: Cleanup ctx leak on shutdown and turn off event (backport #13175)

2 years agozebra: Cleanup ctx leak on shutdown and turn off event 13189/head
Donald Sharp [Fri, 31 Mar 2023 13:08:23 +0000 (09:08 -0400)]
zebra: Cleanup ctx leak on shutdown and turn off event

two things:

On shutdown cleanup any events associated with the update walker.
Also do not allow new events to be created.

Fixes this mem-leak:

./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790:Direct leak of 8 byte(s) in 1 object(s) allocated from:
./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790-    #0 0x7f0dd0b08037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790-    #1 0x7f0dd06c19f9 in qcalloc lib/memory.c:105
./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790-    #2 0x55b42fb605bc in rib_update_ctx_init zebra/zebra_rib.c:4383
./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790-    #3 0x55b42fb6088f in rib_update zebra/zebra_rib.c:4421
./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790-    #4 0x55b42fa00344 in netlink_link_change zebra/if_netlink.c:2221
./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790-    #5 0x55b42fa24622 in netlink_information_fetch zebra/kernel_netlink.c:399
./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790-    #6 0x55b42fa28c02 in netlink_parse_info zebra/kernel_netlink.c:1183
./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790-    #7 0x55b42fa24951 in kernel_read zebra/kernel_netlink.c:493
./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790-    #8 0x7f0dd0797f0c in event_call lib/event.c:1995
./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790-    #9 0x7f0dd0684fd9 in frr_run lib/libfrr.c:1185
./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790-    #10 0x55b42fa30caa in main zebra/main.c:465
./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790-    #11 0x7f0dd01b5d09 in __libc_start_main ../csu/libc-start.c:308
./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790-
./msdp_topo1.test_msdp_topo1/r2.zebra.asan.1117790-SUMMARY: AddressSanitizer: 8 byte(s) leaked in 1 allocation(s).

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 3cd0accb5051e900ab343d5fa7c59360c0c1a812)
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #13212 from FRRouting/mergify/bp/stable/8.4/pr-13181
Donatas Abraitis [Wed, 5 Apr 2023 06:57:21 +0000 (09:57 +0300)]
Merge pull request #13212 from FRRouting/mergify/bp/stable/8.4/pr-13181

bgpd: fix ecommunity parsing for AS4 (backport #13181)

2 years agotests: add test to validate 4-byte ecomm parsing 13212/head
Trey Aspelund [Mon, 3 Apr 2023 21:03:40 +0000 (21:03 +0000)]
tests: add test to validate 4-byte ecomm parsing

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
(cherry picked from commit f615e6dc409c214e66863e8c2ef94775edcac050)

2 years agobgpd: fix ecommunity parsing for AS4
Trey Aspelund [Fri, 31 Mar 2023 21:46:21 +0000 (17:46 -0400)]
bgpd: fix ecommunity parsing for AS4

The parser for extended communities was incorrectly disallowing an
operator from configuring "Route Origin" extended communities
(e.g. RD/RT/SoO) with a 4-byte value matching BGP_AS4_MAX (UINT32_MAX)
and allowed the user to overflow UINT32_MAX. This updates the parser to
read the value as a uint64_t so that we can do proper checks on the
upper bounds (> BGP_AS4_MAX || errno).

before:
```
TORC11(config-router-af)# neighbor uplink-1 soo 4294967296:65
TORC11(config-router-af)# do sh run | include soo
  neighbor uplink-1 soo 0:65
TORC11(config-router-af)# neighbor uplink-1 soo 4294967295:65
% Malformed SoO extended community
TORC11(config-router-af)#
```

after:
```
TORC11(config-router-af)# neighbor uplink-1 soo 4294967296:65
% Malformed SoO extended community
TORC11(config-router-af)# neighbor uplink-1 soo 4294967295:65
TORC11(config-router-af)# do sh run | include soo
  neighbor uplink-1 soo 4294967295:65
TORC11(config-router-af)#
```

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
(cherry picked from commit b571d79d6482217c599c53976cb8cf0ec77b847f)

2 years agoMerge pull request #13204 from FRRouting/mergify/bp/stable/8.4/pr-13198
Donatas Abraitis [Tue, 4 Apr 2023 10:52:08 +0000 (13:52 +0300)]
Merge pull request #13204 from FRRouting/mergify/bp/stable/8.4/pr-13198

bgpd: bmp fix peer-up ports byte order (backport #13198)

2 years agobgpd: bmp fix peer-up ports byte order 13204/head
Maxence Younsi [Mon, 3 Apr 2023 15:19:32 +0000 (17:19 +0200)]
bgpd: bmp fix peer-up ports byte order

added htons to ports in the peer-up message to fix byte order

Signed-off-by: Maxence Younsi <mx.yns@outlook.fr>
(cherry picked from commit 9e681c84fa07d768d41fb8fba269c965c8c08a4b)