bgpd rfapi: fix UN address in show with MPLS TT

Signed-off-by: Lou Berger <lberger@labn.net>
This commit is contained in:
Lou Berger 2017-01-29 08:15:23 -05:00
parent 1858c1d1c4
commit def3f4e942

View File

@ -1175,16 +1175,18 @@ rfapiPrintRemoteRegBi (
inet_ntop (pfx_un.family, &pfx_un.u.prefix, buf_ntop,
BUFSIZ));
}
buf_un[BUFSIZ - 1] = 0;
rfapiGetTunnelType(bi->attr,&tun_type);
/*
* VN addr
*/
buf_vn[0] = 0;
rfapiNexthop2Prefix (bi->attr, &pfx_vn);
if (tun_type == BGP_ENCAP_TYPE_MPLS)
{
/* MPLS carries un in nrli next hop (same as vn for IP tunnels) */
snprintf (buf_un, BUFSIZ, "%s",
inet_ntop (pfx_vn.family, &pfx_vn.u.prefix, buf_ntop, BUFSIZ));
if (bi->extra)
{
u_int32_t l = decode_label (bi->extra->tag);
@ -1197,13 +1199,12 @@ rfapiPrintRemoteRegBi (
}
else
{
rfapiNexthop2Prefix (bi->attr, &pfx_vn);
snprintf (buf_vn, BUFSIZ, "%s",
inet_ntop (pfx_vn.family, &pfx_vn.u.prefix, buf_ntop, BUFSIZ));
}
buf_vn[BUFSIZ - 1] = 0;
buf_un[BUFSIZ - 1] = 0;
/*
* Cost is encoded in local_pref as (255-cost)
* See rfapi_import.c'rfapiRouteInfo2NextHopEntry() for conversion