diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-06-04 09:36:01 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-04 09:36:01 -0400 |
| commit | 7acf817f46b4ed3a9de63264718b159eeafb3de5 (patch) | |
| tree | 68c394882bce3a7f208eab27873d40bdce2ddaf7 /zebra/zebra_vrf.c | |
| parent | 3b7268448fef314c914beaa5c6a9bb2d6f0a8ad6 (diff) | |
| parent | 00384b5fbd0cfd3b2087c50bf07fb6570571b85f (diff) | |
Merge pull request #1976 from pguibert6WIND/issue_1968
Issue 1968 / ip route <> table X
Diffstat (limited to 'zebra/zebra_vrf.c')
| -rw-r--r-- | zebra/zebra_vrf.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index 46443dec4f..d443f725b0 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -328,7 +328,9 @@ int zebra_vrf_has_config(struct zebra_vrf *zvrf) } /* Lookup the routing table in a VRF based on both VRF-Id and table-id. - * NOTE: Table-id is relevant only in the Default VRF. + * NOTE: Table-id is relevant on two modes: + * - case VRF backend is default : on default VRF only + * - case VRF backend is netns : on all VRFs */ struct route_table *zebra_vrf_table_with_table_id(afi_t afi, safi_t safi, vrf_id_t vrf_id, @@ -346,6 +348,13 @@ struct route_table *zebra_vrf_table_with_table_id(afi_t afi, safi_t safi, else table = zebra_vrf_other_route_table(afi, table_id, vrf_id); + } else if (vrf_is_backend_netns()) { + if (table_id == RT_TABLE_MAIN + || table_id == zebrad.rtm_table_default) + table = zebra_vrf_table(afi, safi, vrf_id); + else + table = zebra_vrf_other_route_table(afi, table_id, + vrf_id); } else table = zebra_vrf_table(afi, safi, vrf_id); @@ -434,7 +443,8 @@ struct zebra_vrf *zebra_vrf_alloc(void) zebra_vxlan_init_tables(zvrf); zebra_mpls_init_tables(zvrf); zebra_pw_init(zvrf); - + zvrf->table_id = RT_TABLE_MAIN; + /* by default table ID is default one */ return zvrf; } @@ -501,9 +511,16 @@ struct route_table *zebra_vrf_other_route_table(afi_t afi, uint32_t table_id, if (afi >= AFI_MAX) return NULL; - if ((vrf_id == VRF_DEFAULT) && (table_id != RT_TABLE_MAIN) + if ((table_id != RT_TABLE_MAIN) && (table_id != zebrad.rtm_table_default)) { - return zebra_ns_get_table(zns, zvrf, table_id, afi); + if (zvrf->table_id == RT_TABLE_MAIN || + zvrf->table_id == zebrad.rtm_table_default) { + /* this VRF use default table + * so in all cases, it does not use specific table + * so it is possible to configure tables in this VRF + */ + return zebra_ns_get_table(zns, zvrf, table_id, afi); + } } return zvrf->table[afi][SAFI_UNICAST]; |
