summaryrefslogtreecommitdiff
path: root/sharpd/sharp_zebra.c
AgeCommit message (Collapse)Author
2025-04-08sharpd: clean up variable-shadowing compiler warningsMark Stapp
Clean up -Wshadow in sharpd Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-10-28sharpd: Allow sharpd to watch nexthops in the mribDonald Sharp
Nothing special here, just allow sharpd to ask to watch nexthops in the mrib. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-07-04sharpd: fix set ZAPI_MESSAGE_NEXTHOP in nhg only when nexthops usedPhilippe Guibert
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: 8a71d93d85a6 ("sharpd: Add Super Happy Advanced Routing Protocol") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-01-26sharpd: Add ability to turn off watching of redistributionDonald Sharp
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-23sharpd: Fix coverity issuesDonald Sharp
New commits had an assignment instead of a comparison option. Coverity wisely found it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-22sharpd: Allow sharpd to listen to neighbor eventsDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-18bgpd, lib: add zapi_route_set_nhg_id() supportPhilippe Guibert
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>
2023-12-05sharpd: fix avoid twice sending NHG_DEL for a nexthop-groupPhilippe Guibert
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: 82beaf6ae520 ("sharpd: fix deleting nhid when suppressing nexthop from nh group") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-12-05sharpd: fix deleting nhid when suppressing nexthop from nh groupPhilippe Guibert
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: 82beaf6ae520 ("sharpd: fix deleting nhid when suppressing nexthop from nh group") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-11-30sharpd: fix deleting nhid when suppressing nexthop from nh groupPhilippe Guibert
When removing the last nexthop from a nexthop-group, the nexthop group remains in the zebra contexts: > ubuntu2204(config)# nexthop-group gdgd > 2023/11/23 14:06:36 SHARP: [Q5NBA-GN1BG] NHG ID assigned: 179687502 > ubuntu2204(config-nh-group)# nexthop 192.0.2.7 loop1 > ubuntu2204(config-nh-group)# 2023/11/23 14:06:38 ZEBRA: [VNMVB-91G3G] _netlink_nexthop_build_group: ID (179687502): group 338 > 2023/11/23 14:06:38 ZEBRA: [R43C6-KYHWT] netlink_nexthop_msg_encode: RTM_NEWNEXTHOP, id=179687502 > 2023/11/23 14:06:38 ZEBRA: [HYEHE-CQZ9G] nl_batch_send: netlink-dp (NS 0), batch size=44, msg cnt=1 > 2023/11/23 14:06:38 SHARP: [JWRCN-N9K90] Installed nhg 179687502 > > ubuntu2204(config-nh-group)# no nexthop 192.0.2.7 loop1 > 2023/11/23 14:06:47 SHARP: [Y2G2F-ZTW6M] nhg_add: nhg 179687502 not sent: no valid nexthops > ubuntu2204(config-nh-group)# do show nexthop-group rib 179687502 > ID: 179687502 (sharp) > RefCnt: 1 > Uptime: 00:00:23 > VRF: default > Valid, Installed > Depends: (338) > via 192.0.2.7, loop1 (vrf default), weight 1 Fix this by sending an NHG_DEL message when no nexthops are attached, and when the id was already installed. Fixes: 5a9c0931aa95 ("sharpd: don't send invalid nexthop-groups to zebra") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-11-23sharpd: replace `receive_notify` with requestDavid Lamparter
Send `ZEBRA_ROUTE_NOTIFY_REQUEST` rather than relying on the options field in zclient startup. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-20sharpd: use `zclient->nexthop_update`David Lamparter
Same as above. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-13sharpd: Clean up memory leaks on shutdownDonald Sharp
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>
2023-11-02lib: convert if_zapi_callbacks into actual hooksDavid Lamparter
...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-07-10sharpd: allow sharpd to install non-recursive routesMark Stapp
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-06-23sharpd: support opaque zapi notificationsMark Stapp
Add cli and support to sharpd to exercise the zapi opaque 'notification' features. Signed-off-by: Mark Stapp <mjs@labn.net>
2023-03-30sharpd: Adjust TED builderOlivier Dugeon
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>
2023-03-24*: Convert event.h to frrevent.hDonald Sharp
We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert `struct event_master` to `struct event_loop`Donald Sharp
Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert struct thread_master to struct event_master and it's ilkDonald Sharp
Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Rename thread.[ch] to event.[ch]Donald Sharp
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>
2023-02-17Merge pull request #12780 from opensourcerouting/spdx-license-idDonald Sharp
*: convert to SPDX License identifiers
2023-02-13sharpd: clang-format style fixStephen Worley
clang-format style fix Signed-off-by: Stephen Worley <sworley@nvidia.com>
2023-02-13lib,sharpd: add ability for sharpd to install vni labelsStephen Worley
Add the ability for sharpd to install vni labels for testing. This patch is just for testing/dev work purposes with evpn. It adds some code to vty for nexthop-groups so we can explicitly add a label to nexthops and then let sharpd encode them to zebra. Signed-off-by: Stephen Worley <sworley@nvidia.com>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-11-22sharpd: traffic control PoCSiger Yang
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-04*: Add ability to encode / decode resilence down zapiDonald Sharp
At this point add abilty for the encode/decode of the resilience down ZAPI to zebra. Just hookup sharpd at this point in time. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-03-27*: add SAFI argument to zclient_send_rnhDavid Lamparter
Just pushing that SAFI_UNICAST up 1 level to the caller. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-15Merge pull request #10427 from sworleys/Protodown-Reason-UpstreamRuss White
Add Support for Setting Protodown Reason Code
2022-03-12*: When matching against a nexthop send and process what it matched againstDonald Sharp
Currently the nexthop tracking code is only sending to the requestor what it was requested to match against. When the nexthop tracking code was simplified to not need an import check and a nexthop check in b8210849b8ac1abe2d5d9a5ab2459abfde65efa5 for bgpd. It was not noticed that a longer prefix could match but it would be seen as a match because FRR was not sending up both the resolved route prefix and the route FRR was asked to match against. This code change causes the nexthop tracking code to pass back up the matched requested route (so that the calling protocol can figure out which one it is being told about ) as well as the actual prefix that was matched to. Fixes: #10766 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-03-09sharpd: add support for setting protodownStephen Worley
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-02-02tests: Add CSPF topotestOlivier Dugeon
Add new topotest for the Constraints ShortestPath First (CSPF) algorithm. This topotest uses IS-IS-TE as base network to populate a Traffic Engineering Database (TED) and sharpd to call cspf algorithms on this IS-IS-TE topology. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2021-10-20*: convert zclient callbacks to tableDavid Lamparter
This removes a giant `switch { }` block from lib/zclient.c and harmonizes all zclient callback function types to be the same (some had a subset of the args, some had a void return, now they all have ZAPI_CALLBACK_ARGS and int return.) Apart from getting rid of the giant switch, this is a minor security benefit since the function pointers are now in a `const` array, so they can't be overwritten by e.g. heap overflows for code execution anymore. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-09-27*: Remove the ZEBRA_IMPORT_ROUTE_XXX zapi messagesDonald Sharp
These are no longer really needed. The client just needs to call nexthop resolution instead. So let's remove the zapi types. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27*: Add resolve via default flagDonald Sharp
2021-06-02*: eliminate redundant info from srv6 locator zapiHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02*: fix code format accourding to checkpatchHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02sharpd: support create/delete srv6-locator (step2)Hiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02sharpd: install_routes_helper support ZAPI_ROUTE flags (step1)Hiroki Shirokura
current route addition mechanism on shaprd support only ipv4/v6 nexthop routes simply. so It doesn't need to ensure flags of zapi_routes. Then when we want to configure more complicated routing feature (like a srv6), we will want to control flags of zapi_route. In this patch, it will supports to configure flags of zapi_route when sharpd calls ZEBRA_ROUTE_ADD. Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-05-03sharpd: add v4 redistribute watchingDonald Sharp
Add the ability for sharpd to watch v4 redistribution events Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-03-23sharpd: Add Traffic Engineering Database (TED)Olivier Dugeon
Add new feature and commands to sharpd in order to collect Traffic Engineering Database information from an IGP (OSPF or IS-IS) though the ZAPI Opaque Message and the support of the Link State Library. This feature serves as an example of how to code a Traffic Engineering Database consumer and tests the mechanism. Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2021-03-16sharpd: Dump metric received for the reachabilityDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-03-14sharpd: Convert over to using builtin printf functionalityDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-21sharpd: don't send invalid nexthop-groups to zebraMark Stapp
Ensure that there are valid (resolved) nexthops, and no invalid backup nexthops, in nhgs sent to zebra for installation. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-12-08sharpd, zebra: Pass and display opaque data as PoCDonald Sharp
Pass data from sharpd to zebra as opaque data and display it as part of the detailed route data. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-15*: Convert all usage of zclient_send_message to new enumDonald Sharp
The `enum zclient_send_status` enum needs to be extended throughout the code base to use the new states and to fix up places where we tested against the return value being non zero. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-15bgpd, lib, sharpd: Add enum for zclient_send_message returnDonald Sharp
Add a `enum zclient_send_status` for appropriate handling of return codes from zclient_send_message. Touch all the places where we handle this. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-15sharpd: Add buffering supportDonald Sharp
Have sharpd notice that when sending routes to zebra that the underlying system has buffered data and to pause sending more data to zebra until such time we get a callback that the write was successful to zebra. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-15sharpd: Re-arrange route_add|deleteDonald Sharp
These functions are never called outside of sharp_zebra.c, re-arrange a little to make the inclusions in sharp_zebra.h not needed and to also have these functions return whether or not the underlying buffering system was invoked in stream sending. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-06bgpd: Advertise FIB installed routes to bgp peers (Part 1)Soman K S
Issue: The bgp routes learnt from peers which are not installed in kernel are advertised to peers. This can cause routers to send traffic to these destinations only to get dropped. The fix is to provide a configurable option "bgp suppress-fib-pending". When the option is enabled, bgp will advertise routes only if it these are successfully installed in kernel. Fix (Part1) : * Added message ZEBRA_ROUTE_NOTIFY_REQUEST used by client to request FIB install status for routes * Added AFI/SAFI to ZAPI messages * Modified the functions zapi_route_notify_decode(), zsend_route_notify_owner() and route_notify_internal() to include AFI, SAFI as parameters Signed-off-by: kssoman <somanks@gmail.com>