netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ipv6: Add RT6_LOOKUP_F_IFACE flag if oif is set
@ 2015-09-28 17:12 David Ahern
  2015-09-29 22:01 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: David Ahern @ 2015-09-28 17:12 UTC (permalink / raw)
  To: netdev; +Cc: netdev, yoshfuji, David Ahern

Wolfgang reported that IPv6 stack is ignoring oif in output route lookups:

    With ipv6, ip -6 route get always returns the specific route.

    $ ip -6 r
    2001:db8:e2::1 dev enp2s0  proto kernel  metric 256
    2001:db8:e2::/64 dev enp2s0  metric 1024
    2001:db8:e3::1 dev enp3s0  proto kernel  metric 256
    2001:db8:e3::/64 dev enp3s0  metric 1024
    fe80::/64 dev enp3s0  proto kernel  metric 256
    default via 2001:db8:e3::255 dev enp3s0  metric 1024

    $ ip -6 r get 2001:db8:e2::100
    2001:db8:e2::100 from :: dev enp2s0  src 2001:db8:e3::1  metric 0
        cache

    $ ip -6 r get 2001:db8:e2::100 oif enp3s0
    2001:db8:e2::100 from :: dev enp2s0  src 2001:db8:e3::1  metric 0
        cache

The stack does consider the oif but a mismatch in rt6_device_match is not
considered fatal because RT6_LOOKUP_F_IFACE is not set in the flags.

Cc: Wolfgang Nothdurft <netdev@linux-dude.de>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
 net/ipv6/route.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index f204089e854c..cb32ce250db0 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1193,7 +1193,8 @@ struct dst_entry *ip6_route_output(struct net *net, const struct sock *sk,
 
 	fl6->flowi6_iif = LOOPBACK_IFINDEX;
 
-	if ((sk && sk->sk_bound_dev_if) || rt6_need_strict(&fl6->daddr))
+	if ((sk && sk->sk_bound_dev_if) || rt6_need_strict(&fl6->daddr) ||
+	    fl6->flowi6_oif)
 		flags |= RT6_LOOKUP_F_IFACE;
 
 	if (!ipv6_addr_any(&fl6->saddr))
-- 
2.3.8 (Apple Git-58)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: ipv6: Add RT6_LOOKUP_F_IFACE flag if oif is set
  2015-09-28 17:12 [PATCH] net: ipv6: Add RT6_LOOKUP_F_IFACE flag if oif is set David Ahern
@ 2015-09-29 22:01 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-09-29 22:01 UTC (permalink / raw)
  To: dsa; +Cc: netdev, netdev, yoshfuji

From: David Ahern <dsa@cumulusnetworks.com>
Date: Mon, 28 Sep 2015 10:12:13 -0700

> Wolfgang reported that IPv6 stack is ignoring oif in output route lookups:
 ...
> The stack does consider the oif but a mismatch in rt6_device_match is not
> considered fatal because RT6_LOOKUP_F_IFACE is not set in the flags.
> 
> Cc: Wolfgang Nothdurft <netdev@linux-dude.de>
> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>

Applied, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-29 22:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-28 17:12 [PATCH] net: ipv6: Add RT6_LOOKUP_F_IFACE flag if oif is set David Ahern
2015-09-29 22:01 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).