From c86ba6c283689d0fd9f7dce9c29fdbbea7d0a0b2 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 6 Feb 2019 14:44:44 -0500 Subject: [PATCH] zebra: Add a base node for the zebra vrf tables Add a default route_node for our routing tables. This will allow us to know that we can hang data off the default route for processing. We will be hanging the nexthop tracking data structures off the rib_dest_t so that we can know which nexthops we need to handle. Effectively nexthops that we are tracking that are unresolved will be stored on the default route. When something changes in the rib tree we can work up the rn->parent pointer checking for nexthops we need to re-evaluate. Signed-off-by: Donald Sharp --- zebra/zebra_rib.c | 10 ++++++++++ zebra/zebra_vrf.c | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 5d98d61645..6b837e4e36 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -1204,6 +1204,16 @@ static int rib_can_delete_dest(rib_dest_t *dest) return 0; } + /* + * Unresolved rnh's are stored on the default route's list + * + * dest->rnode can also be the source prefix node in an + * ipv6 sourcedest table. Fortunately the prefix of a + * source prefix node can never be the default prefix. + */ + if (is_default_prefix(&dest->rnode->p)) + return 0; + /* * Don't delete the dest if we have to update the FPM about this * prefix. diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index 90f94902f3..89bda4276e 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -370,10 +370,19 @@ static void zebra_rnhtable_node_cleanup(struct route_table *table, static void zebra_vrf_table_create(struct zebra_vrf *zvrf, afi_t afi, safi_t safi) { + struct route_node *rn; + struct prefix p; + assert(!zvrf->table[afi][safi]); zvrf->table[afi][safi] = zebra_router_get_table(zvrf, zvrf->table_id, afi, safi); + + memset(&p, 0, sizeof(p)); + p.family = afi2family(afi); + + rn = srcdest_rnode_get(zvrf->table[afi][safi], &p, NULL); + zebra_rib_create_dest(rn); } /* Allocate new zebra VRF. */ -- 2.39.5