summaryrefslogtreecommitdiff
path: root/zebra/zapi_msg.c
AgeCommit message (Collapse)Author
2023-08-11lib, zebra: Fix EVPN nexthop config orderXiao Liang
Delay EVPN route addition to synchronize with rib_delete(), which now uses early route queue. Signed-off-by: Xiao Liang <shaw.leon@gmail.com> (cherry picked from commit cea3f7f25a23e485d4f814b670c11c92249568e1)
2023-06-06zebra: Unlock the route node when sending route notificationsDonald Sharp
When using a context to send route notifications to upper level protocols, the code was using a locking function to get the route node. There is no need for this to be locked as such FRR should free it up. Signed-off-by: Donald Sharp <sharpd@nvidia.com> (cherry picked from commit 82c6e4fea54eb65e153e6bc45bb718367b0b5132)
2022-08-17zebra: Create a zebra_rib_route_entry_new function and use itDonald Sharp
Abstract the creation of the route_entry and use it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-17zebra: Introduce early route processing on the MetaQDonald Sharp
Currently if an operator does this operation: sharpd@eva ~/frr8> sudo ip nexthop add id 5000 via 192.168.119.44 dev enp39s0 ; sudo ip route add 10.0.0.1 nhid 5000 2022/06/30 08:52:40 ZEBRA: [ZHQK5-J9M1R] proto2zebra: Please add this protocol(0) to proper rt_netlink.c handling 2022/06/30 08:52:40 ZEBRA: [PS16P-365FK][EC 4043309076] Zebra failed to find the nexthop hash entry for id=5000 in a route entry sharpd@eva ~/frr8> vtysh -c "show ip route 10.0.0.1" Routing entry for 0.0.0.0/0 Known via "kernel", distance 0, metric 100, best Last update 00:01:58 ago * 192.168.119.1, via enp39s0 The route is dropped by zebra with no warnings. This is not good, but unlikely to happen at this point in time. In order to fix this issue route processing from inputs needs to happen after nexthop group processing from inputs. This was not possible because nexthop groups are placed on the metaQ. As such the above nexthop group creation is placed on the metaQ for processing in META_QUEUE_NHG. Then the route is read in and processed immediately. The nexthop group is not found ( not processed yet!) and the route is dropped in zebra. Modify the code to have early route processing of validity on the MetaQ. This preserves the order of operations. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-10zebra: Remove unused return codes in zebra_mpls.cDonald Sharp
There are some return codes for functions that are not really used. Clean them up. Signed-off-by: Donald Sharp <sharpd@nvidia.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>
2022-05-25zebra: avoid pbr iptable added twice when used with flowspecPhilippe Guibert
The usage of zebra dplane makes the job asyncronous which implies that a given job will try to add an iptable, while the second job will not know that its iptable is the same as the former one. The below exabgp rules stand for two bgp flowspec rules sent to the bgp device: flow { route {match { source 185.228.172.73/32; destination 0.0.0.0/0; source-port >=49156&<=49159; }then {redirect 213.242.114.113;}} route {match { source 185.228.172.73/32; destination 0.0.0.0/0; source-port >=49160&<=49163; }then {redirect 213.242.114.113;}} } This rule creates a single iptable, but in fact, the same iptable name is appended twice. This results in duplicated entries in the iptables context. This also results in contexts not flushed, when BGP session or 'flush' operation is performed. iptables-save: [..] -A PREROUTING -m set --match-set match0x55baf4c25cb0 src,src -g match0x55baf4c25cb0 -A PREROUTING -m set --match-set match0x55baf4c25cb0 src,src -g match0x55baf4c25cb0 -A match0x55baf4c25cb0 -j MARK --set-xmark 0x100/0xffffffff -A match0x55baf4c25cb0 -j ACCEPT -A match0x55baf4c25cb0 -j MARK --set-xmark 0x100/0xffffffff -A match0x55baf4c25cb0 -j ACCEPT [..] This commit addresses this issue, by checking that an iptable context is not already being processed. A flag is added in the original iptable context, and a check is done if the iptable context is not already being processed for install or uinstall. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-05-11*: Properly use memset() when zeroingDonatas Abraitis
Wrong: memset(&a, 0, sizeof(struct ...)); Good: memset(&a, 0, sizeof(a)); Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
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-27zebra: register NHT nexthops with proper SAFIDavid Lamparter
Just a small puzzle piece missing in zebra SAFI NHT support. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-09zebra: add support for protodown reason codeStephen Worley
Add support for setting the protodown reason code. https://github.com/torvalds/linux/commit/829eb208e80d6db95c0201cb8fa00c2f9ad87faf These patches handle all our netlink code for setting the reason. For protodown reason we only set `frr` as the reason externally but internally we have more descriptive reasoning available via `show interface IFNAME`. The kernel only provides a bitwidth of 32 that all userspace programs have to share so this makes the most sense. Since this is new functionality, it needs to be added to the dplane pthread instead. So these patches, also move the protodown setting we were doing before into the dplane pthread. For this, we abstract it a bit more to make it a general interface LINK update dplane API. This API can be expanded to support gernal link creation/updating when/if someone ever adds that code. We also move a more common entrypoint for evpn-mh and from zapi clients like vrrpd. They both call common code now to set our internal flags for protodown and protodown reason. Also add debugging code for dumping netlink packets with protodown/protodown_reason. Signed-off-by: Stephen Worley <sworley@nvidia.com>
2022-02-07zebra: Fix ships in the night issueDonald Sharp
When using wait for install there exists situations where zebra will issue several route change operations to the kernel but end up in a state where we shouldn't be at the end due to extra data being received. Example: a) zebra receives from bgp a route change, installs sends the route to the kernel. b) zebra receives a route deletion from bgp, removes the struct route entry and then sends to the kernel a deletion. c) zebra receives an asynchronous notification that (a) succeeded but we treat this as a new route. This is the ships in the night problem. In this case if we receive notification from the kernel about a route that we know nothing about and we are not in startup and we are doing asic offload then we can ignore this update. Ticket: #2563300 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-01Merge pull request #10443 from mjstapp/zebra_re_opaqueIgor Ryzhov
zebra: name the route_entry opaque struct more specifically
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-28zebra: Fix EVPN route nexthop config orderXiao Liang
EVPN route add should be queued to preserve the config order. In particular, against deletion in rib_delete(). Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
2022-01-24Merge pull request #10406 from idryzhov/zebra-opaque-memleakDonatas Abraitis
zebra: fix opaque data memleak
2022-01-23zebra: fix opaque data memleakIgor Ryzhov
Opaque data should be freed together with route entry in case of errors. Signed-off-by: Igor Ryzhov <iryzhov@nfware.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-11-22*: cleanup ifp->vrf_idIgor Ryzhov
Since f60a1188 we store a pointer to the VRF in the interface structure. There's no need anymore to store a separate vrf_id field. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-17zebra: return void for dplane_ctx_get_pbr_ipset_entryDonald Sharp
The dplane_ctx_get_pbr_ipset_entry function only failed when the caller did not pass in a valid usable pointer. Change the code to assert on a pointer not being passed in and remove the bool return Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-17zebra: return void for dplane_ctx_get_pbr_iptableDonald Sharp
The only time this function ever failed is when the developer does not pass in a usable pointer to place the data in. Change it to an assert to signify to the end developer that is what we want and then remove all the if checks for failure Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-17zebra: dplane_ctx_get_pbr_ipset should return voidDonald Sharp
The function call dplane_ctx_get_pbr_ipset only returns false when the calling function fails to pass in a valid ipset pointer. This should be an assertion issue since it's a programming issue as opposed to an actual run time issue. Change the function call parameter to not return a bool on success/fail for a compile time decision. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-04zebra: Send up ifindex for redistribution when appropriateDonald Sharp
Currently the NEXTHOP_TYPE_IPV4 and NEXTHOP_TYPE_IPV6 are not sending up the resolved ifindex for the route. This is causing upper level protocols that have something like this: route-map FOO permit 10 match interface swp13 ! router ospf redistribute static ! ip route 4.5.6.7/32 10.10.10.10 where 10.10.10.10 resolves to interface swp13. The route-map will never match in this case. Since FRR has the resolved nexthop interface, FRR might as well send it up to be selected on by the upper level protocol as needed. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-03zebra: netfilter operations notif sent back to daemonPhilippe Guibert
It appears that without that change, there were no notifications sent to bgp daemon, after flowspec operations have been sent to zebra. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-10-25Merge pull request #9883 from pguibert6WIND/iface_deleted_omitted_gre_tundestJafar Al-Gharaibeh
zebra: GRE_UPDATE message incomplete
2021-10-25zebra: GRE_UPDATE message incompletePhilippe Guibert
when gre information could not be retrieved because GRE interface has been deleted, a GRE_UPDATE message may be sent to NHRP. In that case, the gre values are reset. There was a missing tunnel destination value, which has been omitted. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-10-23Merge pull request #9742 from elimbaum/add-vlan-actionsJafar Al-Gharaibeh
pbrd: add vlan actions to vty
2021-10-13Merge pull request #9676 from donaldsharp/import_registerDavid Lamparter
2021-10-08Merge pull request #9471 from pguibert6WIND/table_manager_alloc2Russ White
zebra: extend table manager per vrf, add vty configuration
2021-10-07pbrd: add vlan actions to vtyEli Baum
Signed-off-by: Eli Baum <ebaum@mitre.org>
2021-09-27lib, zebra: Send safi for rnh resolutionDonald Sharp
Pass down the safi for when we need address resolution. At this point in time we are hard coding the safi to SAFI_UNICAST. Future commits will take advantage of this. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27zebra: Start carrying safi for rnh processingDonald Sharp
PIM is going to need to be able to send down the address it is trying to resolve in the multicast rib. We need a way to signal this to the end developer. Start the conversion by adding the ability to have a safi. But only allow SAFI_UNICAST at the moment. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
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-27zebra: remove 'enum rnh_type' from systemDonald Sharp
This code is now dead code since there are not two nexthop resolution types. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-27zebra: remove import check resolution from zebraDonald Sharp
The entirety of the import checking no longer needs to be in zebra as that no-one is calling it. Remove the code. 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-21zebra: extend table manager per vrf, add vty configurationPhilippe Guibert
Because vrf backend may be based on namespaces, each vrf can use in the [16-(2^32-1)] range table identifier for daemons that request it. Extend the table manager to be hosted by vrf. That possibility is disabled in the case the vrf backend is vrflite. In that case, all vrf context use the same table manager instance. Add a configuration command to be able to configure the wished range of tables to use. This is a solution that permits to give chunks to bgp daemon when it works with bgp flowspec entries and wants to use specific iptables that do not override vrf tables. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-09-14Merge pull request #9486 from slankdev/slankdev-srv6-no-cli-1Igor Ryzhov
CLI to delete SRv6 locator
2021-09-12Merge pull request #9475 from iqras23/change1Donatas Abraitis
bgpd: VRF-Lite fix nexthop type
2021-09-07zebra: Do not send a router-id of 0.0.0.0 when we don't know it yetDonald Sharp
At startup there exists a time frame where we might not know a particular vrf's router id. When zebra gets a request for it let's not just blindly send whatever we have. Let's be a bit smart and only respond with one if we have one. The upper level protocol can wait for it to have one. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-09-07zebra: implement srv6 locator add/delete notification via ZAPIHiroki Shirokura
Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
2021-09-07bgpd: VRF-Lite fix nexthop typeKantesh Mundaragi
Description: Change is intended for fixing the following issues related to vrf route leaking: Routes with special nexthops i.e. blackhole/sink routes when imported, are not programmed into the FIB and corresponding nexthop is set as 'inactive', nexthop interface as 'unknown'. While importing/leaking routes between VRFs, in case of special nexthop(ipv4/ipv6) once bgp announces route(s) to zebra, nexthop type is incorrectly set as NEXTHOP_TYPE_IPV6_IFINDEX/NEXTHOP_TYPE_IFINDEX i.e. directly connected even though we are not able to resolve through an interface. This leads to nexthop_active_check marking nexthop !NEXTHOP_FLAG_ACTIVE. Unable to find the active nexthop(s), route is not programmed into the FIB. Whenever BGP leaks routes, set the correct nexthop type, so that route gets resolved and correctly programmed into the FIB, in the imported vrf. Co-authored-by: Kantesh Mundaragi <kmundaragi@vmware.com> Signed-off-by: Iqra Siddiqui <imujeebsiddi@vmware.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-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-08-12Merge pull request #9374 from mjstapp/fix_nhg_add_leakDonald Sharp
zebra: clean up nhg allocations in error path
2021-08-11zebra: clean up nhg allocations in error pathMark Stapp
Clean up allocated nhgs in error path in zread_nhg_add(). Signed-off-by: Mark Stapp <mjs.ietf@gmail.com>
2021-08-09zebra: Properly note add/update for rib_add_multipath_nheDonald Sharp
When calling rib_add_multipath_nhe ensure that we have well aligned return codes that mean something so that interersted parties can properly handle the situation. Signed-off-by: Donald Sharp <sharpd@nvidia.com>