Skip to contentSkip to conversation

IPV6 nf defrag does not work

DISCUSSION Jiri Pirko 2 participants 4 messages Oct 29, 2013

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

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

maintainer
#1 lore raw
Quoted 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()

author
#2 lore raw
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 ACCEPT

and 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.

author
#3 lore raw
In reply to Jiri Pirko
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