summaryrefslogtreecommitdiff
path: root/lib/zclient.h
AgeCommit message (Collapse)Author
2025-03-21Merge pull request #18359 from soumyar-roy/soumya/streamsizeMark Stapp
zebra: zebra crash for zapi stream
2025-03-20zebra: reduce memory usage by streams when redistributing routesSoumya Roy
This commit undo 8c9b007a0c7efb2e9afc2eac936ba9dd971c6707 stream lib has been modified to expand the stream if needed Now for zapi route encode, we use expandable stream Signed-off-by: Soumya Roy <souroy@nvidia.com>
2025-03-10lib, tests, zebra: keep table routes at vrf disablingLouis Scalbert
At VRF disabling, keep the route entries that was associated to its table ID but not to the VRF itself. Kernel flushes these entries so we need to reinstall them. To do so, add a flag to mean that a route entry is owned by a table ID and not by a VRF. If the VRF associated to the table ID is deleted, the route entry must not be deleted. Update to tests with new flag. 2057 is in hexa 0x809, meaning that the new flag has been to some prefix. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-02-27zebra: reduce memory usage by streams when redistributing routesFrancois Dumontet
required stream size is evaluated as a fix part and variable one. the variable one depend on the number of nexthops. Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
2025-01-28Merge pull request #17941 from opensourcerouting/fix-dst-srcRuss White
static: fix botched staticd YANG conversion for dst-src
2025-01-28lib, zebra: carry source prefix in route_notifyDavid Lamparter
When a daemon wants to know about its routes, make it possible to have that work for dst-src routes. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-01-23bgpd,lib: document the table id / instance usageRafael Zalamena
Document where relevant about the instance overload to table ID so users know what to expect. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-01-23lib,zebra: VRF table-direct supportRafael Zalamena
Implement the necessary data structures and code changes to support sending table-direct routes to protocols running in different VRFs. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-12-12zebra,pimd,lib: Modify ZEBRA_NEXTHOP_LOOKUP_MRIBNathan Bahr
Modified ZEBRA_NEXTHOP_LOOKUP_MRIB to include the SAFI from which to do the lookup. This generalizes the API away from MRIB specifically and allows the user to decide how it should do lookups. Rename ZEBRA_NEXTHOP_LOOKUP_MRIB to ZEBRA_NEXTHOP_LOOKUP now that it is more generalized. This change is in preperation to remove multicast lookup mode completely from zebra. Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-10-16*: clang-SA friendly switch-enum-return-stringDavid Lamparter
clang-19's SA complains about unused initializers for this kind of "switch (enum) { return string }" kind of code. Use direct string return values to avoid the issue. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-10-06lib,zebra: remove unused ZEBRA_VRF_UNREGISTERDonna Sharp
Signed-off-by: Donna Sharp <dksharp5@gmail.com>
2024-06-17zebra, lib: add locator name in sid notify messagesPhilippe Guibert
In the near future, some daemons may only register SIDs. This may be the case for the pathd daemon when creating SRv6 binding SIDs. When a locator is getting deleted at ZEBRA level, the daemon may have an easy way to find out the SIds to unregister to. This commit proposes to add the locator name to the SID_SRV6_NOTIFY message whenever possible. Only case when an allocation failure happens, the locator will not be present. In all other places, the notify API at procol levels has the locator name extra-parameter. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13lib: Add ZAPI command `ZEBRA_SRV6_SID_NOTIFY`Carmine Scarpitta
Add a new ZAPI command `ZEBRA_SRV6_SID_NOTIFY` used by zebra to send asynchronous SRv6 SIDs notifications to zclients. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13lib: Add ZAPI operations to get/release SRv6 SIDsCarmine Scarpitta
Add two new ZAPI operations: `ZEBRA_SRV6_MANAGER_GET_SRV6_SID` and `ZEBRA_SRV6_MANAGER_RELEASE_SRV6_SID`. These APIs allow a daemon to get and release an SRv6 SID, respectively. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-06-13lib: Add ZAPI operation get SRv6 locatorCarmine Scarpitta
Add a new ZAPI operation, ZEBRA_SRV6_MANAGER_GET_LOCATOR, which allows a daemon to request information about a specific locator from the SRv6 SID Manager. Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-04-22*: Use uint64_t for weight down the path to ZebraDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-01-24lib,zebra: add zapi message to control noarp flagLouis Scalbert
Add a ZAPI message to control the setting of the IFF_NOARP flag. Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
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>
2024-01-09Merge pull request #15001 from pguibert6WIND/zebra_nexthop_reworkRuss White
Zebra nexthop rework
2024-01-05lib: remove zebra_interface_vrf_update_read()Louis Scalbert
zebra_interface_vrf_update_read is orphan. Remove it. Fixes: b580c52698 ("*: remove ZEBRA_INTERFACE_VRF_UPDATE") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2023-12-18bgpd, lib: add zapi_route_set_nhg_id() supportPhilippe Guibert
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>
2023-12-05Merge pull request #12600 from donaldsharp/local_routesRuss White
*: Introduce Local Host Routes to FRR
2023-11-23lib, bgp/vnc: add `.auxiliary` zclient optionDavid Lamparter
Avoids calling VRF/interface/... handlers in library code more than once. It's kinda surprising that this hasn't been blowing up already for the VNC code, luckily these handlers are (mostly?) idempotent. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-23*: add `zclient_options_sync`David Lamparter
... and use it instead of fiddling with the `.synchronous` field. (Make it const while at it.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-23lib: remove `.receive_notify` zclient optionDavid Lamparter
This should just be set with `ZEBRA_ROUTE_NOTIFY_REQUEST` instead. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-22Merge pull request #14850 from donaldsharp/IFNAMSIZ_GET_YOUR_SHIT_TOGETHERDonatas Abraitis
*: Let's use the native IFNAMSIZ instead of INTERFACE_NAMSIZ
2023-11-21*: Let's use the native IFNAMSIZ instead of INTERFACE_NAMSIZDonald Sharp
INTERFACE_NAMSIZ is just a redefine of IFNAMSIZ and IFNAMSIZ is the standard for interface name length on all platforms that FRR currently compiles on. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-20lib: make zapi_nexthop_update_decode privateDavid Lamparter
zapi_nexthop_update_decode() is no longer called externally. Also move the comment to zclient->nexthop_update where it now belongs. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-20lib: add common NHT update decode callbackDavid Lamparter
All users of `ZEBRA_NEXTHOP_UPDATE` check the VRF and then call into `zapi_nexthop_update_decode` before further processing. Begin moving this into common code in lib/. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-01*: Introduce Local Host Routes to FRRDonald Sharp
Create Local routes in FRR: S 0.0.0.0/0 [1/0] via 192.168.119.1, enp39s0, weight 1, 00:03:46 K>* 0.0.0.0/0 [0/100] via 192.168.119.1, enp39s0, 00:03:51 O 192.168.119.0/24 [110/100] is directly connected, enp39s0, weight 1, 00:03:46 C>* 192.168.119.0/24 is directly connected, enp39s0, 00:03:51 L>* 192.168.119.224/32 is directly connected, enp39s0, 00:03:51 O 192.168.119.229/32 [110/100] via 0.0.0.0, enp39s0 inactive, weight 1, 00:03:46 C>* 192.168.119.229/32 is directly connected, enp39s0, 00:03:46 Create ability to redistribute local routes. Modify tests to support this change. Signed-off-by: Donald Sharp <sharpd@nvidia.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-09-20bgpd,lib,sharpd,zebra: srv6 introduce multiple segs/SIDs in nexthopDmytro Shytyi
Append zebra and lib to use muliple SRv6 segs SIDs, and keep one seg SID for bgpd and sharpd. Note: bgpd and sharpd compilation relies on the lib and zebra files, i.e if we separate this: lib or zebra or bgpd or sharpd in different commits - this will not compile. Signed-off-by: Dmytro Shytyi <dmytro.shytyi@6wind.com>
2023-08-03lib, zebra: Send up whether or not v6_with_v4_nexthops are supportedDonald Sharp
After Zebra knows it's capability surrounding v6 with v4 nexthops have it send this ability up to interested parties. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-23lib: add notifications for opaque zapi messagesMark Stapp
Add a new notification zapi message type. A zapi client that uses opaque messages can register to be notified when a server for an opaque type is present. Signed-off-by: Mark Stapp <mjs@labn.net>
2023-06-23lib, zebra: include source client zapi info in opaque messagesMark Stapp
Include the sending zapi client info (proto, instance, and session id) in each opaque zapi message. Add opaque 'init' apis for clients who want to encode their opaque data inline, into the zclient's internal stream buffer. Use these init apis in the TE/link-state lib code, instead of hand-coding the zapi opaque header info. Signed-off-by: Mark Stapp <mjs@labn.net>
2023-04-14lib: fix handle seg6local routes on default vrfPhilippe Guibert
An L3VPN network can be configured on the main BGP instance, with an SRv6 SID. By declaring a network, a seg6local route is created but remains invalid. The below BGP VPN configuration the default VRF has been used: > router bgp 1 > address-family ipv6 unicast > sid vpn export auto > rd vpn export 1:30 > rt vpn both 77:77 > import vpn > export vpn > network 2001:7::/64 > exit-address-family The below seg6local route has been added: > # show ipv6 route > [..] > B 2001:db8:2:2:300::/128 [20/0] is directly connected, unknown inactive, seg6local End.DT6 table 254, seg6 ::, weight 1, 00:00:07 > When creating the seg6local route, an interface is used as nexthop. The interface index is obtained from the vrf identifier. This is true when using VRF interfaces, but is wrong when using the lo interface which usually has the '1' ifindex whereas the vrf id for the default VRF is 0. Get the appropriate index from the vrf identifier. The below seg6local route is visible: > # show ipv6 route > [..] > B>* 2001:db8:1:1:300::/128 [20/0] is directly connected, lo, seg6local End.DT6 table 254, seg6 ::, weight 1, 00:00:15 > Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-03-24*: Convert `struct event_master` to `struct event_loop`Donald Sharp
Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert struct thread_master to struct event_master and it's ilkDonald Sharp
Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Rename `struct thread` to `struct event`Donald Sharp
Effectively a massive search and replace of `struct thread` to `struct event`. Using the term `thread` gives people the thought that this event system is a pthread when it is not Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-17Merge pull request #12780 from opensourcerouting/spdx-license-idDonald Sharp
*: convert to SPDX License identifiers
2023-02-13lib: add label_type as field in zapi_nexthopStephen Worley
Add the ability to specify the label type along with the labels you are passing to zebra in zapi_nexthop. This is needed as we abstract the label code to be re-used by evpn as well as mpls. Protocols need to be able to set the type of label they have attached. Signed-off-by: Stephen Worley <sworley@nvidia.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>
2023-01-17Revert "lib: BGP registration with IGP for BGP ORR rSPF calc"Donatas Abraitis
This reverts commit a5dd4bf47d1d24cfc5e916ff29f5124792e85a53.
2022-11-22zebra: traffic control ZAPISiger Yang
This commit adds ZAPI encoders & decoders for traffic control operations, which include tc_qdisc, tc_class and tc_filter. Signed-off-by: Siger Yang <siger.yang@outlook.com>
2022-11-07Merge pull request #12238 from donaldsharp/appendDonatas Abraitis
lib, zebra: Allow for zebra to recognize that a route has gotten desy…
2022-11-04*: Add ability to encode / decode resilence down zapiDonald Sharp
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>
2022-11-04lib, zebra: Allow for zebra to recognize that a route has gotten desyncedDonald Sharp
FRR does not use the NLM_F_APPEND semantics ( in fact I would argue that the NLM_F_APPEND semantics just introduce pain for all parties involved ) I would also argue that most people who use the kernel netlink api have recognized that NLM_F_APPEND for a route is a recipe for disaster that is well documented and as such it is not used as anything other than a curiousity by operators. See: https://bugzilla.redhat.com/show_bug.cgi?id=1337855 https://github.com/thom311/libnl/issues/226 Are 2 great examples of how confusing it is for anyone in user space to know what the correct thing to do is. Given that new fields can be added with no semantics to allow us to know what has resulted in a change or not. In an attempt to recognize this, let's note that FRR believes it has gotten out of sync with the kernel. Future commits will react to the desynchronized route and request from the kernel a reload of that specific route if possible. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-12lib: BGP registration with IGP for BGP ORR rSPF calcMadhuri Kuruganti
Signed-off-by: Madhuri Kuruganti <maduri111@gmail.com>
2022-06-10lib, zebra, bgpd: Move route EVPN flag to nexthopXiao Liang
Multipath route may have mixed nexthops of EVPN and IP unicast. Move EVPN flag to nexthop to support such cases. Signed-off-by: Xiao Liang <shaw.leon@gmail.com>