public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: David Ahern <dsa@cumulusnetworks•com>
To: Hajime Tazaki <thehajime@gmail•com>
Cc: steffen.klassert@secunet•com, netdev@vger•kernel.org
Subject: Re: [PATCH net-next] net: Fix vti use case with oif in dst lookups for IPv6
Date: Tue, 20 Oct 2015 11:48:48 -0600	[thread overview]
Message-ID: <56267E80.5030500@cumulusnetworks.com> (raw)
In-Reply-To: <m2lhaxoh5r.wl@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 503 bytes --]

On 10/20/15 6:31 AM, Hajime Tazaki wrote:
> yes, this sendmsg uses non-zero flowi6_oif.
>
>
> the conditions are
>
> - sendmsg () with INET6/RAW socket (with IPPROTO_MH)
> - ip6_pktinfo.ipi6_addr (fl6.saddr) and ipi6_oif
>    (fl6.flowi6_oif) are non-NULL.
> => ipi6_addr (fl6.saddr) is not the IP address of oif, but
>      another interfaces (home address of mip6)

interesting. so forcing a send out of interface X but using the source 
address of interface Y.

Does the attached patch work for you?

[-- Attachment #2: ipv6-oif-with-saddr.patch --]
[-- Type: text/plain, Size: 848 bytes --]

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index d0619632723a..2701cb3d88e9 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1171,6 +1171,7 @@ struct dst_entry *ip6_route_output(struct net *net, const struct sock *sk,
 {
 	struct dst_entry *dst;
 	int flags = 0;
+	bool any_src;
 
 	dst = l3mdev_rt6_dst_by_oif(net, fl6);
 	if (dst)
@@ -1178,11 +1179,12 @@ struct dst_entry *ip6_route_output(struct net *net, const struct sock *sk,
 
 	fl6->flowi6_iif = LOOPBACK_IFINDEX;
 
+	any_src = ipv6_addr_any(&fl6->saddr);
 	if ((sk && sk->sk_bound_dev_if) || rt6_need_strict(&fl6->daddr) ||
-	    fl6->flowi6_oif)
+	    (fl6->flowi6_oif && any_src))
 		flags |= RT6_LOOKUP_F_IFACE;
 
-	if (!ipv6_addr_any(&fl6->saddr))
+	if (!any_src)
 		flags |= RT6_LOOKUP_F_HAS_SADDR;
 	else if (sk)
 		flags |= rt6_srcprefs2flags(inet6_sk(sk)->srcprefs);

  reply	other threads:[~2015-10-20 17:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-05 14:32 [PATCH net-next] net: Fix vti use case with oif in dst lookups for IPv6 David Ahern
2015-10-07 11:25 ` David Miller
2015-10-07 14:12   ` David Ahern
2015-10-09  6:54 ` Hajime Tazaki
2015-10-09  7:17   ` Steffen Klassert
2015-10-09 15:53     ` David Ahern
2015-10-09 17:27     ` David Ahern
2015-10-11 13:22       ` Hajime Tazaki
2015-10-11 13:31         ` David Ahern
2015-10-11 14:24           ` Hajime Tazaki
2015-10-11 18:01             ` David Ahern
2015-10-20 12:31               ` Hajime Tazaki
2015-10-20 17:48                 ` David Ahern [this message]
2015-10-21  2:38                   ` Hajime Tazaki
2015-10-12 18:49       ` David Ahern
2015-10-13 14:34         ` Steffen Klassert
2015-10-19  8:01         ` Steffen Klassert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56267E80.5030500@cumulusnetworks.com \
    --to=dsa@cumulusnetworks$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=steffen.klassert@secunet$(echo .)com \
    --cc=thehajime@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox