]> git.puffer.fish Git - matthieu/frr.git/log
matthieu/frr.git
22 months agoRevert "ripngd: Cleanup memory allocations on shutdown" mergify/bp/dev/9.0/pr-13800
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 agoMerge pull request #13786 from FRRouting/mergify/bp/dev/9.0/pr-13612
Donald Sharp [Tue, 13 Jun 2023 20:03:28 +0000 (16:03 -0400)]
Merge pull request #13786 from FRRouting/mergify/bp/dev/9.0/pr-13612

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

22 months agoMerge pull request #13791 from FRRouting/mergify/bp/dev/9.0/pr-13589
Donald Sharp [Tue, 13 Jun 2023 20:03:04 +0000 (16:03 -0400)]
Merge pull request #13791 from FRRouting/mergify/bp/dev/9.0/pr-13589

pbrd, zebra: fix zapi and netlink rule encoding (backport #13589)

22 months agopbrd, zebra: fix zapi and netlink rule encoding
Mark Stapp [Tue, 23 May 2023 19:31:31 +0000 (15:31 -0400)]
pbrd, zebra: fix zapi and netlink rule encoding

In pbrd, don't encode a rule without a table. There are cases
where the zapi encoding was incorrect because the 4-octet
table id was missing. In zebra, mask off the ECN bits in the
TOS byte when encoding an iprule to match netlink's
expectation.

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

22 months agoospfd: fix interface param type update
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 agoMerge pull request #13760 from FRRouting/mergify/bp/dev/9.0/pr-13675
Donatas Abraitis [Sun, 11 Jun 2023 18:40:02 +0000 (21:40 +0300)]
Merge pull request #13760 from FRRouting/mergify/bp/dev/9.0/pr-13675

bfd:fix version bits check (backport #13675)

22 months agobfdd: fix version bits check.
zmw12306 [Sat, 3 Jun 2023 19:08:34 +0000 (15:08 -0400)]
bfdd: fix version bits check.

The version of bfd pkt is represented by 3 bits in B[0].
Signed-off-by: zmw12306 <zmw12306@gmail.com>
(cherry picked from commit 3f658e8b1cfc82e1644cc36fcbc1554c70f558d0)

22 months agoMerge pull request #13744 from FRRouting/mergify/bp/dev/9.0/pr-13726
Donatas Abraitis [Fri, 9 Jun 2023 12:37:42 +0000 (15:37 +0300)]
Merge pull request #13744 from FRRouting/mergify/bp/dev/9.0/pr-13726

tests: fixing pim6 topotest bugs (backport #13726)

22 months agoMerge pull request #13746 from FRRouting/mergify/bp/dev/9.0/pr-13739
Donatas Abraitis [Fri, 9 Jun 2023 12:37:05 +0000 (15:37 +0300)]
Merge pull request #13746 from FRRouting/mergify/bp/dev/9.0/pr-13739

zebra: Prevent crash because nl is NULL on shutdown (backport #13739)

22 months agoMerge pull request #13741 from FRRouting/mergify/bp/dev/9.0/pr-13364
Donatas Abraitis [Fri, 9 Jun 2023 07:15:15 +0000 (10:15 +0300)]
Merge pull request #13741 from FRRouting/mergify/bp/dev/9.0/pr-13364

bfd: fix missing Authentication in control pkt (backport #13364)

22 months agoMerge pull request #13736 from FRRouting/mergify/bp/dev/9.0/pr-13645
Jafar Al-Gharaibeh [Fri, 9 Jun 2023 04:47:51 +0000 (23:47 -0500)]
Merge pull request #13736 from FRRouting/mergify/bp/dev/9.0/pr-13645

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

22 months agozebra: Prevent crash because nl is NULL on shutdown
Donald Sharp [Thu, 8 Jun 2023 16:03:49 +0000 (12:03 -0400)]
zebra: Prevent crash because nl is NULL on shutdown

When shutting down the main pthread was first closing
the sockets associated with the dplane pthread and
then telling it to shutdown the pthread at a later point
in time.  This caused the dplane to crash because the nl
data has been freed already.  Change the shutdown order
to stop the dplane pthread *and* then close the sockets.

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

22 months agotests: convert old pim test to more cleanly use pytest fixture
Christian Hopps [Thu, 8 Jun 2023 08:12:26 +0000 (04:12 -0400)]
tests: convert old pim test to more cleanly use pytest fixture

This is a good way to run a per-test background helper process. Here the
helper object is created before the test function requesting it (through param
name match), and then cleaned up after the test function exits (pass or failed).

A context manager is used to further guarantee the cleanup is done.

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

22 months agotests: fixing pim6 topotest bugs
Christian Hopps [Thu, 8 Jun 2023 06:42:32 +0000 (02:42 -0400)]
tests: fixing pim6 topotest bugs

- Remove use of bespoke socat
- Use ipv6 support in mcast-tester.py
- do not run processes in the background behind munet/micronet's
  back with `&` (ever) -- use popen or the helper class

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

22 months agotests: mcast-tester.py handles IPv6
Christian Hopps [Thu, 8 Jun 2023 06:11:50 +0000 (02:11 -0400)]
tests: mcast-tester.py handles IPv6

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

22 months agobfd: fix missing Authentication in control pkt
zmw12306 [Tue, 25 Apr 2023 17:48:18 +0000 (13:48 -0400)]
bfd: fix missing Authentication in control pkt

According RFC 5880, add a simpilfed version handling authentication
Signed-off-by: zmw12306 <zmw12306@gmail.com>
(cherry picked from commit 98707b04d425dfcc24670704d268a733bbf0bc3f)

22 months agobfdd: remove redundant nb destroy callbacks
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 #13723 from FRRouting/mergify/bp/dev/9.0/pr-13624
Donatas Abraitis [Thu, 8 Jun 2023 05:35:22 +0000 (08:35 +0300)]
Merge pull request #13723 from FRRouting/mergify/bp/dev/9.0/pr-13624

bgpd: Free temp memory (backport #13624)

22 months agobgpd: Free temp memory
Keelan10 [Mon, 29 May 2023 07:42:40 +0000 (11:42 +0400)]
bgpd: Free temp memory

This commit addresses a memory leak issue in the BGP Flowspec NLRI parsing function.

Previously when processing NLRI, dynamically allocated memory to `temp` was not being freed, leading to a memory leak.

The commit introduces the necessary code (XFREE) to properly free the temp memory after processing Flowspec NLRI.

The ASan leak log for reference:

```
./bgp_flowspec.test_bgp_flowspec_topo/r1.bgpd.asan.687689:Direct leak of 56 byte(s) in 2 object(s) allocated from:
./bgp_flowspec.test_bgp_flowspec_topo/r1.bgpd.asan.687689-    #0 0x7fc9872b5037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
./bgp_flowspec.test_bgp_flowspec_topo/r1.bgpd.asan.687689-    #1 0x7fc986e5b1ee in qcalloc lib/memory.c:105
./bgp_flowspec.test_bgp_flowspec_topo/r1.bgpd.asan.687689-    #2 0x560421351bfe in bgp_nlri_parse_flowspec bgpd/bgp_flowspec.c:155
./bgp_flowspec.test_bgp_flowspec_topo/r1.bgpd.asan.687689-    #3 0x56042107d01c in bgp_nlri_parse bgpd/bgp_packet.c:350
./bgp_flowspec.test_bgp_flowspec_topo/r1.bgpd.asan.687689-    #4 0x560421086cf3 in bgp_update_receive bgpd/bgp_packet.c:2023
./bgp_flowspec.test_bgp_flowspec_topo/r1.bgpd.asan.687689-    #5 0x56042108deed in bgp_process_packet bgpd/bgp_packet.c:2933
./bgp_flowspec.test_bgp_flowspec_topo/r1.bgpd.asan.687689-    #6 0x7fc986f35bf7 in event_call lib/event.c:1995
./bgp_flowspec.test_bgp_flowspec_topo/r1.bgpd.asan.687689-    #7 0x7fc986e1e99d in frr_run lib/libfrr.c:1185
./bgp_flowspec.test_bgp_flowspec_topo/r1.bgpd.asan.687689-    #8 0x560420f3f59d in main bgpd/bgp_main.c:505
./bgp_flowspec.test_bgp_flowspec_topo/r1.bgpd.asan.687689-    #9 0x7fc986805d09 in __libc_start_main ../csu/libc-start.c:308
```

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

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

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

22 months agoMerge pull request #13711 from FRRouting/mergify/bp/dev/9.0/pr-13706
Donatas Abraitis [Wed, 7 Jun 2023 10:23:14 +0000 (13:23 +0300)]
Merge pull request #13711 from FRRouting/mergify/bp/dev/9.0/pr-13706

lib: close config files after reading (coverity) (backport #13706)

22 months agoMerge pull request #13710 from FRRouting/mergify/bp/dev/9.0/pr-13707
Donatas Abraitis [Wed, 7 Jun 2023 09:49:27 +0000 (12:49 +0300)]
Merge pull request #13710 from FRRouting/mergify/bp/dev/9.0/pr-13707

mgmtd: assert an assertion for coverity (backport #13707)

22 months agotools: fix list value remove in frr-reload
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 agolib: close config files after reading (coverity)
Christian Hopps [Tue, 6 Jun 2023 18:27:04 +0000 (14:27 -0400)]
lib: close config files after reading (coverity)

fixes coverity CID# 1564375

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

22 months agomgmtd: assert an assertion for coverity
Christian Hopps [Tue, 6 Jun 2023 19:12:58 +0000 (15:12 -0400)]
mgmtd: assert an assertion for coverity

I believe coverity can't tell the length of the return value from strftime based
on the format string (like we can), so it allows `n` to be larger than it could
be which then allows `sz - n` to be negative which is size_t positive and very
large so it thinks an overrun is possible.

CID#1563211

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

22 months agoMerge pull request #13701 from opensourcerouting/fix/update_show_ip_bgp_summary_doc base_9.0
Donald Sharp [Tue, 6 Jun 2023 18:55:52 +0000 (14:55 -0400)]
Merge pull request #13701 from opensourcerouting/fix/update_show_ip_bgp_summary_doc

doc: Document RFC8212 under `Displaying BGP Information` section

22 months agoMerge pull request #13687 from donaldsharp/eigrp_fakeout
Jafar Al-Gharaibeh [Tue, 6 Jun 2023 18:53:27 +0000 (13:53 -0500)]
Merge pull request #13687 from donaldsharp/eigrp_fakeout

tests: Babel tests do not need to log to eigrp

22 months agotests: Babel tests do not need to log to eigrp
Donald Sharp [Mon, 5 Jun 2023 12:28:22 +0000 (08:28 -0400)]
tests: Babel tests do not need to log to eigrp

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agodoc: Document RFC8212 under `Displaying BGP Information` section
Donatas Abraitis [Tue, 6 Jun 2023 12:22:44 +0000 (15:22 +0300)]
doc: Document RFC8212 under `Displaying BGP Information` section

Looks like people don't find what does it mean (Policy) at first shot, let's
try giving more hints here.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
22 months agoMerge pull request #13690 from LabNConsulting/chopps/mgmtd-cleanup
Donald Sharp [Tue, 6 Jun 2023 11:22:31 +0000 (07:22 -0400)]
Merge pull request #13690 from LabNConsulting/chopps/mgmtd-cleanup

Chopps/mgmtd cleanup

22 months agoMerge pull request #13618 from LabNConsulting/chopps/fixlogging
Martin Winter [Tue, 6 Jun 2023 09:35:20 +0000 (02:35 -0700)]
Merge pull request #13618 from LabNConsulting/chopps/fixlogging

22 months agoMerge pull request #13649 from donaldsharp/unlock_the_node_or_else
Donatas Abraitis [Tue, 6 Jun 2023 05:52:40 +0000 (08:52 +0300)]
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else

zebra: Unlock the route node when sending route notifications

22 months agoMerge pull request #13689 from sri-mohan1/srib-ldpd1
Donatas Abraitis [Tue, 6 Jun 2023 05:43:36 +0000 (08:43 +0300)]
Merge pull request #13689 from sri-mohan1/srib-ldpd1

ldpd: changes for code maintainability

22 months agoMerge pull request #13670 from donaldsharp/coverity_99
Donatas Abraitis [Mon, 5 Jun 2023 19:33:55 +0000 (22:33 +0300)]
Merge pull request #13670 from donaldsharp/coverity_99

Coverity 99

22 months agomgmtd: rm unused/unneeded code add couple comments
Christian Hopps [Sun, 4 Jun 2023 22:09:25 +0000 (18:09 -0400)]
mgmtd: rm unused/unneeded code add couple comments

Signed-off-by: Christian Hopps <chopps@labn.net>
22 months agoldpd: changes for code maintainability
sri-mohan1 [Mon, 5 Jun 2023 19:09:42 +0000 (00:39 +0530)]
ldpd: changes for code maintainability

these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
22 months agotests: mgmtd: add prologue to bigconf tests
Christian Hopps [Sun, 4 Jun 2023 21:48:08 +0000 (17:48 -0400)]
tests: mgmtd: add prologue to bigconf tests

Signed-off-by: Christian Hopps <chopps@labn.net>
22 months agoMerge pull request #13658 from louis-6wind/fix-flex-algo2
Donald Sharp [Mon, 5 Jun 2023 16:43:01 +0000 (12:43 -0400)]
Merge pull request #13658 from louis-6wind/fix-flex-algo2

isisd: fix wrongly disabled flex-algorithm

22 months agotests: fix some broken logging
Christian Hopps [Sat, 27 May 2023 16:11:48 +0000 (12:11 -0400)]
tests: fix some broken logging

- make sure we close and remove all handlers for named logs on each reuse.
- test module level exec.log no longer truncated to last test case output
- cleanup the log names, and make sure they are present in all exec logs
- keep separate exec logs for each pytest worker when running in distributed mode
- disabled code due to CI infra can't handle it: add per test case exec logs

Signed-off-by: Christian Hopps <chopps@labn.net>
22 months agoMerge pull request #13685 from sri-mohan1/srib-ldpd1
Donald Sharp [Mon, 5 Jun 2023 14:52:46 +0000 (10:52 -0400)]
Merge pull request #13685 from sri-mohan1/srib-ldpd1

ldpd: changes for code maintainability

22 months agomgmtd: Fix up some coverity issues
Donald Sharp [Fri, 2 Jun 2023 19:09:29 +0000 (15:09 -0400)]
mgmtd: Fix up some coverity issues

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agobgpd: entry->any is never true
Donald Sharp [Fri, 2 Jun 2023 19:04:38 +0000 (15:04 -0400)]
bgpd: entry->any is never true

The only places entry->any could ever be set to true was
when str was NULL.  Unfortunately with the way our CLI works
str is impossible to be NonNULL.  The entry->any value *used*
to work prior to commit e961923c7217b935027107cad30c35c3907c936f
but it was changed back in 2016 and no-one has noticed the changed
ability.

Let's just admit that there are no users of this and remove this
dead code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agotests: Rename a test to test_bgp_gr_functionality_topo3.py
Donald Sharp [Fri, 2 Jun 2023 18:01:12 +0000 (14:01 -0400)]
tests: Rename a test to test_bgp_gr_functionality_topo3.py

Since the test was not named test_bgp_gr_functionality_topo3.py
pytest was not picking it up to run.  Let's run it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agoMerge pull request #13684 from LabNConsulting/chopps/pause-functionality
Donald Sharp [Mon, 5 Jun 2023 11:53:54 +0000 (07:53 -0400)]
Merge pull request #13684 from LabNConsulting/chopps/pause-functionality

tests: pause (with CLI) at step() functions when run with --pause

22 months agoMerge pull request #13681 from LabNConsulting/chopps/bad-abstract2
Donald Sharp [Mon, 5 Jun 2023 11:53:31 +0000 (07:53 -0400)]
Merge pull request #13681 from LabNConsulting/chopps/bad-abstract2

lib: mgmtd: remove backend abstraction layer and other cleanup

22 months agoMerge pull request #13677 from LabNConsulting/chopps/bad-abstract
Donald Sharp [Mon, 5 Jun 2023 11:51:25 +0000 (07:51 -0400)]
Merge pull request #13677 from LabNConsulting/chopps/bad-abstract

lib: mgmtd: remove obfuscating abstraction layer and other cleanup

22 months agoldpd: changes for code maintainability
sri-mohan1 [Mon, 5 Jun 2023 05:21:01 +0000 (10:51 +0530)]
ldpd: changes for code maintainability

these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
22 months agotests: pause (with CLI) at step() functions when run with --pause
Christian Hopps [Sun, 4 Jun 2023 21:36:56 +0000 (17:36 -0400)]
tests: pause (with CLI) at step() functions when run with --pause

Signed-off-by: Christian Hopps <chopps@labn.net>
22 months agolib: mgmtd: remove abstraction layer and other cleanup
Christian Hopps [Sun, 4 Jun 2023 19:43:22 +0000 (15:43 -0400)]
lib: mgmtd: remove abstraction layer and other cleanup

Code is no longer using a global FE "client context", and instead
creates client objects, rename the structure and it's uses to reflect this.

Remove an obfuscating abstraction layer whose existence was entirely
based on using a uintptr_t rather than a pointer to an declared-only struct.

Change multi-duty "params" structure into a single duty callbacks one.

Remove unsupported API code.

Signed-off-by: Christian Hopps <chopps@labn.net>
22 months agolib: mgmtd: remove obfuscating abstraction layer and other cleanup
Christian Hopps [Sun, 4 Jun 2023 13:24:03 +0000 (09:24 -0400)]
lib: mgmtd: remove obfuscating abstraction layer and other cleanup

Remove an obfuscating abstraction layer whose existence was entirely
based on using a uintptr_t rather than a pointer to an declared-only struct.

As the code is no longer using a global FE "client context", and instead
create client objects, rename the structure and it's uses to reflect this.

Change init "params" structure into a single use callbacks one.

Signed-off-by: Christian Hopps <chopps@labn.net>
22 months agoMerge pull request #13656 from sri-mohan1/srib-ldpd1
Donatas Abraitis [Sun, 4 Jun 2023 19:37:04 +0000 (22:37 +0300)]
Merge pull request #13656 from sri-mohan1/srib-ldpd1

ldpd: changes for code maintainability

22 months agoMerge pull request #13668 from donaldsharp/fsm_more_descriptive
Donatas Abraitis [Sun, 4 Jun 2023 19:36:43 +0000 (22:36 +0300)]
Merge pull request #13668 from donaldsharp/fsm_more_descriptive

bgpd: Give more data when state machine fails to change state

22 months agobgpd: Give more data when state machine fails to change state
Donald Sharp [Fri, 2 Jun 2023 15:02:54 +0000 (11:02 -0400)]
bgpd: Give more data when state machine fails to change state

When a state machine transition fails, bgpd would output
data about what happened, but not necessarily give the
reason why.  Add that data to the output.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agoMerge pull request #13659 from donaldsharp/increase_mgmt_time
Donatas Abraitis [Fri, 2 Jun 2023 06:50:28 +0000 (09:50 +0300)]
Merge pull request #13659 from donaldsharp/increase_mgmt_time

tests: new mgmt_startup tests are failing due to insufficient time

22 months agoMerge pull request #13646 from donaldsharp/logically_illogical
Donatas Abraitis [Fri, 2 Jun 2023 06:19:04 +0000 (09:19 +0300)]
Merge pull request #13646 from donaldsharp/logically_illogical

mgmtd: xpath is already NULL in the failure path

22 months agoMerge pull request #13641 from donaldsharp/com_list_str
mobash-rasool [Fri, 2 Jun 2023 02:44:10 +0000 (08:14 +0530)]
Merge pull request #13641 from donaldsharp/com_list_str

Bunch of code cleanup from Coverity

22 months agoMerge pull request #13660 from anlancs/bgpd-cleanup-12
mobash-rasool [Fri, 2 Jun 2023 02:41:55 +0000 (08:11 +0530)]
Merge pull request #13660 from anlancs/bgpd-cleanup-12

bgpd: Fix typo in debug message

22 months agoMerge pull request #13637 from yyuanam/fix_vtysh_core
Donatas Abraitis [Thu, 1 Jun 2023 19:30:50 +0000 (22:30 +0300)]
Merge pull request #13637 from yyuanam/fix_vtysh_core

lib: fix vtysh core when handling questionmark

22 months agoMerge pull request #13653 from dpward/ospf6d-redundant-lsa
Donatas Abraitis [Thu, 1 Jun 2023 19:24:45 +0000 (22:24 +0300)]
Merge pull request #13653 from dpward/ospf6d-redundant-lsa

ospf6d: Prevent redundant LSA generation before interface goes down

22 months agobgpd: Fix typo in debug message
anlan_cs [Thu, 1 Jun 2023 01:46:51 +0000 (09:46 +0800)]
bgpd: Fix typo in debug message

Cosmetic change for the debug messages, mainly on the parentheses.

Before:
```
[ZJYCS-KQYD6] VRF vrf-debug(140): Rcvd NH update 50.50.50.0/24(0)0) - metric 300/300 #nhops 2/1 flags Valid Reg Static Static Exact
[VZJVD-D7GXM] parse nexthop update(50.50.50.0/24(0)(VRF vrf-debug)): bnc info not found for nexthop cache
[NSWTE-81HEK] parse nexthop update(50.50.201.0/31(0)(VRF vrf-debug)): bnc info not found for import check
```

After:
```
[ZJYCS-KQYD6] VRF vrf-debug(140): Rcvd NH update 50.50.50.0/24(0)(0) - metric 300/300 #nhops 2/1 flags Valid Reg Static Static Exact
[VZJVD-D7GXM] parse nexthop update 50.50.50.0/24(0)(VRF vrf-debug): bnc info not found for nexthop cache
[NSWTE-81HEK] parse nexthop update 50.50.201.0/31(0)(VRF vrf-debug): bnc info not found for import check
```

Signed-off-by: anlan_cs <vic.lan@pica8.com>
22 months agotests: new mgmt_startup tests are failing due to insufficient time
Donald Sharp [Thu, 1 Jun 2023 13:57:48 +0000 (09:57 -0400)]
tests: new mgmt_startup tests are failing due to insufficient time

The tests are failing due to heavily loaded system and insufficient
time for large configs to be handled.  Increasing the time
allows the tests to complete locally for me under heavy load.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agoeigrpd: dest_addr does not need to be set to NULL
Donald Sharp [Tue, 30 May 2023 23:48:55 +0000 (19:48 -0400)]
eigrpd: dest_addr does not need to be set to NULL

All paths of the loop set dest_addr at the start
of the loop.  No need to set it to NULL to immediately
set it too something else.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agobgpd: vpn_policy_getafi can return AFI_MAX
Donald Sharp [Tue, 30 May 2023 23:47:32 +0000 (19:47 -0400)]
bgpd: vpn_policy_getafi can return AFI_MAX

Let's account for vpn_policy_getafi having a failure
situation and back out of the whole thing gracefully.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agobgpd: blnc cannot be NULL at if statement time
Donald Sharp [Tue, 30 May 2023 23:44:36 +0000 (19:44 -0400)]
bgpd: blnc cannot be NULL at if statement time

It is impossible for the blnc statement to ever be NULL at
line 1470 as that the if statement at 1453 guarantees it
to be set to something.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agozebra: Consolidate the stream_failure section with normal return
Donald Sharp [Tue, 30 May 2023 23:43:24 +0000 (19:43 -0400)]
zebra: Consolidate the stream_failure section with normal return

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agozebra: No need to set msg to NULL
Donald Sharp [Tue, 30 May 2023 23:40:22 +0000 (19:40 -0400)]
zebra: No need to set msg to NULL

The msg value is always reset to something new before it is used inside
the mutex.  No need to set it to NULL.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agobgpd: community_list_set str is always non null
Donald Sharp [Tue, 30 May 2023 23:30:12 +0000 (19:30 -0400)]
bgpd: community_list_set str is always non null

When calling community_list_set the str variable is
always non NULL.  As such let's treat it as such.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agoMerge pull request #13652 from opensourcerouting/fix/drop_old_releases_from_the_table
Donald Sharp [Thu, 1 Jun 2023 12:27:54 +0000 (08:27 -0400)]
Merge pull request #13652 from opensourcerouting/fix/drop_old_releases_from_the_table

doc: Update reference table for current and upcoming release dates

22 months agotests: re-style isis_sr_flex_algo_topo1
Louis Scalbert [Thu, 1 Jun 2023 12:18:47 +0000 (14:18 +0200)]
tests: re-style isis_sr_flex_algo_topo1

Re-style isis_sr_flex_algo_topo1. Cosmetic change.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
22 months agoisisd: fix wrongly disabled flex-algo
Louis Scalbert [Wed, 31 May 2023 14:53:58 +0000 (16:53 +0200)]
isisd: fix wrongly disabled flex-algo

A configured flex-algo algorithm may remain in disabled state after its
definition is advertised on the area.

It happens sometimes that, in isis_sr_flex_algo_topo1 topotest step 4 or
8, flex-algo 203 is disabled. It depends on the following sequence:

 1. Flex-algo 203 is configured on a remote router to be re-advertised.
 2. A LSP is received on the local router and contains the algo 203
    definition.
 3. The local router re-builds its own LSP with lsp_build().
 4. local router isis_run_spf() recomputes the algo 203 SPF tree.

A 1. 2. 3. 4. sequence results in a working test. The reception of the
remote LSP (2.) does not trigger the built of the local LSP. If for
some reasons, the sequence is 1. 3. 4. 2. 4., isis_run_spf() will not
knows that flex-algo 203 has been re-enabled because
flex_algo_get_state() only returns the state from the local LSP.

Compare in sequence step 4. the flex-algo state from the local LSP with
the actual state. If the state is not the same, request a new local LSP
generation and quits the re-computation of algo SPF tree. The SPF tree
will be recomputed just after the built of the local LSP.

Fixes: 3f55b8c621 ("isisd: fix disabled flex-algo on race condition")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
22 months agotests: fix mpls table check in isis_sr_flex_algo_topo1
Louis Scalbert [Thu, 1 Jun 2023 09:39:30 +0000 (11:39 +0200)]
tests: fix mpls table check in isis_sr_flex_algo_topo1

Some test steps result in removing some entries in the MPLS forwarding
table. However, these steps pass before the entries are actually
removed.

Use the exact JSON comparison so that the removal of the entries is
checked.

Fixes: 1a61ef95b2 ("tests: add isis_sr_flex_algo_topo1 for flex-algo")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
22 months agozebra: Unlock the route node when sending route notifications
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>
22 months agoldpd: changes for code maintainability
sri-mohan1 [Thu, 1 Jun 2023 07:27:14 +0000 (12:57 +0530)]
ldpd: changes for code maintainability

these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
22 months agoMerge pull request #13450 from patrasar/mld_core
Donatas Abraitis [Thu, 1 Jun 2023 06:13:30 +0000 (09:13 +0300)]
Merge pull request #13450 from patrasar/mld_core

pim6d: Fix crash in ipv6 pim command

22 months agoospf6d: Prevent redundant LSA generation before interface goes down
David Ward [Wed, 31 May 2023 20:44:44 +0000 (16:44 -0400)]
ospf6d: Prevent redundant LSA generation before interface goes down

Commit 76249532faad ("ospf6d: Handle Premature Aging of LSAs") added a
duplicate call to OSPF6_INTRA_PREFIX_LSA_EXECUTE_TRANSIT(), when the
interface state changes to "Down".

Fixes: #1738
Signed-off-by: David Ward <david.ward@ll.mit.edu>
22 months agolib: fix vtysh core when handling questionmark
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>
22 months agodoc: Update reference table for current and upcoming release dates
Donatas Abraitis [Wed, 31 May 2023 20:08:57 +0000 (23:08 +0300)]
doc: Update reference table for current and upcoming release dates

Keep only 3 release dates, current and two upcoming. On the next release,
just update one, instead of multiple (zero point looking too much in the
future).

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
22 months agomgmtd: xpath is already NULL in the failure path
Donald Sharp [Wed, 31 May 2023 11:54:10 +0000 (07:54 -0400)]
mgmtd: xpath is already NULL in the failure path

There is no way that xpath can ever be anything but NULL
in the failure path with the goto's.  Let's just remove
the goto's and return immediately.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
22 months agoMerge pull request #13632 from LabNConsulting/chopps/mgmt-avoid-race
Donald Sharp [Wed, 31 May 2023 11:28:50 +0000 (07:28 -0400)]
Merge pull request #13632 from LabNConsulting/chopps/mgmt-avoid-race

mgmtd: fix possible race btw read config and backend connection

22 months agoMerge pull request #13639 from opensourcerouting/ospf-timestamp-truncation
Donald Sharp [Wed, 31 May 2023 11:26:06 +0000 (07:26 -0400)]
Merge pull request #13639 from opensourcerouting/ospf-timestamp-truncation

ospfd, ospf6d: fix time_t truncation

22 months agoMerge pull request #13634 from yyuanam/fix_bgp_core
Donatas Abraitis [Wed, 31 May 2023 05:57:40 +0000 (08:57 +0300)]
Merge pull request #13634 from yyuanam/fix_bgp_core

bgpd: fix bgpd core when unintern attr

23 months agoMerge pull request #13635 from donaldsharp/give_ping_a_chance
Jafar Al-Gharaibeh [Tue, 30 May 2023 23:59:44 +0000 (18:59 -0500)]
Merge pull request #13635 from donaldsharp/give_ping_a_chance

tests: Actually loop if ping fails

23 months agobgpd: fix bgpd core when unintern attr
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>
23 months agoospfd, ospf6d: fix time_t truncation
Renato Westphal [Tue, 30 May 2023 22:41:39 +0000 (19:41 -0300)]
ospfd, ospf6d: fix time_t truncation

Change timestamp parameter from int to time_t to avoid truncation.

Found by Coverity Scan (CID 1563226 and 1563222)

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
23 months agotests: Actually loop if ping fails
Donald Sharp [Tue, 30 May 2023 19:20:56 +0000 (15:20 -0400)]
tests: Actually loop if ping fails

The usage of run_and_expect doesn't work if the function
being called as the run part asserts.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
23 months agoMerge pull request #13631 from donaldsharp/fix_some_ping_issues
Donatas Abraitis [Tue, 30 May 2023 18:26:24 +0000 (21:26 +0300)]
Merge pull request #13631 from donaldsharp/fix_some_ping_issues

various issues

23 months agomgmtd: fix possible race btw read config and backend connection
Christian Hopps [Tue, 30 May 2023 15:52:19 +0000 (11:52 -0400)]
mgmtd: fix possible race btw read config and backend connection

Signed-off-by: Christian Hopps <chopps@labn.net>
23 months agoMerge pull request #13601 from opensourcerouting/build-yang-embed-20230525
Donald Sharp [Tue, 30 May 2023 15:34:29 +0000 (11:34 -0400)]
Merge pull request #13601 from opensourcerouting/build-yang-embed-20230525

build: fix missing YANG model embedding

23 months agoMerge pull request #13588 from sri-mohan1/srib-ldpd1
mobash-rasool [Tue, 30 May 2023 15:32:31 +0000 (21:02 +0530)]
Merge pull request #13588 from sri-mohan1/srib-ldpd1

ldpd: changes for code maintainability

23 months agoMerge pull request #13414 from LabNConsulting/chopps/no-mgmtd-nowrite-on-off
Donald Sharp [Tue, 30 May 2023 14:48:32 +0000 (10:48 -0400)]
Merge pull request #13414 from LabNConsulting/chopps/no-mgmtd-nowrite-on-off

rework messaging, resource handling in mgmtd with bug fix and code hardening

23 months agozebra: use ifindex vs ifp to avoid use-after-free on shutdown
Christian Hopps [Tue, 30 May 2023 00:29:33 +0000 (20:29 -0400)]
zebra: use ifindex vs ifp to avoid use-after-free on shutdown

Signed-off-by: Christian Hopps <chopps@labn.net>
23 months agozebra: avoid unneeded vxlan work on shutdown
Christian Hopps [Sun, 28 May 2023 15:31:23 +0000 (11:31 -0400)]
zebra: avoid unneeded vxlan work on shutdown

Signed-off-by: Christian Hopps <chopps@labn.net>
23 months agotests: add unified config tests
Christian Hopps [Sun, 28 May 2023 08:33:18 +0000 (04:33 -0400)]
tests: add unified config tests

- simple unified test
- unified test with late backend startup test

Signed-off-by: Christian Hopps <chopps@labn.net>
23 months agopim6d: Fix crash in ipv6 pim command
Sarita Patra [Fri, 5 May 2023 17:52:33 +0000 (10:52 -0700)]
pim6d: Fix crash in ipv6 pim command

Problem:
Execute the below commands, pim6d core happens.
interface ens193
 ip address 69.0.0.2/24
 ipv6 address 8000::1/120
 ipv6 mld
 ipv6 pim
We see crash only if the interface is not configured, and
we are executing PIM/MLD commands.

RootCause:
Interface ens193 is not configured. So, it will have
ifindex = 0 and mroute_vif_index = -1.
Currently, we don't enable MLD on an interface if
mroute_vif_index < 0. So, pim_ifp->MLD = NULL.
In the API pim_if_membership_refresh(), we are accessing
pim_ifp->MLD NULL pointer which leads to crash.

Fix:
Added NULL check before accessing pim_ifp->MLD pointer in
the API pim_if_membership_refresh().

Issue: #13385

Signed-off-by: Sarita Patra <saritap@vmware.com>
23 months agomgmtd: address review comments
Christian Hopps [Tue, 23 May 2023 12:35:56 +0000 (08:35 -0400)]
mgmtd: address review comments

Signed-off-by: Christian Hopps <chopps@labn.net>
23 months agomgmtd: fix clang uninit warning
Christian Hopps [Sat, 20 May 2023 18:55:31 +0000 (14:55 -0400)]
mgmtd: fix clang uninit warning

Signed-off-by: Christian Hopps <chopps@labn.net>
23 months agotests: add some more mgmtd tests
Christian Hopps [Sat, 20 May 2023 14:49:08 +0000 (10:49 -0400)]
tests: add some more mgmtd tests

Signed-off-by: Christian Hopps <chopps@labn.net>
23 months agomgmtd: cleanup BE xpath subscription and matching code
Christian Hopps [Sat, 20 May 2023 08:25:47 +0000 (04:25 -0400)]
mgmtd: cleanup BE xpath subscription and matching code

Signed-off-by: Christian Hopps <chopps@labn.net>
23 months agolib: mgmtd: fix memleaks
Christian Hopps [Sat, 20 May 2023 03:12:33 +0000 (23:12 -0400)]
lib: mgmtd: fix memleaks

Signed-off-by: Christian Hopps <chopps@labn.net>