Commit Graph

36255 Commits

Author SHA1 Message Date
Donald Sharp
82bbf2e82d *: Spelling issues
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-18 16:15:56 -04:00
Donald Sharp
c5fd6ba2dc
Merge pull request #16602 from LabNConsulting/chopps/fix-warnings
mgmtd: fix a couple compilation warnings.
2024-08-18 15:22:33 -04:00
Donald Sharp
5dd2b67ff5
Merge pull request #16603 from cscarpitta/fix/fix-compilation-warnings
lib, zebra: Fix a couple compilation warnings
2024-08-18 13:34:12 -04:00
Donald Sharp
c61069c341
Merge pull request #16601 from LabNConsulting/aceelindem/ospf-sa-warning-fix
ospfd: Fix SA warnings in ospf_packet.c and ospf_vty.c
2024-08-18 12:49:12 -04:00
Donald Sharp
34e7dcda62
Merge pull request #16599 from anlancs/fix/pimd-limit-join
pimd: fix missing checking the return value for igmp command
2024-08-18 12:48:51 -04:00
Carmine Scarpitta
354f9e9009 zebra: Fix compilation warning
Make sure the variable `srv6` is not NULL before dereferencing it.

Fixes the following compilation warnings:

```
error	15-Aug-2024 14:20:01	zebra/zebra_srv6_vty.c:974:8: warning: Access to field 'locators' results in a dereference of a null pointer (loaded from variable 'srv6') [core.NullDereference]
error	15-Aug-2024 14:20:01	                for (ALL_LIST_ELEMENTS_RO(srv6->locators, node, locator)) {
error	15-Aug-2024 14:20:01	                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error	15-Aug-2024 14:20:01	./lib/linklist.h:345:11: note: expanded from macro 'ALL_LIST_ELEMENTS_RO'
error	15-Aug-2024 14:20:01	        (node) = listhead(list), ((data) = NULL);                              \
error	15-Aug-2024 14:20:01	                 ^~~~~~~~~~~~~~
error	15-Aug-2024 14:20:01	./lib/linklist.h:63:22: note: expanded from macro 'listhead'
error	15-Aug-2024 14:20:01	#define listhead(X) ((X) ? ((X)->head) : NULL)
error	15-Aug-2024 14:20:01	                     ^
```

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-08-18 13:03:04 +02:00
Carmine Scarpitta
075899dee0 lib: Fix compilation warning
Don't store unnecessary `len` returned by snprintf and snprintfrr function.

Fixes the following compilation warnings:

```
error	15-Aug-2024 13:54:10	In file included from lib/bfd.c:16:
error	15-Aug-2024 13:54:10	In file included from ./lib/zclient.h:22:
error	15-Aug-2024 13:54:10	In file included from ./lib/nexthop.h:14:
error	15-Aug-2024 13:54:10	./lib/srv6.h:338:3: warning: Value stored to 'len' is never read [deadcode.DeadStores]
error	15-Aug-2024 13:54:10	                len += snprintf(str + len, size - len, " USP");
error	15-Aug-2024 13:54:10	                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error	15-Aug-2024 13:54:10	./lib/srv6.h:343:3: warning: Value stored to 'len' is never read [deadcode.DeadStores]
error	15-Aug-2024 13:54:10	                len += snprintfrr(str + len, size - len, " nh6 %pI6", &ctx->nh6);
error	15-Aug-2024 13:54:10	                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error	15-Aug-2024 13:54:10	./lib/srv6.h:347:3: warning: Value stored to 'len' is never read [deadcode.DeadStores]
error	15-Aug-2024 13:54:10	                len += snprintfrr(str + len, size - len, " nh4 %pI4", &ctx->nh4);
error	15-Aug-2024 13:54:10	                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error	15-Aug-2024 13:54:10	./lib/srv6.h:354:3: warning: Value stored to 'len' is never read [deadcode.DeadStores]
error	15-Aug-2024 13:54:10	                len += snprintf(str + len, size - len, " vrf_id %u",
error	15-Aug-2024 13:54:10	                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error	15-Aug-2024 13:54:10	./lib/srv6.h:367:3: warning: Value stored to 'len' is never read [deadcode.DeadStores]
error	15-Aug-2024 13:54:10	                len += snprintf(str + len, size - len, " unknown(%s)", __func__);
error	15-Aug-2024 13:54:10	                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-08-18 13:03:04 +02:00
Christian Hopps
e7fc74aa14 mgmtd: fix a couple compilation warnings.
Also an empty (thus non-replace) notify selectors message shouldn't
clear the selectors, it should just do nothing.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-08-18 05:33:29 -05:00
Acee
e42e58118f ospfd: Fix SA warnings in ospf_packet.c and ospf_vty.c
Fix SA warnings in ospf_packet.c and ospf_vty.c. The former was
    introduced by commit ed48014884.

Signed-off-by: Acee <aceelindem@gmail.com>
2024-08-16 13:49:41 -04:00
anlan_cs
cbe50989d9 pimd: fix missing checking the return value for igmp command
`gm_join_new()` will return NULL in the case of running out of
socket/file resources.  Just add the check for it.

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2024-08-16 22:33:59 +08:00
Kristof Provost
f0aa8d4f42 zebra: fix loading kernel routs without netlink
Commit 605df8d44 zebra: Use zebra dplane for RTM link and addr broke loading of
kernel routes at startup for configurations without netlink.

It rearranged the startup sequence in zebra_ns_enable() to pass via
zebra_ns_startup_continue(), triggered through zebra_dplane_startup_stage()
calls. However, it neglected to make these calls in the non-netlink code path.
As a result zebra failed to load kernel routes at startup on platforms such
as FreeBSD.

Insert these calls so we run through all of the expected startup stages.

Signed-off-by: Kristof Provost <kprovost@netgate.com>
2024-08-16 10:42:33 +02:00
Mark Stapp
fa50fde954
Merge pull request #16590 from donaldsharp/spelling_in_master
*: Fix spelling errors found
2024-08-15 14:42:11 -04:00
Mark Stapp
4451f93d97
Merge pull request #16589 from opensourcerouting/fix/remove_deprecated_confdate
ospfd: Remove deprecated router_info_area_id_cmd
2024-08-15 13:45:38 -04:00
Nathan Bahr
7ce2a1b8fb tests: Added new topotest for pim igmp static groups
Copied the existing "join-group" test and modified to test
static groups instead. Functionally the same but without IGMP
reports.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-08-15 17:10:32 +00:00
Nathan Bahr
fbf7bf44ed doc: Add PIM docs for join-group and static-group
Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-08-15 16:20:05 +00:00
Nathan Bahr
0cb1bf7873 pimd, yang: Implement igmp static-group command
This will add a static IGMP group that does not rely on an underlying
socket join which sends traffic to the cpu unneccesarily. Instead, the
groups are joined directly without any IGMP interactions.
New command is under interfaces, 'ip igmp static-group ...'.
Added an alias for 'ip igmp join ...' to 'ip igmp join-group'.
Moved IGMP join groups to new yang list "join-group" and reused
the "static-group" list for the IGMP static groups.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-08-15 16:20:00 +00:00
Mark Stapp
6de80911b0
Merge pull request #16586 from donaldsharp/fix_route_scale_startup
tests: Fix route_scale startup issues
2024-08-15 09:21:12 -04:00
Donald Sharp
89a3879973
Merge pull request #16549 from opensourcerouting/fix/some_memory_optimizations_for_struct_attr
bgpd: Move evpn_overlay to a pointer
2024-08-15 09:20:41 -04:00
Donald Sharp
baa0a1df5b *: Fix spelling errors found
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-15 09:19:37 -04:00
Donatas Abraitis
4f70004723
Merge pull request #16585 from pguibert6WIND/prd_pretty_mt_fix
bgpd: fix memory type for static->prd_pretty
2024-08-15 08:59:47 +02:00
Donatas Abraitis
efcc1cacaf ospfd: Remove deprecated router_info_area_id_cmd
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-14 23:16:39 +03:00
Donatas Abraitis
93032f183a
Merge pull request #16578 from donaldsharp/more_memory_leaks_on_shutdown
More memory leaks on shutdown
2024-08-14 22:09:39 +02:00
Donald Sharp
28df4462c3
Merge pull request #16583 from mjstapp/fix_all_proto_nhg
tests: add retries to nhg tests in all_proto_startup
2024-08-14 14:54:27 -04:00
Donatas Abraitis
b57cb7a8e8
Merge pull request #16574 from donaldsharp/non_json_free_ptr
bgpd: Free up non-freed json memory on function return
2024-08-14 18:44:54 +02:00
Donald Sharp
b0c86804f8 tests: Fix route_scale startup issues
Upstream CI is frequently running into a situation where
the routes are not being installed.  These routes
start at the beginning and suddenly in the middle
they start working properly.

D   1.0.15.183/32 [150/0] via 192.168.0.1, r1-eth0 inactive, weight 1, 00:10:17
                          via 192.168.1.1, r1-eth1 inactive, weight 1, 00:10:17
D   1.0.15.184/32 [150/0] via 192.168.0.1, r1-eth0 inactive, weight 1, 00:10:17
                          via 192.168.1.1, r1-eth1 inactive, weight 1, 00:10:17
D   1.0.15.185/32 [150/0] via 192.168.0.1, r1-eth0 inactive, weight 1, 00:10:17
                          via 192.168.1.1, r1-eth1 inactive, weight 1, 00:10:17
D>* 1.0.15.186/32 [150/0] via 192.168.0.1, r1-eth0, weight 1, 00:10:17
  *                       via 192.168.1.1, r1-eth1, weight 1, 00:10:17
D>* 1.0.15.187/32 [150/0] via 192.168.0.1, r1-eth0, weight 1, 00:10:17
  *                       via 192.168.1.1, r1-eth1, weight 1, 00:10:17
D>* 1.0.15.188/32 [150/0] via 192.168.0.1, r1-eth0, weight 1, 00:10:17

Turning on some debugs showed that the failed installed routes are
trying to be matched against the default route.  Thus implying
all the connected routes for the test are not yet successfully
installed.  Let's modify the test(s) on startup to just ensure
that the connected routes are installed correctly.  I am no
longer seeing the problem after this change.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-14 10:18:41 -04:00
Philippe Guibert
64594f8a68 bgpd: fix memory type for static->prd_pretty
A crash happens when executing the following command:

> ubuntu2204hwe# conf
> ubuntu2204hwe(config)# router bgp 65500
> ubuntu2204hwe(config-router)#  !
> ubuntu2204hwe(config-router)#  address-family ipv4 unicast
> ubuntu2204hwe(config-router-af)#   sid vpn export auto
> ubuntu2204hwe(config-router-af)#  exit-address-family
> ubuntu2204hwe(config-router)#  !
> ubuntu2204hwe(config-router)#  address-family ipv4 vpn
> ubuntu2204hwe(config-router-af)#   network 4.4.4.4/32 rd 55:55 label 556
> ubuntu2204hwe(config-router-af)#   network 5.5.5.5/32 rd 662:33 label 232
> ubuntu2204hwe(config-router-af)#  exit-address-family
> ubuntu2204hwe(config-router)# exit
> ubuntu2204hwe(config)# !
> ubuntu2204hwe(config)# no router bgp

The crash analysis indicates a memory item has been freed.

> #6  0x000076066a629c15 in mt_count_free (mt=0x56b57be85e00 <MTYPE_BGP_NAME>, ptr=0x60200038b4f0)
>     at lib/memory.c:73
> #7  mt_count_free (ptr=0x60200038b4f0, mt=0x56b57be85e00 <MTYPE_BGP_NAME>) at lib/memory.c:69
> #8  qfree (mt=mt@entry=0x56b57be85e00 <MTYPE_BGP_NAME>, ptr=0x60200038b4f0) at lib/memory.c:129
> #9  0x000056b57bb09ce9 in bgp_free (bgp=<optimized out>) at bgpd/bgpd.c:4120
> #10 0x000056b57bb0aa73 in bgp_unlock (bgp=<optimized out>) at ./bgpd/bgpd.h:2513
> #11 peer_free (peer=0x62a000000200) at bgpd/bgpd.c:1313
> #12 0x000056b57bb0aca8 in peer_unlock_with_caller (name=<optimized out>, peer=<optimized out>)
>     at bgpd/bgpd.c:1344
> #13 0x000076066a6dbb2c in event_call (thread=thread@entry=0x7ffc8cae1d60) at lib/event.c:2011
> #14 0x000076066a60aa88 in frr_run (master=0x613000000040) at lib/libfrr.c:1214
> #15 0x000056b57b8b2c44 in main (argc=<optimized out>, argv=<optimized out>) at bgpd/bgp_main.c:543

Actually, the BGP_NAME item has not been used at allocation for
static->prd_pretty, and this results in reaching 0 quicker at bgp
deletion.

Fix this by reassigning MTYPE_BGP_NAME to prd_pretty.

Fixes: 16600df2c4 ("bgpd: fix show run of network route-distinguisher")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-08-14 15:41:40 +02:00
Donald Sharp
9356e3fdb0
Merge pull request #16579 from opensourcerouting/fix/bgpd_use_after_free_no_router_bgp
bgpd: Avoid use-after-free when doing `no router bgp` with auto created instances
2024-08-14 08:39:25 -04:00
Mark Stapp
dd146614df tests: add retries to nhg tests in all_proto_startup
The all_protocol_startup topotest needs to allow for some delay
between configuring nexthop-groups and their installation. Add
some wait periods in a couple of nhg test cases.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-08-14 08:37:00 -04:00
Donatas Abraitis
464212db08 bgpd: Avoid use-after-free when doing no router bgp with auto created instances
```
==1145965==ERROR: AddressSanitizer: heap-use-after-free on address 0x6030007159c0 at pc 0x55ade8d962d1 bp 0x7ffec4ce74c0 sp 0x7ffec4ce74b0
READ of size 8 at 0x6030007159c0 thread T0
    0 0x55ade8d962d0 in no_router_bgp bgpd/bgp_vty.c:1701
    1 0x7efe5aed19ed in cmd_execute_command_real lib/command.c:1002
    2 0x7efe5aed1da3 in cmd_execute_command lib/command.c:1061
    3 0x7efe5aed2303 in cmd_execute lib/command.c:1227
    4 0x7efe5af6c023 in vty_command lib/vty.c:616
    5 0x7efe5af6d2d2 in vty_execute lib/vty.c:1379
    6 0x7efe5af77df2 in vtysh_read lib/vty.c:2374
    7 0x7efe5af64c9b in event_call lib/event.c:1996
    8 0x7efe5af03887 in frr_run lib/libfrr.c:1232
    9 0x55ade8cd9850 in main bgpd/bgp_main.c:555
    10 0x7efe5aa29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    11 0x7efe5aa29e3f in __libc_start_main_impl ../csu/libc-start.c:392
    12 0x55ade8cdc314 in _start (/usr/lib/frr/bgpd+0x16f314)
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-14 10:16:01 +03:00
Mark Stapp
e03feca82f
Merge pull request #16575 from donaldsharp/doc_address_sanitizer_stuff
doc: Add doc to show sysctl setting for Sanitizers
2024-08-13 14:18:40 -04:00
Donald Sharp
90a50fd4af
Merge pull request #16576 from opensourcerouting/fix/free_opaque_data_of_route_entry
zebra: Do not forget to free opaque data for route entry
2024-08-13 14:14:36 -04:00
Donald Sharp
68fff49056 babeld: Free up memory on shutdown
a) call vector_delete on created vector on shutdown.
b) Call babel_clean_routing_process on shutdown

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-13 14:12:05 -04:00
Donald Sharp
f01205bb96 pbrd: Call vrf_terminate on shutdown
Free up vrf memory on shutdown.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-13 14:11:07 -04:00
Donatas Abraitis
1e288c9b55 zebra: Do not forget to free opaque data for route entry
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-13 18:00:30 +03:00
Donatas Abraitis
b0bb8cbfcf
Merge pull request #16559 from donaldsharp/fix_python_warning
tests: Fix bgp_duplicate_nexthop python warning
2024-08-13 16:20:27 +02:00
Donald Sharp
2de9d71a5c doc: Add doc to show sysctl setting for Sanitizers
In order to run the XXXX Sanitizers over the code as a developer
modern linux distro's require a specific sysctl.  Let's document
that so that people are aware of it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-13 08:58:29 -04:00
Donald Sharp
ce4e451c5b bgpd: Free up non-freed json memory on function return
json_peers is allocated in the above if statement block
for json but is not freed in this code path.  Noticed
by running Address Sanitizer.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-13 08:49:01 -04:00
Donald Sharp
847d74a5b0
Merge pull request #16558 from nabahr/pim_doc
doc: Fix up pim user docs.
2024-08-13 08:47:27 -04:00
Donatas Abraitis
b4e4fb476a
Merge pull request #16557 from donaldsharp/pathd_shutdown_memory_leaks
pathd: Cleanup shutdown memory leaks
2024-08-12 23:45:32 +03:00
Donatas Abraitis
74333790e3
Merge pull request #16555 from donaldsharp/agentx_event_leak
lib: Fix memory leak in snmp on shutdown
2024-08-12 23:45:14 +03:00
Nathan Bahr
33ce5d2410 doc: Fix up pim user docs.
Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-08-12 18:48:02 +00:00
Donald Sharp
1563d9f9c8 tests: Fix bgp_duplicate_nexthop python warning
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-12 13:55:26 -04:00
Donald Sharp
c4fdc837c0
Merge pull request #16534 from opensourcerouting/fix/start_ldpd_if_unified
doc: Document on how to start specific daemons with unified config in topotests
2024-08-12 10:25:54 -04:00
Donald Sharp
33af3c0278 pathd: Cleanup shutdown memory leaks
Just some code to cleanup the shutdown memory leaks
that are in pathd.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-12 10:14:31 -04:00
Donald Sharp
b8b38a593c lib: Fix memory leak in snmp on shutdown
The events list is storing a `struct event *` allocated
as a MTYPE_TMP pointer, on shutdown ensure that it is
properly free'd up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-12 08:51:19 -04:00
Donatas Abraitis
cc0fdd3b1d
Merge pull request #16439 from louis-6wind/fix-ipv4-mapped-ipv6
bgpd: fixes for ipv4 mapped ipv6 address
2024-08-12 15:37:36 +03:00
Donatas Abraitis
4e208087fd
Merge pull request #16545 from mjstapp/fix_isis_threeway
isisd: fix memory handling in isis_adj_process_threeway()
2024-08-12 09:39:45 +03:00
Donatas Abraitis
1d5f0a2beb
Merge pull request #16556 from donaldsharp/mgmt_ignore
mgmtd: Add to .gitignore for mgmtd_testc program
2024-08-12 09:39:22 +03:00
Donatas Abraitis
8c936d44d0
Merge pull request #16420 from pguibert6WIND/trap_rfc4382
bgpd: add bgp snmp traps rfc4382 command
2024-08-12 09:38:58 +03:00
Donatas Abraitis
263eb6d141
Merge pull request #16554 from donaldsharp/zebra_ensure_no_use_after_free
zebra: Ensure non-equal id's are not same nhg's
2024-08-12 07:59:42 +03:00