Commit Graph

69 Commits

Author SHA1 Message Date
Donald Sharp
241e5df125 sharpd: Re-arrange route_add|delete
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-15 14:50:17 -05:00
Soman K S
77b38a4a7d bgpd: Advertise FIB installed routes to bgp peers (Part 1)
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>
2020-11-06 08:39:28 +05:30
Quentin Young
6c83ddedcf *: make failure to decode nht update an error
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>
2020-09-30 18:37:15 -04:00
Stephen Worley
2173535298 lib,zebra,sharpd: add code for backup proto-NHs but disabled
Add the zapi code for encoding/decoding of backup nexthops for when
we are ready for it, but disable it for now so that we revert
to the old way with them.

When zebra gets a proto-NHG with a backup in it, we early fail and
tell the upper level proto. In this case sharpd. Sharpd then reverts
to the old way of installation with the route.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28 12:41:00 -04:00
Stephen Worley
c6ce9334b5 lib,sharpd: align zapi NHG apis a bit
Align the zapi NHG apis to be more consistent with the zapi_route
apis. Add a struct zapi_nhg to use for encodings as well.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28 12:41:00 -04:00
Stephen Worley
54a701e4c1 sharp: add check for num_nh > multipath
Add a check for installing nexthop_group greater than multipath
number. Truncate if we hit it and log a warning to the user.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28 12:41:00 -04:00
Stephen Worley
ff9aca4f8d lib,zebra,sharpd: clang format
Clang format for NHG API and sharpd patches.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28 12:41:00 -04:00
Stephen Worley
2053061bae sharpd: implement NHG notification handling
Implement handling of NHG notifications in sharpd so that
the routes don't attempt to use an NHG ID that did not
successfully get created. If it does not get installed, we
fall back to traditional zapi messaging.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28 12:41:00 -04:00
Donald Sharp
569e87c0c8 sharpd: add abilty to send a nhg to zebra
Modify the sharpd program to have the ability to pass down
a NHG and then operate on it for route installation.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-09-28 12:40:59 -04:00
Jakub Urbańczyk
da187b7705 sharpd: add a command to send ARP/NDP requests
Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
2020-08-12 23:20:04 +02:00
Mark Stapp
faa75dfa6c sharpd: support 'update lsp' zapi testing
Add 'update' support so that sharpd can exercise add,
update, and delete zapi exchanges for LSPs.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-08-04 13:58:16 -04:00
Mark Stapp
474aebd939 lib,sharpd,zebra: initial support for multiple backup nexthops
Initial changes to support a nexthop with multiple backups. Lib
changes to hold a small array in each primary, zapi message
changes to support sending multiple backups, and daemon
changes to show commands to support multiple backups. The config
input for multiple backup indices is not present here.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-07-17 13:12:33 -04:00
Donald Sharp
373edbbc99
Merge pull request #6530 from mjstapp/backup_nhg_notify
lib, zebra: async notifications for backup routes and LSPs
2020-07-10 10:54:59 -04:00
Mark Stapp
8b85b2cb59 sharpd: be explicit if nht is uninstalled
Emit a debug if sharpd gets a nexthop-tracking message
without any nexthops.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-07-07 13:14:01 -04:00
Mark Stapp
04cbc08f89 sharpd: use extern for globals
Use extern when declaring a couple of globals in sharp_zebra.
gcc 10 on fedora 32 needs this.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-07-07 13:00:42 -04:00
Mark Stapp
2be4d61a86 sharpd: add zclient session create and delete
Add a couple of clis and some simple support that allows sharpd to
create extra zapi client sessions.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-16 12:24:24 -04:00
Mark Stapp
c8b27f2ad9 sharpd,zebra: unicast support for zapi messages
Distinguish between unicast and broadcast opaque messages
in zebra handler code. Add cli and internal api changes to
have sharpd send unicast opaque messages. Add opaque cli
commands to the sharp user doc.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-10 15:05:25 -04:00
Mark Stapp
387831ffc3 lib,zebra,sharpd: modify opaque zapi message to support unicast
Start modifying the OPAQUE zapi message to include optional
unicast destination zapi client info. Add a 'decode' api and
opaque msg struct to encapsulate that optional info.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-10 08:26:27 -04:00
Mark Stapp
7f5ac77319 sharpd: add handler for OPAQUE messages
Add a simple handler to receive OPAQUE zapi messages for
testing.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-02 08:22:24 -04:00
Mark Stapp
939b2339b4 sharpd: send opaque message registrations
For testing, add cli to sharpd to send opaque message
registration and un-registration messages.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-02 08:22:24 -04:00
Mark Stapp
2ac6c90d18 sharpd: send new OPAQUE messages
Add a simple cli to exercise the new OPAQUE messages.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-02 08:21:38 -04:00
Mark Stapp
665edffd1e sharpd: include backup nh info with lsps
If present in a configured nexthop_group, include
backup nexthop/nhlfe info with LSP zapi add/update
messages.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-01 14:46:32 -04:00
Mark Stapp
1df3b1dc65 sharpd: support backup nexthops
Add cli and zapi support for backup nexthops for sharpd routes.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-27 09:39:14 -04:00
David Lamparter
d6951e5ef9 *: remove tabs from log messages
Some logging systems are, er, "allergic" to tabs in log messages.
(RFC5424: "The syslog application SHOULD avoid octet values below 32")

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-03-24 18:47:12 +01:00
Donald Sharp
136b3d67db
Merge pull request #5779 from mjstapp/sharp_with_lsps
sharpd: add support to install/remove lsps
2020-03-17 11:40:35 -04:00
Donatas Abraitis
15569c58f8 *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__
Just keep the code cool.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-05 20:23:23 +02:00
Mark Stapp
c9e5adba73 sharpd: add support for install/remove lsps
First round of support for exercising the lsp and ftn paths
using sharpd. This supports lsp-only, and binding to
ipv4 prefix. Also use the common lib nexthop-to-zapi
helper api instead of sharpd's open-coded version.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-02-25 10:55:51 -05:00
Donald Sharp
bd054c1aa2 lib, zebra: Allow for encode/decode of nexthop weight in pass down
Add code to encode/decode the nexthop weight when we pass it down
into zebra.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-12-09 13:37:37 -05:00
Mark Stapp
054af19a41 lib,sharpd: support labelled nexthop-groups in sharpd
Update sharpd's zapi client code to support labelled nexthops if
they're present in a nexthop-group.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-06 13:49:25 -05:00
Donald Sharp
721c08573a *: Convert connected_free to a double pointer
Set the connected pointer to set the pointer to NULL.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-11-02 16:13:44 -04:00
Donald Sharp
67a9eda9ee sharpd: Start infrastructure to allow for redistribution testing
Start the work in sharpd to allow the testing of redistribution
of routes.  Namely telling zebra to tell us about redistribution events
via the callback.

Future work here will allow sharpd to specify the redistribution
events it wants and to allow us to track that via counters.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-02 10:01:35 -04:00
Donald Sharp
3c3c325203 *: Convert zapi->interface_delete to ifp callback
Convert the callback of the interface_delete to the new
ifp callback.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
b0b69e59f4 *: Convert interface_down to interface down callback
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
ddbf3e6060 *: Convert from ->interface_up to the interface callback
For all the places we have a zclient->interface_up convert
them to use the interface ifp_up callback instead.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
ef7bd2a3d5 *: Switch all zclient->interface_add to interface create callback
Switch the zclient->interface_add functionality to have everyone
use the interface create callback in lib/if.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
138c5a7450 *: Add infrastructure to support zapi interface callbacks
Start the conversion to allow zapi interface callbacks to be
controlled like vrf creation/destruction/change callbacks.

This will allow us to consolidate control into the interface.c
instead of having each daemon read the stream and react accordingly.
This will hopefully reduce a bunch of cut-n-paste stuff

Create 4 new callback functions that will be controlled by
lib/if.c

create -> A upper level protocol receives an interface creation event
The ifp is brand spanking newly created in the system.
up -> A upper level protocol receives a interface up event
This means the interface is up and ready to go.
down -> A upper level protocol receives a interface down
destroy -> A upper level protocol receives a destroy event
This means to delete the pointers associated with it.

At this point this is just boilerplate setup for future commits.
There is no new functionality.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
f54f37c19f sharpd: Fix repeat sub-command to work
The repeat sub-command was not properly repeating.  It was starting
the removal during the install:

2019/08/03 00:10:14.351 SHARP: Inserting 300000 routes
2019/08/03 00:13:01.556 SHARP: Installed All Items 167.204747
2019/08/03 00:13:01.556 SHARP: Removing 300000 routes
2019/08/03 00:13:03.126 SHARP: Inserting 300000 routes
2019/08/03 00:14:34.794 SHARP: Removed all Items 91.668040
2019/08/03 00:16:11.743 SHARP: Installed All Items 188.616462
2019/08/03 00:16:11.743 SHARP: Removing 300000 routes
2019/08/03 00:16:14.256 SHARP: Inserting 300000 routes

This command allows the remove to wait till the install is fully
finished and vice versa:

2019/08/03 00:22:54 SHARP: Inserting 10000 routes
2019/08/03 00:22:55 SHARP: Installed All Items 0.572028
2019/08/03 00:22:55 SHARP: Removing 10000 routes
2019/08/03 00:22:55 SHARP: Removed all Items 0.568284
2019/08/03 00:22:55 SHARP: Inserting 10000 routes
2019/08/03 00:22:56 SHARP: Installed All Items 0.567687
2019/08/03 00:22:56 SHARP: Removing 10000 routes
2019/08/03 00:22:56 SHARP: Removed all Items 0.551011

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-08-02 20:35:16 -04:00
Donald Sharp
a36898e755
Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
Philippe Guibert
f11e98eca3 *: change if_lookup_by_name() api with vrf
the vrf_id parameter is replaced by struct vrf * parameter.
this impacts most of the daemons that look for an interface based on the
name and the vrf identifier.
Also, it fixes 2 lookup calls in zebra and sharpd, where the vrf_id was
ignored until now.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 08:37:54 +02:00
David Lamparter
051a0be4b2 *: fix some dumb printf format warnings
Some types like `time_t` vary across platforms and always need to be
cast when printed.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-06-11 13:34:57 +02:00
Donald Sharp
9a8a7b0ed1 lib, pimd, sharpd: Various output string cleanups
Various compilers in our CI system were complaining about various
auto-conversions.  Let's get these cleaned up a bit more.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-06-07 09:29:45 -04:00
Quentin Young
121f9dee7c *: use ZAPI_CALLBACK_ARGS macro for zapi handlers
This macro:
- Marks ZAPI callbacks for readability
- Standardizes argument names
- Makes it simple to add ZAPI arguments in the future
- Ensures proper types
- Looks better
- Shortens function declarations

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-03 20:57:35 +00:00
Donald Sharp
91529dc88d sharpd: Add ability to pass vrf we want to watch
Add the ability for the sharp zebra code to pass down the
vrf that we want to watch.  At this point in time, we
cannot use it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-01 16:15:02 -05:00
Donald Sharp
0cf08685d2 sharpd: Setup route installation to be able to select vrf to use
Modify the sharp code to allow for vrf route installation.  At
this point in time the code is nascent.  Future commits will turn
on this behavior.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-01 16:12:05 -05:00
Donald Sharp
b47dc61ade sharpd: Allow the registration of import checks to zebra
Minor code modification to allow the sharp_zebra.c code
to differentiate between import check or nexthop watch
types.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-13 09:28:38 -05:00
Donald Sharp
86da53ab0e sharpd: Add 'sharp data nexthop' data dump
Add some basic data dumping about what we have watched
from the vty/vtysh cli for nexthops.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-07 10:14:17 -05:00
Donald Sharp
547dc6429c sharpd: Move route global variables into the global data structure
Clean up the route global variables into a global data structure.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-07 10:14:17 -05:00
Donald Sharp
a60ffbc985 sharpd: Allow nhop tracking to specify connected
Allow the sharp daemon to specify whether or not a watched
nexthop should be connected or not.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-07 09:35:49 -05:00
Donald Sharp
25c84d86d7 sharpd: Do addition/subtraction for me
Write a bit of code to track the start/stop times and do subtraction!
In the future we expect this code to slice and dice as well.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-10 19:29:00 -05:00
Donald Sharp
dbc1bf462b sharpd: Allow route install/removal of v6 routes.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-10 19:26:31 -05:00