Commit Graph

34623 Commits

Author SHA1 Message Date
Donald Sharp
ea9d2b82c7
Merge pull request #15101 from LabNConsulting/chopps/new-libyang-req
build: require libyang 2.1.128
2024-01-07 15:03:13 -05:00
Donald Sharp
6d72776d62 Revert "zebra: Cleanup zrouter.stale_client_list on shutdown"
This reverts commit 71f7ecb571.
2024-01-07 13:14:54 -05:00
Donald Sharp
733511782f
Merge pull request #15102 from opensourcerouting/Revert-memleak-PR14811
Revert "bgpd: On shutdown do not create a workqueue for the self peer"
2024-01-07 12:30:22 -05:00
Christian Hopps
e85ff7a1f2 tests: test new XPath 1.0 predicate functionality
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-07 15:17:56 +00:00
Christian Hopps
1e4229fc1f lib: use libyang functions if they are present
Add configure.ac tests for libyang functions, if not present supply the
functionality ourselves in yang.[ch]

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-07 15:17:56 +00:00
Christian Hopps
cf67a7e265 lib: mgmtd: implement full XPath 1.0 predicate functionality
Allow user to specify full YANG compatible XPath 1.0 predicates. This
allows for trimming results of generic queries using functions and other
non-key predicates from XPath 1.0

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-07 15:17:30 +00:00
Christian Hopps
00138ffb47 lib: fix clang SA warnings
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-07 15:04:18 +00:00
Donatas Abraitis
7a474b8754 bgpd: Add debug bgp updates detail command
When filtering with `debug bgp updates in x.x.x.x prefix-list plist`, we want
to filter out unnecessary messages like:

```
127.0.0.1(Unknown) rcvd UPDATE wlen 0 attrlen 20 alen 5
```

Such a line as above will be repeated for all the paths received and it's useless
without knowing the prefix (because NLRIs are not parsed yet).

But want to see only relevant ones:

```
127.0.0.1(Unknown) rcvd UPDATE w/ attr: nexthop 127.0.0.1, origin i, path 65002
127.0.0.1(Unknown) rcvd 10.255.255.1/32 IPv4 unicast
```

With `debug bgp updates detail` we can combine this to something like:

```
127.0.0.1(Unknown) rcvd UPDATE w/ attr: nexthop 127.0.0.1, origin i, path 65002
127.0.0.1(Unknown) rcvd UPDATE wlen 0 attrlen 20 alen 5
127.0.0.1(Unknown) rcvd 10.255.255.1/32 IPv4 unicast
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-07 16:17:11 +02:00
Donatas Abraitis
fa62132278
Merge pull request #15104 from donaldsharp/label_pool_manager
bgpd: bgp_sync_label_manager failure case
2024-01-07 15:11:38 +02:00
Donatas Abraitis
7e6b4f7990 doc: Rename Thread to Event in events example
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-07 14:43:38 +02:00
Donatas Abraitis
e0422df53b vtysh: Rename show thread ... to show event ...
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-07 14:43:38 +02:00
Donatas Abraitis
1903b819fd tests: Rename show thread ... to show event ...
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-07 14:43:38 +02:00
Donatas Abraitis
2435c218e9 tools: Rename show thread ... to show event ...
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-07 14:14:56 +02:00
Donatas Abraitis
8c382a675e doc: Rename show thread ... to show event ...
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-07 14:14:56 +02:00
Donatas Abraitis
d2fe1936d9
Merge pull request #15105 from donaldsharp/event_thread_mishap
lib: Use event name instead of thread
2024-01-07 13:27:02 +02:00
Donald Sharp
5146ba710b lib: Use event name instead of thread
The thread system has been renamed, let's use the proper
terminology now in the show commands.  Also realign
output a tiny bit for stuff that was missing.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-06 20:43:22 -05:00
Donald Sharp
02049ffb13 bgpd: bgp_sync_label_manager failure case
There are several problems with the bgp_sync_label_manager
function:

a) It is possible that a request in the lp->requests
fifo will be unable to be filled at this point in time
and the lf will be leaked and not ever fullfilled.

b) The bgp_sync_label_manager runs one time a second
irrelevant if there is work to do or not.

To fix (a) just add the request back to the requests
fifo and set the timer to pop in the future.

To fix (b) just every time something is put into
the request pool start a timer to run in 1 second
and do not restart it if all the work is done.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-06 20:26:14 -05:00
Martin Winter
0222f553fb
Revert "bgpd: On shutdown do not create a workqueue for the self peer"
This reverts commit 7bf3c2fb19.
Commit reverted as it introduces a memoery leak during the tests

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2024-01-06 15:57:12 +01:00
Christian Hopps
db3ac9d4f3 build: require libyang 2.1.128
Update building docs to reflect this as well.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-06 06:55:04 -05:00
Donatas Abraitis
4d29c17407
Merge pull request #15054 from k0ste/help
redhat: rpm spec: added protobuf-c to deps & fix bogus changelog date
2024-01-06 13:20:19 +02:00
Christian Hopps
43331c0d78
Merge pull request #15092 from donaldsharp/lib_zebra_h_cleanup
Lib zebra h cleanup
2024-01-05 09:40:56 -05:00
Donald Sharp
8d7d560e70
Merge pull request #15085 from LabNConsulting/chopps/mgmtd-doc-update
doc: add diagram of oper-state queries.
2024-01-05 09:28:27 -05:00
Donald Sharp
75490f2c6e
Merge pull request #15087 from cscarpitta/fix/fix-cid-1575079
zebra: Fix coverity issue in `dplane_srv6_encap_srcaddr_set`
2024-01-05 09:27:53 -05:00
Donald Sharp
96067c7d9d
Merge pull request #15089 from pguibert6WIND/asan_sharpd_fix
lib: fix memory leak when disabling nexthop_hold contexts
2024-01-05 09:27:33 -05:00
Donald Sharp
88046da570
Merge pull request #15091 from louis-6wind/fix-ecommunity_fill_pbr_action
bgpd: fix ecommunity_fill_pbr_action heap-buffer-overflow
2024-01-05 09:26:50 -05:00
Donald Sharp
4038b6db3a
Merge pull request #15097 from louis-6wind/cleanup_vrf_update
lib: remove zebra_interface_vrf_update_read()
2024-01-05 09:25:41 -05:00
Donald Sharp
d04349e7f6
Merge pull request #15086 from LabNConsulting/chopps/remove-old-oper-iter-code
lib: remove unused/replaced oper-state iteration code
2024-01-05 09:24:23 -05:00
Donald Sharp
4494bebb38
Merge pull request #15095 from LabNConsulting/chopps/fix-centos-warn
lib: fix initializer warning on centos 7.
2024-01-05 09:23:39 -05:00
Louis Scalbert
c6fe42f64d lib: remove zebra_interface_vrf_update_read()
zebra_interface_vrf_update_read is orphan. Remove it.

Fixes: b580c52698 ("*: remove ZEBRA_INTERFACE_VRF_UPDATE")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-01-05 11:08:55 +01:00
Christian Hopps
ae1d854abf
lib: fix initializer warning on centos 7.
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-05 06:45:34 +00:00
Donald Sharp
496d87c14f lib: sys/utsname.h is not needed in zebra.h
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 15:34:22 -05:00
Donald Sharp
cbc187867c lib: zebra.h does not need to include syslog.h
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 15:34:22 -05:00
Donald Sharp
0b4ff79063 *: sys/uio.h does not need to be in zebra.h
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 15:34:22 -05:00
Donald Sharp
d69ac58c65 lib, sharpd: Move sys/resource.h to where it is used
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 14:43:46 -05:00
Donald Sharp
2700519cb3 *: Remove sys/ioctl.h from zebra.h
Practically no-one uses this and ioctls are pretty much
wrappered.  Further wrappering could make this even better.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 14:42:17 -05:00
Donald Sharp
88f8c90073 lib, vtysh: Remove inclusion of grp.h for everyone
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 14:34:41 -05:00
Donald Sharp
1b1fc14ffc lib: Remove in_systm.h it is never used
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 14:32:32 -05:00
Donald Sharp
75b3e82dfa *: Remove cost of including netinet/icmp.h everywhere
This file inclusion is only used in 3 places move
the includes to those spots.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 14:26:33 -05:00
Donald Sharp
ca54540576 lib: Remove inclusion of various MAXINT from zebra.h
All modern systems should have these defined.  Let's stop
paying the cost of this compilation.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 14:24:01 -05:00
Donald Sharp
fbc31156f0 lib: HAVE_GLIBC_BACKTRACE does not belong in zebra.h
The backtrace functionality has been abstracted over
to zlog_backtrace().  Now that every place uses this
move the inclusion for HAVE_GLIBC_BACKTRACE into
the appropriate files instead of having everyone
pay for this costly include.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 14:20:40 -05:00
Donald Sharp
a57379fa14 bgpd: rfapi was not using internal zlog_backtrace()
The rfapi code was not using the zlog_backtrace()
functionality.  Let's just convert over to using
the proper functionality that we have built in now.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 14:18:16 -05:00
Donald Sharp
78690deaf2 lib: Move some priviledge headers to file they are used.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 14:04:36 -05:00
Donald Sharp
2bf051a577 *: Remove Crypto openSSL define from zebra.h
Only a couple of places use this.  Move these to a better
spot.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 14:02:34 -05:00
Donald Sharp
10387101fe lib: Breakout sendmmsg into it's own header
The only 2 places sendmmsg is used is in zlog_5424.c
and zlog_live.c.  Why is the rest of the entire system
paying for this compilation?

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 13:56:09 -05:00
Donald Sharp
4e249eb2e4
Merge pull request #15083 from louis-6wind/fix-isis_spftree_del
isisd: fix _isis_spftree_del heap-use-after-free
2024-01-04 13:01:21 -05:00
Louis Scalbert
6001c765e2 bgpd: fix ecommunity_fill_pbr_action heap-buffer-overflow
Fix the following heap-buffer-overflow:

> ==3901635==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020003a5940 at pc 0x56260067bb48 bp 0x7ffe8a4f3840 sp 0x7ffe8a4f3838
> READ of size 4 at 0x6020003a5940 thread T0
>     #0 0x56260067bb47 in ecommunity_fill_pbr_action bgpd/bgp_ecommunity.c:1587
>     #1 0x5626007a246e in bgp_pbr_build_and_validate_entry bgpd/bgp_pbr.c:939
>     #2 0x5626007b25e6 in bgp_pbr_update_entry bgpd/bgp_pbr.c:2933
>     #3 0x562600909d18 in bgp_zebra_announce bgpd/bgp_zebra.c:1351
>     #4 0x5626007d5efd in bgp_process_main_one bgpd/bgp_route.c:3528
>     #5 0x5626007d6b43 in bgp_process_wq bgpd/bgp_route.c:3641
>     #6 0x7f450f34c2cc in work_queue_run lib/workqueue.c:266
>     #7 0x7f450f327a27 in event_call lib/event.c:1970
>     #8 0x7f450f21a637 in frr_run lib/libfrr.c:1213
>     #9 0x56260062fc04 in main bgpd/bgp_main.c:540
>     #10 0x7f450ee2dd09 in __libc_start_main ../csu/libc-start.c:308
>     #11 0x56260062ca29 in _start (/usr/lib/frr/bgpd+0x2e3a29)
>
> 0x6020003a5940 is located 0 bytes to the right of 16-byte region [0x6020003a5930,0x6020003a5940)
> allocated by thread T0 here:
>     #0 0x7f450f6aa1f8 in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:164
>     #1 0x7f450f244f8a in qrealloc lib/memory.c:112
>     #2 0x562600673313 in ecommunity_add_val_internal bgpd/bgp_ecommunity.c:143
>     #3 0x5626006735bc in ecommunity_uniq_sort_internal bgpd/bgp_ecommunity.c:193
>     #4 0x5626006737e3 in ecommunity_parse_internal bgpd/bgp_ecommunity.c:228
>     #5 0x562600673890 in ecommunity_parse bgpd/bgp_ecommunity.c:236
>     #6 0x562600640469 in bgp_attr_ext_communities bgpd/bgp_attr.c:2674
>     #7 0x562600646eb3 in bgp_attr_parse bgpd/bgp_attr.c:3893
>     #8 0x562600791b7e in bgp_update_receive bgpd/bgp_packet.c:2141
>     #9 0x56260079ba6b in bgp_process_packet bgpd/bgp_packet.c:3406
>     #10 0x7f450f327a27 in event_call lib/event.c:1970
>     #11 0x7f450f21a637 in frr_run lib/libfrr.c:1213
>     #12 0x56260062fc04 in main bgpd/bgp_main.c:540
>     #13 0x7f450ee2dd09 in __libc_start_main ../csu/libc-start.c:308

Fixes: dacf6ec120 ("bgpd: utility routine to convert flowspec actions into pbr actions")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-01-04 17:32:01 +01:00
Philippe Guibert
e266c44345 lib: fix memory leak when disabling nexthop_hold contexts
A memory leak is detected when stopping the sharpd daemon
with a nexthop group configuration that includes nexthops.

The nexthop_hold structure and its attributes are not
freed. Fix it by adding the missing free function.

Fixes: 98cbbaea91 ("lib: Handle if up/down and vrf enable/disable events")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-01-04 17:12:36 +01:00
Carmine Scarpitta
a061ba2348 zebra: ctx has to be non NULL at this point
Fix the following coverity issue:

*** CID 1575079:  Null pointer dereferences  (REVERSE_INULL)
/zebra/zebra_dplane.c: 5950 in dplane_srv6_encap_srcaddr_set()
5944     	if (ret == AOK)
5945     		result = ZEBRA_DPLANE_REQUEST_QUEUED;
5946     	else {
5947     		atomic_fetch_add_explicit(&zdplane_info
5948     						   .dg_srv6_encap_srcaddr_set_errors,
5949     					  1, memory_order_relaxed);
     CID 1575079:  Null pointer dereferences  (REVERSE_INULL)
     Null-checking "ctx" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
5950     		if (ctx)
5951     			dplane_ctx_free(&ctx);
5952     	}
5953     	return result;
5954     }
5955

Remove the pointer check for `ctx`. At this point in the
function it has to be non null since we deref'ed it.
Additionally the alloc function that creates it cannot
fail.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-01-04 11:13:31 +01:00
Christian Hopps
87a0e1f52b lib: remove unused/replaced oper-state iteration code
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-04 06:33:43 +00:00
Christian Hopps
d2661a3841
doc: add diagram of oper-state queries.
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-04 05:36:14 +00:00