zebra: include the prefix in nht show command

Include the prefix in "show ip nht" and "show ipv6 nht".

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
This commit is contained in:
Enke Chen 2024-09-14 23:47:00 -07:00
parent afe37c8698
commit f6e28717ec
3 changed files with 23 additions and 19 deletions

View File

@ -1,35 +1,35 @@
VRF default:
Resolve via default: on
1.1.1.1
resolved via static
resolved via static, prefix 1.1.1.1/32
is directly connected, r1-eth1 (vrf default), weight 1
Client list: pbr(fd XX)
1.1.1.2
resolved via static
resolved via static, prefix 1.1.1.2/32
is directly connected, r1-eth2 (vrf default), weight 1
Client list: pbr(fd XX)
1.1.1.3
resolved via static
resolved via static, prefix 1.1.1.3/32
is directly connected, r1-eth3 (vrf default), weight 1
Client list: pbr(fd XX)
1.1.1.4
resolved via static
resolved via static, prefix 1.1.1.4/32
is directly connected, r1-eth4 (vrf default), weight 1
Client list: pbr(fd XX)
1.1.1.5
resolved via static
resolved via static, prefix 1.1.1.5/32
is directly connected, r1-eth5 (vrf default), weight 1
Client list: pbr(fd XX)
1.1.1.6
resolved via static
resolved via static, prefix 1.1.1.6/32
is directly connected, r1-eth6 (vrf default), weight 1
Client list: pbr(fd XX)
1.1.1.7
resolved via static
resolved via static, prefix 1.1.1.7/32
is directly connected, r1-eth7 (vrf default), weight 1
Client list: pbr(fd XX)
1.1.1.8
resolved via static
resolved via static, prefix 1.1.1.8/32
is directly connected, r1-eth8 (vrf default), weight 1
Client list: pbr(fd XX)
2.2.2.1
@ -54,19 +54,19 @@ VRF default:
unresolved
Client list: pbr(fd XX)
192.168.0.2
resolved via connected
resolved via connected, prefix 192.168.0.0/24
is directly connected, r1-eth0 (vrf default), weight 1
Client list: static(fd XX)
192.168.0.4
resolved via connected
resolved via connected, prefix 192.168.0.0/24
is directly connected, r1-eth0 (vrf default), weight 1
Client list: static(fd XX)
192.168.7.10
resolved via connected
resolved via connected, prefix 192.168.7.0/26
is directly connected, r1-eth7 (vrf default), weight 1
Client list: bgp(fd XX)
192.168.7.20(Connected)
resolved via connected
resolved via connected, prefix 192.168.7.0/26
is directly connected, r1-eth7 (vrf default), weight 1
Client list: bgp(fd XX)
192.168.161.4

View File

@ -1,15 +1,15 @@
VRF default:
Resolve via default: on
fc00::2
resolved via connected
resolved via connected, prefix fc00::/64
is directly connected, r1-eth0 (vrf default), weight 1
Client list: static(fd XX)
fc00:0:0:8::1000
resolved via connected
resolved via connected, prefix fc00:0:0:8::/64
is directly connected, r1-eth8 (vrf default), weight 1
Client list: bgp(fd XX)
fc00:0:0:8::2000(Connected)
resolved via connected
resolved via connected, prefix fc00:0:0:8::/64
is directly connected, r1-eth8 (vrf default), weight 1
Client list: bgp(fd XX)

View File

@ -1344,13 +1344,17 @@ static void print_rnh(struct route_node *rn, struct vty *vty, json_object *json)
}
if (rnh->state) {
if (json)
if (json) {
json_object_string_add(
json_nht, "resolvedProtocol",
zebra_route_string(rnh->state->type));
else
vty_out(vty, " resolved via %s\n",
zebra_route_string(rnh->state->type));
json_object_string_addf(json_nht, "prefix", "%pFX",
&rnh->resolved_route);
} else {
vty_out(vty, " resolved via %s, prefix %pFX\n",
zebra_route_string(rnh->state->type),
&rnh->resolved_route);
}
for (nexthop = rnh->state->nhe->nhg.nexthop; nexthop;
nexthop = nexthop->next) {