]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: Store actual safi in info pointer and don't free then remalloc
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 4 Jan 2019 13:36:02 +0000 (08:36 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 4 Jan 2019 13:42:03 +0000 (08:42 -0500)
When we call zebra_vrf_table_create, we've already created the info
pointer in zebra_router_get_table, so properly set the info->safi
and just store the zvrf->table[afi][safi] value.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/zebra_router.c
zebra/zebra_vrf.c

index 2e1c69fb9269af3cc29252e2b9577bd6a0b1c2e7..7f911164cd18a4df789c870cb8276b56b3485516 100644 (file)
@@ -105,7 +105,7 @@ struct route_table *zebra_router_get_table(struct zebra_vrf *zvrf,
        info = XCALLOC(MTYPE_RIB_TABLE_INFO, sizeof(*info));
        info->zvrf = zvrf;
        info->afi = afi;
-       info->safi = SAFI_UNICAST;
+       info->safi = safi;
        route_table_set_info(zrt->table, info);
        zrt->table->cleanup = zebra_rtable_node_cleanup;
 
index 38b8b43d73f45dfb0db3f01afc55994cd409cd76..f1458cb138b1eabc92161befbe79fe02b57e453a 100644 (file)
@@ -370,22 +370,10 @@ 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)
 {
-       rib_table_info_t *info;
-       struct route_table *table;
-
        assert(!zvrf->table[afi][safi]);
 
-       table = zebra_router_get_table(zvrf, zvrf->table_id, afi, safi);
-
-       table->cleanup = zebra_rtable_node_cleanup;
-       zvrf->table[afi][safi] = table;
-
-       XFREE(MTYPE_RIB_TABLE_INFO, table->info);
-       info = XCALLOC(MTYPE_RIB_TABLE_INFO, sizeof(*info));
-       info->zvrf = zvrf;
-       info->afi = afi;
-       info->safi = safi;
-       route_table_set_info(table, info);
+       zvrf->table[afi][safi] =
+               zebra_router_get_table(zvrf, zvrf->table_id, afi, safi);
 }
 
 /* Allocate new zebra VRF. */