summaryrefslogtreecommitdiff
path: root/lib/zclient.h
AgeCommit message (Collapse)Author
2022-05-02*: use FRR interface name definition everywhereRafael Zalamena
Don't rely on the OS interface name length definition and use the FRR definition instead. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-04-26zebra, pimd: add AF param on NEXTHOP_LOOKUP_MRIBDavid Lamparter
By changing this API call to use a `struct ipaddr`, which encodes the type of IP address with it. (And rename/remove the `IPV4` from the command name.) Also add a comment explaining that this function call is going to be obsolete in the long run since pimd needs to move to proper MRIB NHT. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
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-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>
2021-11-15lib: rename bfd function to reflect real functionalityIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-26Merge pull request #9854 from opensourcerouting/zapi-call-tableRuss White
*: convert zclient callbacks to table
2021-10-22lib: finish fixing spelling in lib filesewlumpkin
Signed-off-by: ewlumpkin <ewlumpkin@gmail.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-27zebra: Attempt to clarify variable names as they are usedDonald Sharp
Cleanup the poorly implemented variable names so that we can understand what is going on a bit better. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
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-09-07lib: add zapi encode/decode func for srv6 locatorHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-08-26lib, zebra: complete the ndm flags on zclient apiPhilippe Guibert
Insist on the fact that zclient neighbor state flags are mapped over netlink state flags. List all the defines currently known on kernel, and create a netlink API to convert netlink values to zclient values. The function is simplified as it is a 1-1 match. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-08-26nhrp, zebra, lib: pass exact received neighbor state value to nhrpPhilippe Guibert
As NHRP expects some notification of neighboring entries on GRE interface, when a new interface notification is encountered, the exact neighbor state flag is found. Previously, the flag passed to the upper layer was forced to NDM_STATE which is REACHABLE, as can be seen on below trace: 2021/08/25 10:58:39 NHRP: [QQ0NK-1H449] Netlink: new-neigh 102.1.1.1 dev gre1 lladdr 10.125.0.2 nud 0x2 cache used 1 type 5 When passing the real value, NHRP received an other value like STALE. 2021/08/25 11:28:44 NHRP: [QQ0NK-1H449] Netlink: new-neigh 102.1.1.1 dev gre1 lladdr 10.125.0.2 nud 0x4 cache used 0 type 5 This flag is important for NHRP, as it permits to monitor the link layer of NHRP entries. Fixes: d603c0774eba ("nhrp, zebra, lib: enforce usage of zapi_neigh_ip structure") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-06-28isisd, ospfd: update interface_link_params callback to check for changeKaren Schoener
Adding defensive code to the interface_link_params zebra callback to check if the link params changed before taking action. Signed-off-by: Karen Schoener <karen@voltanet.io>
2021-06-02*: delete ZEBRA_FLAG_SEG6*_ROUTE and add ZAPI_NEXTHOP_FLAG_SEG6*Hiroki Shirokura
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>
2021-06-02zebra: delete unneeded zebra_srv6_manager_connectHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02zebra: add zapi_srv6_locator_chunk_{en,de}codeHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02lib: add usual func to install SRv6 localsid (step4)Hiroki Shirokura
This commit add usuful function to configure SRv6 localsid which is represented with seg6local lwt route. Now, it can support only NEXTHOP_TYPE_IFINDEX route. Actual configurationof SRv6 localsid is performed with ZEBRA_ROUTE_ADD. So this is just a wrapper function for route-install. Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02lib: add new nexthop's attributes seg6 (step3)Hiroki Shirokura
This commit add new nexthop's addional object for SRv6 routing about seg6 route. Before this commit, we can add MPLS info as additional object on nexthop. This commit make it add more support about seg6 routes. seg6 routes are ones of the LWT routing mechanism, so configuration of seg6local routes is performed by ZEBRA_ROUTE_SEND, it's same as MPLS configuration. Real configuration implementation isn't implemented at this commit. later commit add that. This commit add only nexthop additional object and some misc functions. Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02lib: add new structures for srv6-locator (step2)Hiroki Shirokura
This commit is a part of #5853 works that add new structures for SRv6-locator. This structure will be used by zebra and another routing daemon and its ZAPI messaging to manage SRv6-locator. Encoder/decoder for ZAPI stream is also added by this commit. Real configuration mechanism isn't implemented at this commit. later commit add real configure implementation. This commit add only SRv6-locator's structures and misc functions. Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02lib: add new nexthop's attributes seg6local (step1)Hiroki Shirokura
This commit is a part of #5853 works that add new nexthop's addional object for SRv6 routing about seg6local route. Before this commit, we can add MPLS info as additional object on nexthop. This commit make it add more support about seg6local routes. seg6local routes are ones of the LWT routing mechanism, so configuration of seg6local routes is performed by ZEBRA_ROUTE_SEND, it's same as MPLS configuration. Real configuration implementation isn't implemented at this commit. later commit add that. This commit add only nexthop additional object and some misc functions. Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-04-30lib, zebra: get gre informationPhilippe Guibert
the get gre information code is obtained by nhrp, via zebra. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-30zebra: add 3 new gre commands, and enforce synchro mecanismPhilippe Guibert
3 new gre commands are available: - GRE_GET to permit a daemon to retrieve gre information. - GRE_UPDATe is the reply message from zebra to the daemon. as it is a syncronous request, the GRE_GET expected will have to match the vrf id where the gre information is wished. this has an impact on label manager with change in APIs. - SET_GRE_SOURCE. this command will be stubbed for now, assuming that the gre interface is set accordingly by external script. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-28lib, bgpd, zebra: RA interval is unsignedQuentin Young
Use unsigned value for all RA requests to Zebra - encoding signed int as unsigned is bad practice - RA interval is never, and should never be, negative Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2021-04-27Merge pull request #8488 from mjstapp/more_workqueueStephen Worley
lib, zebra: use zebra workqueue for NHG updates
2021-04-15lib: add 2string for zapi nhg result codesMark Stapp
Add a utility '2string' function for daemon nhg result codes. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-04-13nhrp, zebra, lib: enforce usage of zapi_neigh_ip structurePhilippe Guibert
zapi_nbr structure is renamed to zapi_neigh_ip. Initially used to set a neighbor ip entry for gre interfaces, this structure is used to get events from the zebra layer to nhrp layer. The ndm state has been added, as it is needed on both sides. The zebra dplane layer is slightly modified. Also, to clarify what ZEBRA_NEIGH_ADD/DEL means, a rename is done: it is called now ZEBRA_NEIGH_IP_ADD/DEL, and it signified that this zapi interface permits to set link operations by associating ip addresses to link addresses. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-09zebra, lib: handle NEIGH_ADD/DELETE to zebra dataplane frameworkPhilippe Guibert
EVPN neighbor operations were already done in the zebra dataplane framework. Now that NHRP is able to use zebra to perform neighbor IP operations (by programming link IP operations), handle this operation under dataplane framework: - assign two new operations NEIGH_IP_INSTALL and NEIGH_IP_DELETE; this is reserved for GRE like interfaces: example: ip neigh add A.B.C.D lladdr E.F.G.H - use 'struct ipaddr' to store and encode the link ip address - reuse dplane_neigh_info, and create an union with mac address - reuse the protocol type and use it for neighbor operations; this permits to store the daemon originating this neighbor operation. a new route type is created: ZEBRA_ROUTE_NEIGH. - the netlink level functions will handle a pointer, and a type; the type indicates the family of the pointer: AF_INET or AF_INET6 if the link type is an ip address, mac address otherwise. - to keep backward compatibility with old queries, as no extension was done, an option NEIGH_NO_EXTENSION has been put in place - also, 2 new state flags are used: NUD_PERMANENT and NUD_FAILED. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-09lib: add api to configure neighbor table per interfacePhilippe Guibert
this api is needed for nhrp. the goal is to implement it in zebra, while other daemon will used it. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-09nhrp, lib, zebra: add/del neighbor entry possible from nhrpPhilippe Guibert
a zebra api is extended to offer ability to add or remove neighbor entry from daemon. Also this extension makes possible to add neigh entry, not only between IPs and macs, but also between IPs and NBMA IPs. This API supports configuring ipv6/ipv4 entries with ipv4/ipv6 lladdr. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-09zebra: link layer config and notification, implementation in zebraPhilippe Guibert
zebra implements zebra api for configuring link layer information. that can be an arp entry (for ipv4) or ipv6 neighbor discovery entry. This can also be an ipv4/ipv6 entry associated to an underlay ipv4 address, as it is used in gre point to multipoint interfaces. this api will also be used as monitoring. an hash list is instantiated into zebra (this is the vrf bitmap). each client interested in those entries in a specific vrf, will listen for following messages: entries added, removed, or who-has messages. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-09lib: link layer neighbor registration and notification, define API msgsPhilippe Guibert
This patch implements new zapi api to get neighbor information that zebra knows and that other daemons may need to know. Actually, nhrp daemons is interested in getting the neighbor information on gre interfaces, and the API will be used for that. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-03-30Merge pull request #8137 from Orange-OpenSource/ospf_lsRuss White
ospfd: Add Link State support
2021-03-25lib/zebra: zapi for installing EVPN nexthops from bgpAnuradha Karuppiah
EVPN nexthops are installed as remote neighs by zebra. This was earlier done only via VRF IPvX uni routes imported from EVPN routes. With EVPN-MH these VRF routes now reference a L3NHG which is setup based on the EAD and doesn't include the RMAC. To workaround that BGP now consolidates and maintains EVPN nexthops which are then sent to zebra. zebra sets up these nexthops as L3-VNI nh entries using a dummy type-1 route as reference. Ticket: CM-31398 Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2021-03-23lib: Update Link State DatabaseOlivier Dugeon
Add new status for Vertex, Edge and Subnet to manage their respective states in the data base. Add new functions: - to register/unregister server and client - to show content of the Database (VTY and Json output) - to update and compare subnets - to clean vertex and ted from ORPHAN elements - to convert message or stream into a Link State Element and update Link State Database accordingly to message event Change Edge and Vertex key computation by using the host order systematically. This impact mostly key based on IPv4 addresses where `ntohl()` function must be used when searching a Vertex or Edge by key. Update the documentation accordingly Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2021-03-10zebra: move ipset and ipset_entry to zebra dplane contextsPhilippe Guibert
like it has been done for iptable contexts, a zebra dplane context is created for each ipset/ipset entry event. The zebra_dplane_ctx job is then enqueued and processed by separate thread. Like it has been done for zebra_pbr_iptable context, the ipset and ipset entry contexts are encapsulated into an union of structures in zebra_dplane_ctx. There is a specificity in that when storing ipset_entry structure, there was a backpointer pointer to the ipset structure that is necessary to get some complementary information before calling the hook. The proposal is to use an ipset_entry_info structure next to the ipset_entry, in the zebra_dplane context. That information is used for ipset_entry processing. The ipset name and the ipset type are the only fields necessary. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-01-19libs,zebra: remove zapi nhg encode and decode public apisMark Stapp
The raw zapi apis to encode and decode NHGs don't need to be public; also add a little more validity-checking. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-01-13zebra: Create function to dump MACIP flagsDonald Sharp
Create a function to dump MACIP flags and to use it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-13zebra: Add ability to display in human readable format re->flags and statusDonald Sharp
The re->flags and re->status in debugs were being dumped as hex values. I can never quickly decode this. Here is an idea. Let's let FRR do it for me. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-08ldpd: add support for RLFA clientsRenato Westphal
Add an API that allows IGP client daemons to register/unregister RLFAs with ldpd. IGP daemons need to be able to query the LDP labels needed by RLFAs and monitor label updates that might affect those RLFAs. This is similar to the NHT mechanism used by bgpd to resolve and monitor recursive nexthops. This API is based on the following ZAPI opaque messages: * LDP_RLFA_REGISTER: used by IGP daemons to register an RLFA with ldpd. * LDP_RLFA_UNREGISTER_ALL: used by IGP daemons to unregister all of their RLFAs with ldpd. * LDP_RLFA_LABELS: used by ldpd to send RLFA labels to the registered clients. For each RLFA, ldpd needs to return the following labels: * Outer label(s): the labels advertised by the adjacent routers to reach the PQ node; * Inner label: the label advertised by the PQ node to reach the RLFA destination. For the inner label, ldpd automatically establishes a targeted neighborship with the PQ node if one doesn't already exist. For that to work, the PQ node needs to be configured to accept targeted hello messages. If that doesn't happen, ldpd doesn't send a response to the IGP client daemon which in turn won't be able to activate the previously computed RLFA. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-12-10Merge pull request #7678 from donaldsharp/aspath_to_zebraRuss White
Aspath to zebra
2020-12-09ldpd, isisd, ospfd: Remove periodic ldp-sync hello messageKaren Schoener
Removing the obsolete ldp-sync periodic 'hello' message. When ldp-sync is configured, IGPs take action if the LDP process goes down. The IGPs have been updated to use the zapi client close callback to detect the LDP process going down. Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-12-08lib: Add encode/decode of opaque dataDonald Sharp
Add a bit of code that allows for opaque data to be sent from an upper level protocol to zebra. This is just pass through data that will be used as part of displaying useful data about a route in a `show ip route` command in future commits. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-08lib, zebra: Fix overlapping message typesDonald Sharp
We had duplicate message id's. Shit's broke yo. Fix. I have no idea how this properly worked. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-07zebra: Adding zapi client close notificationKaren Schoener
When zebra detects a client close, send a zapi client close notification. Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-11-18Merge pull request #7478 from donaldsharp/bufferMark Stapp
Buffer
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-15bgpd, lib: Indicate when we are buffering instead of immediately sending ↵Donald Sharp
down ZAPI When FRR sends data over the ZAPI protocol from the upper levels to zebra, indicate to the calling functions that we have started buffering data to be sent if the socket is full underneath it. Also add a call back function `zebra_buffer_write_ready` that we can call when an upper level protocol's socket buffer has been drained. Signed-off-by: Donald Sharp <sharpd@nvidia.com>