summaryrefslogtreecommitdiff
path: root/zebra/rib.h
AgeCommit message (Collapse)Author
2021-07-19zebra: add workqueue support for EVPN updatesMark Stapp
Add workqueue subqueue for EVPN/VxLAN updates; migrate the evpn route and remote ES processing from their ZAPI handlers to the workqueue. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-06-29Merge pull request #8744 from sworleys/RTADV-Fix-UpstreamPhilippe Guibert
zebra: rework RA handling for vrf-lite
2021-06-11zebra: use const in rib_matchMark Stapp
Use const in common rib_match api. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-06-08zebra: rework RA handling for vrf-liteStephen Worley
Rework RA handling for vrf-lite scenarios. Before we were using a single FD descriptor for polling across multiple zvrf's. This would cause us to hit this assert() in some bgp unnumbered and vrrp configs: ``` /* * What happens if we have a thread already * created for this event? */ if (thread_array[fd]) assert(!"Thread already scheduled for file descriptor"); ``` We were scheduling a thread_read on the same FD for every zvrf. With vrf-lite, RAs and ARPs are not vrf-bound, so we can just use one rtadv instance to manage them for all VRFs. We will choose the default VRF for this. This patch removes the rtadv_sock altogether for zrouter and moves the functionality this represented to the default VRF. All RAs will be handled in the default VRF under vrf-lite configs with only one poll thread started for it. This patch also extends how we track subscribed interfaces (s or msec) to use an actual sorted list by interface names rather than just a counter. With multiple daemons turning interfaces/on/off these counters can get very wrong during ifup/down events. Making them a sorted list prevents this from happening by preventing duplicates. With netns-vrf's nothing should change other than the interface list. Signed-off-by: Stephen Worley <sworley@nvidia.com>
2021-04-15zebra: use workqueue for daemon-owned NHGsMark Stapp
Use the main zebra workqueue for daemon-owned NHGs, in addition to processing kernel-owned NHGs. The zapi message processing creates a temporary object that's enqueued to the workqueue, then processed/installed as part of the workqueue processing. Signed-off-by: Mark Stapp <mjs@voltanet.io>
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-17*: require semicolon after DEFINE_<typesafe...>David Lamparter
Again, see previous commits. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-17*: require semicolon after DEFINE_HOOK & co.David Lamparter
See previous commit. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-01-15zebra: Allow rib_update_table to receive a specified route typeDonald Sharp
When we need to cause a reprocessing of data the code currently marks all routes as needing to be looked at. Modify the rib_update_table code to allow us to specify a specific route type we only want to reprocess. At this point none of the code is behaving differently this is just setup for a future code change. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-01-15zebra: remove unused function rib_update_vrfDonald Sharp
The function rib_update_vrf is never used. Remove it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-12-29Merge pull request #7777 from volta-networks/fix_zebra_rib_c++Quentin Young
zebra: avoid c++ reserved keyword
2020-12-21zebra: avoid c++ reserved keywordEmanuele Di Pascale
in rib_handle_nhg_replace, do not use new as a parameter name to allow compilation of c++ code including zebra headers. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2020-12-11Revert "zebra: When shutting down an interface immediately notify about rnh"Donald Sharp
This reverts commit 0aaa722883245c2109d9856ca0656749860fc579.
2020-12-08zebra: Gather opaque data into the route entry for storageDonald Sharp
Just gather the opaque data into the route entry. Later commits will display this data for end users as well as to send it down. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-29zebra: Consolidate on 32 bits as the flag size for route flagsDonald Sharp
When we get a route for installation via any method we should consolidate on 32 bits as the flag size, since we have actually more than 8 bits of data to bass around. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-01zebra: Make connected routes their own entry on the meta_qDonald Sharp
During quick ifdown / ifup events from the linux kernel there exists a situation where a prefix that has both a kernel route and a static route can queued up on the meta-q. If the static route happens to point at a connected route for nexthop resolution and we receive a series of quick up/down events *after* the static route and kernel route are queued up for rib reprocessing. Since the static route and kernel route are queued on meta-q 1 and the connected route is also on meta-q 1 there exists a situation where the connected route will be resolved after the static route fails to resolve, leaving the static route in a unresolved state. Add a new queue level and put connected routes on their own level, since they are the fundamental building blocks of pretty much all the other routes. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-09-28zebra: fix refcnt/rib issues in NHG replace/deleteStephen Worley
Fix some reference counting issues seen when replacing a NHG and deleting one. For replacement, we should end with the same refcnt on the new one. For delete, its the caller's job to decrement its ref after its done with it. Further, update routes in the rib with the new pointer after replace. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-08-28zebra: When shutting down an interface immediately notify about rnhDonald Sharp
Imagine a situation where a interface is bouncing up/down. The interface comes up and daemons like pbr will get a nht tracking callback for a connected interface up and will install the routes down to zebra. At this same time the interface can go down. But since zebra is busy handling route changes ( from pbr ) it has not read the netlink message and can get into a situation where the route resolves properly and then we attempt to install it into the kernel( which is rejected ). If the interface bounces back up fast at this point, the down then up netlink message will be read and create two route entries off the connected route node. Zebra will then enqueue both route entries for future processing. After this processing happens the down/up is collapsed into an up and nexthop tracking sees no changes and does not inform any upper level protocol( in this case pbr ) that nexthop tracking has changed. So pbr still believes the nexthops are good but the routes are not installed since pbr has taken no action. Fix this by immediately running rnh when we signal a connected route entry is scheduled for removal. This should cause upper level protocols to get a rnh notification for the small amount of time that the connected route was bouncing around like a madman. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-04Merge pull request #6698 from deastoe/fpm-netlink-fixesDonald Sharp
zebra: always set kernel table ID in FPM netlink
2020-07-17zebra: add a route_entry flag for FIB-specific nexthopsMark Stapp
Add a route_entry flag to indicate the presence of a fib (installed) list of nexthops - more explicit and clearer. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-07-08zebra: Add table_id to rib_table_info_tDuncan Eastoe
When given a route_table this allows the corresponding kernel table ID to be determined. The table_id value is set upon table creation to the table_id of the VRF, unless the table was created with a specific ID. Signed-off-by: Duncan Eastoe <duncan.eastoe@att.com>
2020-07-07zebra: add fib nhg for backups, revise apiMark Stapp
Add an nhg for the fib-installed backup nexthops; rename an api to access the fib-installed nexthop nhg. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-05-14zebra: avoid using c++ keywords in headersEmanuele Di Pascale
to make sure that c++ code can include them, avoid using reserved keywords like 'delete' or 'new'. Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2020-05-12zebra: route node first next nodeChirag Shah
Add macros for route entry first and next node walk. Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-05-08zebra: remove typedef rib_update_event_t from systemDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-05-08zebra: Remove typedef rib_table_info_t from systemDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-05-08zebra: Remove typedef rib_tables_iter_state from systemDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-05-08zebra: Remove typedef rnh_type_t from systemDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-27zebra: add per-nexthop backup indexMark Stapp
Use a backup index in a nexthop directly (if it has a backup nexthop); revise the zebra nhe/nhg code; revise zapi route decoding to match; revise the dataplane route datastructs. Refactor some of the rib_add_multipath code to be prepared to be called with an nhe, carrying nexthop and (possibly) backup info together. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-02-27zebra: Embed lib nexthop-group in zebra hash entryMark Stapp
Embed nexthop-group, which is just a pointer, in the zebra nexthop-hash-entry object, rather than mallocing one. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-12-04lib,zebra: use nhg_hash_entry pointer in route_entryMark Stapp
Replace the existing list of nexthops (via a nexthop_group struct) in the route_entry with a direct pointer to zebra's new shared group (from zebra_nhg.h). This allows more direct access to that shared group and the info it carries. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-11-21zebra: clean up rib and nhg headersMark Stapp
Clean up the relationships between zebra's rib and nexthop-group headers as prep for adding a nexthop-group pointer to the route_entry. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-10-25zebra: Use nexthop object id on route deleteStephen Worley
When we receive a route delete from the kernel and it contains a nexthop object id, use that to match against route gateways with instead of explicit nexthops. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25zebra: Use a nhe context dataplane and rib metaqStephen Worley
We will use a nhe context for dataplane interaction with nextho group hash entries. New nhe's from the kernel will be put into a group array if they are a group and queued on the rib metaq to be processed later. New nhe's sent to the kernel will be set on the dataplane context with approprate ID's in the group array if needed. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25zebra: Update rib_add to take a nexthop IDStephen Worley
Add a parameter to the rib_add function so that it takes a nexthop ID from the kernel if one is passed along with the route. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25zebra: Route entries use nexthop entry ID's instead of pointersStephen Worley
Switched the route entries to use ID's instead of pointers. Perform lookups with the ID and then check if its null. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-10-25zebra: Add a nhe pointer to the route entryDonald Sharp
Add a nexthop hash entry to the route_entry so that we can track the nhe with the route entry. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25zebra: Remove nexthop_active_num from route entryDonald Sharp
The nexthop_active_num data structure is a property of the nexthop group. Move the keeping of this data to that. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25zebra: Remove re->nexthop_num from reDonald Sharp
The nexthop_num is not a function of the re. It is owned by the nexthop group. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25zebra: Replace nexthop_group with pointer in route entryDonald Sharp
In the route_entry we are keeping a non pointer based nexthop group, switch the code to use a pointer for all operations here and ensure we create and delete the memory. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-18zebra: Handle rib updates as a thread eventStephen Worley
If we need to batch process the rib (all tables or specific vrf), do so as a scheduled thread event rather than immediately handling it. Further, add context to the events so that you narrow down to certain route types you want to reprocess. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-07-29zebra, tests: Remove ROUTE_ENTRY_NEXTHOPS_CHANGEDDonald Sharp
The flag ROUTE_ENTRY_NEXTHOPS_CHANGED is only ever set or unset. Since this flag is not used for anything useful, remove from system. By changing this flag we have re-ordered `internalStatus' of json output of zebra rib routes. Go through and fix up tetsts to use the new values. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-07-29zebra: Remove repeated enqueueing of system routes for rethinkingDonald Sharp
The code as written before this code change point would enqueue every system route type to be refigured when we have an interface event. I believe this was to originally handle bugs in the way nexthop tracking was handled, mainly that if you keep asking the question you'll eventually get the right answer. Modify the code to not do this, we have fixed nexthop tracking to not be so brain dead and to know when it needs to refigure a route that it is tracking. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-07-01*: s/TRUE/true/, s/FALSE/false/Quentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-29zebra: Move multicast mode to being a property of the routerDonald Sharp
The multicast mode enum was a global static in zebra_rib.c it does not belong there, it belongs in zebra_router, moving. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-28zebra: add a fib-specific nexthop-groupMark Stapp
Add a fib-specific nhg, distinct from the nhg developed from the route-owner / RIB information. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-05-23zebra: Add kernel level graceful restartDonald Sharp
<Initial Code from Praveen Chaudhary> Add the a `--graceful_restart X` flag to zebra start that now creates a timer that pops in X seconds and will go through and remove all routes that are older than startup. If graceful_restart is not specified then we will just pop a timer that cleans everything up immediately. Signed-off-by: Praveen Chaudhary <pchaudhary@linkedin.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-20Merge pull request #4328 from sworleys/Re-order-RouteEntryRenato Westphal
zebra: Reorder `struct route_entry` to reduce size
2019-05-14zebra: Reorder `struct route_entry` to reduce sizeDonald Sharp
Reduce the size of the data structure from 88 bytes to 80 bytes Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-13zebra: Share route type checking macrosStephen Worley
Make the RIB_*_ROUTE() macro which is passed a route in rib.h just use the R*_ROUTE() macros that directly check the type in rt.h. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>