Commit Graph

32667 Commits

Author SHA1 Message Date
Christian Hopps
ff6b14a658 zebra: use ifindex vs ifp to avoid use-after-free on shutdown
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 04:09:29 -04:00
Christian Hopps
8cfe36bc7e zebra: avoid unneeded vxlan work on shutdown
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 04:09:29 -04:00
Christian Hopps
7cd87abc5e tests: add unified config tests
- simple unified test
- unified test with late backend startup test

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 04:09:29 -04:00
Sarita Patra
6d1d2c27a3 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>
2023-05-30 00:43:45 -07:00
anlan_cs
237c7a827e pimd: Fix wrong creating order for pimreg
`pim_if_create_pimreg()` need use the `mroute_socket`, so adjust the order.
First call `pim_mroute_socket_enable()`, then call `pim_if_create_pimreg()`.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-05-30 15:10:03 +08:00
Christian Hopps
51941c1916 mgmtd: address review comments
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:10:20 -04:00
Christian Hopps
8611886d52 mgmtd: fix clang uninit warning
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:10:20 -04:00
Christian Hopps
e3c4bd2472 tests: add some more mgmtd tests
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:10:20 -04:00
Christian Hopps
0327be91d1 mgmtd: cleanup BE xpath subscription and matching code
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:10:20 -04:00
Christian Hopps
52a50ca1d7 lib: mgmtd: fix memleaks
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:10:20 -04:00
Christian Hopps
5ba5613077 lib: mgmtd: add manual vty server start option and use it
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:10:20 -04:00
Christian Hopps
e13a5c4165 lib: mgmtd: fixes for startup config file processing
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:10:19 -04:00
Christian Hopps
7a0894b532 mgmtd: Add note to SETCFG_REQ and debug logging
- convert impossible situation into assert

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:09:51 -04:00
Christian Hopps
acd7aea00e mgmtd: simplify early config build removing unused code
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:09:51 -04:00
Christian Hopps
a1d8c7a36e mgmtd: fix reading of config file[s]
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-30 02:09:44 -04:00
Keelan10
269a2d3dae 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>
2023-05-29 13:39:14 +04:00
Kuldeep Kashyap
ac9c7ac8ba tests: Adding framework support for bgp_always_compare_med
Added/enhanced bgp.py to support config/
unconfig bgp always compare med related
configurations.

Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
2023-05-29 13:20:15 +05:30
Kuldeep Kashyap
9bd040b2fa tests: Adding bgp_always_compare_med testuite
Automated 5 different scenarios to verify BGP
always compare med functionality.

Signed-off-by: Kuldeep Kashyap <kashyapk@vmware.com>
2023-05-29 13:07:54 +05:30
Donald Sharp
46d725f76b lib, zebra: Ensure that the ifp->node exists
On removal, ensure that the ifp->node is set to a null
pointer so that FRR does not use data after freed.
In addition ensure that the ifp->node exists before
attempting to free it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-28 10:13:16 -04:00
Donald Sharp
06504bea79 pimd: When doing json output do not output non-json strings
When entering some show commands that use json in pimd
when the interface cannot be found do not output non-json
format in that case.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-28 07:37:25 -04:00
Donald Sharp
131153ea22 tests: Allow ping to run multiple times before failing
the bgp_default_originate test brings up the topology and
then immediately pings.  Which sometimes fails.  This is
of course possible since the first ping might actually fail
due to arp going on.  So let's give it a second chance or two.
Especially since the test, at this point, is just installing
a default route.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-28 07:37:25 -04:00
Donald Sharp
2fccc9fa10
Merge pull request #13602 from opensourcerouting/fix/reuse_subgroup_process_announce_selected
bgpd: Refactor subgroup_announce_table() to reuse an existing helpers
2023-05-28 07:11:43 -04:00
Christian Hopps
edafa64c30 lib: enable short circuit for FE client/adapter connection
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
43f7196f3a staticd: remove connect notify function, not needed
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
218625aa43 mgmtd: lib: cleanup error and debug messages
- always use IDs not a mix of IDs and pointers.
- always use PRIu64 not a mix of hex and decimal for IDs

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
42f4bb2b1a mgmtd: lib: move INIT to after client registers
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
9405278ef2 mgmtd: send reply to SUBSCR_REQ with success or not
since we don't actually handle xpath subscriptions, reply with fail
if they are requested.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
5f05ff5821 lib: add short-circuit operation between same process
- Use a socketpair for connection, and direct (no event loop)
message sending and handling.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
08e8019c65 lib: mgmtd: add a identifying tag to the debug message
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
d6665cf63f lib: dont be tricky with session_id just make it a session_id
- Previously was substituting a pointer to local allocated session for the
session_id returned from the FE adapter. This complexity isn't needed.
- Get rid of "%llu" format and the casts that came with it, instead use PRIu64
and the actual (uint64_t) type.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
bcc350971f mgmtd: fix cleanup of cleanup in FE adapter code
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
c193194905 mgmtd: eliminate unused state
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
e3cacd9643 mgmtd: cleanup/fix BE adapter deletion code
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
6dad9b53e7 mgmtd: convert BE/FE adapter to use allocated connections
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
99564edc43 lib: mgmtd: add server-side connection code to mgmt_msg
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
070c5e7a91 lib: msg: refactor common connection code from mgmtd
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
528b326616 lib: mgmt msg: add version to messages
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
fff34d7274 lib: remove write-on-off, just requeue to the back of the queue
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Christian Hopps
898499a50f tests: python-foo assure foo[0] is on a list not dict_values object
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-28 05:13:22 -04:00
Donatas Abraitis
5773954be9
Merge pull request #13611 from donaldsharp/logger_warn
tests: Convert to using logger.warning
2023-05-27 20:05:50 +03:00
Donatas Abraitis
607c84f406
Merge pull request #13608 from donaldsharp/pam_wrong
vtysh: Give actual pam error messages
2023-05-27 15:35:25 +03:00
Pooja Jagadeesh Doijode
be469ddc88 ospfd: re-added old json hierarchy for ospf intf json
Re-added the old JSON hierarchy for "show ip ospf interface json"
command in addition to new, so that the scripts don't break.
Old hierarchy will be deprecated after a year.

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2023-05-26 17:18:04 -07:00
Donald Sharp
780a8a10e6 tests: Convert to using logger.warning
Use the non deprecated format.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-26 16:00:42 -04:00
Donald Sharp
618a9f0592
Merge pull request #13607 from LabNConsulting/chopps/fixospftest
tests: ospfapi: fix non-determinism in test
2023-05-26 15:09:38 -04:00
Donald Sharp
8495b425bd vtysh: Give actual pam error messages
Code was was written where the pam error message put out
was the result from a previous call to the pam modules
instead of the current call to the pam module.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-05-26 07:44:11 -04:00
Donald Sharp
145acbb3bb
Merge pull request #13599 from LabNConsulting/chopps/analyze-search
tests: allow selecting test results by regexp match
2023-05-26 07:20:17 -04:00
Christian Hopps
054d6bdc48 tests: selecting results by regexp and ragnes, add container support
- Allow selecting results using a regexp
- Allow selecting results using commasep range specs
- Add support for getting and saving results from a docker/podman
  container.
- update docs

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-26 06:32:24 -04:00
Donatas Abraitis
91ac217356
Merge pull request #13594 from LabNConsulting/chopps/uniconfig
tests: cleanup unified config and config arg
2023-05-26 13:16:06 +03:00
Christian Hopps
39e1f084b5 tests: ospfapi: fix non-determinism in test
fixes #13584

The test had the ospf client injecting multiple opaque LSAs on 5s pace,
but the test itself verified and advanced on an LSA in the middle of
that sequence and not the last one. Then the test reset the ospf client
and originating router. If a later injected LSA managed to get in to the
router and flooded prior to the client/router reset then the opaque data
or sequence number could differ from the expected value.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-05-26 05:09:13 -04:00
Philippe Guibert
4f725062a4 bgpd: upon if event, evaluate bnc with matching nexthop
In BGP, when an interface event is detected or triggered,
the BNC that have a next-hop that matches the interface
are not evaluated.

The paths attached to the bnc context are evaluated in the
following situation:
- In the up event case, if at least one next-hop interface
matched the event interface.
- In the down event case, if there is no alternate next-hop
that does not use the event interface.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-05-26 08:35:46 +02:00