X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=zebra%2Fzebra_router.c;h=63724fc350dec0241fcc60c8eb7d21b5963a0deb;hb=c447ad08b2c880d5f3ef35af2e4055fcbc970961;hp=c3b861c2424b0f16a93c9f90f15bb12bb31ce4ae;hpb=c06c9ded2114055fcba55ee1020d68121f0f1aad;p=mirror_frr.git diff --git a/zebra/zebra_router.c b/zebra/zebra_router.c index c3b861c24..63724fc35 100644 --- a/zebra/zebra_router.c +++ b/zebra/zebra_router.c @@ -164,14 +164,33 @@ static void zebra_router_free_table(struct zebra_router_table *zrt) { void *table_info; - rib_close_table(zrt->table); - 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 @@ -183,10 +202,8 @@ void zebra_router_terminate(void) { struct zebra_router_table *zrt, *tmp; - RB_FOREACH_SAFE (zrt, zebra_router_table_head, &zrouter.tables, tmp) { - RB_REMOVE(zebra_router_table_head, &zrouter.tables, zrt); + RB_FOREACH_SAFE (zrt, zebra_router_table_head, &zrouter.tables, tmp) zebra_router_free_table(zrt); - } work_queue_free_and_null(&zrouter.ribq); meta_queue_free(zrouter.mq); @@ -209,7 +226,6 @@ void zebra_router_init(void) { zrouter.sequence_num = 0; - zrouter.rtm_table_default = 0; zrouter.packets_to_process = ZEBRA_ZAPI_PACKETS_TO_PROCESS; zebra_vxlan_init();