summaryrefslogtreecommitdiffstats
path: root/sharpd/sharp_zebra.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* sharpd: Allow sharpd to watch nexthops in the mribDonald Sharp2024-10-281-5/+6
| | | | | | | Nothing special here, just allow sharpd to ask to watch nexthops in the mrib. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* sharpd: fix set ZAPI_MESSAGE_NEXTHOP in nhg only when nexthops usedPhilippe Guibert2024-07-041-1/+1
| | | | | | | | | | 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>
* sharpd: Add ability to turn off watching of redistributionDonald Sharp2024-01-261-3/+4
| | | | | | | | 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>
* sharpd: Fix coverity issuesDonald Sharp2024-01-231-1/+1
| | | | | | | New commits had an assignment instead of a comparison option. Coverity wisely found it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* sharpd: Allow sharpd to listen to neighbor eventsDonald Sharp2024-01-221-0/+43
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* bgpd, lib: add zapi_route_set_nhg_id() supportPhilippe Guibert2023-12-181-2/+1
| | | | | | | | | 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>
* sharpd: fix avoid twice sending NHG_DEL for a nexthop-groupPhilippe Guibert2023-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* sharpd: fix deleting nhid when suppressing nexthop from nh groupPhilippe Guibert2023-12-051-4/+4
| | | | | | | | | | 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>
* sharpd: fix deleting nhid when suppressing nexthop from nh groupPhilippe Guibert2023-11-301-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* sharpd: replace `receive_notify` with requestDavid Lamparter2023-11-231-3/+2
| | | | | | | Send `ZEBRA_ROUTE_NOTIFY_REQUEST` rather than relying on the options field in zclient startup. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* sharpd: use `zclient->nexthop_update`David Lamparter2023-11-201-15/+8
| | | | | | Same as above. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* sharpd: Clean up memory leaks on shutdownDonald Sharp2023-11-131-0/+14
| | | | | | | | | | | | | 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>
* lib: convert if_zapi_callbacks into actual hooksDavid Lamparter2023-11-031-2/+4
| | | | | | | | | ...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>
* sharpd: allow sharpd to install non-recursive routesMark Stapp2023-07-101-1/+0
| | | | | | | | 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>
* sharpd: support opaque zapi notificationsMark Stapp2023-06-231-0/+34
| | | | | | | Add cli and support to sharpd to exercise the zapi opaque 'notification' features. Signed-off-by: Mark Stapp <mjs@labn.net>
* sharpd: Adjust TED builderOlivier Dugeon2023-03-301-1/+1
| | | | | | | 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>
* *: Convert event.h to frrevent.hDonald Sharp2023-03-241-1/+1
| | | | | | | We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert `struct event_master` to `struct event_loop`Donald Sharp2023-03-241-1/+1
| | | | | | Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Convert struct thread_master to struct event_master and it's ilkDonald Sharp2023-03-241-1/+1
| | | | | | | Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Rename thread.[ch] to event.[ch]Donald Sharp2023-03-241-1/+1
| | | | | | | | | | | 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>
* Merge pull request #12780 from opensourcerouting/spdx-license-idDonald Sharp2023-02-171-16/+1
|\ | | | | *: convert to SPDX License identifiers
| * *: auto-convert to SPDX License IDsDavid Lamparter2023-02-091-16/+1
| | | | | | | | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | sharpd: clang-format style fixStephen Worley2023-02-141-2/+2
| | | | | | | | | | | | clang-format style fix Signed-off-by: Stephen Worley <sworley@nvidia.com>
* | lib,sharpd: add ability for sharpd to install vni labelsStephen Worley2023-02-141-0/+5
|/ | | | | | | | | | 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>
* sharpd: traffic control PoCSiger Yang2022-11-221-35/+87
| | | | | | | 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>
* *: Add ability to encode / decode resilence down zapiDonald Sharp2022-11-041-0/+3
| | | | | | | | 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>
* *: add SAFI argument to zclient_send_rnhDavid Lamparter2022-03-271-1/+2
| | | | | | Just pushing that SAFI_UNICAST up 1 level to the caller. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge pull request #10427 from sworleys/Protodown-Reason-UpstreamRuss White2022-03-161-0/+12
|\ | | | | Add Support for Setting Protodown Reason Code
| * sharpd: add support for setting protodownStephen Worley2022-03-091-0/+12
| | | | | | | | | | | | | | 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>
* | *: When matching against a nexthop send and process what it matched againstDonald Sharp2022-03-121-4/+5
|/ | | | | | | | | | | | | | | | | | 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>
* tests: Add CSPF topotestOlivier Dugeon2022-02-021-1/+3
| | | | | | | | 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>
* *: convert zclient callbacks to tableDavid Lamparter2021-10-201-18/+26
| | | | | | | | | | | | | 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>
* *: Remove the ZEBRA_IMPORT_ROUTE_XXX zapi messagesDonald Sharp2021-09-271-11/+3
| | | | | | | | | 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>
* *: Add resolve via default flagDonald Sharp2021-09-271-1/+1
|
* *: eliminate redundant info from srv6 locator zapiHiroki Shirokura2021-06-021-34/+15
| | | | Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
* *: fix code format accourding to checkpatchHiroki Shirokura2021-06-021-8/+11
| | | | Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
* sharpd: support create/delete srv6-locator (step2)Hiroki Shirokura2021-06-021-0/+63
| | | | Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
* sharpd: install_routes_helper support ZAPI_ROUTE flags (step1)Hiroki Shirokura2021-06-021-7/+13
| | | | | | | | | | | | 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>
* sharpd: add v4 redistribute watchingDonald Sharp2021-05-041-0/+6
| | | | | | Add the ability for sharpd to watch v4 redistribution events Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* sharpd: Add Traffic Engineering Database (TED)Olivier Dugeon2021-03-231-0/+27
| | | | | | | | | | | 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>
* sharpd: Dump metric received for the reachabilityDonald Sharp2021-03-161-1/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* sharpd: Convert over to using builtin printf functionalityDonald Sharp2021-03-141-11/+6
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* sharpd: don't send invalid nexthop-groups to zebraMark Stapp2021-01-211-1/+31
| | | | | | | | 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>
* sharpd, zebra: Pass and display opaque data as PoCDonald Sharp2020-12-081-9/+18
| | | | | | | 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>
* *: Convert all usage of zclient_send_message to new enumDonald Sharp2020-11-151-4/+6
| | | | | | | | | 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>
* bgpd, lib, sharpd: Add enum for zclient_send_message returnDonald Sharp2020-11-151-8/+4
| | | | | | | | 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>
* sharpd: Add buffering supportDonald Sharp2020-11-151-22/+106
| | | | | | | | | 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>
* sharpd: Re-arrange route_add|deleteDonald Sharp2020-11-151-68/+85
| | | | | | | | | 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>
* bgpd: Advertise FIB installed routes to bgp peers (Part 1)Soman K S2020-11-061-1/+2
| | | | | | | | | | | | | | | | | | 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>
* *: make failure to decode nht update an errorQuentin Young2020-10-011-2/+1
| | | | | | | This should never happen; no need to debug guard it and it's not a warning, if this isn't working then NHT is not working at all. Signed-off-by: Quentin Young <qlyoung@nvidia.com>