Skip to content

Commit

Permalink
zebra: fix show ip route table vrf display
Browse files Browse the repository at this point in the history
A table ID != 254 is not assigned to VRF default but "show ip route
table XX" shows that is owned by VRF default.

> ip route add blackhole default table 111
> ip link add RED type vrf table 111

> ubu-24-arm# do sho ip route vrf RED
> [...]
> VRF RED:
> K>* 0.0.0.0/0 [0/0] unreachable (blackhole) (vrf default), weight 1, 00:00:53
>
> ubu-24-arm# do sho ip route table 111
> [...]
> VRF default table 111:
> K>* 0.0.0.0/0 [0/0] unreachable (blackhole) (vrf default), weight 1, 00:00:39

Fix the output:

> ubu-24-arm# do sho ip route table all
> [...]
> Table 111:
> K>* 0.0.0.0/0 [0/0] unreachable (blackhole) (vrf default), weight 1, 00:00:39
>
> Table 254:
> [...]

Signed-off-by: Louis Scalbert <[email protected]>
  • Loading branch information
louis-6wind committed Sep 21, 2024
1 parent c3b5c96 commit b9a5d5b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions zebra/zebra_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -939,14 +939,17 @@ static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf,
vty_out(vty, "\n");
if (ctx->multi || zvrf_id(zvrf) != VRF_DEFAULT
|| tableid) {
if (!tableid)
vty_out(vty, "VRF %s:\n",
zvrf_name(zvrf));
else
if (vrf_is_backend_netns() && tableid)
vty_out(vty,
"VRF %s table %u:\n",
zvrf_name(zvrf),
tableid);
else if (tableid)
vty_out(vty, "Table %u:\n",
tableid);
else
vty_out(vty, "VRF %s:\n",
zvrf_name(zvrf));
}
ctx->header_done = true;
first = 0;
Expand Down

0 comments on commit b9a5d5b

Please sign in to comment.