From 433e8b67331f356926e122428c21d1df7eba9ab6 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 12 Jun 2015 07:59:12 -0700 Subject: [PATCH] bgpd-5549-display-ll-ifname.patch BGP: Display Link local addr and ifname as part of 5549 support As part of BGP unnumbered and RFC 5549 support, the implementation will honor the link local address as the NH if present and so it'd be useful to display that info along with the interface name, when displaying the BGP route summary. That is what this patch aims to do. Signed-off-by: Dinesh G Dutt --- bgpd/bgp_route.c | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index bc203d4400..bd33888716 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -6676,14 +6676,46 @@ route_vty_out (struct vty *vty, struct prefix *p, } else { - len = vty_out (vty, "%s", - inet_ntop (AF_INET6, &attr->extra->mp_nexthop_global, - buf, BUFSIZ)); - len = 16 - len; - if (len < 1) - vty_out (vty, "%s%*s", VTY_NEWLINE, 36, " "); - else - vty_out (vty, "%*s", len, " "); + if ((attr->extra->mp_nexthop_len == 32) || (binfo->peer->conf_if)) + { + if (binfo->peer->conf_if) + { + len = vty_out (vty, "%s", + binfo->peer->conf_if); + len = 7 - len; /* len of IPv6 addr + max len of def ifname */ + + if (len < 1) + vty_out (vty, "%s%*s", VTY_NEWLINE, 45, " "); + else + vty_out (vty, "%*s", len, " "); + } + else + { + len = vty_out (vty, "%s", + inet_ntop (AF_INET6, + &attr->extra->mp_nexthop_local, + buf, BUFSIZ)); + len = 16 - len; + + if (len < 1) + vty_out (vty, "%s%*s", VTY_NEWLINE, 36, " "); + else + vty_out (vty, "%*s", len, " "); + } + } + else + { + len = vty_out (vty, "%s", + inet_ntop (AF_INET6, + &attr->extra->mp_nexthop_global, + buf, BUFSIZ)); + len = 16 - len; + + if (len < 1) + vty_out (vty, "%s%*s", VTY_NEWLINE, 36, " "); + else + vty_out (vty, "%*s", len, " "); + } } } #endif /* HAVE_IPV6 */ -- 2.39.5