aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid Ahern <dsa@cumulusnetworks.com>2015-10-21 11:42:22 -0400
committerDavid S. Miller <davem@davemloft.net>2015-10-22 10:36:19 -0400
commitd46a9d678e4c9fac1e968d0593e4dba683389324 (patch)
tree24b84e5a7b51f6c7687993a7951c44661b16fa4b /net
parent92a93fd5bbe7dbe0ee7322c92e44a820f62bef90 (diff)
net: ipv6: Dont add RT6_LOOKUP_F_IFACE flag if saddr set
741a11d9e410 ("net: ipv6: Add RT6_LOOKUP_F_IFACE flag if oif is set") adds the RT6_LOOKUP_F_IFACE flag to make device index mismatch fatal if oif is given. Hajime reported that this change breaks the Mobile IPv6 use case that wants to force the message through one interface yet use the source address from another interface. Handle this case by only adding the flag if oif is set and saddr is not set. Fixes: 741a11d9e410 ("net: ipv6: Add RT6_LOOKUP_F_IFACE flag if oif is set") Cc: Hajime Tazaki <thehajime@gmail.com> Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/route.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index be5d2879b5d8..946880ad48ac 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1193,14 +1193,16 @@ struct dst_entry *ip6_route_output(struct net *net, const struct sock *sk,
1193 struct flowi6 *fl6) 1193 struct flowi6 *fl6)
1194{ 1194{
1195 int flags = 0; 1195 int flags = 0;
1196 bool any_src;
1196 1197
1197 fl6->flowi6_iif = LOOPBACK_IFINDEX; 1198 fl6->flowi6_iif = LOOPBACK_IFINDEX;
1198 1199
1200 any_src = ipv6_addr_any(&fl6->saddr);
1199 if ((sk && sk->sk_bound_dev_if) || rt6_need_strict(&fl6->daddr) || 1201 if ((sk && sk->sk_bound_dev_if) || rt6_need_strict(&fl6->daddr) ||
1200 fl6->flowi6_oif) 1202 (fl6->flowi6_oif && any_src))
1201 flags |= RT6_LOOKUP_F_IFACE; 1203 flags |= RT6_LOOKUP_F_IFACE;
1202 1204
1203 if (!ipv6_addr_any(&fl6->saddr)) 1205 if (!any_src)
1204 flags |= RT6_LOOKUP_F_HAS_SADDR; 1206 flags |= RT6_LOOKUP_F_HAS_SADDR;
1205 else if (sk) 1207 else if (sk)
1206 flags |= rt6_srcprefs2flags(inet6_sk(sk)->srcprefs); 1208 flags |= rt6_srcprefs2flags(inet6_sk(sk)->srcprefs);