Commit Graph

34898 Commits

Author SHA1 Message Date
Donald Lee
ac91b343d6 lib: Remove old noop decoders
Co-authored-by: Quentin Young <qlyoung@qlyoung.net>
Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
Signed-off-by: Donald Lee <dlqs@gmx.com>
2023-11-20 20:45:02 -05:00
Donald Lee
ac3fdc60df lib: Add more Lua types to encoder/decoder
Signed-off-by: Donald Lee <dlqs@gmx.com>
2023-11-20 20:45:01 -05:00
Donald Lee
2faab06ed3 lib: Add polymorphic noop macro
Co-authored-by: Quentin Young <qlyoung@qlyoung.net>
Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
Signed-off-by: Donald Lee <dlqs@gmx.com>
2023-11-20 20:44:57 -05:00
Donald Sharp
83cbdcc267
Merge pull request #14813 from idryzhov/vtysh-file-lock
vtysh: clean vtysh_file_locked when exiting config node
2023-11-20 15:18:42 -05:00
Donald Sharp
9ec7aa95f5
Merge pull request #14833 from opensourcerouting/fix/frrtrace_bmp
bgpd: Fix frrtrace arguments for bmp_eor tracing
2023-11-20 15:17:13 -05:00
Donald Sharp
c1420682c4
Merge pull request #14823 from opensourcerouting/isis-adj-cleanup
isisd: remove unused router_address fields
2023-11-20 10:44:25 -05:00
Donald Sharp
e05bb2ddbf
Merge pull request #14825 from mjstapp/fix_opcode_switches
zebra: reduce number of switch statements with dplane opcodes
2023-11-20 10:43:16 -05:00
Christian Hopps
9c1b357bb6
Merge pull request #14831 from opensourcerouting/libyang-multi-err-ifdef
lib: use LYD_VALIDATE_MULTI_ERROR only if available
2023-11-20 15:56:16 +01:00
Donald Sharp
6b23ece88b zebra: Fix fpm multipath encap addition
The fpm code path in building a ecmp route for evpn has
a bug that caused it to not add the encap attribute to
the netlink message.  See #f0f7b285b99dbd971400d33feea007232c0bd4a9
for the single path case being fixed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-20 09:47:31 -05:00
David Lamparter
03c4375a4a lib: make zapi_nexthop_update_decode private
zapi_nexthop_update_decode() is no longer called externally.

Also move the comment to zclient->nexthop_update where it now belongs.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-20 11:28:39 +01:00
David Lamparter
409a693165 bgpd: use zclient->nexthop_update
Same as before.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-20 11:28:35 +01:00
David Lamparter
f115dc5889 ospf6d: use zclient->nexthop_update
Same as before.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-20 11:28:23 +01:00
David Lamparter
53a82c1c2f ospfd: use zclient->nexthop_update
Same as before.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-20 11:28:20 +01:00
David Lamparter
088250ff04 staticd: use zclient->nexthop_update
Same as before.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-20 11:24:28 +01:00
David Lamparter
94fc9c04fc sharpd: use zclient->nexthop_update
Same as above.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-20 11:24:28 +01:00
David Lamparter
ac18d56a0b pimd: use zclient->nexthop_update
Same as before, use shared nexthop decode function.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-20 11:24:28 +01:00
David Lamparter
20007eb773 pbrd: use zclient->nexthop_update
Have the library decode the nexthop.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-20 11:24:28 +01:00
David Lamparter
b951e59300 lib: add common NHT update decode callback
All users of `ZEBRA_NEXTHOP_UPDATE` check the VRF and then call into
`zapi_nexthop_update_decode` before further processing.  Begin moving
this into common code in lib/.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-20 11:24:21 +01:00
Donatas Abraitis
88db20c4c8 bgpd: Fix frrtrace arguments for bmp_eor tracing
Arguments number was wrong.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-11-20 12:21:13 +02:00
David Lamparter
75a7b5b6b6 lib: use LYD_VALIDATE_MULTI_ERROR only if available
LYD_VALIDATE_MULTI_ERROR was added in libyang 2.1.36.  The currently
enforced minimum of libyang is 2.0.0.  Stick an #ifdef around it.

Fixes: 51a2a4b3f4 ("lib: print all errors when validating a config")
Cc: Igor Ryzhov <iryzhov@nfware.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-20 10:32:52 +01:00
mobash-rasool
f9012ed5cf
Merge pull request #14824 from opensourcerouting/ospf6-p2xp-fixuninit
ospf6d: fix uninitialized value warning in p2xp
2023-11-19 22:28:51 +05:30
Christian Hopps
94659cf9e5
Merge pull request #14657 from idryzhov/mgmtd-remove-batch-ids
mgmtd, lib: remove batch ids from all messages
2023-11-18 05:59:44 +01:00
Donatas Abraitis
df4e4f82ce
Merge pull request #14827 from qlyoung/doc-restore-frr-theme
doc: fix docs path to requirements.txt
2023-11-17 23:03:37 +02:00
Quentin Young
9d963dc3f1 doc: fix docs path to requirements.txt
Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
2023-11-17 12:11:09 -05:00
Donatas Abraitis
d9c606aebb
Merge pull request #14806 from mxyns/master
bgpd: bmp bgp asn & router_id coverity fix
2023-11-17 16:34:22 +02:00
David Lamparter
484608f065 ospf6d: fix uninitialized value warning in p2xp
GCC is complaining prev_cost may be used uninitialized.  It really
can't, but let's get rid of the warning.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-17 14:42:28 +01:00
Mark Stapp
bb3faf1b95 zebra: reduce number of switch statements with dplane opcodes
Replace several switch blocks that contain every dplane opcode
with simpler sets of if()s. In these cases the code only
uses a couple of opcodes.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-11-17 08:40:58 -05:00
Donald Sharp
f671c92857
Merge pull request #14814 from idryzhov/staticd-debug
staticd: fix debug commands
2023-11-17 07:25:40 -05:00
Igor Ryzhov
057f442309 lib, mgmtd: remove function duplication
And also remove lib dependency on mgmtd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-11-17 11:27:03 +01:00
Igor Ryzhov
c0568d4f9e lib, mgmtd: move common header to lib
The common header included from lib and other daemons should be located
in lib, not in mgmt directory.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-11-17 11:27:03 +01:00
Donatas Abraitis
51d14b910d
Merge pull request #14812 from qlyoung/doc-restore-frr-theme
doc: restore frr docs theme
2023-11-17 12:07:30 +02:00
Igor Ryzhov
649f04d679 staticd: fix debug commands
Debug commands should be installed in staticd, not in mgmtd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-11-17 03:18:28 +01:00
Igor Ryzhov
40def43dfa vtysh: clean vtysh_file_locked when exiting config node
The flag should be cleared to make sure it's not reused the next time
we enter the config node.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-11-17 03:16:36 +01:00
Quentin Young
5b7563c7e9 doc: restore frr docs theme
Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
2023-11-16 18:44:28 -05:00
David Lamparter
c1f665a075 isisd: remove unused router_address fields
These were added in e38e0df01a but never used anywhere.  Also the code
grabs any random /32 or /128 that is directly connected to the adjacent
router, which may not even be an address of that router itself.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-16 17:09:38 +01:00
Donatas Abraitis
c599ed56fc
Merge pull request #14807 from Keelan10/fix-babel-int-delete-leak
babeld: Free IPv4 Memory in babel_interface_free
2023-11-16 14:54:03 +02:00
Keelan10
419cc234c1 babeld: Free IPv4 Memory in babel_interface_free
Ensure proper memory cleanup by freeing the `babel_ifp->ipv4` when
babel interface is deleted. This prevents memory leaks.

The ASan leak log for reference:

```
***********************************************************************************
Address Sanitizer Error detected in all_protocol_startup.test_all_protocol_startup/r1.asan.babeld.4141

=================================================================
==4141==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 40 byte(s) in 10 object(s) allocated from:
    #0 0x7f1cde6a9b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x562b8eff328d in babel_interface_address_add babeld/babel_interface.c:112
    #2 0x7f1cde1772cb in zclient_read lib/zclient.c:4425
    #3 0x7f1cde14729c in event_call lib/event.c:1980
    #4 0x7f1cde08a3bf in frr_run lib/libfrr.c:1214
    #5 0x562b8eff481b in main babeld/babel_main.c:202
    #6 0x7f1cdd8acc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 40 byte(s) leaked in 10 allocation(s).
***********************************************************************************
```

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
2023-11-16 02:09:11 +04:00
Donald Sharp
93379c01d1
Merge pull request #14792 from mobash-rasool/fixes2
pim6d: Fix memory leaks
2023-11-15 13:19:53 -05:00
Donald Sharp
520bb404f5
Merge pull request #14800 from idryzhov/nb-validate-errors
Print all errors when validating NB configuration
2023-11-15 13:19:11 -05:00
Donald Sharp
4cce1e4d6b
Merge pull request #14802 from Keelan10/fix-nht-leak
sharpd: Set Callback Function for Memory Cleanup
2023-11-15 12:22:29 -05:00
Donald Sharp
3c4d64d7d4
Merge pull request #14803 from Keelan10/fix-babel-leak
babeld: Free IPv4 Memory in interface_reset
2023-11-15 09:54:36 -05:00
Maxou
d6940cc886 bgpd: bmp bgp asn & router_id coverity fix
Signed-off-by: Maxence Younsi <mx.yns@outlook.fr>
2023-11-15 14:37:03 +01:00
teletajp
62754e1029 ospfd: fix show_ip_ospf_gr_helper
Fix for the command "show ip ospf vrf NAME graceful-restart helper".
FRR did not show information by vrf's name.
If i have router ospf vrf red, vtysh's command
'show ip ospf vrf red graceful-restart helper' will not show anything.
But command 'show ip ospf vrf all graceful-restart helper' will work
normally. This fix fixes the display of information by vrf's name.

Example:
frr1# show ip ospf vrf vrf-1 graceful-restart helper
VRF Name: vrf-1

       OSPF Router with ID (192.168.255.81)

 Graceful restart helper support enabled.
 Strict LSA check is enabled.
 Helper supported for Planned and Unplanned Restarts.
 Supported Graceful restart interval: 1800(in seconds).

Signed-off-by: teletajp <teletajp@yandex.ru>
2023-11-15 16:18:46 +03:00
Igor Ryzhov
51a2a4b3f4 lib: print all errors when validating a config
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-11-15 14:17:29 +01:00
Donatas Abraitis
43290b565b
Merge pull request #14798 from Keelan10/zebra-fix-json-leak
zebra: Refactor memory allocation in zebra_rnh.c
2023-11-15 14:27:21 +02:00
Keelan10
4937a4eab5 babeld: Free IPv4 Memory in interface_reset
Release memory allocated for the IPv4 address during the interface reset.
The addition of `free(babel_ifp->ipv4)` ensures proper cleanup, preventing
potential memory leaks.

The ASan leak log for reference:

```
***********************************************************************************
Address Sanitizer Error detected in babel_topo1.test_babel_topo1/r2.asan.babeld.18864

=================================================================
==18864==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 8 byte(s) in 2 object(s) allocated from:
    #0 0x7f3f4531bb40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x55c1806cb28d in babel_interface_address_add babeld/babel_interface.c:112
    #2 0x7f3f44de9e29 in zclient_read lib/zclient.c:4425
    #3 0x7f3f44db9dfa in event_call lib/event.c:1965
    #4 0x7f3f44cfd3bf in frr_run lib/libfrr.c:1214
    #5 0x55c1806cc81b in main babeld/babel_main.c:202
    #6 0x7f3f4451fc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 8 byte(s) leaked in 2 allocation(s).
***********************************************************************************
```

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
2023-11-15 12:56:42 +04:00
Keelan10
9dd86deaa7 sharpd: Set Callback Function for Memory Cleanup
Implement a callback function for memory cleanup of sharp_nh_tracker.
Specifically, set `sharp_nh_tracker_free` as the deletion function for the `sg.nhs` list.
This ensures proper cleanup of resources when elements are removed.

The ASan leak log for reference:

```
***********************************************************************************
Address Sanitizer Error detected in zebra_nht_resolution.test_verify_nh_resolution/r1.asan.sharpd.32320

=================================================================
==32320==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f4ee812ad28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f4ee7b291cc in qcalloc lib/memory.c:105
    #2 0x5582be672011 in sharp_nh_tracker_get sharpd/sharp_nht.c:36
    #3 0x5582be680b42 in watch_nexthop_v4_magic sharpd/sharp_vty.c:139
    #4 0x5582be680b42 in watch_nexthop_v4 sharpd/sharp_vty_clippy.c:192
    #5 0x7f4ee7aac0b1 in cmd_execute_command_real lib/command.c:978
    #6 0x7f4ee7aac575 in cmd_execute_command lib/command.c:1036
    #7 0x7f4ee7aac9f4 in cmd_execute lib/command.c:1203
    #8 0x7f4ee7bd50bb in vty_command lib/vty.c:594
    #9 0x7f4ee7bd5566 in vty_execute lib/vty.c:1357
    #10 0x7f4ee7bdde37 in vtysh_read lib/vty.c:2365
    #11 0x7f4ee7bc8dfa in event_call lib/event.c:1965
    #12 0x7f4ee7b0c3bf in frr_run lib/libfrr.c:1214
    #13 0x5582be671252 in main sharpd/sharp_main.c:188
    #14 0x7f4ee6f1bc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: 64 byte(s) leaked in 1 allocation(s).
***********************************************************************************
```

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
2023-11-15 11:59:02 +04:00
Donatas Abraitis
3a109ef215
Merge pull request #14796 from donaldsharp/ospf_bsd_double_whammy_no_whammy
lib: Prevent infinite loop in ospf
2023-11-15 09:39:31 +02:00
Igor Ryzhov
81cb39a934 lib: fix printing multiple yang errors
When printing multiple YANG errors, we should print paths for all of
them, not only for the last one.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-11-15 03:27:32 +01:00
Keelan10
531866c538 zebra: Refactor memory allocation in zebra_rnh.c
Fix memory leaks by allocating `json_segs` conditionally on `nexthop->nh_srv6->seg6_segs`.
The previous code allocated memory even when not in use or attached to the JSON tree.

The ASan leak log for reference:

```
Direct leak of 3240 byte(s) in 45 object(s) allocated from:
    #0 0x7f6e84a35d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f6e83de9e6f in json_object_new_array (/lib/x86_64-linux-gnu/libjson-c.so.3+0x3e6f)
    #2 0x564dcab5c1a6 in vty_show_ip_route zebra/zebra_vty.c:705
    #3 0x564dcab5cc71 in do_show_route_helper zebra/zebra_vty.c:955
    #4 0x564dcab5d418 in do_show_ip_route zebra/zebra_vty.c:1039
    #5 0x564dcab63ee5 in show_route_magic zebra/zebra_vty.c:1878
    #6 0x564dcab63ee5 in show_route zebra/zebra_vty_clippy.c:659
    #7 0x7f6e843b6fb1 in cmd_execute_command_real lib/command.c:978
    #8 0x7f6e843b7475 in cmd_execute_command lib/command.c:1036
    #9 0x7f6e843b78f4 in cmd_execute lib/command.c:1203
    #10 0x7f6e844dfe3b in vty_command lib/vty.c:594
    #11 0x7f6e844e02e6 in vty_execute lib/vty.c:1357
    #12 0x7f6e844e8bb7 in vtysh_read lib/vty.c:2365
    #13 0x7f6e844d3b7a in event_call lib/event.c:1965
    #14 0x7f6e844172b0 in frr_run lib/libfrr.c:1214
    #15 0x564dcaa50e81 in main zebra/main.c:488
    #16 0x7f6e837f7c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 11520 byte(s) in 45 object(s) allocated from:
    #0 0x7f6e84a35d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f6e83de88c0 in array_list_new (/lib/x86_64-linux-gnu/libjson-c.so.3+0x28c0)

Indirect leak of 1080 byte(s) in 45 object(s) allocated from:
    #0 0x7f6e84a35d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    #1 0x7f6e83de8897 in array_list_new (/lib/x86_64-linux-gnu/libjson-c.so.3+0x2897)
```

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
Signed-off-by: ryndia <dindyalsarvesh@gmail.com>
2023-11-15 01:57:04 +04:00