Skip to contentSkip to conversation

Packet fragmentation handling

DISCUSSION Emmanuel Fleury 2 participants 2 messages Nov 14, 2003 netfilter

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw
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