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: VRF default:
Resolve via default: on Resolve via default: on
1.1.1.1 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 is directly connected, r1-eth1 (vrf default), weight 1
Client list: pbr(fd XX) Client list: pbr(fd XX)
1.1.1.2 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 is directly connected, r1-eth2 (vrf default), weight 1
Client list: pbr(fd XX) Client list: pbr(fd XX)
1.1.1.3 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 is directly connected, r1-eth3 (vrf default), weight 1
Client list: pbr(fd XX) Client list: pbr(fd XX)
1.1.1.4 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 is directly connected, r1-eth4 (vrf default), weight 1
Client list: pbr(fd XX) Client list: pbr(fd XX)
1.1.1.5 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 is directly connected, r1-eth5 (vrf default), weight 1
Client list: pbr(fd XX) Client list: pbr(fd XX)
1.1.1.6 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 is directly connected, r1-eth6 (vrf default), weight 1
Client list: pbr(fd XX) Client list: pbr(fd XX)
1.1.1.7 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 is directly connected, r1-eth7 (vrf default), weight 1
Client list: pbr(fd XX) Client list: pbr(fd XX)
1.1.1.8 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 is directly connected, r1-eth8 (vrf default), weight 1
Client list: pbr(fd XX) Client list: pbr(fd XX)
2.2.2.1 2.2.2.1
@ -54,19 +54,19 @@ VRF default:
unresolved unresolved
Client list: pbr(fd XX) Client list: pbr(fd XX)
192.168.0.2 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 is directly connected, r1-eth0 (vrf default), weight 1
Client list: static(fd XX) Client list: static(fd XX)
192.168.0.4 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 is directly connected, r1-eth0 (vrf default), weight 1
Client list: static(fd XX) Client list: static(fd XX)
192.168.7.10 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 is directly connected, r1-eth7 (vrf default), weight 1
Client list: bgp(fd XX) Client list: bgp(fd XX)
192.168.7.20(Connected) 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 is directly connected, r1-eth7 (vrf default), weight 1
Client list: bgp(fd XX) Client list: bgp(fd XX)
192.168.161.4 192.168.161.4

View File

@ -1,15 +1,15 @@
VRF default: VRF default:
Resolve via default: on Resolve via default: on
fc00::2 fc00::2
resolved via connected resolved via connected, prefix fc00::/64
is directly connected, r1-eth0 (vrf default), weight 1 is directly connected, r1-eth0 (vrf default), weight 1
Client list: static(fd XX) Client list: static(fd XX)
fc00:0:0:8::1000 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 is directly connected, r1-eth8 (vrf default), weight 1
Client list: bgp(fd XX) Client list: bgp(fd XX)
fc00:0:0:8::2000(Connected) 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 is directly connected, r1-eth8 (vrf default), weight 1
Client list: bgp(fd XX) 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 (rnh->state) {
if (json) if (json) {
json_object_string_add( json_object_string_add(
json_nht, "resolvedProtocol", json_nht, "resolvedProtocol",
zebra_route_string(rnh->state->type)); zebra_route_string(rnh->state->type));
else json_object_string_addf(json_nht, "prefix", "%pFX",
vty_out(vty, " resolved via %s\n", &rnh->resolved_route);
zebra_route_string(rnh->state->type)); } 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; for (nexthop = rnh->state->nhe->nhg.nexthop; nexthop;
nexthop = nexthop->next) { nexthop = nexthop->next) {