Skip to content

Commit

Permalink
Merge pull request FRRouting#16828 from enkechen-panw/print-rnh
Browse files Browse the repository at this point in the history
zebra: include the prefix in nht show command
  • Loading branch information
donaldsharp authored Sep 16, 2024
2 parents 81db47a + f6e2871 commit aab2946
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
24 changes: 12 additions & 12 deletions tests/topotests/all_protocol_startup/r1/ip_nht.ref
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/topotests/all_protocol_startup/r1/ipv6_nht.ref
Original file line number Diff line number Diff line change
@@ -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)

12 changes: 8 additions & 4 deletions zebra/zebra_rnh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit aab2946

Please sign in to comment.