summaryrefslogtreecommitdiff
path: root/zebra/zebra_vty.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_vty.c')
-rw-r--r--zebra/zebra_vty.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index ece8f40dcf..257fb168d2 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -382,7 +382,8 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
}
static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
- struct route_entry *re, json_object *json)
+ struct route_entry *re, json_object *json,
+ bool is_fib)
{
struct nexthop *nexthop;
int len = 0;
@@ -394,11 +395,20 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
time_t uptime;
struct tm *tm;
rib_dest_t *dest = rib_dest_from_rnode(rn);
+ struct nexthop_group *nhg;
uptime = monotime(NULL);
uptime -= re->uptime;
tm = gmtime(&uptime);
+ /* If showing fib information, use the fib view of the
+ * nexthops.
+ */
+ if (is_fib)
+ nhg = rib_active_nhg(re);
+ else
+ nhg = &(re->ng);
+
if (json) {
json_route = json_object_new_object();
json_nexthops = json_object_new_array();
@@ -455,7 +465,7 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
json_object_string_add(json_route, "uptime", buf);
- for (ALL_NEXTHOPS(re->ng, nexthop)) {
+ for (ALL_NEXTHOPS_PTR(nhg, nexthop)) {
json_nexthop = json_object_new_object();
json_object_int_add(json_nexthop, "flags",
@@ -625,8 +635,8 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
}
/* Nexthop information. */
- for (ALL_NEXTHOPS(re->ng, nexthop)) {
- if (nexthop == re->ng.nexthop) {
+ for (ALL_NEXTHOPS_PTR(nhg, nexthop)) {
+ if (nexthop == nhg->nexthop) {
/* Prefix information. */
len = vty_out(vty, "%c", zebra_route_char(re->type));
if (re->instance)
@@ -779,7 +789,7 @@ static void vty_show_ip_route_detail_json(struct vty *vty,
*/
if (use_fib && re != dest->selected_fib)
continue;
- vty_show_ip_route(vty, rn, re, json_prefix);
+ vty_show_ip_route(vty, rn, re, json_prefix, use_fib);
}
prefix2str(&rn->p, buf, sizeof(buf));
@@ -865,7 +875,7 @@ static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf,
}
}
- vty_show_ip_route(vty, rn, re, json_prefix);
+ vty_show_ip_route(vty, rn, re, json_prefix, use_fib);
}
if (json_prefix) {
@@ -1552,7 +1562,7 @@ DEFUN (show_ipv6_mroute,
vty_out(vty, SHOW_ROUTE_V6_HEADER);
first = 0;
}
- vty_show_ip_route(vty, rn, re, NULL);
+ vty_show_ip_route(vty, rn, re, NULL, false);
}
return CMD_SUCCESS;
}
@@ -1584,7 +1594,7 @@ DEFUN (show_ipv6_mroute_vrf_all,
vty_out(vty, SHOW_ROUTE_V6_HEADER);
first = 0;
}
- vty_show_ip_route(vty, rn, re, NULL);
+ vty_show_ip_route(vty, rn, re, NULL, false);
}
}
return CMD_SUCCESS;