net: ipv6 bind to device issue

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Saturday, April 24, 2010 - 3:59 pm

Gitweb:     http://git.kernel.org/linus/f4f914b58019f0e50d521bbbadfaee260d766f95
Commit:     f4f914b58019f0e50d521bbbadfaee260d766f95
Parent:     f2228f785a9d97307aa8ba709088cfda6c3df73f
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Tue Apr 20 21:21:26 2010 +0000
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Wed Apr 21 22:59:24 2010 -0700

    net: ipv6 bind to device issue
    
    The issue raises when having 2 NICs both assigned the same
    IPv6 global address.
    
    If a sender binds to a particular NIC (SO_BINDTODEVICE),
    the outgoing traffic is being sent via the first found.
    The bonded device is thus not taken into an account during the
    routing.
    
    From the ip6_route_output function:
    
    If the binding address is multicast, linklocal or loopback,
    the RT6_LOOKUP_F_IFACE bit is set, but not for global address.
    
    So binding global address will neglect SO_BINDTODEVICE-binded device,
    because the fib6_rule_lookup function path won't check for the
    flowi::oif field and take first route that fits.
    
    Signed-off-by: Jiri Olsa <jolsa@redhat.com>
    Signed-off-by: Scott Otto <scott.otto@alcatel-lucent.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/ipv6/route.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index c2438e8..05ebd78 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -815,7 +815,7 @@ struct dst_entry * ip6_route_output(struct net *net, struct sock *sk,
 {
 	int flags = 0;
 
-	if (rt6_need_strict(&fl->fl6_dst))
+	if (fl->oif || rt6_need_strict(&fl->fl6_dst))
 		flags |= RT6_LOOKUP_F_IFACE;
 
 	if (!ipv6_addr_any(&fl->fl6_src))
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
net: ipv6 bind to device issue, Linux Kernel Mailing ..., (Sat Apr 24, 3:59 pm)