From: dslice Date: Wed, 17 Feb 2016 18:19:18 +0000 (-0800) Subject: zebra: fix creation of "other table" for rdnbrd X-Git-Tag: frr-2.0-rc1~1123 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=99a654bd0c58be5ae70499c894dedea831d5aaff;p=mirror%2Ffrr.git zebra: fix creation of "other table" for rdnbrd zebra: add the creation of the alternative table for rdnbrd in the context of vrfs When rdnbrd pulls arp entries into table 10, which are then sent into quagga via netlink, the entries were incorrectly being added to the main table. This fix creates or uses the alternative table if the table-id is not default but the vrf-id is default. Tested manually and also run successfully in the /tests/l3/ospf_ebgp_redist_comprehensive_test.py:TestBasicEndToEndPing , which consistently failed bafore this fix was applied. Signed-off-by: Don Slice Reviewed-by: Donald Sharp --- diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 67034fa4c0..5b10739b4c 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -3917,6 +3917,8 @@ struct route_table * zebra_vrf_other_route_table (afi_t afi, u_int32_t table_id, vrf_id_t vrf_id) { struct zebra_vrf *zvrf; + rib_table_info_t *info; + struct route_table *table; zvrf = vrf_info_lookup (vrf_id); if (! zvrf) @@ -3928,22 +3930,21 @@ zebra_vrf_other_route_table (afi_t afi, u_int32_t table_id, vrf_id_t vrf_id) if (table_id >= ZEBRA_KERNEL_TABLE_MAX) return NULL; - /* Pending: This is a MUST-DO for import-table feature. - - Making it work like zebra_vrf_table() for now. Ideally, we want to - implement import table in a way, so that the other_table doesnt have to be - maintained separately. - - Need to explore how to provide import table concept - (May be only the default VRF?) - - How/if to provide some safety against picking a import table to be same as - a table associated/used in some other vrf. - if (zvrf->other_table[afi][table_id] == NULL) + if ((vrf_id == VRF_DEFAULT) && (table_id != RT_TABLE_MAIN) && (table_id != zebrad.rtm_table_default)) { - zvrf->other_table[afi][table_id] = route_table_init(); - } - return (zvrf->other_table[afi][table_id]); - */ + if (zvrf->other_table[afi][table_id] == NULL) + { + table = route_table_init(); + info = XCALLOC (MTYPE_RIB_TABLE_INFO, sizeof (*info)); + info->zvrf = zvrf; + info->afi = afi; + info->safi = SAFI_UNICAST; + table->info = info; + zvrf->other_table[afi][table_id] = table; + } + return (zvrf->other_table[afi][table_id]); + } + return zvrf->table[afi][SAFI_UNICAST]; } - -