Commit graph

675 commits

Author SHA1 Message Date
Donald Sharp d7e19c604f *: Allow returns to work with --enable-undefined-behavior
If you have undefined behavior compilation checking gcc
starts to complain about a bunch of places that do not
have return's.  When most of them actually do and we
have the assert's to prove it.  I'm just doing this
to make the compiler happy for me, so I can continue
to do work.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-04-28 14:05:28 -04:00
Mark Stapp 098d692b6f *: expose and clean up 'noreturn' functions
Enable the -Wmissing-noreturn warning, and resolve warnings
for gcc and clang. Add a FRR_NORETURN macro and use that for
the new changes.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-24 13:41:23 -04:00
Mark Stapp 27ba9956a1 lib,ripd: resolve clang SA warnings
Looks like there were a couple of SA warnings lurking; fix
them.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Mark Stapp 536944dc53 lib,ripd: clean up -Wshadow compiler warnings
Clean up compiler warnings; convert a linklist macro
to an inline to resolve one; clean up a side-effect in isisd.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Donald Sharp fbdce3358e *: Ensure prefix lists are freed on shutdown.
Several daemons were not calling prefix_list_reset
to clean up memory on shutdown.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-30 17:00:38 -04:00
Shbinging 22bec0df47 ripd: fix no ip rip split-horizon poisoned-reverse command
`no ip rip split-horizon poisoned-reverse` will undo poisoned-reverse and set default behavior which is split-horizon.
By contrast, `no ip rip split-horizon` will undo interface's split-horizon behavior.

Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
2025-02-25 16:07:49 +08:00
Christian Hopps 5f2a927d7b lib: northbound/mgmtd: add backend model support
Signed-off-by: Christian Hopps <chopps@labn.net>
2025-01-14 18:48:59 +00:00
Donald Sharp 735809756f ripd: Use route_node_match instead of route_node_match_ipv4
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-11-25 13:12:10 -05:00
Igor Ryzhov 25d94ec3ee ripd: fix show run output for distribute-list
CLI show callbacks should be defined in frr_ripd_cli_info instead of
frr_ripd_info, because only the former is loaded by mgmtd and only its
callbacks are getting called for config output.

Signed-off-by: Igor Ryzhov <idryzhov@gmail.com>
2024-08-08 01:25:02 +03:00
anlan_cs c0b6095856 ripd: adjust header for display command
Continue to adjust `show ip rip` 's header for display comand.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2024-07-05 09:32:50 +08:00
T-Nicolas 1a64fe4254
ripd: Change the start value of sequence 1 to 0
Signed-off-by: T-Nicolas <github@toselli.email>
2024-06-27 10:42:48 +02:00
Donald Sharp 73ad64a6f4 *: Modify agentx to be allowed to be called
If you had a situation where an operator turned on
ospfd with snmp but not ospf6d and agentx was configured
then you get into a situation where ospf6d would complain
that the config for agentx did not exist.  Let's modify
the code to allow this situation to happen.

Fixes: #15896
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-05-10 10:16:29 -04:00
Igor Ryzhov dbaf05ae3d ripd: convert RPC commands to mgmtd
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-22 16:36:23 +03:00
Igor Ryzhov 58a8ebc1fc lib: rework northbound RPC callback
Change input/output arguments of the RPC callback from lists of
(xpath/value) tuples to YANG data trees.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-22 16:36:22 +03:00
Igor Ryzhov 1ba97510e2 ripd: fix "clear ip rip" command
mgmtd doesn't support YANG RPCs yet, so this command must go directly to
ripd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-09 00:00:12 +02:00
Donald Sharp 7e058c201a
Merge pull request #15469 from LabNConsulting/chopps/keychain-yang
add ietf-key-chain YANG module support
2024-03-08 08:15:02 -05:00
Igor Ryzhov aaa6c7088e ripd: fix missing "exit" for "router rip"
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-06 21:42:53 +02:00
Christian Hopps 4caffbda8e lib: add keychain northbound support
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-03-04 20:00:15 -05:00
Mark Stapp 72b31b96fc *: create a single registry of daemons' default port values
Create a single registry of default port values that daemons
are using. Most of these are vty ports, but there are some
others for features like ospfapi and zebra FPM.

Signed-off-by: Mark Stapp <mjs@labn.net>
2024-02-01 11:40:02 -05:00
David Lamparter 634f481113 *: fix frr_daemon_info indentation
clang-format doesn't understand FRR_DAEMON_INFO is a long macro where
laying out items semantically makes sense.

(Also use only one `FRR_DAEMON_INFO(` in isisd so editors don't get
confused with the mismatching `( ( )`.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-01-27 19:02:51 +01:00
Christian Hopps e6eec072ab ripngd: convert ripngd to mgmtd
- a couple small fixes for ripd conversion as well.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-26 17:40:55 -05:00
Christian Hopps 83abe9c3cb ripd: ripd convert to mgmtd
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-26 12:34:46 -05:00
Donald Sharp 16406a31d3
Merge pull request #15196 from idryzhov/nb-leaf-list
lib: remove leaf-list xpath hack from northbound
2024-01-24 10:49:52 -05:00
Igor Ryzhov a594cda8ce lib: remove leaf-list xpath hack from northbound
Currently, when editing a leaf-list, `nb_candidate_edit` expects to
receive it's xpath without a predicate and the value in a separate
argument, and then creates the full xpath. This hack is complicated,
because it depends on the operation and on the caller being a backend or
not. Instead, let's require to always include the predicate in a
leaf-list xpath. Update all the usages in the code accordingly.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-23 12:33:39 +02:00
Igor Ryzhov 45b868a2af ripd: use correct autocompletion for distribute-list commands
Currently, we always use access-list autocompletion, even if configuring
prefix-lists. We should differentiate.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-22 23:59:30 +02:00
Christian Hopps 8f7a9355f2 ripd: use new distribute-list northbound code.
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-22 11:33:33 +00:00
Christian Hopps a993b8e9bb lib: enable multiple instance support with distribute lists
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-22 11:32:29 +00: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
Christian Hopps 2c01083d35 lib: all: remove './' from xpath 22% speedup
fixes #8299

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-11-29 14:37:23 -05:00
Christian Hopps bb6fe6beb9
Merge pull request #14811 from donaldsharp/zebra_final_shutdown_finally
Zebra final shutdown finally
2023-11-28 20:14:42 +01:00
David Lamparter 8b23c0b0bd *: convert struct interface->connected to DLIST
Replace `struct list *` with `DLIST(if_connected, ...)`.

NB: while converting this, I found multiple places using connected
prefixes assuming they were IPv4 without checking:

- vrrpd/vrrp.c: vrrp_socket()
- zebra/irdp_interface.c: irdp_get_prefix(), irdp_if_start(),
  irdp_advert_off()

(these fixes are really hard to split off into separate commits as that
would require going back and reapplying the change but with the old list
handling)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-22 23:00:30 +01:00
Donald Sharp 88a54b123d *: Cleanup keychain on shutdown
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-21 12:41:18 -05:00
Donald Sharp 07b91ca096 *: Let's use the native IFNAMSIZ instead of INTERFACE_NAMSIZ
INTERFACE_NAMSIZ is just a redefine of IFNAMSIZ and IFNAMSIZ
is the standard for interface name length on all platforms
that FRR currently compiles on.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-21 08:08:29 -05:00
Donald Sharp c0dc9d329f ripd: Cleanup memory on shutdown
a) routemap data was not being cleaned up
b) rip data structure was not being cleaned up

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-13 09:16:45 -05:00
Donald Sharp 6de9f7fbf5 *: Move distance related defines into their own header
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-07 06:47:51 -05:00
David Lamparter d889055d8e lib: convert if_zapi_callbacks into actual hooks
...so that multiple functions can be subscribed.

The create/destroy hooks are renamed to real/unreal because that's what
they *actually* signal.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-02 17:10:43 -07:00
anlan_cs b580c52698 *: remove ZEBRA_INTERFACE_VRF_UPDATE
Currently when one interface changes its VRF, zebra will send these messages to
all daemons in *order*:
    1) `ZEBRA_INTERFACE_DELETE` ( notify them delete from old VRF )
    2) `ZEBRA_INTERFACE_VRF_UPDATE` ( notify them move from old to new VRF )
    3) `ZEBRA_INTERFACE_ADD` ( notify them added into new VRF )

When daemons deal with `VRF_UPDATE`, they use
`zebra_interface_vrf_update_read()->if_lookup_by_name()`
to check the interface exist or not in old VRF. This check will always return
*NULL* because `DELETE` ( deleted from old VRF ) is already done, so can't
find this interface in old VRF.

Send `VRF_UPDATE` is redundant and unuseful. `DELETE` and `ADD` are enough,
they will deal with RB tree, so don't send this `VRF_UPDATE` message when
vrf changes.

Since all daemons have good mechanism to deal with changing vrf, and don't
use this `VRF_UPDATE` mechanism.  So, it is safe to completely remove
all the code with `VRF_UPDATE`.

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2023-10-07 10:06:39 +08:00
Igor Ryzhov 054ca9b9ee Revert "ripd: Cleanup memory allocations on shutdown"
This reverts commit 3d1588d8ed.

This commit introduced a crash. When the VRF is deleted, the RIP instance
should not be freed, because the NB infrastructure still stores the
pointer to it. The instance should be deleted only when it's actually
deleted from the configuration.

To reproduce the crash:
```
frr# conf t
frr(config)# vrf vrf1
frr(config-vrf)# exit
frr(config)# router rip vrf vrf1
frr(config-router)# exit
frr(config)# no vrf vrf1
frr(config)# no router rip vrf vrf1
vtysh: error reading from ripd: Resource temporarily unavailable (11)Warning: closing connection to ripd because of an I/O error!
frr(config)#
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-06-15 17:43:40 +03:00
David Lamparter d76e6a58e5 ripd: embed BFD YANG models
The frr-ripd model has a dependency on frr-bfdd, so include it in build.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-05-25 13:47:54 +02:00
Russ White 6a88c7a87e
Merge pull request #13548 from opensourcerouting/fix/use_min_value_of_cli_zebra_cap_ecmp
ripd: Make sure we do not overuse higher values for ECMP count
2023-05-23 08:25:46 -04:00
Donatas Abraitis a82a6d409d ripd: Use argv_find to avoid buffer overflow when parsing allow-ecmp args
==13211==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000af158 at pc 0x55d48c5f1e38 bp 0x7fffd8a713d0 sp 0x7fffd8a713c0
READ of size 8 at 0x6020000af158 thread T0
    #0 0x55d48c5f1e37 in rip_allow_ecmp ripd/rip_cli.c:98
    #1 0x7f2ec125aa0f in cmd_execute_command_real lib/command.c:990
    #2 0x7f2ec125ae90 in cmd_execute_command lib/command.c:1049
    #3 0x7f2ec125b406 in cmd_execute lib/command.c:1217
    #4 0x7f2ec137ca36 in vty_command lib/vty.c:551
    #5 0x7f2ec137ce52 in vty_execute lib/vty.c:1314
    #6 0x7f2ec1384f9e in vtysh_read lib/vty.c:2223
    #7 0x7f2ec137041b in event_call lib/event.c:1995
    #8 0x7f2ec12b54bf in frr_run lib/libfrr.c:1204
    #9 0x55d48c5f0f32 in main ripd/rip_main.c:171
    #10 0x7f2ec0ad9c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
    #11 0x55d48c5f1349 in _start (/usr/lib/frr/ripd+0x3b349)

0x6020000af158 is located 0 bytes to the right of 8-byte region [0x6020000af150,0x6020000af158)
allocated by thread T0 here:
    #0 0x7f2ec18ccb40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40)
    #1 0x7f2ec12d2e41 in qmalloc lib/memory.c:100
    #2 0x7f2ec125a815 in cmd_execute_command_real lib/command.c:955
    #3 0x7f2ec125ae90 in cmd_execute_command lib/command.c:1049
    #4 0x7f2ec125b406 in cmd_execute lib/command.c:1217
    #5 0x7f2ec137ca36 in vty_command lib/vty.c:551
    #6 0x7f2ec137ce52 in vty_execute lib/vty.c:1314
    #7 0x7f2ec1384f9e in vtysh_read lib/vty.c:2223
    #8 0x7f2ec137041b in event_call lib/event.c:1995
    #9 0x7f2ec12b54bf in frr_run lib/libfrr.c:1204
    #10 0x55d48c5f0f32 in main ripd/rip_main.c:171
    #11 0x7f2ec0ad9c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

SUMMARY: AddressSanitizer: heap-buffer-overflow ripd/rip_cli.c:98 in rip_allow_ecmp
Shadow bytes around the buggy address:
  0x0c048000ddd0: fa fa fd fa fa fa fd fa fa fa fd fd fa fa fd fa
  0x0c048000dde0: fa fa fd fa fa fa fd fd fa fa fd fa fa fa fd fd
  0x0c048000ddf0: fa fa fd fa fa fa fd fd fa fa fd fd fa fa fd fd
  0x0c048000de00: fa fa fd fa fa fa fd fd fa fa 00 03 fa fa fd fa
  0x0c048000de10: fa fa fd fa fa fa 00 00 fa fa fd fa fa fa 00 03
=>0x0c048000de20: fa fa 00 03 fa fa fd fa fa fa 00[fa]fa fa fa fa
  0x0c048000de30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c048000de40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c048000de50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c048000de60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c048000de70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==13211==ABORTING

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-05-23 09:20:27 +03:00
Donatas Abraitis 1b839d486a ripd: Make sure we do not overuse higher values for ECMP count
Use a minimum value of a CLI version and a value of Zebra capabilities.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-05-18 21:32:32 +03:00
Donald Sharp 907183cb35
Merge pull request #13430 from opensourcerouting/feature/rip_allow-ecmp_limit
ripd: Implement allow-ecmp X command
2023-05-11 20:31:46 -04:00
Renato Westphal 76f444a5d3 ripd: fix another memtype mismatch
Fixes #13447.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-05-08 12:30:50 -03:00
Donatas Abraitis f21277a38a ripd: Do not overrun with more ECMP paths than Zebra supports
Let's say FRR is compiled with ECMP max 16, we enter `allow-ecmp 10`, but
Zebra supports only 4.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-05-05 23:11:16 +03:00
Donatas Abraitis 75fce4645a ripd: Implement allow-ecmp X command
Allow setting an arbitrary number of paths to be installed instead of ALL.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-05-04 15:43:02 +03:00
Renato Westphal 2da9c4c206 ripd: use correct memory type when freeing BFD profile
Fixes #13415.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-05-03 17:02:58 -03:00
Renato Westphal bf384bbc90 ripd: fix null-pointer dereference
Fixes #13416.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-05-03 17:01:36 -03:00
Donatas Abraitis da57946b0e
Merge pull request #13366 from zmw12306/rte_tag
ripd: add non-zero check for RIPv1 reserved field
2023-05-02 17:56:09 +03:00
zmw12306 762f54f088 ripd: add non-zero check for RIPv1 reserved field,
According to RFC2453 3.6, the tag of a RIP-1 entry should be zero
Signed-off-by: zmw12306 <zmw12306@gmail.com>
2023-04-25 15:17:01 -04:00