mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 03:27:39 +00:00
Merge pull request #16750 from donaldsharp/table_display_is_not_vrf_based_in_some_cases
zebra: Don't display the vrf if not using namespace based vrfs
This commit is contained in:
commit
f68d5b3811
@ -24,6 +24,7 @@ extern "C" {
|
|||||||
#if !defined(GNU_LINUX)
|
#if !defined(GNU_LINUX)
|
||||||
/* BSD systems
|
/* BSD systems
|
||||||
*/
|
*/
|
||||||
|
#define RT_TABLE_ID_MAIN 0
|
||||||
#else
|
#else
|
||||||
/* Linux Systems
|
/* Linux Systems
|
||||||
*/
|
*/
|
||||||
|
@ -398,6 +398,7 @@ vrf_id_t zebra_vrf_lookup_by_table(uint32_t table_id, ns_id_t ns_id)
|
|||||||
|
|
||||||
RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
|
RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
|
||||||
zvrf = vrf->info;
|
zvrf = vrf->info;
|
||||||
|
|
||||||
if (zvrf == NULL)
|
if (zvrf == NULL)
|
||||||
continue;
|
continue;
|
||||||
/* case vrf with netns : match the netnsid */
|
/* case vrf with netns : match the netnsid */
|
||||||
@ -408,6 +409,7 @@ vrf_id_t zebra_vrf_lookup_by_table(uint32_t table_id, ns_id_t ns_id)
|
|||||||
/* VRF is VRF_BACKEND_VRF_LITE */
|
/* VRF is VRF_BACKEND_VRF_LITE */
|
||||||
if (zvrf->table_id != table_id)
|
if (zvrf->table_id != table_id)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return zvrf_id(zvrf);
|
return zvrf_id(zvrf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -858,6 +858,27 @@ static void vty_show_ip_route_detail_json(struct vty *vty,
|
|||||||
vty_json(vty, json);
|
vty_json(vty, json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void zebra_vty_display_vrf_header(struct vty *vty, struct zebra_vrf *zvrf, uint32_t tableid)
|
||||||
|
{
|
||||||
|
if (!tableid)
|
||||||
|
vty_out(vty, "VRF %s:\n", zvrf_name(zvrf));
|
||||||
|
else {
|
||||||
|
if (vrf_is_backend_netns())
|
||||||
|
vty_out(vty, "VRF %s table %u:\n", zvrf_name(zvrf), tableid);
|
||||||
|
else {
|
||||||
|
vrf_id_t vrf = zebra_vrf_lookup_by_table(tableid, zvrf->zns->ns_id);
|
||||||
|
|
||||||
|
if (vrf == VRF_DEFAULT && tableid != RT_TABLE_ID_MAIN)
|
||||||
|
vty_out(vty, "table %u:\n", tableid);
|
||||||
|
else {
|
||||||
|
struct zebra_vrf *zvrf2 = zebra_vrf_lookup_by_id(vrf);
|
||||||
|
|
||||||
|
vty_out(vty, "VRF %s table %u:\n", zvrf_name(zvrf2), tableid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf,
|
static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf,
|
||||||
struct route_table *table, afi_t afi,
|
struct route_table *table, afi_t afi,
|
||||||
bool use_fib, route_tag_t tag,
|
bool use_fib, route_tag_t tag,
|
||||||
@ -937,17 +958,9 @@ static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf,
|
|||||||
}
|
}
|
||||||
if (ctx->multi && ctx->header_done)
|
if (ctx->multi && ctx->header_done)
|
||||||
vty_out(vty, "\n");
|
vty_out(vty, "\n");
|
||||||
if (ctx->multi || zvrf_id(zvrf) != VRF_DEFAULT
|
if (ctx->multi || zvrf_id(zvrf) != VRF_DEFAULT || tableid)
|
||||||
|| tableid) {
|
zebra_vty_display_vrf_header(vty, zvrf, tableid);
|
||||||
if (!tableid)
|
|
||||||
vty_out(vty, "VRF %s:\n",
|
|
||||||
zvrf_name(zvrf));
|
|
||||||
else
|
|
||||||
vty_out(vty,
|
|
||||||
"VRF %s table %u:\n",
|
|
||||||
zvrf_name(zvrf),
|
|
||||||
tableid);
|
|
||||||
}
|
|
||||||
ctx->header_done = true;
|
ctx->header_done = true;
|
||||||
first = 0;
|
first = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user