Commit Graph

32148 Commits

Author SHA1 Message Date
Christian Hopps
c874d567cc lib: mgmtd: avoid recursion with vty_close and add error log
Avoid recursion into vty_close() when being notified of a session closure that
happened inside vty_close().

If a vty is closed with outstanding config yet to be commited
issue a warning that it is being lost.

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 4307fdd070)
2023-06-22 21:56:44 +00:00
Christian Hopps
cfca317c59 vtysh: stop reading config file if user exits from root level.
This is required to make sure that we properly send the
XFRR_end_configuration tag to the daemons. Previously if the user had an
`exit` at the root level the parser would just drop out of the config
node and so XFRR_end_configuration, even if sent, would be ignored

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 315e9032e4)
2023-06-22 21:56:43 +00:00
Christian Hopps
edf01373b8 staticd: staticd no longer loads config files
We need to ignore SIGHUP rather than reload config now.

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit f7a2c2ab5a)
2023-06-22 21:56:43 +00:00
Donatas Abraitis
7ede6dda1a
Merge pull request #13816 from FRRouting/mergify/bp/dev/9.0/pr-13758
isisd: Fix read beyond end of stream of ASLA Sub-TLV parsing (backport #13758)
2023-06-21 16:47:02 +03:00
Carmine Scarpitta
f1c151c7ff isisd: Fix use beyond end of stream of ASLA Sub-TLV parsing
Fixes a crash associated with attempting to read beyond the end of the
stream when parsing ASLA Sub-TLV.

```
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
    subtlv_len=13 '\r') at isisd/isis_tlvs.c:1473
    at isisd/isis_tlvs.c:3264
    context=<optimized out>, mtid=<optimized out>) at isisd/isis_tlvs.c:6078
    indent=4) at isisd/isis_tlvs.c:6142
    avail_len=<optimized out>, context=<optimized out>) at isisd/isis_tlvs.c:7032
    at isisd/isis_tlvs.c:7054
(gdb)
```

Caught by fuzzer.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
(cherry picked from commit 2a9e0824a7)
2023-06-20 13:20:13 +00:00
Donald Sharp
61ba3a4d56
Merge pull request #13786 from FRRouting/mergify/bp/dev/9.0/pr-13612
ospfd: fix interface param type update (backport #13612)
2023-06-13 16:03:28 -04:00
Donald Sharp
948a984434
Merge pull request #13791 from FRRouting/mergify/bp/dev/9.0/pr-13589
pbrd, zebra: fix zapi and netlink rule encoding (backport #13589)
2023-06-13 16:03:04 -04:00
Mark Stapp
3326a17cfd 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 4112baec9f)
2023-06-13 15:11:21 +00:00
Chirag Shah
4edc16b7a3 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 0d005b2d5c)
2023-06-13 13:55:52 +00:00
Donatas Abraitis
5dc6972e13
Merge pull request #13760 from FRRouting/mergify/bp/dev/9.0/pr-13675
bfd:fix version bits check (backport #13675)
2023-06-11 21:40:02 +03:00
zmw12306
7e6fe5fe1b 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 3f658e8b1c)
2023-06-11 11:17:31 +00:00
Donatas Abraitis
fdfee18f54
Merge pull request #13744 from FRRouting/mergify/bp/dev/9.0/pr-13726
tests: fixing pim6 topotest bugs (backport #13726)
2023-06-09 15:37:42 +03:00
Donatas Abraitis
9fa39ba3ce
Merge pull request #13746 from FRRouting/mergify/bp/dev/9.0/pr-13739
zebra: Prevent crash because nl is NULL on shutdown (backport #13739)
2023-06-09 15:37:05 +03:00
Donatas Abraitis
497c887e37
Merge pull request #13741 from FRRouting/mergify/bp/dev/9.0/pr-13364
bfd: fix missing Authentication in control pkt (backport #13364)
2023-06-09 10:15:15 +03:00
Jafar Al-Gharaibeh
bddbcc60da
Merge pull request #13736 from FRRouting/mergify/bp/dev/9.0/pr-13645
bfdd: remove redundant nb destroy callbacks (backport #13645)
2023-06-08 23:47:51 -05:00
Donald Sharp
fecd91afbe 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 977d7e24ff)
2023-06-09 04:45:36 +00:00
Christian Hopps
4e6e3e66c6 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 b28bc2561e)
2023-06-08 18:52:51 +00:00
Christian Hopps
b442bc17db 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 efedb18976)
2023-06-08 18:52:51 +00:00
Christian Hopps
1daa8842e0 tests: mcast-tester.py handles IPv6
Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 71231d304f)
2023-06-08 18:52:51 +00:00
zmw12306
4bcaae4cb5 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 98707b04d4)
2023-06-08 17:14:06 +00:00
Igor Ryzhov
1c2ff1c21a 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 f7884aedf7)
2023-06-08 15:20:16 +00:00
Donatas Abraitis
2681de7b19
Merge pull request #13723 from FRRouting/mergify/bp/dev/9.0/pr-13624
bgpd: Free temp memory (backport #13624)
2023-06-08 08:35:22 +03:00
Keelan10
78cda591ac 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 269a2d3dae)
2023-06-07 21:36:45 +00:00
Donald Sharp
0d0c8798e9
Merge pull request #13712 from FRRouting/mergify/bp/dev/9.0/pr-13693
tools: fix list value remove in frr-reload (backport #13693)
2023-06-07 08:07:40 -04:00
Donatas Abraitis
c3f7381eaf
Merge pull request #13711 from FRRouting/mergify/bp/dev/9.0/pr-13706
lib: close config files after reading (coverity) (backport #13706)
2023-06-07 13:23:14 +03:00
Donatas Abraitis
5f687dce66
Merge pull request #13710 from FRRouting/mergify/bp/dev/9.0/pr-13707
mgmtd: assert an assertion for coverity (backport #13707)
2023-06-07 12:49:27 +03:00
Chirag Shah
ba9f9c979d 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 9845c09d61)
2023-06-07 06:23:53 +00:00
Christian Hopps
7678f2dbc0 lib: close config files after reading (coverity)
fixes coverity CID# 1564375

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit f5626596ee)
2023-06-07 06:13:37 +00:00
Christian Hopps
e5c6161439 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 565139a6d5)
2023-06-07 06:13:12 +00:00
Donald Sharp
b615b1094a
Merge pull request #13701 from opensourcerouting/fix/update_show_ip_bgp_summary_doc
doc: Document RFC8212 under `Displaying BGP Information` section
2023-06-06 14:55:52 -04:00
Jafar Al-Gharaibeh
5648279b7a
Merge pull request #13687 from donaldsharp/eigrp_fakeout
tests: Babel tests do not need to log to eigrp
2023-06-06 13:53:27 -05:00
Donald Sharp
8625fe0f45 tests: Babel tests do not need to log to eigrp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-06 11:59:20 -04:00
Donatas Abraitis
efce200d93 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>
2023-06-06 15:28:19 +03:00
Donald Sharp
da877b5ced
Merge pull request #13690 from LabNConsulting/chopps/mgmtd-cleanup
Chopps/mgmtd cleanup
2023-06-06 07:22:31 -04:00
Martin Winter
6a771192de
Merge pull request #13618 from LabNConsulting/chopps/fixlogging 2023-06-06 02:35:20 -07:00
Donatas Abraitis
29f6fb04d8
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else
zebra: Unlock the route node when sending route notifications
2023-06-06 08:52:40 +03:00
Donatas Abraitis
d827795153
Merge pull request #13689 from sri-mohan1/srib-ldpd1
ldpd: changes for code maintainability
2023-06-06 08:43:36 +03:00
Donatas Abraitis
fecc953b3c
Merge pull request #13670 from donaldsharp/coverity_99
Coverity 99
2023-06-05 22:33:55 +03:00
Christian Hopps
c6b8e95703 mgmtd: rm unused/unneeded code add couple comments
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-05 15:29:05 -04:00
sri-mohan1
4e60d88ee1 ldpd: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2023-06-06 00:58:49 +05:30
Christian Hopps
ee235c606f tests: mgmtd: add prologue to bigconf tests
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-06-05 13:53:51 -04:00
Donald Sharp
05cb9e55a7
Merge pull request #13658 from louis-6wind/fix-flex-algo2
isisd: fix wrongly disabled flex-algorithm
2023-06-05 12:43:01 -04:00
Christian Hopps
9c57c2900a 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>
2023-06-05 12:42:57 -04:00
Donald Sharp
b107092ce7
Merge pull request #13685 from sri-mohan1/srib-ldpd1
ldpd: changes for code maintainability
2023-06-05 10:52:46 -04:00
Donald Sharp
60dc2992c9 mgmtd: Fix up some coverity issues
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-05 07:57:49 -04:00
Donald Sharp
75aaf03ff3 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 e961923c72
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>
2023-06-05 07:57:49 -04:00
Donald Sharp
0889f6d894 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>
2023-06-05 07:57:49 -04:00
Donald Sharp
4285bdadcc
Merge pull request #13684 from LabNConsulting/chopps/pause-functionality
tests: pause (with CLI) at step() functions when run with --pause
2023-06-05 07:53:54 -04:00
Donald Sharp
dfbccb4cb8
Merge pull request #13681 from LabNConsulting/chopps/bad-abstract2
lib: mgmtd: remove backend abstraction layer and other cleanup
2023-06-05 07:53:31 -04:00
Donald Sharp
42d6f84585
Merge pull request #13677 from LabNConsulting/chopps/bad-abstract
lib: mgmtd: remove obfuscating abstraction layer and other cleanup
2023-06-05 07:51:25 -04:00