From b62983cf98eb07350cd1120c3b0f32cf223d93f0 Mon Sep 17 00:00:00 2001 From: Duncan Eastoe Date: Tue, 13 Nov 2018 15:26:21 +0000 Subject: [PATCH 1/2] zebra: Add table_id to rib_table_info_t When given a route_table this allows the corresponding kernel table ID to be determined. The table_id value is set upon table creation to the table_id of the VRF, unless the table was created with a specific ID. Signed-off-by: Duncan Eastoe --- zebra/rib.h | 1 + zebra/zebra_router.c | 1 + 2 files changed, 2 insertions(+) diff --git a/zebra/rib.h b/zebra/rib.h index a024b6dfaa..fc4044f22e 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -294,6 +294,7 @@ struct rib_table_info { struct zebra_vrf *zvrf; afi_t afi; safi_t safi; + uint32_t table_id; }; enum rib_tables_iter_state { diff --git a/zebra/zebra_router.c b/zebra/zebra_router.c index 61fef8779f..66f2924555 100644 --- a/zebra/zebra_router.c +++ b/zebra/zebra_router.c @@ -133,6 +133,7 @@ struct route_table *zebra_router_get_table(struct zebra_vrf *zvrf, info->zvrf = zvrf; info->afi = afi; info->safi = safi; + info->table_id = tableid; route_table_set_info(zrt->table, info); zrt->table->cleanup = zebra_rtable_node_cleanup; From a7449876affaf475a458500d0bf407c40a6a56f4 Mon Sep 17 00:00:00 2001 From: Duncan Eastoe Date: Thu, 8 Nov 2018 16:43:02 +0000 Subject: [PATCH 2/2] zebra: always set kernel table ID in FPM netlink Ensure that rtm_table is populated with the kernel table ID. Otherwise routes intended for a non-main table appear to the FPM server as though they should be installed in the main table. Signed-off-by: Duncan Eastoe --- zebra/zebra_fpm_netlink.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c index a18885ddb7..06e5fab444 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -279,7 +279,6 @@ static int netlink_route_info_fill(struct netlink_route_info *ri, int cmd, rib_dest_t *dest, struct route_entry *re) { struct nexthop *nexthop; - struct zebra_vrf *zvrf; memset(ri, 0, sizeof(*ri)); @@ -287,9 +286,7 @@ static int netlink_route_info_fill(struct netlink_route_info *ri, int cmd, ri->af = rib_dest_af(dest); ri->nlmsg_type = cmd; - zvrf = rib_dest_vrf(dest); - if (zvrf) - ri->rtm_table = zvrf->table_id; + ri->rtm_table = rib_table_info(rib_dest_table(dest))->table_id; ri->rtm_protocol = RTPROT_UNSPEC; /*