]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: mpls nexthop entry displays also interface when available
authorPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 2 Mar 2023 09:46:31 +0000 (10:46 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 22 Mar 2023 11:06:29 +0000 (12:06 +0100)
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>
zebra/zebra_mpls.c

index cb9a527f744a2a60fe527944154141ffe7619264..dd935fc47c9fb918cadd19bb009fae13fe5eff6d 100644 (file)
@@ -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: