Packet fragmentation handling
Hi,
I am trying to understand the way Netfilter (and other firewall) are handling packet fragmentation.
Does somebody has good documentations, links, opinions about packet fragmentation handling in firewall ?
Regards
Signature · 5 lines
Emmanuel Education is an admirable thing, but nothing that is worth knowing can be taught. -- Oscar Wilde
Quoted 7 lines · Emmanuel Fleury
Hi,
I am trying to understand the way Netfilter (and other firewall) are handling packet fragmentation.
Does somebody has good documentations, links, opinions about packet fragmentation handling in firewall ?
In the netfilter/iptables case it's pretty easy.
If you don't have ip_conntrack loaded, you can match the first fragment like any other packet, and all further fragments with the '-f' or '--fragment' switch to iptables.
If you have ip_conntrack loaded, all fragmented packets get defragmented via ip_defrag() at the PRE_ROUTING hook, and (if necessarry) re-fragmented at POST_ROUTING according to the MTU of the outgoing interface. Thus all your packet filter rules (filter,nat,mangle table) will never see fragmented packets in that case.
Quoted 2 lines
Regards
Emmanuel
Signature · 5 lines
- Harald Welte <[email protected]> http://www.netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie