ipv6: Preserve link scope traffic original oif
Subsystems (2)
PATCH 1/1 ipv6: Preserve link scope traffic original oif
Link-local and multicast packets must keep their original oif after ip6_route_me_harder is called.
--- net/ipv6/netfilter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/netfilter.c +2 -1
@@ -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,
Signature · 1 line
1.7.12.4
Pablo Neira Ayuso
maintainerQuoted 2 lines · Alin Nastac
Link-local and multicast packets must keep their original oif after
ip6_route_me_harderis called.
Out of curiosity, how does the setup you use look like to trigger this problem?
Quoted 6 lines · Pablo Neira Ayuso
Quoted 2 lines · Alin Nastac
Link-local and multicast packets must keep their original oif after
ip6_route_me_harderis called.Out of curiosity, how does the setup you use look like to trigger this problem?
ICMPv6 RA/NS/NA are marked by a -j MARK iptables rule (the mark value is used to set the QoS queue).
Because skb->mark value changed, ip6t_mangle_out will call ip6_route_me_harder.
Pablo Neira Ayuso
maintainerQuoted 11 lines · Alin Năstac
Quoted 6 lines · Pablo Neira Ayuso
Quoted 2 lines · Alin Nastac
Link-local and multicast packets must keep their original oif after
ip6_route_me_harderis called.Out of curiosity, how does the setup you use look like to trigger this problem?
ICMPv6 RA/NS/NA are marked by a -j MARK iptables rule (the mark value is used to set the QoS queue).
Becauseskb->markvalue changed,ip6t_mangle_outwill callip6_route_me_harder.
That sounds quite standard. Did this broke after kernel upgrade? I'm trying to guess if the problem is somewhere else...
Quoted 9 lines · Pablo Neira Ayuso
Quoted 8 lines · Alin Năstac
Quoted 6 lines · Pablo Neira Ayuso
Quoted 2 lines · Alin Nastac
Link-local and multicast packets must keep their original oif after
ip6_route_me_harderis called.Out of curiosity, how does the setup you use look like to trigger this problem?
Quoted 6 lines
Quoted 3 lines
ICMPv6 RA/NS/NA are marked by a -j MARK iptables rule (the mark value is used to set the QoS queue).
Becauseskb->markvalue changed,ip6t_mangle_outwill callip6_route_me_harder.That sounds quite standard. Did this broke after kernel upgrade? I'm trying to guess if the problem is somewhere else...
I used kernel version 4.1 to test an adapted version of this patch.
Judging after ip6_route_output_flags() definition present in kernel version 4.10, callers are expected to provide a valid value for fl6->flowi6_oif when rt6_need_strict(&fl6->daddr) is true.