netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alin Nastac <alin.nastac@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH] ipv6: Preserve link scope traffic original oif
Date: Wed,  1 Mar 2017 14:47:23 +0100	[thread overview]
Message-ID: <1488376043-31976-1-git-send-email-alin.nastac@gmail.com> (raw)

Link-local and multicast packets must keep their original oif after
ip6_route_me_harder is called.

Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
---
 net/ipv6/netfilter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index 39970e2..02811c5 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -24,7 +24,8 @@ int ip6_route_me_harder(struct net *net, struct sk_buff *skb)
 	unsigned int hh_len;
 	struct dst_entry *dst;
 	struct flowi6 fl6 = {
-		.flowi6_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
+		.flowi6_oif = skb->sk ? skb->sk->sk_bound_dev_if :
+			rt6_need_strict(&iph->daddr) ? skb_dst(skb)->dev->ifindex : 0,
 		.flowi6_mark = skb->mark,
 		.flowi6_uid = sock_net_uid(net, skb->sk),
 		.daddr = iph->daddr,
-- 
1.7.12.4


             reply	other threads:[~2017-03-01 14:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-01 13:47 Alin Nastac [this message]
2017-03-03 11:39 ` [PATCH] ipv6: Preserve link scope traffic original oif Pablo Neira Ayuso
2017-03-03 11:56   ` Alin Năstac
2017-03-03 12:12     ` Pablo Neira Ayuso
2017-03-03 13:22       ` Alin Năstac
  -- strict thread matches above, loose matches on Subject: below --
2017-03-01 13:00 Alin Nastac

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=1488376043-31976-1-git-send-email-alin.nastac@gmail.com \
    --to=alin.nastac@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).