Add End.B6.Encap support to install seg6local routes.
> ubuntu2204hwe# sharp install seg6local-routes 4004::4 nexthop-seg6local loop1 End_B6_Encap nexthop-seg6 2001::5 encap 2001🅰️🅱️c 2001🅰️:d:e 1
> ubuntu2204hwe# do show ipv6 route
> [..]
> D>* 4004::4/128 [150/0] via 2001::5, loop1, seg6local End.B6.Encap nh6 2001::5, seg6 2001🅰️🅱️c,2001🅰️:d:e, weight 1, 00:00:04
The uB6_Encap operation is also supported, but not displayed in the
documentation as iproute2 does not support it yet.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Add the possibility to configure uSID seg6local route with specific
block and node length.
> ubuntu2204hwe# sharp install seg6local-routes 1005::1 nexthop-seg6local loop1 uN usid-block-length 40 usid-function-length 8 1
> ubuntu2204hwe# Ctrl-D
> # ip -6 ro show
> 1005::1 nhid 26 encap seg6local action End flavors next-csid lblen 40 nflen 8 dev loop1 proto 194 metric 20 pref medium
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Seg6local routes can be installed with uSID instruction.
> ubuntu2204hwe# sharp install seg6local-routes 1006::1 nexthop-seg6local loop1 uN
> ubuntu2204hwe# Ctrl-D
> # ip -6 ro show
> 1006::1 nhid 28 encap seg6local action End flavors next-csid lblen 32 nflen 16 dev loop1 proto 194 metric 20 pref medium
As of today, uA and uN can be displayed with iproute2. The other
instructions are not rejected by the kernel, but are not displayed by
iproute2.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
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>
This adds 2 commands, one that should just straight up SEGV, another
that should trip an ASAN warning for an use-after-free.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
The ZAPI_MESSAGE_NEXTHOP flag is systematically set, even if the
route message does not include any nexthops. Limit the usage of this
value only when nexthops are present.
Fixes: 8a71d93d85 ("sharpd: Add Super Happy Advanced Routing Protocol")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Add the support for adding DX6 behavior into netlink layer of zebra.
Add the necessary test in sharpd.
> ubuntu2204# sharp install seg6local-routes 1:1::1:2 nexthop-seg6local loop1 End_DX6 4:4::4:6 1
> ubuntu2204# do show ipv6 route
> [..]
> D>* 1:1::1:2/128 [150/0] is directly connected, loop1, seg6local End.DX6 nh6 4:4::4:6, weight 1, 00:00:03
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
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>
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>
Wanted to do some testing of redistribute without having
to restart sharpd over and over. Added ability to
turn off the `sharp watch redistribute XX` functionality.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
There is no function that both sets the nhg id, and sets
the ZAPI_MESSAGE_NHG flag if the nhg id is valid.
Create a ZAPI API to do this, and apply the changes wherever
needed.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
After removing the nexthop of a nexthop group, when the nexthop group
is removed, a nhg removal failure happens:
> ubuntu2204(config)# nexthop-group CCC
> ubuntu2204(config-nh-group)# nexthop 192.0.2.211 loop1
> ubuntu2204(config-nh-group)# no nexthop 192.0.2.211 loop1
> [..]
> 2023/12/05 08:59:22 SHARP: [H3QKG-WH8ZV] Removed nhg 179687505
> ubuntu2204(config-nh-group)# exi
> ubuntu2204(config)# no nexthop-group CCC
> [..]
> 2023/12/05 08:59:27 SHARP: [N030J-V0SFN] Failed removal of nhg 179687505
The NHG_DEL message is sent twice at the nexthop deletion, and at the
nexthop-group deletion. Avoid sending it twice.
Fixes: 82beaf6ae5 ("sharpd: fix deleting nhid when suppressing nexthop from nh group")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
When no nexthops are in a nexthop group, two successive events are
sent: NHG_DEL and NHG_ADD, but only the NHG_DEL one is necessary.
Fixes this by returning in the nhg_add() function.
Fixes: 82beaf6ae5 ("sharpd: fix deleting nhid when suppressing nexthop from nh group")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Send `ZEBRA_ROUTE_NOTIFY_REQUEST` rather than relying on the options
field in zclient startup.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
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>
a) The cleanup of zclient on shutdown was not being
done
b) Cleanup vrf shutdown
c) Cleanup some lists
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
sharpd: Cleanup shutdown of vrf and some lists
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
...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>
Append zebra and lib to use muliple SRv6 segs SIDs, and keep one
seg SID for bgpd and sharpd.
Note: bgpd and sharpd compilation relies on the lib and zebra files,
i.e if we separate this: lib or zebra or bgpd or sharpd in different
commits - this will not compile.
Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
Add a config option so that sharpd can install routes without
the ALLOW_RECURSION flag, matching IGP behavior.
The default remains 'recursion'.
Signed-off-by: Mark Stapp <mjs@labn.net>
Following the modification of the edge key in link state database
this patch updates the sharp_vty.c file to replace the old uint64_t edge key by
the new ls_edge_key structure when searching for an edge.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
When passing a prefix into a function let's pass by address instead
of pass by value. Let's save our stack space.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Following correction of IS-IS subnet creation, this patch adjust the way the
TED is created in sharpd to automatically adjust subnet deletion.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
Effectively a massive search and replace of
`struct thread` to `struct event`. Using the
term `thread` gives people the thought that
this event system is a pthread when it is not
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This is a first in a series of commits, whose goal is to rename
the thread system in FRR to an event system. There is a continual
problem where people are confusing `struct thread` with a true
pthread. In reality, our entire thread.c is an event system.
In this commit rename the thread.[ch] files to event.[ch].
Signed-off-by: Donald Sharp <sharpd@nvidia.com>