IPV6 nf defrag does not work
Subsystems (3)
Hi All.
On the current net-next if you on HOSTA do:
ip6tables -I INPUT -p icmpv6 -j DROP
ip6tables -I INPUT -p icmpv6 -m icmp6 --icmpv6-type 128 -j ACCEPT
and on HOSTB you do:
ping6 HOSTA -s2000 (MTU is 1500)
Only the first ICMP echo request will be passed through, the rest is not passed on HOSTA. This issue does not occur with smaller packets than MTU (where fragmentation does not happen).
I'm trying to find out where the problem is.
Any quick ideas?
Thanks
Jiri
Florian Westphal
maintainerQuoted 4 lines · Jiri Pirko
On the current net-next if you on HOSTA do:
ip6tables -I INPUT -p icmpv6 -j DROP
ip6tables -I INPUT -p icmpv6 -m icmp6 --icmpv6-type 128 -j ACCEPT
Quoted 8 lines
and on HOSTB you do:
ping6 HOSTA -s2000 (MTU is 1500)Only the first ICMP echo request will be passed through, the rest is not passed on HOSTA. This issue does not occur with smaller packets than MTU (where fragmentation does not happen).
I'm trying to find out where the problem is.
Are you sure this is new behaviour? As far back as I can remember it was always like this.
in ip6tables, the individual fragments are sent through the ruleset, iow. you'll need to make use of '-m conntrack' to match the fragments belonging to an existing connection.
I don't know why this is, and I don't like this either. But this is how it was implemented, see
net/ipv6/netfilter/nf_defrag_ipv6_hooks.c, ipv6_defrag() -> nf_ct_frag6_output()
Quoted 8 lines · Tue, Oct 29, 2013 at 12:56:17PM CET, [email protected] wrote:
Quoted 7 lines · Jiri Pirko
On the current net-next if you on HOSTA do:
ip6tables -I INPUT -p icmpv6 -j DROP
ip6tables -I INPUT -p icmpv6 -m icmp6 --icmpv6-type 128 -j ACCEPTand on HOSTB you do:
ping6 HOSTA -s2000 (MTU is 1500)
Quoted 8 lines
Quoted 5 lines
Only the first ICMP echo request will be passed through, the rest is not passed on HOSTA. This issue does not occur with smaller packets than MTU (where fragmentation does not happen).
I'm trying to find out where the problem is.
Are you sure this is new behaviour? As far back as I can remember it was always like this.
Yes. This is not new.
Quoted 4 lines
in ip6tables, the individual fragments are sent through the ruleset, iow. you'll need to make use of '-m conntrack' to match the fragments belonging to an existing connection.
Hmm. I think that it is not correct to force user (iptables user) to make dirrerent rules because some ipv6 packets might be fragmented. This should be handled in kernel.
Quoted 6 lines
I don't know why this is, and I don't like this either. But this is how it was implemented, see
net/ipv6/netfilter/nf_defrag_ipv6_hooks.c,ipv6_defrag()->nf_ct_frag6_output()
Yep. I'm studying the code atm.
Quoted 6 lines · Tue, Oct 29, 2013 at 11:52:08AM CET, [email protected] wrote:
Hi All.
On the current net-next if you on HOSTA do:
ip6tables -I INPUT -p icmpv6 -j DROP
ip6tables -I INPUT -p icmpv6 -m icmp6 --icmpv6-type 128 -j ACCEPT
Quoted 7 lines
and on HOSTB you do:
ping6 HOSTA -s2000 (MTU is 1500)Only the first ICMP echo request will be passed through, the rest is not passed on HOSTA. This issue does not occur with smaller packets than MTU (where fragmentation does not happen).
Hmm. The reason why first packet goes through is because of:
commit 58a317f1061c894d2344c0b6a18ab4a64b69b815
Author: Patrick McHardy <[email protected]> Date: Sun Aug 26 19:14:12 2012 +0200
netfilter: ipv6: add IPv6 NAT support
First packet will hit "if ((help && help->helper) || !nf_ct_is_confirmed(ct))" (ct is uncorfirmed for it).
For this, nf_conntrack_ipv6 has to be loaded. Continuing investigation.
Quoted 7 lines
I'm trying to find out where the problem is.
Any quick ideas?
Thanks
Jiri