summaryrefslogtreecommitdiff
path: root/zebra/zapi_msg.h
AgeCommit message (Collapse)Author
2024-01-22lib, nhrpd: Move neighbor reg/unreg to lib/zclient.cDonald Sharp
This is needed to be generic. Let's make it so. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-22*: Rename ZEBRA_NHRP_NEIGH_XXX to ZEBRA_NEIGH_XXXDonald Sharp
This does not need to be nhrp specific. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-10-20zebra: add redistribute table-direct supportPhilippe Guibert
Redistributing routes from a specific routing table to a particular routing protocol necessitates copying route entries to the main routing table using the "ip import-table" command. Once copied, these routes are assigned a distinct "table" route type, which the "redistribute table" command of the routing protocol then picks up. For illustration, here is a configuration that showcases the use of "import-table" and "redistribute": > # show running-config > [..] > ip route 172.31.0.10/32 172.31.1.10 table 100 > router bgp 65500 > address-family ipv4 unicast > redistribute table 100 > exit-address-family > exit > ip import-table 100 > > # show ip route vrf default > [..] > T[100]>* 172.31.0.10/32 [15/0] via 172.31.1.10, r2-eth1, weight 1, 00:00:05 However, this method has inherent constraints: - The 'import-table' parameter only handles route table id up to 252. The 253/254/255 table ids are reserved in the linux system, and adding other table IDs above 255 leads to a design issue, where the size of some tables is directly related to the maximum number of table ids to support. - Duplicated route entries might interfere with original default table routes, leading to potential conflicts. There is no guarantee that the zebra RIB will favor these duplicated entries during redistribution. - There are cases where the table ID can be checked independently of the default routing table, as seen in Linux where the "ip rule" command is able to divert traffic to that routing table. In that case, there is no need to duplicate route entries in the default routing table. To overcome these issues, a new redistribution type is proposed to redistribute route entries directly from a specified routing table, eliminating the need for an initial import into the default table. Add a 'ZEBRA_ROUTE_TABLE_DIRECT' type to the 'REDISTRIBUTE' ZAPI messages. It allows sending routes from a given non default table ID from zebra to a routing daemon. The destination routing protocol table must be the default table. The redistributed route inherit from the default distance value of 14: this is the distance value reserved for routes redistributed via ROUTE_TABLE_DIRECT. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-10-07*: remove ZEBRA_INTERFACE_VRF_UPDATEanlan_cs
Currently when one interface changes its VRF, zebra will send these messages to all daemons in *order*: 1) `ZEBRA_INTERFACE_DELETE` ( notify them delete from old VRF ) 2) `ZEBRA_INTERFACE_VRF_UPDATE` ( notify them move from old to new VRF ) 3) `ZEBRA_INTERFACE_ADD` ( notify them added into new VRF ) When daemons deal with `VRF_UPDATE`, they use `zebra_interface_vrf_update_read()->if_lookup_by_name()` to check the interface exist or not in old VRF. This check will always return *NULL* because `DELETE` ( deleted from old VRF ) is already done, so can't find this interface in old VRF. Send `VRF_UPDATE` is redundant and unuseful. `DELETE` and `ADD` are enough, they will deal with RB tree, so don't send this `VRF_UPDATE` message when vrf changes. Since all daemons have good mechanism to deal with changing vrf, and don't use this `VRF_UPDATE` mechanism. So, it is safe to completely remove all the code with `VRF_UPDATE`. Signed-off-by: anlan_cs <anlan_cs@tom.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-01-31zebra: name the route_entry opaque struct more specificallyMark Stapp
The name 'opaque' is a little general - call the route_entry struct 're_opaque' to make it more specific. Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2022-01-18zebra: Modify route_notify_internal to use a route_nodeDonald Sharp
Pass in the route_node that is under consideration into route_notify_internal to allow calling functions to reduce stack size as well as looking up data. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-01-18zebra: Modify zsend_redistribute_route to receive struct route_nodeDonald Sharp
The function zsend_redistribute_route uses the prefix and source prefix. Just pass in the route_node instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-08-19zebra: Fix usage to enum in notify functionsDonald Sharp
For some reason commit #ef524230a6baa decided to remove enums and switch to uint16_t. Which is not the right thing to do. Put it back Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-06-02*: fix code format accourding to checkpatchHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-06-02zebra: ZAPI add new api to manipulate srv6-locator (step2)Hiroki Shirokura
This commit is a part of #5853 works that add new ZAPI to configure SRv6 locator which manages chunk prefix for SRv6 SID IPv6 address for each routing protocol daemons. NEW-ZAPIs: * ZEBRA_SRV6_LOCATOR_ADD * ZEBRA_SRV6_LOCATOR_DELETE * ZEBRA_SRV6_MANAGER_CONNECT * ZEBRA_SRV6_MANAGER_GET_LOCATOR_CHUNK * ZEBRA_SRV6_MANAGER_RELEASE_LOCATOR_CHUNK Zclient can connect to zebra's srv6-manager with ZEBRA_SRV6_MANAGER_CONNECT api like a label-manager. Then zclient uses ZEBRA_SRV6_MANAGER_GET_LOCATOR_CHUNK to allocated dedicated locator chunk for it's routing protocol. Zebra works for only prefix reservation and distribute the ownership of the locator chunks for zcliens. Then, zclient installs SRv6 function with ZEBRA_ROUTE_ADD api with nh_seg6local_* fields. This feature is already implemented by another PR(#7680). Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
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: 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-03-22zebra: kill zebra_memory.h, use MTYPE_STATICDavid Lamparter
This one also needed a bit of shuffling around, but MTYPE_RE is the only one left used across file boundaries now. Signed-off-by: David Lamparter <equinox@diac24.net>
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-03-04zebra: move iptable handling in zebra_dplanePhilippe Guibert
The iptable processing was not handled in remote dataplane, and was directly processed by the thread in charge of zapi calls. Now that call can be handled in the zebra_dplane separate thread. once a zebra_dplane_ctx is allocated for iptable handling, the hook call is performed later. Subsequently, a return code may be triggered to zclient interface if any problem occurs when calling the hook call. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-01-22zebra: send async nhg update resultsMark Stapp
Send the results of daemons' nhg updates asynchronously, after the update has actually completed. Capture additional info about the source daemon in order to locate the correct zapi session. Simplify the result types considered by the zebra_nhg module. Signed-off-by: Mark Stapp <mjs@voltanet.io>
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-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-09-28zebra: Convert zserv_nexthop_num_warn to return boolDonald Sharp
Allow us to key of the warning if we have one. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-10Merge pull request #6783 from opensourcerouting/feature/sr-teRuss White
lib, zebra: Add SR-TE policy infrastructure to zebra
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-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-10zebra: convert ip rule installation to use dplane threadJakub Urbańczyk
* Implement new dataplane operations * Convert existing code to use dataplane context object * Modify function preparing netlink message to use dataplane context object Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
2020-06-02zebra: call zapi message handler with a batchMark Stapp
The zapi code processes a batch of incoming messages, using a fifo. Hand the entire batch into the main zebra handling code, and let it loop through the individual messages. Divert the special OPAQUE messages from the normal processing flow, and offer them to the new zebra_opaque module instead. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-04-16zebra,ldpd: use zapi client session id in LM apisMark Stapp
Use the zapi client session id in the label manager apis; use the client struct directly in some code. Assign a session id to ldpd's sync LM zapi session. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-09-12zebra: revise redistribution delete to improve update caseMark Stapp
When selecting a new best route, zebra sends a redist update when the route is installed. There are cases where redist clients may not see that redist add - clients who are not subscribed to the new route type, e.g. In that case, attempt to send a redist delete for the old/previous route type. Revised the redist delete api to accomodate both cases; also tightened up the const-ness of a few internal redist apis. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-07-10zebra: label manager refactorEmanuele Di Pascale
in order to both streamline the code and allow users to define their own specialized versions of the LM api handlers, define hooks for the 4 main primitives offered by the label manager (i.e. connect, disconnect, get_chunk and release_chunk), and have the existing code be run in response to a hook_call. Additionally, have the responses to the requesting daemon be callable from an external API. Note that the proxy version of the label manager was a source of issues and hardly used in practice. With the new hooks, users with more complex requirements can simply plug in their own code to handle label distribution remotely, so there is no longer a reason to maintain this code. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2019-03-25add cplusplus guards to all zebra headersEmanuele Di Pascale
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2019-01-31zebra: Add ability to send to all clients updated capability informationDonald Sharp
When capability information changes, allow for resending of data. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-25zebra: revise struct names to resolve review commentsMark Stapp
Use standard type naming and remove use of typedef to resolve some review comments. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25zebra: start dataplane layer workMark Stapp
Reduce or eliminate use of global zebra_ns structs in a couple of netlink/kernel code paths, so that those paths can potentially be made asynch eventually. Slide netlink_talk_info into place to remove dependency on core zebra structs; add accessors for dplane context block Start init of route context from zebra core re and rn structs; start queueing and event handling for incoming route updates. Expose netlink apis that don't rely on zebra core structs; add parallel route-update code path using the dplane ctx; simplest possible event loop to process queued route' updates. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-08-14zebra, lib: error references for zebraQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-07-11zebra, libs: use const prefix ptrs in apisMark Stapp
Add 'const' to prefix args to several zebra route update, redistribution, and route owner notification apis. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-05-29zebra: optimize zserv_process_messagesQuentin Young
* Simplify zapi_msg <-> zserv interaction * Remove header validity checks, as they're already performed before the packet ever makes it here * Perform the same kind of batch processing done in zserv_write by copying multiple inbound packets under lock instead of doing serial locking * Perform self-scheduling under the same lock Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-22zebra: style last 3 changesQuentin Young
Fixup latent style issues in copied code. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-22zebra: cleanup for zapi_msg.c splitQuentin Young
* Rename client_connect and client_close hooks to zapi_client_connect and zapi_client_close * Remove some more unnecessary headers * Fix a copy-paste error in zapi_msg.[ch] header comments * Fix an inclusion comment in zserv.c Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-22zebra: clean up zapi organizationQuentin Young
zserv.c has become something of a dumping ground for everything vaguely related to ZAPI and really needs some love. This change splits out the code fo building and consuming ZAPI messages into a separate source file, leaving the actual session and client lifecycle code in zserv.c. Unfortunately since the #include situation in Zebra has not been paid much attention I was forced to fix the headers in a lot of other source files. This is a net improvement overall though. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>