struct route_table *table;
bool uj = use_json(argc, argv);
- if (table_id == 0)
- table_id = RT_TABLE_MAIN;
-
if (vrf_all) {
struct vrf *vrf;
struct zebra_vrf *zvrf;
if ((zvrf = vrf->info) == NULL)
continue;
- table = zebra_vrf_lookup_table_with_table_id(
- afi, SAFI_UNICAST, zvrf->vrf->vrf_id, table_id);
+ if (table_id == 0)
+ table = zebra_vrf_table(afi, SAFI_UNICAST,
+ zvrf->vrf->vrf_id);
+ else
+ table = zebra_vrf_lookup_table_with_table_id(
+ afi, SAFI_UNICAST, zvrf->vrf->vrf_id,
+ table_id);
if (!table)
continue;
if (vrf_name)
VRF_GET_ID(vrf_id, vrf_name, false);
- table = zebra_vrf_lookup_table_with_table_id(afi, SAFI_UNICAST,
- vrf_id, table_id);
+ if (table_id == 0)
+ table = zebra_vrf_table(afi, SAFI_UNICAST, vrf_id);
+ else
+ table = zebra_vrf_lookup_table_with_table_id(
+ afi, SAFI_UNICAST, vrf_id, table_id);
if (!table)
return CMD_SUCCESS;