diff options
author | Mark Stapp <mjs@voltanet.io> | 2019-03-08 20:48:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-08 20:48:19 +0100 |
commit | 9af85338e13be4d9be2b7d5b0c976248a970843d (patch) | |
tree | 6d889bf8283bb74df0c07840358d91e5a27dd429 /zebra | |
parent | Merge pull request #3926 from donaldsharp/improved_debugs_vxlan (diff) | |
parent | zebra: Upon vrf deletion, actually release this data. (diff) | |
download | frr-9af85338e13be4d9be2b7d5b0c976248a970843d.tar.xz frr-9af85338e13be4d9be2b7d5b0c976248a970843d.zip |
Merge pull request #3889 from donaldsharp/rnh_vrf_down_stuff
zebra Rnh vrf down stuff
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/zebra_router.c | 21 | ||||
-rw-r--r-- | zebra/zebra_router.h | 2 | ||||
-rw-r--r-- | zebra/zebra_vrf.c | 13 |
3 files changed, 30 insertions, 6 deletions
diff --git a/zebra/zebra_router.c b/zebra/zebra_router.c index c3b861c24..cabc8be8d 100644 --- a/zebra/zebra_router.c +++ b/zebra/zebra_router.c @@ -168,10 +168,31 @@ static void zebra_router_free_table(struct zebra_router_table *zrt) table_info = route_table_get_info(zrt->table); route_table_finish(zrt->table); + RB_REMOVE(zebra_router_table_head, &zrouter.tables, zrt); + XFREE(MTYPE_RIB_TABLE_INFO, table_info); XFREE(MTYPE_ZEBRA_NS, zrt); } +void zebra_router_release_table(struct zebra_vrf *zvrf, uint32_t tableid, + afi_t afi, safi_t safi) +{ + struct zebra_router_table finder; + struct zebra_router_table *zrt; + + memset(&finder, 0, sizeof(finder)); + finder.afi = afi; + finder.safi = safi; + finder.tableid = tableid; + finder.ns_id = zvrf->zns->ns_id; + zrt = RB_FIND(zebra_router_table_head, &zrouter.tables, &finder); + + if (!zrt) + return; + + zebra_router_free_table(zrt); +} + uint32_t zebra_router_get_next_sequence(void) { return 1 diff --git a/zebra/zebra_router.h b/zebra/zebra_router.h index fb2849591..e5043f38a 100644 --- a/zebra/zebra_router.h +++ b/zebra/zebra_router.h @@ -117,6 +117,8 @@ extern struct route_table *zebra_router_find_table(struct zebra_vrf *zvrf, extern struct route_table *zebra_router_get_table(struct zebra_vrf *zvrf, uint32_t tableid, afi_t afi, safi_t safi); +extern void zebra_router_release_table(struct zebra_vrf *zvrf, uint32_t tableid, + afi_t afi, safi_t safi); extern int zebra_router_config_write(struct vty *vty); diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index d42aad0d2..1300ca24f 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -208,8 +208,11 @@ static int zebra_vrf_disable(struct vrf *vrf) * table, see rib_close_table above * we no-longer need this pointer. */ - for (safi = SAFI_UNICAST; safi <= SAFI_MULTICAST; safi++) + for (safi = SAFI_UNICAST; safi <= SAFI_MULTICAST; safi++) { + zebra_router_release_table(zvrf, zvrf->table_id, afi, + safi); zvrf->table[afi][safi] = NULL; + } route_table_finish(zvrf->rnh_table[afi]); zvrf->rnh_table[afi] = NULL; @@ -256,14 +259,12 @@ static int zebra_vrf_delete(struct vrf *vrf) /* release allocated memory */ for (afi = AFI_IP; afi <= AFI_IP6; afi++) { - void *table_info; - for (safi = SAFI_UNICAST; safi <= SAFI_MULTICAST; safi++) { table = zvrf->table[afi][safi]; if (table) { - table_info = route_table_get_info(table); - route_table_finish(table); - XFREE(MTYPE_RIB_TABLE_INFO, table_info); + zebra_router_release_table(zvrf, zvrf->table_id, + afi, safi); + zvrf->table[afi][safi] = NULL; } } |