summaryrefslogtreecommitdiff
path: root/lib/zclient.h
AgeCommit message (Collapse)Author
2020-11-15zebra: use smaller stream buffer for zapi route notificationsMark Stapp
The owner-notification zapi message is small; use a small buffer for it. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-11-15lib, zebra: Add ability to read kernel notice of Offload FailedDonald Sharp
The linux kernel is getting RTM_F_OFFLOAD_FAILED for kernel routes that have failed to offload. Write the code to receive these notifications from the linux kernel and store that data for display about the routes. 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>
2020-10-26bgpd: support for DF election in EVPN-MHAnuradha Karuppiah
DF (Designated forwarder) election is used for picking a single BUM-traffic forwarded per-ES. RFC7432 specifies a mechanism called service carving for DF election. However that mechanism has many disadvantages - 1. LBs poorly. 2. Doesn't allow for a controlled failover needed in upgrade scenarios. 3. Not easy to hw accelerate. To fix the poor performance of service carving alternate DF mechanisms have been proposed via the following drafts - draft-ietf-bess-evpn-df-election-framework draft-ietf-bess-evpn-pref-df This commit adds support for the pref-df election mechanism which is used as the default. Other mechanisms including service-carving may be added later. In this mechanism one switch on an ES is elected as DF based on the preference value; higher preference wins with IP address acting as the tie-breaker (lower-IP wins if pref value is the same). Sample output ============= >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> torm-11# sh bgp l2vpn evpn es 03:00:00:00:00:01:11:00:00:01 ESI: 03:00:00:00:00:01:11:00:00:01 Type: LR RD: 27.0.0.15:6 Originator-IP: 27.0.0.15 Local ES DF preference: 100 VNI Count: 10 Remote VNI Count: 10 Inconsistent VNI VTEP Count: 0 Inconsistencies: - VTEPs: 27.0.0.16 flags: EA df_alg: preference df_pref: 32767 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> torm-11# sh bgp l2vpn evpn route esi 03:00:00:00:00:01:11:00:00:01 *> [4]:[03:00:00:00:00:01:11:00:00:01]:[32]:[27.0.0.15] 27.0.0.15 32768 i ET:8 ES-Import-Rt:00:00:00:00:01:11 DF: (alg: 2, pref: 100) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-09-28lib,zebra,sharpd: add code for backup proto-NHs but disabledStephen Worley
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-28lib,sharpd: align zapi NHG apis a bitStephen Worley
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-28lib,zebra,sharpd: clang formatStephen Worley
Clang format for NHG API and sharpd patches. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28zebra: NHG ID bounds macrosStephen Worley
Determine the NHG ID spacing and lower bound with ZEBRA_ROUTE_MAX in macros. Directly set the upperbound to be the lower 28bits of the uint32_t ID space (the top 4 are reserved for l2-NHGs). Round that number down a bit to make it more even. Convert all former lower_bound calls to just use the macro. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28zebra,lib: command to only install proto-based nexthopsStephen Worley
Add a command/functionality to only install proto-based nexthops. That is nexthops owned/created by upper level protocols, not ones implicitly created by zebra. There are some scenarios where you would not want zebra to be arbitrarily installing nexthop groups and but you still want to use ones you have control over via lib/nexthop_group config and an upper level protocol. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-09-28lib, zebra: Add ability to send down a nhgid over route installDonald Sharp
Modify the send down of a route to use the nexthop group id if we have one associated with the route. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-09-28lib, zebra: Add ZAPI_NHG_ADD|DELETEDonald Sharp
Add the ability to send a NHG from an upper level protocol down to zebra. ZAPI_NHG_ADD encompasses both the addition and replace semantics ( If the id passed down does not exist yet, it's Add, else it's a replace ). Effectively zebra will take this nhg passed down save the nhg in the id hash for nhg's and then create the appropriate nhg's and finally install them into the linux kernel. Notification will be the ZAPI_NHG_NOTIFY_OWNER zapi message for normal success/failure messaging to the installing protocol. This work is being done to allow us to work with EVPN MH which needs the ability to modify NHG's that BGP will own and operate on. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-09-28lib: Add the ability to grab a nhg starting idDonald Sharp
Add new function zclient_get_nhg_start that will allow an upper level protocol to get a starting point for it's own nhg space. Give each protocol a space of 50 million. zebra will own the space from 0 - 199999999 because of SYSTEM, KERNEL and CONNECT route types. This is the start of some work that will allow upper level protocols to install and maintain their own NHG's. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-09-22lib, zebra: Add ability to read kernel notice of TRAP/OFFLOADDonald Sharp
The linux kernel is getting RTM_F_TRAP and RTM_F_OFFLOAD for kernel routes that have an underlying asic offload. Write the code to receive these notifications from the linux kernel and to store that data for display about the routes. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-09-11bgpd, lib, pbrd, zebra: Pass by ifnameDonald Sharp
When installing rules pass by the interface name across zapi. This is being changed because we have a situation where if you quickly create/destroy ephermeal interfaces under linux the upper level protocol may be trying to add a rule for a interface that does not quite exist at the moment. Since ip rules actually want the interface name ( to handle just this sort of situation ) convert over to passing the interface name and storing it and using it in zebra. Ticket: CM-31042 Signed-off-by: Stephen Worley <sworley@nvidia.com> Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-09-11Merge pull request #6789 from volta-networks/feat_ldp_igp_syncRenato Westphal
ldpd: Add support for LDP-IGP Synchronization
2020-09-09ldpd: Adding support for LDP IGP SynchronizationKaren Schoener
Signed-off-by: Lynne Morrison <lynne@voltanet.io> Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-08-20lib: zapi nexthop sort fixesMark Stapp
The sorting for zapi nexthops in zapi routes needs to match the sorting of nexthops done in zebra. Ensure all zapi_nexthop attributes are included in the sort. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-08-12lib, zebra: add support for sending ARP requestsJakub Urbańczyk
We can make the Linux kernel send an ARP/NDP request by adding a neighbour with the 'NUD_INCOMPLETE' state and the 'NTF_USE' flag. This commit adds new dataplane operation as well as new zapi message to allow other daemons send ARP/NDP requests. Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
2020-08-10Merge pull request #6783 from opensourcerouting/feature/sr-teRuss White
lib, zebra: Add SR-TE policy infrastructure to zebra
2020-08-10Merge pull request #6483 from sylane/router-id-v6Donald Sharp
zebra: add IPv6 router-id
2020-08-07lib, zebra: Add SR-TE policy infrastructure to zebraSebastien Merle
For the sake of Segment Routing (SR) and Traffic Engineering (TE) Policies there's a need for additional infrastructure within zebra. The infrastructure in this PR is supposed to manage such policies in terms of installing binding SIDs and LSPs. Also it is capable of managing MPLS labels using the label manager, keeping track of nexthops (for resolving labels) and notifying interested parties about changes of a policy/LSP state. Further it enables a route map mechanism for BGP and SR-TE colors such that learned BGP routes can be mapped onto SR-TE Policies. This PR does not introduce any usable features by now, it is just infrastructure for other upcoming PRs which will introduce 'pathd', a new SR-TE daemon. Co-authored-by: Renato Westphal <renato@opensourcerouting.org> Co-authored-by: GalaxyGorilla <sascha@netdef.org> Signed-off-by: Sebastien Merle <sebastien@netdef.org>
2020-08-05lib: MAC-IP flags used by zebra and BGP for SYNC route handlingAnuradha Karuppiah
1. BGP informs zebra if a MAC-IP is a SYNC path and if it active on the ES peer. 2. Zebra sends paths that are "local-inactive" with the proxy flag to BGP. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-08-05zebra: Ethernet segment management and support for MAC-ECMPAnuradha Karuppiah
1. Local ethernet segments are configured in zebra by attaching a local-es-id and sys-mac to a access interface - >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ! interface hostbond1 evpn mh es-id 1 evpn mh es-sys-mac 00:00:00:00:01:11 ! >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> This info is then sent to BGP and used for the generation of EAD-per-ES routes. 2. Access VLANs associated with an (ES) access port are translated into ES-EVI objects and sent to BGP. This is used by BGP for the generation of EAD-EVI routes. 3. Remote ESs are imported by BGP and sent to zebra. A list of VTEPs is maintained per-remote ES in zebra. This list is used for the creation of the L2-NHG that is used for forwarding traffic. 4. MAC entries with a non-zero ESI destination use the L2-NHG associated with the ESI for forwarding traffic over the VxLAN overlay. Please see zebra_evpn_mh.h for the datastruct organization details. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2020-07-17lib,sharpd,zebra: initial support for multiple backup nexthopsMark Stapp
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-17zebra: add IPv6 router-idSebastien Merle
* add a vrf sub-command `[no] ipv6 router-id X:X::X:X`. * add command `[no] ipv6 router-id X:X::X:X [vrf NAME]` for backward compatibility. * add a vrf sub-command `[no] ip router-id A.B.C.D` and make the old one without `ip` an alias for it. * add a command `[no] ip router-id A.B.C.D [vrf NAME]` for backward comptibility and make the old one without `ip` an alias for it. * add command `show ip router-id [vrf NAME]` and make the old one without `ip` an alias for it. * add command `show ipv6 router-id [vrf NAME]`. * add ZAPI commands `ZEBRA_ROUTER_ID_V6_ADD`, `ZEBRA_ROUTER_ID_V6_DELETE` and `ZEBRA_ROUTER_ID_V6_UPDATE` for deamons to get notified of the IPv6 router-id. * update zebra documentation. Signed-off-by: Sebastien Merle <sebastien@netdef.org>
2020-06-10lib,zebra,sharpd: modify opaque zapi message to support unicastMark Stapp
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-10lib,zebra: rename opaque decode apiMark Stapp
Change name of an opaque zapi api to 'decode' to align with the other zapi message parsing apis. Missed that in the original opaque commits. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-02Merge pull request #6506 from volta-networks/ldp_pwstatus_cleanupRenato Westphal
ldpd: remove unused 'pwstatus' field from message zapi_pw_status
2020-06-02ldpd: remove unused 'pwstatus' field from message zapi_pw_status.Karen Schoener
Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-06-02lib: add OPAQUE zapi messageMark Stapp
Add a zapi message type designed to carry opaque data. Add 'send' api, and prototype for client handler function. Also add registration/unreg messages, so that clients can 'subscribe' to receive these messages as they're passing through zebra. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-01Merge pull request #6480 from volta-networks/feat_pwstatusRenato Westphal
ldpd: Relay data plane pseudowire status in LDP notification
2020-06-01lib: add zapi_nexthop2str()Mark Stapp
Add a handy 2str api for zapi nexthop debugging. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-01lib: add backup nexthop/nhlfe to zapi label messagesMark Stapp
Add backup nexthops/nhlfes to the zapi messages used to convey LSPs to zebra. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-06-01ldpd: Relay data plane pseudowire status in LDP notificationKaren Schoener
Provide a way for the data plane to indicate pseudowire status (such as: not forwarding, AC failure). On a data plane pseudowire install failure, data plane sets the pseudowire status. Zebra relays the pseudowire status to LDP. LDP includes the pseudowire status in the LDP notification to the LDP peer. Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-04-22lib, zebra: add missing extern "C" {} blocks to new header filesRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-04-16lib,zebra: add a session id for zapi sessionsMark Stapp
Distinguish zapi sessions, for daemons who use more than one, by adding a session id. The tuple of proto + instance is not adequate to support clients who use multiple zapi sessions. Include the id in the client show output if it's present. Add a bit of info about this to the developer doc. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-04-13lib: make all zclient.[ch] stream funcs safeQuentin Young
Use STREAM_GET* variants of stream getters, which all have non-assert error paths. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-03-27lib: support backup nexthops in nexthop-groups and zapiMark Stapp
Add vty support for backup nexthops in nexthop groups. Capture backup nexthop info in zapi route messages. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-27lib: add backup nexthops to zapi routesMark Stapp
Add backup nexthop info to zapi route messages. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-27zebra,lib: use const in more apisMark Stapp
Use const with some args to ipaddr, zebra vxlan, mpls lsp, and nexthop apis; add some extra checks to some nexthop-related apis. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-03-26Merge pull request #5925 from volta-networks/synchronous_clientRenato Westphal
zebra: synchronous client queues accumulate messages from zebra
2020-03-23zebra: Synchronous client queues accumulate messages from zebra.Karen Schoener
Zebra is currently sending messages on interface add/delete/update, VRF add/delete, and interface address change - regardless of whether its clients had requested them. This is problematic for lde and isis, which only listens to label chunk messages, and only when it is waiting for one (synchronous client). The effect is the that messages accumulate on the lde synchronous message queue. With this change: - Zebra does not send unsolicited messages to synchronous clients. - Synchronous clients send a ZEBRA_HELLO to zebra. The ZEBRA_HELLO contains a new boolean field: sychronous. - LDP and PIM have been updated to send a ZEBRA_HELLO for their synchronous clients. Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-03-22lib: Modify zclient_send_rnh to use const struct prefixDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-14*: encode zapi labels message using nexthopsMark Stapp
Use the zapi_nexthop struct with the mpls_labels zapi messages instead of the special-purpose (and more limited) nexthop struct that was being used. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-01-30lib: Adding GR capabilites encode and decode.Santosh P K
For Graceful restart clients have to send GR capabilities library functions are added to encode capabilities and also for zebra to decode client capabilities. Co-authored-by: Santosh P K <sapk@vmware.com> Co-authored-by: Soman K S <somanks@vmware.com> Signed-off-by: Santosh P K <sapk@vmware.com>
2020-01-23bgpd: Zebra lib for Graceful Restart.bisdhdh
These changes are for Zebra lib in order to supportGraceful Restart feature. These changes are addedtemporarily, until Zebra Graceful Restart lib Pr is merged. Signed-off-by: Biswajit Sadhu <sadhub@vmware.com> Signed-off-by: Soman K S <somanks@vmware.com>
2020-01-15zebra: fix redist memleak on client disconnectQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-01-08lib,zebra: add zapi msg top level error handlingStephen Worley
Add error handling for top level failures (not able to execute command, unable to find vrf for command, etc.) With this error handling we add a new zapi message type of ZEBRA_ERROR used when we are unable to properly handle a zapi command and pass it down into the lower level code. In the event of this, we reply with a message of type enum zebra_error_types containing the error type. The sent packet will look like so: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length | Marker | Version | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | VRF ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Command | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ERROR TYPE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Also add appropriate hooks for clients to subscribe to for handling these types of errors. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-12-09lib, zebra: Allow for encode/decode of nexthop weight in pass downDonald Sharp
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-06Merge pull request #5332 from mjstapp/remove_zapi_label_flagDonald Sharp
*: revise zapi nexthop encoding