]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
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 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)

2 years agobuild: add doc files missing from dist tarball 12610/head
David Lamparter [Fri, 6 Jan 2023 16:07:47 +0000 (17:07 +0100)]
build: add doc files missing from dist tarball

The override.css/js files for sphinx docs were not being included into
the tarball created by `make dist`.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 26eaf6e386ed2b960c0004d2f927b586e516f587)

2 years agolib/clippy: fix symbol validity check
David Lamparter [Fri, 6 Jan 2023 16:05:25 +0000 (17:05 +0100)]
lib/clippy: fix symbol validity check

If symvalid is false, looking at symidx is bogus.

This fixes a build-time SEGV on mips64el.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit a185874504654a691aa7c204b87ee2f9e3b8a49a)

2 years agolib: disable xref ELF note on mips64el
David Lamparter [Fri, 6 Jan 2023 15:59:55 +0000 (16:59 +0100)]
lib: disable xref ELF note on mips64el

mips64el does not have a 64-bit PC-relative relocation, which is needed
to emit the ELF note for xrefs.  Disabling the ELF note means clippy
takes the fallback path using section headers, so everything does still
work (... unless you strip the section headers.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit ee4a6b9f654fbd4e07485037481ad6b4766bbc6d)

2 years agozebra: do not load/store wider-than-ptr atomics
David Lamparter [Fri, 6 Jan 2023 15:55:38 +0000 (16:55 +0100)]
zebra: do not load/store wider-than-ptr atomics

Most 32-bit architectures cannot do atomic loads and stores of data
wider than their pointer size, i.e. 32 bit.  Funnily enough they
generally *can* do a CAS2, i.e., 64-bit compare-and-swap, but while a
CAS can emulate atomic add/bitops, loads and stores aren't available.

Replace with a mutex;  since this is 99% used from the zserv thread, the
mutex should take the local-to-thread fast path anyway.  And while one
atomic might be faster than a mutex lock/unlock, we're doing several
here, and at some point a mutex wins on speed anyway.

This fixes build on armel, mipsel, m68k, powerpc, and sh4.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit ccac11096c385d269ecd15ad24ac88d469e7577c)

2 years agoMerge pull request #12607 from FRRouting/mergify/bp/stable/8.4/pr-12605
Donatas Abraitis [Mon, 9 Jan 2023 17:36:11 +0000 (19:36 +0200)]
Merge pull request #12607 from FRRouting/mergify/bp/stable/8.4/pr-12605

ospfd: report the router IP with opaque capability mismatch (backport #12605)

2 years agoospfd: report the router IP with Opaque capability mismatch 12607/head
Jafar Al-Gharaibeh [Fri, 6 Jan 2023 15:27:18 +0000 (09:27 -0600)]
ospfd: report the router IP with Opaque capability mismatch

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

2 years agoMerge pull request #12598 from FRRouting/mergify/bp/stable/8.4/pr-12557
Donatas Abraitis [Thu, 5 Jan 2023 11:42:55 +0000 (13:42 +0200)]
Merge pull request #12598 from FRRouting/mergify/bp/stable/8.4/pr-12557

vtysh: Remove double retrieve of env VTYSH_HISTFILE (backport #12557)

2 years agoMerge pull request #12593 from FRRouting/mergify/bp/stable/8.4/pr-12458
Donatas Abraitis [Thu, 5 Jan 2023 08:32:42 +0000 (10:32 +0200)]
Merge pull request #12593 from FRRouting/mergify/bp/stable/8.4/pr-12458

bgpd: Fix aggregated routes are withdrawn abnormally. (backport #12458)

2 years agovtysh: Remove double retrieve of env VTYSH_HISTFILE 12598/head
Donald Sharp [Wed, 21 Dec 2022 13:04:34 +0000 (08:04 -0500)]
vtysh: Remove double retrieve of env VTYSH_HISTFILE

The code is double checking the VTYSH_HISTFILE env variable,
additionally clang-15 when running SA over it doesn't fully
understand the code pattern.  Reduce the double check to
one check to reduce program run-time (ha!) and make SA happy.

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

2 years ago bgpd: Fix aggregated routes are withdrawn abnormally. 12593/head
liuze03 [Wed, 7 Dec 2022 04:22:43 +0000 (12:22 +0800)]
bgpd: Fix aggregated routes are withdrawn abnormally.

    The withdraw message and announcement message of a prefix are received continuously within 50ms, which may lead to abnormal aggregation route reference count.
    Steps to reproduce:
    --------------------------
    step1:
    local config aggregate route 111.0.0.0/24
    received route:111.0.0.1/32 111.0.0.02/32
    ref_count:2

    step2:
    peer withdraw 111.0.0.1/32 and network 111.0.0.1/32 in 50ms
    received route:111.0.0.1/32 111.0.0.02/32
    ref_count:1

    step3:
    peer withdraw 111.0.0.1/32
    received route:111.0.0.02/32
    ref_count:0
    aggregate route will be withdrawn abnormally

Signed-off-by: liuze03 <liuze03@baidu.com>
(cherry picked from commit 704e189e594418571463c80a3efcc2c1020adcf4)

2 years agoMerge pull request #12585 from FRRouting/mergify/bp/stable/8.4/pr-12566
Donatas Abraitis [Tue, 3 Jan 2023 07:17:53 +0000 (09:17 +0200)]
Merge pull request #12585 from FRRouting/mergify/bp/stable/8.4/pr-12566

ospfd: add advertising router IP to Opaque capability mismatch err msg (backport #12566)

2 years agoospfd: add advertising router IP to Opaque capability mismatch error message 12585/head
Jafar Al-Gharaibeh [Sun, 25 Dec 2022 01:56:29 +0000 (19:56 -0600)]
ospfd: add advertising router IP to Opaque capability mismatch error message

Submitted-by Marc Boucher <marc@airvitesse.net>
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
(cherry picked from commit eab190351fc4460477274cec106989392bcff1b5)

2 years agoMerge pull request #12565 from FRRouting/mergify/bp/stable/8.4/pr-12560
Donatas Abraitis [Mon, 2 Jan 2023 20:42:30 +0000 (22:42 +0200)]
Merge pull request #12565 from FRRouting/mergify/bp/stable/8.4/pr-12560

tools: Ignore agentx command for frr-reload.py (backport #12560)

2 years agoMerge pull request #12570 from FRRouting/mergify/bp/stable/8.4/pr-12558
Donatas Abraitis [Wed, 28 Dec 2022 11:12:26 +0000 (13:12 +0200)]
Merge pull request #12570 from FRRouting/mergify/bp/stable/8.4/pr-12558

bgpd: static routes are leaked on shutdown (backport #12558)

2 years agobgpd: bgp_connected_add memory was being leaked in some cases 12570/head
Donald Sharp [Thu, 22 Dec 2022 00:26:58 +0000 (19:26 -0500)]
bgpd: bgp_connected_add memory was being leaked in some cases

On shutdown, bgp calls an unlock for the bnc connected table,
via the bgp_connected_cleanup function.  This function is
only ever called on shutdown, so we know that bgp is going
away.  The refcount for the connected data can be more than
1.  Let's not worry about the refcount on shutdown and
just delete the nodes instead of leaving them around.

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

2 years agobgpd: rfapi properly free a couple lists
Donald Sharp [Wed, 21 Dec 2022 20:22:24 +0000 (15:22 -0500)]
bgpd: rfapi properly free a couple lists

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

2 years agobgpd: static routes are leaked on shutdown
Donald Sharp [Wed, 21 Dec 2022 17:11:56 +0000 (12:11 -0500)]
bgpd: static routes are leaked on shutdown

Shutdown of bgp results in both the bgp_path_info,
bgp_dest and bgp_table's not being freed because
the bgp_path_info remains locked.

Effectively static routes are scheduled for deletion but bgp_process
skips the work because the work queue sees that the bgp router
is marked for deletion.  Effectively not doing any work and leaving
data on the floor.

Modify the code when attempting to put into the work queue to
notice and not do so but just unlock the path info.

This is effectively the same as what goes on for normal peering
as that it checks for shutdown and just calls bgp_path_info_free
too.

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

2 years agotools: Ignore agentx command for frr-reload.py 12565/head
Donatas Abraitis [Thu, 22 Dec 2022 15:55:40 +0000 (17:55 +0200)]
tools: Ignore agentx command for frr-reload.py

agentx can't be disabled once enabled, so we should ignore it for frr-reload.py.

```
$ /usr/lib/frr/frr-reload.py --reload /etc/frr/bgpd.conf --bindir /usr/local/bin
"no agentx" we failed to remove this command
SNMP AgentX support cannot be disabled once enabled
```

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

2 years agoMerge pull request #12545 from FRRouting/mergify/bp/stable/8.4/pr-12438
Donatas Abraitis [Tue, 20 Dec 2022 07:51:42 +0000 (09:51 +0200)]
Merge pull request #12545 from FRRouting/mergify/bp/stable/8.4/pr-12438

bgpd: Stop overriding nexthop in vpn_leak_from_vrf_update when the peer is BGP unnumberred (backport #12438)

2 years agotests: Add topotest bgp_vrf_leaking_5549_routes 12545/head
Ryoga Saito [Tue, 6 Dec 2022 17:27:16 +0000 (02:27 +0900)]
tests: Add topotest bgp_vrf_leaking_5549_routes

To verify previous changes, this PR introduces topotest to verify
whether imported routes learnt from BGP unnumbered peers will be active
on VPN RIB and other VRF RIB.

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
(cherry picked from commit 2b0efccd057752a14e88c71f142a5b8bc0ad93a8)

2 years agobgpd: Stop overriding nexthop when BGP unnumberred
Ryoga Saito [Sun, 4 Dec 2022 14:51:45 +0000 (23:51 +0900)]
bgpd: Stop overriding nexthop when BGP unnumberred

When we use vrf-to-vrf export, the nexthop has already not been
overridden when the peer is BGP unnumberred. However, when we use normal
export, the nexthop will be oberridden. This behavior will make the VPN
routes invalid in VPN RIB.

This PR stops overriding nexthop even if we use normal export.

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
(cherry picked from commit f784007d677ee20e4dbd20366928652be2a0b23c)

2 years agoMerge pull request #12512 from FRRouting/mergify/bp/stable/8.4/pr-12498
Donald Sharp [Wed, 14 Dec 2022 11:51:29 +0000 (06:51 -0500)]
Merge pull request #12512 from FRRouting/mergify/bp/stable/8.4/pr-12498

ospfd: fix typo and report the link name in the warning (backport #12498)

2 years agoMerge pull request #12514 from donaldsharp/cleanup_8.4
Jafar Al-Gharaibeh [Wed, 14 Dec 2022 04:07:51 +0000 (22:07 -0600)]
Merge pull request #12514 from donaldsharp/cleanup_8.4

zebra: Remove badly backported TC code

2 years agozebra: Remove badly backported TC code 12514/head
Donald Sharp [Tue, 13 Dec 2022 20:11:05 +0000 (15:11 -0500)]
zebra: Remove badly backported TC code

Some TC code for the dplane got backported that should
not have been.  Remove it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoospfd: fix typo and report the link name in the warning 12512/head
Jafar Al-Gharaibeh [Mon, 12 Dec 2022 15:12:34 +0000 (09:12 -0600)]
ospfd: fix typo and report the link name in the warning

Submitted-by: Marc Boucher <marc@airvitesse.net>
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
(cherry picked from commit bf8d8a5451b869a07c147ae1b31d2c2b52458b2a)

2 years agoMerge pull request #12493 from FRRouting/mergify/bp/stable/8.4/pr-12466
Donatas Abraitis [Mon, 12 Dec 2022 12:25:21 +0000 (14:25 +0200)]
Merge pull request #12493 from FRRouting/mergify/bp/stable/8.4/pr-12466

build: FreeBSD fixes (backport #12466)

2 years agodoc: add FreeBSD 13 build docs 12493/head
David Lamparter [Thu, 8 Dec 2022 13:17:17 +0000 (14:17 +0100)]
doc: add FreeBSD 13 build docs

Some minor changes since FreeBSD 11, mostly fewer extra sauce.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit d3135b0189f3b99b5eb327d821bb9a40d09988e1)

2 years agobuild: pim6d is Linux only
David Lamparter [Thu, 8 Dec 2022 11:45:38 +0000 (12:45 +0100)]
build: pim6d is Linux only

This stops breaking build on FreeBSD.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit d9a2d546da40fa6eb5b546eff34e07b8e67c2247)

2 years agobuild: fix sed regex in Lua macro
David Lamparter [Thu, 8 Dec 2022 11:35:03 +0000 (12:35 +0100)]
build: fix sed regex in Lua macro

Using `\s` to match whitespace is not portable, use `[[:space:]]`
instead.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 9e46405ca2c7b3d5380dc6ab619666a6d32bbbfb)

2 years agoMerge pull request #12486 from FRRouting/mergify/bp/stable/8.4/pr-12482
Donatas Abraitis [Sun, 11 Dec 2022 19:35:23 +0000 (21:35 +0200)]
Merge pull request #12486 from FRRouting/mergify/bp/stable/8.4/pr-12482

Mem this (backport #12482)

2 years agozebra: Free up routemap name memory on vrf deletion event 12486/head
Donald Sharp [Fri, 9 Dec 2022 13:51:34 +0000 (08:51 -0500)]
zebra: Free up routemap name memory on vrf deletion event

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

2 years agolib: Hide list macros in linklist.c
Donald Sharp [Fri, 9 Dec 2022 13:37:45 +0000 (08:37 -0500)]
lib: Hide list macros in linklist.c

The LISTNODE_ATTACH|DELETE macros are only used in
linklist.c.  Let's remove temptation from people
to use them.

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

2 years agoospf6d: Don't allocate json memory in non-json path
Donald Sharp [Fri, 9 Dec 2022 13:32:12 +0000 (08:32 -0500)]
ospf6d: Don't allocate json memory in non-json path

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

2 years agozebra: Actually free all memory associated ctx->u.iptable.interface_name_list
Donald Sharp [Fri, 9 Dec 2022 13:14:31 +0000 (08:14 -0500)]
zebra: Actually free all memory associated ctx->u.iptable.interface_name_list

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

2 years agoisisd: Fix sadj memory leak
Donald Sharp [Fri, 9 Dec 2022 12:44:26 +0000 (07:44 -0500)]
isisd: Fix sadj memory leak

In some cases the sadj was directly dropped.

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

2 years agoMerge pull request #12428 from FRRouting/mergify/bp/stable/8.4/pr-12427
Donatas Abraitis [Fri, 2 Dec 2022 08:43:20 +0000 (10:43 +0200)]
Merge pull request #12428 from FRRouting/mergify/bp/stable/8.4/pr-12427

build: enable pim6d by default (backport #12427)

2 years agobuild: enable pim6d by default 12428/head
Mark Stapp [Thu, 1 Dec 2022 18:57:46 +0000 (13:57 -0500)]
build: enable pim6d by default

Change configure.ac so that pim6d is enabled by default; a
command-line option can disable it.

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

2 years agoMerge pull request #12419 from FRRouting/mergify/bp/stable/8.4/pr-12386
Donatas Abraitis [Tue, 29 Nov 2022 19:32:49 +0000 (21:32 +0200)]
Merge pull request #12419 from FRRouting/mergify/bp/stable/8.4/pr-12386

bfdd: fix IPv4 socket source selection (backport #12386)

2 years agoMerge pull request #12420 from FRRouting/mergify/bp/stable/8.4/pr-12367
Donatas Abraitis [Tue, 29 Nov 2022 19:32:34 +0000 (21:32 +0200)]
Merge pull request #12420 from FRRouting/mergify/bp/stable/8.4/pr-12367

ospfd: Fixing a memleak. (backport #12367)

2 years agoospfd: Fixing memleak. 12420/head
rgirada [Tue, 22 Nov 2022 09:59:40 +0000 (09:59 +0000)]
ospfd: Fixing memleak.

Description:
As part of signal handler ospf_finish_final(),  lsas are originated
and added to refresh queues are not freed.

One such leak is :
==2869285== 432 (40 direct, 392 indirect) bytes in 1 blocks are definitely lost in loss record 159 of 221
==2869285==    at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2869285==    by 0x4910EC3: qcalloc (memory.c:116)
==2869285==    by 0x199024: ospf_refresher_register_lsa (ospf_lsa.c:4017)
==2869285==    by 0x199024: ospf_refresher_register_lsa (ospf_lsa.c:3979)
==2869285==    by 0x19A37F: ospf_network_lsa_install (ospf_lsa.c:2680)
==2869285==    by 0x19A37F: ospf_lsa_install (ospf_lsa.c:2941)
==2869285==    by 0x19C18F: ospf_network_lsa_update (ospf_lsa.c:1099)
==2869285==    by 0x1931ED: ism_change_state (ospf_ism.c:556)
==2869285==    by 0x1931ED: ospf_ism_event (ospf_ism.c:596)
==2869285==    by 0x494E0B0: thread_call (thread.c:2006)
==2869285==    by 0x494E395: _thread_execute (thread.c:2098)
==2869285==    by 0x19FBC6: nsm_change_state (ospf_nsm.c:695)
==2869285==    by 0x19FBC6: ospf_nsm_event (ospf_nsm.c:861)
==2869285==    by 0x494E0B0: thread_call (thread.c:2006)
==2869285==    by 0x494E395: _thread_execute (thread.c:2098)
==2869285==    by 0x19020B: ospf_if_cleanup (ospf_interface.c:322)
==2869285==    by 0x192D0C: ism_interface_down (ospf_ism.c:393)
==2869285==    by 0x193028: ospf_ism_event (ospf_ism.c:584)
==2869285==    by 0x494E0B0: thread_call (thread.c:2006)
==2869285==    by 0x494E395: _thread_execute (thread.c:2098)
==2869285==    by 0x190F10: ospf_if_down (ospf_interface.c:851)
==2869285==    by 0x1911D6: ospf_if_free (ospf_interface.c:341)
==2869285==    by 0x1E6E98: ospf_finish_final (ospfd.c:748)
==2869285==    by 0x1E6E98: ospf_deferred_shutdown_finish (ospfd.c:578)
==2869285==    by 0x1E7727: ospf_finish (ospfd.c:682)
==2869285==    by 0x1E7727: ospf_terminate (ospfd.c:652)
==2869285==    by 0x18852B: sigint (ospf_main.c:105)
==2869285==    by 0x493BE12: frr_sigevent_process (sigevent.c:130)
==2869285==    by 0x494DCD4: thread_fetch (thread.c:1775)
==2869285==    by 0x4905022: frr_run (libfrr.c:1197)
==2869285==    by 0x187891: main (ospf_main.c:235)

Added a fix to cleanup all these queue pointers and corresponing lsas in it.

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

2 years agobfdd: fix IPv4 socket source selection 12419/head
Rafael Zalamena [Thu, 24 Nov 2022 14:16:18 +0000 (11:16 -0300)]
bfdd: fix IPv4 socket source selection

The imported BFD code had some logic to ignore the source address when
using single hop IPv4. The BFD peer socket function should allow the
source to be selected so we can:
1. Select the source address in the outgoing packets
2. Only receive packets from that specific source

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

2 years agoMerge pull request #12411 from FRRouting/mergify/bp/stable/8.4/pr-12408
Donatas Abraitis [Mon, 28 Nov 2022 19:00:58 +0000 (21:00 +0200)]
Merge pull request #12411 from FRRouting/mergify/bp/stable/8.4/pr-12408

zebra: Use `mpls enable`, not `mpls` when generating a config (backport #12408)

2 years agoMerge pull request #12412 from FRRouting/mergify/bp/stable/8.4/pr-12389
Donatas Abraitis [Mon, 28 Nov 2022 19:00:49 +0000 (21:00 +0200)]
Merge pull request #12412 from FRRouting/mergify/bp/stable/8.4/pr-12389

ospf6d: fix infinite loop when adding ASBR route (backport #12389)

2 years agoospf6d: fix infinite loop when adding ASBR route 12412/head
Renato Westphal [Thu, 24 Nov 2022 01:14:51 +0000 (22:14 -0300)]
ospf6d: fix infinite loop when adding ASBR route

Commit 8f359e1593c414322 removed a check that prevented the same route
from being added twice. In certain topologies, that change resulted in
the following infinite loop when adding an ASBR route:

ospf6_route_add
 ospf6_top_brouter_hook_add
  ospf6_abr_examin_brouter
   ospf6_abr_examin_summary
    ospf6_route_add
     (repeat until stack overflow)

Revert the offending commit and update `ospf6_route_is_identical()` to
not do comparison using `memcmp()`.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
(cherry picked from commit 4dfe15200ab1a84a8d77fcbc33085c373d556eae)

2 years agozebra: Use `mpls enable`, not `mpls` when generating a config 12411/head
Donatas Abraitis [Mon, 28 Nov 2022 09:14:06 +0000 (11:14 +0200)]
zebra: Use `mpls enable`, not `mpls` when generating a config

If we enable MPLS for an interface via sysctl, we should write `mpls enable`,
not `mpls`.

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

2 years agoMerge pull request #12407 from FRRouting/mergify/bp/stable/8.4/pr-12403
Donatas Abraitis [Mon, 28 Nov 2022 10:39:12 +0000 (12:39 +0200)]
Merge pull request #12407 from FRRouting/mergify/bp/stable/8.4/pr-12403

Echo exclusion (backport #12403)

2 years agolib: Do not log `echo PING` commands from watchfrr 12407/head
Donald Sharp [Sat, 26 Nov 2022 14:23:50 +0000 (09:23 -0500)]
lib: Do not log `echo PING` commands from watchfrr

Since the `echo PING` commands are from watchfrr and are sent
a whole bunch when an operator has `log commands` on the amount
of logging done is quite significant.

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

2 years agozebra: Fix tracepoint changes for lttng
Donald Sharp [Sat, 26 Nov 2022 14:28:14 +0000 (09:28 -0500)]
zebra: Fix tracepoint changes for lttng

The recent tracepoint additions in c317d3f246769e8261df0f9d1eb787bea7b5da06
did not properly setup the tracepoints for lttng.  Fix this.

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

2 years agoMerge pull request #12404 from FRRouting/mergify/bp/stable/8.4/pr-12399
Donatas Abraitis [Sun, 27 Nov 2022 14:50:33 +0000 (16:50 +0200)]
Merge pull request #12404 from FRRouting/mergify/bp/stable/8.4/pr-12399

staticd: Fix crash for an existing route with color (backport #12399)

2 years agostaticd: Do not crash when modifying an existing static route with color 12404/head
Donatas Abraitis [Fri, 25 Nov 2022 14:19:28 +0000 (16:19 +0200)]
staticd: Do not crash when modifying an existing static route with color

```
$ vtysh -c 'conf' -c 'ip route 192.168.0.0/32 192.168.10.65 color 123'
$ vtysh -c 'show ip route 192.168.0.0/32 json' | jq '."192.168.0.0/32"[0].nexthops[0].srteColor'
123
$ vtysh -c 'conf' -c 'ip route 192.168.0.0/32 192.168.10.65'
$ vtysh -c 'show ip route 192.168.0.0/32 json' | jq '."192.168.0.0/32"[0].nexthops[0].srteColor'
0
```

Before this patch:
```
STATIC: Received signal 6 at 1666938633 (si_addr 0x4e1a, PC 0x7f295139c438); aborting...
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(zlog_backtrace_sigsafe+0x70) [0x7f29519ef0a0]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(zlog_signal+0xec) [0x7f29519ef28c]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xccee2) [0x7f2951a1aee2]
STATIC: /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f2951742390]
STATIC: /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7f295139c438]
STATIC: /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f295139e03a]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(_zlog_assert_failed+0xe6) [0x7f2951a46766]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xae7ee) [0x7f29519fc7ee]
STATIC: /home/u1/mGIT/frr-master/staticd/.libs/lt-staticd(routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xaf264) [0x7f29519fd264]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xafb4f) [0x7f29519fdb4f]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(nb_candidate_commit_apply+0x33) [0x7f29519fde33]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(nb_candidate_commit+0x9e) [0x7f29519fdf6e]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xb0469) [0x7f29519fe469]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xb3055) [0x7f2951a01055]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(nb_cli_apply_changes+0xd8) [0x7f2951a01358]
STATIC: /home/u1/mGIT/frr-master/staticd/.libs/lt-staticd() [0x407ec2]
STATIC: /home/u1/mGIT/frr-master/staticd/.libs/lt-staticd() [0x40a307]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0x74923) [0x7f29519c2923]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(cmd_execute_command+0xe4) [0x7f29519c2aa4]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(cmd_execute+0xc9) [0x7f29519c2c49]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xe4184) [0x7f2951a32184]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xe4436) [0x7f2951a32436]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xe6fcc) [0x7f2951a34fcc]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(thread_call+0x98) [0x7f2951a2cc28]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(frr_run+0xe8) [0x7f29519e7518]
STATIC: /home/u1/mGIT/frr-master/staticd/.libs/lt-staticd(main+0xda) [0x40572a]
STATIC: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f2951387840]
STATIC: /home/u1/mGIT/frr-master/staticd/.libs/lt-staticd(_start+0x29) [0x4058e9]
STATIC: in thread vtysh_read scheduled from lib/vty.c:2710 vty_event()
```

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

2 years agoMerge pull request #12400 from FRRouting/mergify/bp/stable/8.4/pr-12370
Donatas Abraitis [Sat, 26 Nov 2022 19:19:06 +0000 (21:19 +0200)]
Merge pull request #12400 from FRRouting/mergify/bp/stable/8.4/pr-12370

bgpd: Fix crash for `set ipv4/ipv6 vpn next-hop` command (backport #12370)

2 years agobgpd: Fix crash for `set ipv4/ipv6 vpn next-hop` command 12400/head
Donatas Abraitis [Tue, 22 Nov 2022 12:50:09 +0000 (14:50 +0200)]
bgpd: Fix crash for `set ipv4/ipv6 vpn next-hop` command

Crash when using for example:

```
route-map test permit 10
 set ipv6 vpn next-hop 10.10.10.10
```

```
bgpd[30843]: libyang: Unsatisfied pattern - "1.1.1.1" does not conform to "((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(%[\p{N}\p{L}]+)?". (Schema location /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/set-action/frr-bgp-route-map:ipv6-address/ipv6-address.)
bgpd[30843]: [JEA2K-29RPH][EC 100663345] nb_candidate_edit: lyd_new_path(/frr-route-map:lib/route-map[name='belekas']/entry[sequence='109']/set-action[action='frr-bgp-route-map:ipv6-vpn-address']/rmap-set-action/frr-bgp-route-map:ipv6-address) failed: 7
bgpd[30843]: [ZDEA9-V1X7W][EC 100663341] nb_cli_apply_changes_internal: failed to edit candidate configuration: operation [modify] xpath [/frr-route-map:lib/route-map[name='belekas']/entry[sequence='109']/set-action[action='frr-bgp-route-map:ipv6-vpn-address']/rmap-set-action/frr-bgp-route-map:ipv6-address]
bgpd[30843]: [SZNR8-V24R3][EC 100663326] yang_dnode_xpath_get_canon: couldn't find ./rmap-set-action/frr-bgp-route-map:ipv6-address
bgpd[30843]: Backtrace for 20 stack frames:
bgpd[30843]: [bt 0] /usr/local/lib/libfrr.so.0(zlog_backtrace+0x3a) [0x7f539c87c95a]
bgpd[30843]: [bt 1] /usr/local/lib/libfrr.so.0(+0xed022) [0x7f539c8c8022]
bgpd[30843]: [bt 2] /usr/local/lib/libfrr.so.0(yang_dnode_get_string+0x96) [0x7f539c8c9ea6]
bgpd[30843]: [bt 3] /usr/local/lib/libfrr.so.0(route_map_action_show+0xc40) [0x7f539c8a4540]
bgpd[30843]: [bt 4] /usr/local/lib/libfrr.so.0(nb_cli_show_dnode_cmds+0x5c) [0x7f539c88fa8c]
bgpd[30843]: [bt 5] /usr/local/lib/libfrr.so.0(nb_cli_show_dnode_cmds+0x159) [0x7f539c88fb89]
bgpd[30843]: [bt 6] /usr/local/lib/libfrr.so.0(nb_cli_show_dnode_cmds+0x1a3) [0x7f539c88fbd3]
bgpd[30843]: [bt 7] /usr/local/lib/libfrr.so.0(nb_cli_show_dnode_cmds+0x159) [0x7f539c88fb89]
bgpd[30843]: [bt 8] /usr/local/lib/libfrr.so.0(+0xc4d47) [0x7f539c89fd47]
bgpd[30843]: [bt 9] /usr/local/lib/libfrr.so.0(+0x7274a) [0x7f539c84d74a]
bgpd[30843]: [bt 10] /usr/local/lib/libfrr.so.0(+0x72cb0) [0x7f539c84dcb0]
bgpd[30843]: [bt 11] /usr/local/lib/libfrr.so.0(+0x74c40) [0x7f539c84fc40]
bgpd[30843]: [bt 12] /usr/local/lib/libfrr.so.0(cmd_execute_command+0xa4) [0x7f539c84fd74]
bgpd[30843]: [bt 13] /usr/local/lib/libfrr.so.0(cmd_execute+0x142) [0x7f539c84ffe2]
bgpd[30843]: [bt 14] /usr/local/lib/libfrr.so.0(+0xe51b7) [0x7f539c8c01b7]
bgpd[30843]: [bt 15] /usr/local/lib/libfrr.so.0(+0xe53f0) [0x7f539c8c03f0]
bgpd[30843]: [bt 16] /usr/local/lib/libfrr.so.0(+0xe8078) [0x7f539c8c3078]
bgpd[30843]: [bt 17] /usr/local/lib/libfrr.so.0(thread_call+0x7d) [0x7f539c8bacbd]
bgpd[30843]: [bt 18] /usr/local/lib/libfrr.so.0(frr_run+0xe8) [0x7f539c8749b8]
bgpd[30843]: [bt 19] /usr/lib/frr/bgpd(main+0x3f1) [0x55f887e97d71]
BGP[30843]: Received signal 6 at 1669121170 (si_addr 0x7f0000787b, PC 0x7f539ba58e87); aborting...
```

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

2 years agoMerge pull request #12382 from FRRouting/mergify/bp/stable/8.4/pr-12374
Donatas Abraitis [Fri, 25 Nov 2022 06:55:15 +0000 (08:55 +0200)]
Merge pull request #12382 from FRRouting/mergify/bp/stable/8.4/pr-12374

lib: disable vrf before terminating interfaces (backport #12374)

2 years agoMerge pull request #12387 from FRRouting/mergify/bp/stable/8.4/pr-12317
Donatas Abraitis [Fri, 25 Nov 2022 06:55:06 +0000 (08:55 +0200)]
Merge pull request #12387 from FRRouting/mergify/bp/stable/8.4/pr-12317

ospfd: Fix RFC conformance test cases 25.19 and 27.6 (backport #12317)

2 years agoospfd: Fix RFC conformance test cases 25.19 and 27.6 12387/head
Mobashshera Rasool [Tue, 15 Nov 2022 05:00:55 +0000 (21:00 -0800)]
ospfd: Fix RFC conformance test cases 25.19 and 27.6

Steps to reproduce:
--------------------------
1. ANVL: Establish full adjacency with DUT for neighbor Rtr-0-A on DIface-0 with DUT as DR.
2. ANVL: Listen (for up to 2 * <RxmtInterval> seconds) on DIface-0.
3. DUT: Send <OSPF-LSU> packet.
4. ANVL: Verify that the received <OSPF-LSU> packet contains a Network- LSA for network N1
   originated by DUT, and the LS Sequence Number is set to <InitialSequenceNumber>.
5. ANVL: Establish full adjacency with DUT for neighbor Rtr-0-B on DIface-0 with DUT as DR.
6. ANVL: Listen (for up to 2 * <RxmtInterval> seconds) on DIface-0.
7. DUT: Send <OSPF-LSU> packet.
8. ANVL: Verify that the received <OSPF-LSU> packet contains a new instance of the
   Network-LSA for network N1 originated by DUT, and the LS Sequence Number
   is set to (<InitialSequenceNumber> + 1).

Both the test cases were failing while verifying the initial sequence number for network LSA.

This is because currently OSPF does not reset its LSA sequence number when it is going down.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
(cherry picked from commit ca5997cd018ec66534285130d02de168a3a4ed5c)

2 years agolib: disable vrf before terminating interfaces 12382/head
Stephen Worley [Tue, 22 Nov 2022 22:18:02 +0000 (17:18 -0500)]
lib: disable vrf before terminating interfaces

We must disable the vrf before we start terminating interfaces.

On termination, we free the 'zebra_if' struct from the interface ->info
pointer. We rely on that for subsystems like vxlan for cleanup when
shutting down.

'''
==497406== Invalid read of size 8
==497406==    at 0x47E70A: zebra_evpn_del (zebra_evpn.c:1103)
==497406==    by 0x47F004: zebra_evpn_cleanup_all (zebra_evpn.c:1363)
==497406==    by 0x4F2404: zebra_evpn_vxlan_cleanup_all (zebra_vxlan.c:1158)
==497406==    by 0x4917041: hash_iterate (hash.c:267)
==497406==    by 0x4F25E2: zebra_vxlan_cleanup_tables (zebra_vxlan.c:5676)
==497406==    by 0x4D52EC: zebra_vrf_disable (zebra_vrf.c:209)
==497406==    by 0x49A247F: vrf_disable (vrf.c:340)
==497406==    by 0x49A2521: vrf_delete (vrf.c:245)
==497406==    by 0x49A2E2B: vrf_terminate_single (vrf.c:533)
==497406==    by 0x49A2D8F: vrf_terminate (vrf.c:561)
==497406==    by 0x441240: sigint (main.c:192)
==497406==    by 0x4981F6D: frr_sigevent_process (sigevent.c:130)
==497406==  Address 0x6d68c68 is 200 bytes inside a block of size 272 free'd
==497406==    at 0x48470E4: free (vg_replace_malloc.c:872)
==497406==    by 0x4942CF0: qfree (memory.c:141)
==497406==    by 0x49196A9: if_delete (if.c:293)
==497406==    by 0x491C54C: if_terminate (if.c:1031)
==497406==    by 0x49A2E22: vrf_terminate_single (vrf.c:532)
==497406==    by 0x49A2D8F: vrf_terminate (vrf.c:561)
==497406==    by 0x441240: sigint (main.c:192)
==497406==    by 0x4981F6D: frr_sigevent_process (sigevent.c:130)
==497406==    by 0x499A5F0: thread_fetch (thread.c:1775)
==497406==    by 0x492850E: frr_run (libfrr.c:1197)
==497406==    by 0x441746: main (main.c:476)
==497406==  Block was alloc'd at
==497406==    at 0x4849464: calloc (vg_replace_malloc.c:1328)
==497406==    by 0x49429A5: qcalloc (memory.c:116)
==497406==    by 0x491D971: if_new (if.c:174)
==497406==    by 0x491ACC8: if_create_name (if.c:228)
==497406==    by 0x491ABEB: if_get_by_name (if.c:613)
==497406==    by 0x427052: netlink_interface (if_netlink.c:1178)
==497406==    by 0x43BC18: netlink_parse_info (kernel_netlink.c:1188)
==497406==    by 0x4266D7: interface_lookup_netlink (if_netlink.c:1288)
==497406==    by 0x42B634: interface_list (if_netlink.c:2368)
==497406==    by 0x4ABF83: zebra_ns_enable (zebra_ns.c:127)
==497406==    by 0x4AC17E: zebra_ns_init (zebra_ns.c:216)
==497406==    by 0x44166C: main (main.c:408)
'''

Signed-off-by: Stephen Worley <sworley@nvidia.com>
(cherry picked from commit b14fa9c4dca1846d64ced5a9710faa1345da4ca0)

2 years agoMerge pull request #12381 from FRRouting/mergify/bp/stable/8.4/pr-12377
Donatas Abraitis [Thu, 24 Nov 2022 07:13:07 +0000 (09:13 +0200)]
Merge pull request #12381 from FRRouting/mergify/bp/stable/8.4/pr-12377

zebra: Replace TC definitions for dplane (backport #12377)

2 years agoMerge pull request #12378 from FRRouting/mergify/bp/stable/8.4/pr-12260
mobash-rasool [Thu, 24 Nov 2022 05:26:32 +0000 (10:56 +0530)]
Merge pull request #12378 from FRRouting/mergify/bp/stable/8.4/pr-12260

pimd: consistently ignore prefix list mask len (backport #12260)

2 years agozebra: Replace TC definitions for dplane 12381/head
Donatas Abraitis [Wed, 23 Nov 2022 15:35:33 +0000 (17:35 +0200)]
zebra: Replace TC definitions for dplane

They were replaced, but forgot for `--enable-scripting`.

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

2 years agopimd: consistently ignore prefix list mask len 12378/head
David Lamparter [Fri, 4 Nov 2022 15:55:55 +0000 (16:55 +0100)]
pimd: consistently ignore prefix list mask len

... the prefix length wasn't ignored as expected.  Both S and G are
always /32.  But expecting "le 32" in prefix-list config is unexpected &
counterintuitive.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit ab2f9e89b44642af568c3542e1f2b14378fb5ec2)

2 years agoMerge pull request #12360 from FRRouting/mergify/bp/stable/8.4/pr-12347
Jafar Al-Gharaibeh [Tue, 22 Nov 2022 16:31:01 +0000 (10:31 -0600)]
Merge pull request #12360 from FRRouting/mergify/bp/stable/8.4/pr-12347

snapcraft: Add pim6 daemon for PIM IPv6 to snap package (backport #12347)

2 years agosnapcraft: Add pim6 daemon for PIM IPv6 to snap package 12360/head
Martin Winter [Sat, 19 Nov 2022 11:15:41 +0000 (12:15 +0100)]
snapcraft: Add pim6 daemon for PIM IPv6 to snap package

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
(cherry picked from commit feeaf30fde211fcff4231807fc9e52c4bbd3000e)

2 years agoFRR Release 8.4.1 docker/8.4.1 frr-8.4.1
Jafar Al-Gharaibeh [Fri, 18 Nov 2022 05:09:28 +0000 (23:09 -0600)]
FRR Release 8.4.1

- zebra: reuse netinet/if_ether.h to avoid redefinition of struct ethhdr
- zebra: fix build without AF_MPLS
- ospfd: get route-map name for default-information originate
- ospfd: allow unnumbered and numbered addresses to co-exist better
- ospfd: prevent from crashing when processing external lsa
- bgpd: fix "storing the address of local variable"
- bgpd: rpki was decrementing the node lock one time too many
- bgpd: do not send Deconfig/Shutdown message when restarting
- pimd: convert zlog_warn to debug

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2 years agoMerge pull request #12332 from FRRouting/mergify/bp/stable/8.4/pr-12309
Donatas Abraitis [Thu, 17 Nov 2022 20:21:43 +0000 (22:21 +0200)]
Merge pull request #12332 from FRRouting/mergify/bp/stable/8.4/pr-12309

bgpd: fix invalid ipv4-vpn nexthop for IPv6 peer (backport #12309)

2 years agobgpd: fix invalid ipv4-vpn nexthop for IPv6 peer 12332/head
Ryoga Saito [Sat, 12 Nov 2022 08:45:19 +0000 (17:45 +0900)]
bgpd: fix invalid ipv4-vpn nexthop for IPv6 peer

Given that two routers are connected each other and they have IPv6
addresses and they establish BGP peer with extended-nexthop capability
and one router tries to advertise locally-generated IPv4-VPN routes to
other router.

In this situation, bgpd on the router that tries to advertise IPv4-VPN
routes will be crashed with "invalid MP nexthop length (AFI IP6)".

This issue is happened because MP_REACH_NLRI path attribute is not
generated correctly when ipv4-vpn routes are advertised to IPv6 peer.
When IPv4 routes are leaked from VRF RIB, the nexthop of these routes
are also IPv4 address (0.0.0.0/0 or specific addresses). However,
bgp_packet_mpattr_start only covers the case of IPv6 nexthop (for IPv6
peer).

ipv4-unicast routes were not affected by this issue because the case of
IPv4 nexthop is covered in `else` block.

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
(cherry picked from commit 63e7ddb509435d9e178cf51a9a288273fb91bf7e)

2 years agotests: Add topotest for l3vpn over ipv6 peer
Ryoga Saito [Wed, 16 Nov 2022 23:37:55 +0000 (08:37 +0900)]
tests: Add topotest for l3vpn over ipv6 peer

To check the effect of the next patch, I added topotest.

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
(cherry picked from commit 3db8aa8750d1be675f6df1ed765afeb101b6402b)

2 years agoMerge pull request #12331 from FRRouting/mergify/bp/stable/8.4/pr-12302
Donatas Abraitis [Thu, 17 Nov 2022 14:42:01 +0000 (16:42 +0200)]
Merge pull request #12331 from FRRouting/mergify/bp/stable/8.4/pr-12302

isisd: fix area NULL pointer in isis_route_update (backport #12302)

2 years agoMerge pull request #12330 from FRRouting/mergify/bp/stable/8.4/pr-12312
Donatas Abraitis [Thu, 17 Nov 2022 12:14:58 +0000 (14:14 +0200)]
Merge pull request #12330 from FRRouting/mergify/bp/stable/8.4/pr-12312

bgpd: authorise to select bgp self peer prefix on rr case (backport #12312)

2 years agoisisd: fix area NULL pointer in isis_route_update 12331/head
Louis Scalbert [Thu, 10 Nov 2022 16:18:01 +0000 (17:18 +0100)]
isisd: fix area NULL pointer in isis_route_update

Fix the case area is NULL.

Fixes: acc0029779 ("isisd: fix potential access to NULL pointer in isis_route_update")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 41c2bf853f072008330a929480bf235ac840212a)

2 years agobgpd: authorise to select bgp self peer prefix on rr case 12330/head
Philippe Guibert [Mon, 7 Nov 2022 10:56:37 +0000 (11:56 +0100)]
bgpd: authorise to select bgp self peer prefix on rr case

This commit addresses an issue that happens when using bgp
peering with a rr client, with a received prefix which is the
local ip address of the bgp session.

When using bgp ipv4 unicast session, the local prefix is
received by a peer, and finds out that the proposed prefix
and its next-hop are the same. To avoid a route loop locally,
no nexthop entry is referenced for that prefix, and the route
will not be selected.

When the received peer is a route reflector, the prefix has
to be selected, even if the route can not be installed locally.

Fixes: ("fb8ae704615c") bgpd: prevent routes loop through itself
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit f874552557cf2577ae91b297f422e307084f22d3)

2 years agoMerge pull request #12320 from FRRouting/mergify/bp/stable/8.4/pr-12307
Donatas Abraitis [Tue, 15 Nov 2022 16:02:43 +0000 (18:02 +0200)]
Merge pull request #12320 from FRRouting/mergify/bp/stable/8.4/pr-12307

tools: remove backslash from declare check regex (backport #12307)

2 years agoMerge pull request #12319 from FRRouting/mergify/bp/stable/8.4/pr-12315
Donatas Abraitis [Tue, 15 Nov 2022 09:28:25 +0000 (11:28 +0200)]
Merge pull request #12319 from FRRouting/mergify/bp/stable/8.4/pr-12315

Dplane sorry (backport #12315)

2 years agotools: remove backslash from declare check regex 12320/head
Marius Tomaschewski [Fri, 11 Nov 2022 11:26:04 +0000 (12:26 +0100)]
tools: remove backslash from declare check regex

The backslash in `grep -q '^declare \-a'` is not needed and
causes `grep: warning: stray \ before -` warning in grep-3.8.

Signed-off-by: Marius Tomaschewski <mt@suse.com>
(cherry picked from commit 5216a05b32390a64efeb598051411e1776042624)

2 years agozebra: Fix dplane_fpm_nl to allow for fast configuration 12319/head
Donald Sharp [Mon, 14 Nov 2022 13:28:45 +0000 (08:28 -0500)]
zebra: Fix dplane_fpm_nl to allow for fast configuration

If you have this order in your configuration file:

no fpm use-next-hop-groups
fpm address 127.0.0.1

the dplane code was using the same event thread t_event and the second
add event in the code was going, you already have an event scheduled
and as such the second event does not overwrite it.  Leaving
no code to actually start the whole processing.  There are probably
other cli iterations that will cause this fun as well, but I'm
not going to spend the time sussing them out at the moment.

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

2 years agozebra: Use the enum, luke
Donald Sharp [Mon, 14 Nov 2022 13:06:16 +0000 (08:06 -0500)]
zebra: Use the enum, luke

Use the enum and let the compiler help us figure out
what cases are being missed.

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

2 years agoMerge pull request #12305 from FRRouting/mergify/bp/stable/8.4/pr-12303
Donatas Abraitis [Fri, 11 Nov 2022 08:47:46 +0000 (10:47 +0200)]
Merge pull request #12305 from FRRouting/mergify/bp/stable/8.4/pr-12303

zebra: relax if_type check to allow early ES config creation (backport #12303)

2 years agozebra: relax if_type check to allow early ES config creation 12305/head
Anuradha Karuppiah [Fri, 29 May 2020 16:53:31 +0000 (09:53 -0700)]
zebra: relax if_type check to allow early ES config creation

The API for configuring ES in zebra had a strict check for if_type
"isBond" that prevented the ES config from being created before the
interface.

Ticket: CM-29454

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
(cherry picked from commit 3fa177eed287823bbe1d6c7bd9856d1d19435db3)

2 years agoMerge pull request #12304 from FRRouting/mergify/bp/stable/8.4/pr-12269
Jafar Al-Gharaibeh [Thu, 10 Nov 2022 22:20:57 +0000 (16:20 -0600)]
Merge pull request #12304 from FRRouting/mergify/bp/stable/8.4/pr-12269

ospfd: prevent from crashing when processing external lsa (backport #12269)

2 years agoospfd: prevent from crashing when processing external lsa 12304/head
Philippe Guibert [Mon, 7 Nov 2022 10:03:41 +0000 (11:03 +0100)]
ospfd: prevent from crashing when processing external lsa

When using debug mode, the ei parameter may be NULL. In that
case, do not display the log trace, otherwise a crash will
happen.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit e5309c1a6e366f5dc95cbc3bbbe5c7ce1d46625c)

2 years agoMerge pull request #12299 from FRRouting/mergify/bp/stable/8.4/pr-12297
Jafar Al-Gharaibeh [Thu, 10 Nov 2022 04:55:42 +0000 (22:55 -0600)]
Merge pull request #12299 from FRRouting/mergify/bp/stable/8.4/pr-12297

pimd: Convert zlog_warn to debug (backport #12297)

2 years agopimd: Convert zlog_warn to debug 12299/head
Donald Sharp [Fri, 22 Nov 2019 20:12:05 +0000 (15:12 -0500)]
pimd: Convert zlog_warn to debug

The unable to find a nexthop should not be a warning it should
be a debug.  Switching over.

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