Commit graph

109 commits

Author SHA1 Message Date
Philippe Guibert cb8d0e125c sharpd: add End.B6.Encap behaviour to seg6local routes
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>
2025-04-25 15:22:47 +02:00
Philippe Guibert a65e5eab3e sharpd: add uSID block and function length parameters to seg6local route
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>
2025-04-25 14:51:49 +02:00
Philippe Guibert 542a0f7518 sharpd: add uSID instruction support to seg6local routes
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>
2025-04-25 14:30:13 +02:00
David Lamparter cda7c4ed31 sharpd: add crashme commands
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>
2025-02-14 17:31:18 +01:00
Donatas Abraitis 564a8bca2c
Merge pull request #17445 from cscarpitta/fix/sharp-use-ipv6-max-bitlen
sharpd: Convert numeric 128 into IPV6_MAX_BITLEN for prefixlen
2024-11-17 14:19:58 +02:00
Carmine Scarpitta 58b2e8c5b0 sharpd: Use IPV6_MAX_BITLEN in sharp send opaque notify
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-11-17 08:24:44 +01:00
Carmine Scarpitta 0019ecff1b sharpd: Use IPV6_MAX_BITLEN in sharp install seg6local-routes
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-11-17 08:24:18 +01:00
Carmine Scarpitta cf658b28b1 sharpd: Fix typo in sharp install seg6local-routes help message
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-11-17 08:16:26 +01:00
Carmine Scarpitta 4cb6f5b875 sharpd: Fix typo in sharp install seg6-routes help message
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-11-17 08:15:51 +01:00
Carmine Scarpitta 769751f6fc sharpd: Fix typo in sharp install routes help message
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-11-17 08:15:00 +01:00
Donald Sharp aff8eaa4a2 sharpd: Allow sharpd to watch nexthops in the mrib
Nothing special here, just allow sharpd to ask to watch
nexthops in the mrib.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-10-28 14:10:06 -04:00
Philippe Guibert f6e58d26f6 zebra, sharpd: add srv6 End.DX6 support
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>
2024-04-25 13:54:25 +02:00
Donald Sharp 3d97d2679f sharpd: Add ability to turn off watching of redistribution
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>
2024-01-26 09:26:30 -05:00
Donald Sharp 01cb1fb82c sharpd: Allow sharpd to listen to neighbor events
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-22 12:19:20 -05:00
Donatas Abraitis 02d8b80ce4 *: Do not cast to the same type as the destination is
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-09-29 10:24:16 +03:00
Dmytro Shytyi f20cf1457d bgpd,lib,sharpd,zebra: srv6 introduce multiple segs/SIDs in nexthop
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>
2023-09-20 15:07:15 +02:00
Mark Stapp 89ff272d38 sharpd: allow sharpd to install non-recursive routes
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>
2023-07-10 16:43:53 -04:00
Mark Stapp f6700b3491 sharpd: support opaque zapi notifications
Add cli and support to sharpd to exercise the zapi opaque
'notification' features.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-06-23 08:57:37 -04:00
Philippe Guibert 7b343a9ed5
Merge pull request #12933 from Orange-OpenSource/link_state
lib: Update edge key in link state database
2023-04-20 18:33:21 +02:00
Olivier Dugeon f2dcaf3555 sharpd: Update TE to new Link State Edge key
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>
2023-04-07 16:40:26 +02:00
Donald Sharp b589466918 *: Use a struct prefix *p instead of a struct prefix in functions
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>
2023-04-06 18:00:09 -04:00
Keelan10 5aa36ff77b sharpd: Fix sharpd memory leak
Free path

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
2023-04-03 17:51:48 +04:00
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
Siger Yang 04bc334e7a
sharpd: traffic control PoC
This commit adds a command to sharpd to validate the proof of concept for
traffic control on specific interface with specific filters.

Signed-off-by: Siger Yang <siger.yang@outlook.com>
2022-11-22 22:35:35 +08:00
David Lamparter 89cb86aeb0 build, vtysh: extract vtysh commands from .xref
Rather than running selected source files through the preprocessor and a
bunch of perl regex'ing to get the list of all DEFUNs, use the data
collected in frr.xref.

This not only eliminates issues we've been having with preprocessor
failures due to nonexistent header files, but is also much faster.
Where extract.pl would take 5s, this now finishes in 0.2s.  And since
this is a non-parallelizable build step towards the end of the build
(dependent on a lot of other things being done already), the speedup is
actually noticeable.

Also files containing CLI no longer need to be listed in `vtysh_scan`
since the .xref data covers everything.  `#ifndef VTYSH_EXTRACT_PL`
checks are equally obsolete.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-26 17:12:34 +01:00
Carmine Scarpitta 6c2e67be73 sharpd: add support for SRv6 End.DT46 behavior
This commit adds the support for SRv6 End.DT46 behavior to SHARPD.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-10-18 16:08:23 +02:00
Donald Sharp cf00164b69 *: Create and use infrastructure to show debugs in lib
There are lib debugs being set but never show up in
`show debug` commands because there was no way to show
that they were being used.  Add a bit of infrastructure
to allow this and then use it for `debug route-map`

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-07 12:39:05 -04:00
Carmine Scarpitta 877682e328 sharpd: Fix memory leaks related to SRv6 nexthops
Running the `zebra_seg6local_route` topotest with `--valgrind-memleaks`
gives several memory leak errors. This is due to the way SRv6 routes
(seg6 and seg6local routes) are handled: when the user executes the CLI
command `sharp install seg6-routes` or `sharp install seg6local-routes`
to create a seg6 or seg6local route, sharpd calls
`nexthop_add_srv6_seg6` or `nexthop_add_srv6_seg6local` to create an
SRv6 nexthop. A pointer to the SRv6 nexthop is stored in the global data
structure `sg.r.nhop`. If you call `sharp install routes`,
`sharp install seg6-routes` or `sharp install seg6local-routes` to create
more routes, `sg.r.nhop` is set to zero and the
pointer to the SRv6 nexthop contained in `sg.r.nhop` is definitely lost
and the allocated memory is never freed.

This patch adds calls to `nexthop_del_srv6_seg6()` and
`nexthop_del_srv6_seg6local()` to free the memory allocated for the SRv6
nexthop before clearing the `sg.r.nhop` data structure.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-08-24 14:22:04 +02:00
Carmine Scarpitta 6dece5ac29 sharpd: Fix memory leak in release-locator-chunk
Running the `zebra_seg6local_route` topotest with `--valgrind-memleaks`
gives several memory leak errors. This is due to the way SRv6 chunks are
released: when the user executes the CLI command
`sharp srv6-manager release-locator-chunk` to release the chunks of an
SRv6 locator, the `list_delete()` function is called to delete the
chunks list (`loc->chunks`), but the memory allocated for the chunks is
not freed.

This patch defines a new callback `sharp_srv6_locator_chunk_free()`.
This callback takes care of freeing the memory allocated for a given
chunk. When `list_delete()` is called to remove the chunk list
`loc->chunks`, it automatically calls `sharp_srv6_locator_chunk_free()`
on each element of the list to free the allocated memory before
deleting the list.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-08-24 14:22:04 +02:00
Carmine Scarpitta a0c47583a4 sharpd: Fix memory leak in release-locator-chunk
Running the `zebra_seg6local_route` topotest with `--valgrind-memleaks`
gives several memory leak errors. This is due to the way SRv6 chunks are
released: when the user executes the CLI command
`sharp srv6-manager release-locator-chunk` to release the chunks of an
SRv6 locator, all the chunks are removed from the list `loc->chunks`.
Also, the locator is removed from the SRv6 locators list
`sg.srv6_locators`, but the memory allocated for the locator is not
freed.

This patch adds a call to `XFREE()` to properly free the allocated
memory when all the chunks of an SRv6 locator are removed and the
locator is removed as well.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2022-08-24 14:22:04 +02:00
David Lamparter 5c7a6fb36c build: fix new gcc 11.2 warnings
Some recent improvement in GCC triggers 2 new warnings, and they're
actual bugs (reading beyond end of prefix_ipv6 by accessing it as
prefix, which is larger.)  Luckily it's only in sharpd.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-04-25 14:07:41 +02:00
Stephen Worley f9a1140c9a sharpd: add support for setting protodown
Add support for setting protodown via sharpd. This is just useful
for testing. We can make use of this in topotests.

Signed-off-by: Stephen Worley <sworley@nvidia.com>
2022-03-09 17:52:44 -05:00
anlan_cs 4d4c404bf6 *: Add necessary new line for output of vty_out()
Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-02-27 10:59:19 +08:00
Russ White e735c8073c
Merge pull request #9649 from proelbtn/add-support-for-end-dt4
add support for SRv6 IPv4 L3VPN
2022-02-08 08:30:02 -05:00
Olivier Dugeon 621fb5f341 sharpd: Add call to CSPF
New Constaint Shortest Path First algorithm has been introduce in FRR library.
Add a new 'show sharp cspf' command as example of how to use these
CSPF algorithm.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2022-02-02 17:04:12 +01:00
Donatas Abraitis c48349e346 *: Remove redundand braces for single statement blocks
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-27 11:20:59 +02:00
Donatas Abraitis 7297350e61 sharpd: Convert vty_out to vty_json for JSON
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-25 17:49:56 +02:00
Ryoga Saito 478d592ed7 sharpd: add support for End.DT4
This patch enables sharpd to insert End.DT4 routes into zebra.

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
2021-11-22 23:32:37 +09:00
Donatas Abraitis 8643c2e5f7 *: Replace 4/16 integers to IPV4_MAX_BYTELEN/IPV6_MAX_BYTELEN
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-01 23:54:39 +03:00
Donatas Abraitis 12256b84a5 *: Convert numeric 32 into IPV4_MAX_BITLEN for prefixlen
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-01 23:50:39 +03:00
Donatas Abraitis 13ccce6e7e *: Convert numeric 128 into IPV6_MAX_BITLEN for prefixlen
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-01 17:53:21 +03:00
Hiroki Shirokura 2ba6be5b24 bgpd,sharpd,zebra: fix code style
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02 10:24:48 -04:00
Hiroki Shirokura c60c1ade86 *: delete ZEBRA_FLAG_SEG6*_ROUTE and add ZAPI_NEXTHOP_FLAG_SEG6*
https://github.com/FRRouting/frr/pull/5865#discussion_r597670225

As this comment says. ZEBRA_FLAG_XXX should not have been used.
To communicate SRv6 Route Information. A simple Nexthop Flag would
have been sufficient for SRv6 information. And I fixed the whole
thing that way.

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02 10:24:48 -04:00
Hiroki Shirokura eab0f8f0a2 lib,sharpd,zebra: update nexthop object with nh_srv6
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02 10:24:48 -04:00
Hiroki Shirokura 1cb131eec3 sharpd: split srv6 route install command
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02 10:24:48 -04:00
Hiroki Shirokura a2df1e4f9a sharpd: follow the practice on cli design for json output
The "show sharp segment-routing srv6" command was a
json output command, but it did not follow the common
practice of the other commands.

It follows the review and outputs the json format by
using the json keyword. Otherwise, it produces human
readable output.

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02 10:24:48 -04:00
Hiroki Shirokura 1bda3e627d *: use one line init instead of memset and format it
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02 10:24:48 -04:00
Hiroki Shirokura 4df9d8592b *: fix code format accourding to checkpatch
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02 10:24:48 -04:00
Hiroki Shirokura af31f6c05c sharpd: install route supports nexthop-seg6 (step3)
We can install seg6 routes from shapd cli.
This is for the behaviour test(topotest) to ensure
SRv6 ZAPI is working fine.

NEW-CLI:
sharp install routes 1::1 nexthop-seg6 2001::1 encap a::

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02 10:24:48 -04:00
Hiroki Shirokura ade3eebc6a sharpd: support create/delete srv6-locator (step2)
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02 10:24:47 -04:00