if (nexthop == NULL)
return;
- if (IN6_IS_ADDR_LINKLOCAL (nexthop) && ! ifindex)
+ if (!ifindex)
{
if (info->peer->ifname)
ifindex = if_nametoindex (info->peer->ifname);
for (mpinfo = bgp_info_mpath_first (info); mpinfo;
mpinfo = bgp_info_mpath_next (mpinfo))
{
+ ifindex = 0;
+
/* Only global address nexthop exists. */
if (mpinfo->attr->extra->mp_nexthop_len == 16)
- {
nexthop = &mpinfo->attr->extra->mp_nexthop_global;
- }
+
/* If both global and link-local address present. */
- if (mpinfo->attr->extra->mp_nexthop_len == 32)
+ if (mpinfo->attr->extra->mp_nexthop_len == 32)
{
/* Workaround for Cisco's nexthop bug. */
if (IN6_IS_ADDR_UNSPECIFIED (&mpinfo->attr->extra->mp_nexthop_global)
ifindex = mpinfo->peer->nexthop.ifp->ifindex;
}
}
- if (nexthop == NULL)
- {
- continue;
- }
- if (IN6_IS_ADDR_LINKLOCAL (nexthop) && ! ifindex)
- {
- if (mpinfo->peer->ifname)
- {
- ifindex = if_nametoindex (mpinfo->peer->ifname);
+ if (nexthop == NULL)
+ {
+ continue;
+ }
+
+ if (!ifindex)
+ {
+ if (mpinfo->peer->ifname)
+ {
+ ifindex = if_nametoindex (mpinfo->peer->ifname);
}
- else if (mpinfo->peer->nexthop.ifp)
- {
- ifindex = mpinfo->peer->nexthop.ifp->ifindex;
- }
- }
- if (ifindex == 0)
- {
- continue;
+ else if (mpinfo->peer->nexthop.ifp)
+ {
+ ifindex = mpinfo->peer->nexthop.ifp->ifindex;
}
+ }
+
+ if (ifindex == 0)
+ {
+ continue;
+ }
stream_put (bgp_nexthop_buf, &nexthop, sizeof (struct in6_addr *));
stream_put (bgp_ifindices_buf, &ifindex, sizeof (unsigned int));