diff options
| author | Philippe Guibert <philippe.guibert@6wind.com> | 2023-03-02 10:46:31 +0100 | 
|---|---|---|
| committer | Philippe Guibert <philippe.guibert@6wind.com> | 2023-03-22 12:06:29 +0100 | 
| commit | 92fed67b291add521019c4cc6ad7ae4b75121c6b (patch) | |
| tree | d7cf2d38a2e0ef510eea10d83bd462d0a540c209 /zebra/zebra_mpls.c | |
| parent | a654281e51e06cdeee44ee1a7d0db739834ad2d7 (diff) | |
zebra: mpls nexthop entry displays also interface when available
The 'show mpls table json' command displays the outgoing interface
name only when the nexthop type is either NEXTHOP_TYPE_IFINDEX or
NEXTHOP_TYPE_IPV6_IFINDEX. add the interface name for the nexthop
type NEXTHOP_TYPE_IPV4_IFINDEX.
Fixes: ("b78b820d46d6") MPLS: Display enhancements and JSON support
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/zebra_mpls.c')
| -rw-r--r-- | zebra/zebra_mpls.c | 4 | 
1 files changed, 4 insertions, 0 deletions
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index cb9a527f74..dd935fc47c 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -1525,6 +1525,10 @@ static json_object *nhlfe_json(struct zebra_nhlfe *nhlfe)  	case NEXTHOP_TYPE_IPV4_IFINDEX:  		json_object_string_addf(json_nhlfe, "nexthop", "%pI4",  					&nexthop->gate.ipv4); +		if (nexthop->ifindex) +			json_object_string_add(json_nhlfe, "interface", +					       ifindex2ifname(nexthop->ifindex, +							      nexthop->vrf_id));  		break;  	case NEXTHOP_TYPE_IPV6:  	case NEXTHOP_TYPE_IPV6_IFINDEX:  | 
