Skip to content

Commit c891cd2

Browse files
committed
zebra: Display interface name not ifindex in nh dump
When dumping nexthop data, display the interface name as well. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
1 parent b732ad2 commit c891cd2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

zebra/zebra_rib.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4241,12 +4241,13 @@ void route_entry_dump_nh(const struct route_entry *re, const char *straddr,
42414241
struct interface *ifp;
42424242
struct vrf *vrf = vrf_lookup_by_id(nexthop->vrf_id);
42434243

4244+
ifp = if_lookup_by_index(nexthop->ifindex, nexthop->vrf_id);
4245+
42444246
switch (nexthop->type) {
42454247
case NEXTHOP_TYPE_BLACKHOLE:
42464248
snprintf(nhname, sizeof(nhname), "Blackhole");
42474249
break;
42484250
case NEXTHOP_TYPE_IFINDEX:
4249-
ifp = if_lookup_by_index(nexthop->ifindex, nexthop->vrf_id);
42504251
snprintf(nhname, sizeof(nhname), "%s",
42514252
ifp ? ifp->name : "Unknown");
42524253
break;
@@ -4284,9 +4285,9 @@ void route_entry_dump_nh(const struct route_entry *re, const char *straddr,
42844285
if (nexthop->weight)
42854286
snprintf(wgt_str, sizeof(wgt_str), "wgt %d,", nexthop->weight);
42864287

4287-
zlog_debug("%s(%s): %s %s[%u] %svrf %s(%u) %s%s with flags %s%s%s%s%s%s%s%s%s",
4288+
zlog_debug("%s(%s): %s %s[%s:%d] %svrf %s(%u) %s%s with flags %s%s%s%s%s%s%s%s%s",
42884289
straddr, VRF_LOGNAME(re_vrf),
4289-
(nexthop->rparent ? " NH" : "NH"), nhname, nexthop->ifindex,
4290+
(nexthop->rparent ? " NH" : "NH"), nhname, ifp ? ifp->name : "Unknown", nexthop->ifindex,
42904291
label_str, vrf ? vrf->name : "Unknown", nexthop->vrf_id,
42914292
wgt_str, backup_str,
42924293
(CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE) ? "ACTIVE "

0 commit comments

Comments
 (0)