bfb7690decbc5ceeeaaaba891e396ede97ca15cd
[openwrt/staging/ynezz.git] /
1 From 508b09046c0f21678652fb66fd1e9959d55591d2 Mon Sep 17 00:00:00 2001
2 From: Alin Nastac <alin.nastac@gmail.com>
3 Date: Wed, 21 Nov 2018 14:00:30 +0100
4 Subject: [PATCH] netfilter: ipv6: Preserve link scope traffic original oif
5
6 When ip6_route_me_harder is invoked, it resets outgoing interface of:
7 - link-local scoped packets sent by neighbor discovery
8 - multicast packets sent by MLD host
9 - multicast packets send by MLD proxy daemon that sets outgoing
10 interface through IPV6_PKTINFO ipi6_ifindex
11
12 Link-local and multicast packets must keep their original oif after
13 ip6_route_me_harder is called.
14
15 Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
16 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
17 ---
18 net/ipv6/netfilter.c | 3 ++-
19 1 file changed, 2 insertions(+), 1 deletion(-)
20
21 --- a/net/ipv6/netfilter.c
22 +++ b/net/ipv6/netfilter.c
23 @@ -24,7 +24,8 @@ int ip6_route_me_harder(struct net *net,
24 unsigned int hh_len;
25 struct dst_entry *dst;
26 struct flowi6 fl6 = {
27 - .flowi6_oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
28 + .flowi6_oif = skb->sk && skb->sk->sk_bound_dev_if ? skb->sk->sk_bound_dev_if :
29 + rt6_need_strict(&iph->daddr) ? skb_dst(skb)->dev->ifindex : 0,
30 .flowi6_mark = skb->mark,
31 .daddr = iph->daddr,
32 .saddr = iph->saddr,