Commit Graph

35139 Commits

Author SHA1 Message Date
Donald Sharp
153ab6eb43
Merge pull request #15122 from opensourcerouting/fix/drop_packet_send_debugs
bgpd: Change printing format show debugging for debug bgp updates
2024-01-09 12:21:09 -05:00
Russ White
6c8706802a
Merge pull request #15108 from opensourcerouting/fix/debug_bgp_updates_detail
bgpd: Add `debug bgp updates detail` command
2024-01-09 10:18:50 -05:00
Russ White
d5a0a70bbf
Merge pull request #15001 from pguibert6WIND/zebra_nexthop_rework
Zebra nexthop rework
2024-01-09 10:11:35 -05:00
Donald Sharp
92d0242a51
Merge pull request #15120 from opensourcerouting/fix/memory_leak_for_default_originate
bgpd: Fix memory leak for default-originate with route-map
2024-01-09 10:03:29 -05:00
Donatas Abraitis
546fe3144c bgpd: Change printing format show debugging for debug bgp updates
Before:

```
BGP debugging status:
  BGP updates debugging is on (inbound) for 127.0.0.1 with prefix-list rn-dummy 192.168.10.18 with prefix-list rn-dummy 1.1.1.1
```

After:

```
BGP debugging status:
  BGP updates debugging is on (inbound) for:
   127.0.0.1 with prefix-list rn-dummy
   192.168.10.18 with prefix-list rn-dummy
   192.168.10.20
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-09 10:08:54 +02:00
Donatas Abraitis
8f3d99b495 bgpd: Drop BGP_DEBUG_PACKET_SEND_DETAIL/BGP_DEBUG_PACKET_SEND consts
Not used anywhere.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-09 09:58:00 +02:00
Donald Sharp
956b6153fe
Merge pull request #15106 from opensourcerouting/fix/rename_thread_cli
vtysh: Add `show event ...` commands
2024-01-08 13:51:36 -05:00
Donatas Abraitis
74c1d4f8c0 bgpd: Fix memory leak for default-originate with route-map
```
Direct leak of 40 byte(s) in 1 object(s) allocated from:
    0 0x7fc4b81eed28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    1 0x7fc4b7bd60bb in qcalloc lib/memory.c:105
    2 0x56221dc19207 in aspath_dup bgpd/bgp_aspath.c:689
    3 0x56221daacd42 in route_set_aspath_prepend bgpd/bgp_routemap.c:2283
    4 0x7fc4b7c3891a in route_map_apply_ext lib/routemap.c:2687
    5 0x56221dace552 in subgroup_default_originate bgpd/bgp_updgrp_adv.c:906
    6 0x56221dabf79c in update_group_default_originate_route_map_walkcb bgpd/bgp_updgrp.c:2105
    7 0x56221dabde4e in update_group_walkcb bgpd/bgp_updgrp.c:1721
    8 0x7fc4b7b9d398 in hash_walk lib/hash.c:270
    9 0x56221dac94cb in update_group_af_walk bgpd/bgp_updgrp.c:2062
    10 0x56221dac9b0f in update_group_walk bgpd/bgp_updgrp.c:2071
    11 0x56221dac9fd5 in update_group_refresh_default_originate_route_map bgpd/bgp_updgrp.c:2118
    12 0x7fc4b7c7fc54 in event_call lib/event.c:1974
    13 0x7fc4b7bb9276 in frr_run lib/libfrr.c:1214
    14 0x56221d9217fd in main bgpd/bgp_main.c:510
    15 0x7fc4b6bf2c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
```

tmp_pi.attr should be flushed since it's already interned (new_attr) or the
origin value is used (attr).

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-08 20:48:56 +02:00
Donatas Abraitis
87a92274f6
Merge pull request #15119 from donaldsharp/pytest_mgmtd
tests: Add mgmtd to the official pytest.mark list
2024-01-08 20:48:30 +02:00
Donatas Abraitis
482f082a41
Merge pull request #15111 from donaldsharp/json_vpn_wait_what
bgpd: show_adj_route_vpn always leaked json memory
2024-01-08 15:57:25 +02:00
Donald Sharp
b1a39549df tests: Add mgmtd to the official pytest.mark list
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-08 07:58:14 -05:00
Christian Hopps
2022141afe
Merge pull request #15110 from donaldsharp/revert_zrouter.stale_client
Revert "zebra: Cleanup zrouter.stale_client_list on shutdown"
2024-01-08 07:35:20 -05:00
Donald Sharp
bed55ecc8e bgpd: show_adj_route_vpn always leaked json memory
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-07 15:55:15 -05:00
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
Chirag Shah
2db979522e tools: fix frr-reload for nbr deletion
bgp neighbor config can have multiple lines, if neighbor is
deleted via frr-reload, no neighbor remote-as <> wipes out
the neighbor, subsequent neighbor associated config deletion
would throw generic error.
Frr-reload needs to move neighbor remote-as line to end and allow
all other config lines to be removed.

Ticket:#3588361 #3589216

Testing Done:
config:
neighbor swp3 interface remote-as external
 neighbor swp3 bfd 3 300 300
 neighbor swp3 password leaf11-spine

INFO: Executed "router bgp 65101  no neighbor swp3 interface remote-as external"
INFO: Failed to execute router bgp 65101  no neighbor swp3 bfd 3 300 300
INFO: Failed to execute router bgp 65101  no neighbor swp3 bfd 3 300
INFO: Failed to execute router bgp 65101  no neighbor swp3 bfd 3
INFO: Failed to execute router bgp 65101  no neighbor swp3 bfd
INFO: Failed to execute router bgp 65101  no neighbor swp3
INFO: Failed to execute router bgp 65101  no neighbor
INFO: Failed to execute router bgp 65101  no
  ERROR: "router bgp 65101 --  no" we failed to remove this command
  ERROR: % Specify remote-as or peer-group commands first

INFO: Failed to execute router bgp 65101  no neighbor swp3 password leaf11-spine
INFO: Failed to execute router bgp 65101  no neighbor swp3 password
INFO: Failed to execute router bgp 65101  no neighbor swp3
INFO: Failed to execute router bgp 65101  no neighbor
INFO: Failed to execute router bgp 65101  no
 ERROR: "router bgp 65101 --  no" we failed to remove this command
 ERROR: % Specify remote-as or peer-group commands first

After fix:

move the neighbor remote-as deletion line to end which allows to remove
other neighbor associated lines to be deleted.
router bgp 65101  no neighbor swp3 interface remote-as external

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-01-06 14:58:41 -08: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