From 56724b7fb989c990cbbab9ccabd96d02b0e43f85 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 1 Oct 2020 14:58:37 -0400 Subject: [PATCH] zebra: Make connected routes their own entry on the meta_q 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 --- zebra/rib.h | 14 +++++++----- zebra/zebra_rib.c | 56 +++++++++++++++++++++++------------------------ 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/zebra/rib.h b/zebra/rib.h index be680a112f..38f8029791 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -165,13 +165,15 @@ struct route_entry { /* meta-queue structure: * sub-queue 0: nexthop group objects - * sub-queue 1: connected, kernel - * sub-queue 2: static - * sub-queue 3: RIP, RIPng, OSPF, OSPF6, IS-IS, EIGRP, NHRP - * sub-queue 4: iBGP, eBGP - * sub-queue 5: any other origin (if any) + * sub-queue 1: connected + * sub-queue 2: kernel + * sub-queue 3: static + * sub-queue 4: RIP, RIPng, OSPF, OSPF6, IS-IS, EIGRP, NHRP + * sub-queue 5: iBGP, eBGP + * sub-queue 6: any other origin (if any) typically those that + * don't generate routes */ -#define MQ_SIZE 6 +#define MQ_SIZE 7 struct meta_queue { struct list *subq[MQ_SIZE]; uint32_t size; /* sum of lengths of all subqueues */ diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 5d4eeaafd6..f56f585e9a 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -79,35 +79,35 @@ static const struct { uint8_t meta_q_map; } route_info[ZEBRA_ROUTE_MAX] = { [ZEBRA_RO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ROUTE_NHRP, 10, 4}, + [ZEBRA_ROUTE_HSLS] = {ZEBRA_ROUTE_HSLS, 255, 6}, + [ZEBRA_ROUTE_OLSR] = {ZEBRA_ROUTE_OLSR, 255, 6}, + [ZEBRA_ROUTE_TABLE] = {ZEBRA_ROUTE_TABLE, 150, 3}, + [ZEBRA_ROUTE_LDP] = {ZEBRA_ROUTE_LDP, 150, 6}, + [ZEBRA_ROUTE_VNC] = {ZEBRA_ROUTE_VNC, 20, 5}, + [ZEBRA_ROUTE_VNC_DIRECT] = {ZEBRA_ROUTE_VNC_DIRECT, 20, 5}, + [ZEBRA_ROUTE_VNC_DIRECT_RH] = {ZEBRA_ROUTE_VNC_DIRECT_RH, 20, 5}, + [ZEBRA_ROUTE_BGP_DIRECT] = {ZEBRA_ROUTE_BGP_DIRECT, 20, 5}, + [ZEBRA_ROUTE_BGP_DIRECT_EXT] = {ZEBRA_ROUTE_BGP_DIRECT_EXT, 20, 5}, + [ZEBRA_ROUTE_BABEL] = {ZEBRA_ROUTE_BABEL, 100, 4}, + [ZEBRA_ROUTE_SHARP] = {ZEBRA_ROUTE_SHARP, 150, 6}, + [ZEBRA_ROUTE_PBR] = {ZEBRA_ROUTE_PBR, 200, 6}, + [ZEBRA_ROUTE_BFD] = {ZEBRA_ROUTE_BFD, 255, 6}, + [ZEBRA_ROUTE_OPENFABRIC] = {ZEBRA_ROUTE_OPENFABRIC, 115, 4}, + [ZEBRA_ROUTE_VRRP] = {ZEBRA_ROUTE_VRRP, 255, 6}, + [ZEBRA_ROUTE_SRTE] = {ZEBRA_ROUTE_SRTE, 255, 6}, /* Any new route type added to zebra, should be mirrored here */ /* no entry/default: 150 */ -- 2.39.5