From: Vivek Venkatraman <[email protected]> Ensure that if 'update-source <interface>' is specified, that interface is chosen as the source for the local nexthops. Otherwise, do a complete match on the local IP address of the connection to determine the source interface for the local nexthops; this will handle scenarios where there is an overlap of subnets between interfaces (e.g., loopback and another interface).
Signed-off-by: Vivek Venkatraman <[email protected]> --- bgpd/bgp_zebra.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 339ed12..685cdba 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -729,7 +729,10 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote, if (local->sa.sa_family == AF_INET) { nexthop->v4 = local->sin.sin_addr; - ifp = if_lookup_by_ipv4 (&local->sin.sin_addr); + if (peer->update_if) + ifp = if_lookup_by_name (peer->update_if); + else + ifp = if_lookup_by_ipv4_exact (&local->sin.sin_addr); } #ifdef HAVE_IPV6 if (local->sa.sa_family == AF_INET6) @@ -739,8 +742,10 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote, if (peer->conf_if || peer->ifname) ifp = if_lookup_by_index (if_nametoindex (peer->conf_if ? peer->conf_if : peer->ifname)); } + else if (peer->update_if) + ifp = if_lookup_by_name (peer->update_if); else - ifp = if_lookup_by_ipv6 (&local->sin6.sin6_addr); + ifp = if_lookup_by_ipv6_exact (&local->sin6.sin6_addr); } #endif /* HAVE_IPV6 */ -- 1.9.1 _______________________________________________ Quagga-dev mailing list [email protected] https://lists.quagga.net/mailman/listinfo/quagga-dev
