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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>