Skip to contentSkip to conversation

DF, IP ID always 0 and the reassembly protections

DISCUSSION Rick Jones 3 participants 5 messages Jun 20, 2006 – Jun 21, 2006

Subsystems (2)
lore
Share & tools
lore

Rick Jones

author
#0 lore raw

A while back (I cannot recall exactly when) the issue of always setting the IP datagram ID to zero when the DF bit was set was brought-up. I suggested it might not be a good idea because there are admittedly broken devices out there that "helpfully" and silently clear DF and the start to fragment. The counter point was that coding around such broken hardware was silly.

I was just writing a missive to one of my co-workers on IP fragmentation. It got me to thinking about the stuff (I think it went-in?) to try to protect against "Frankengrams" during IP fragment reassembly.

Doesn't that mechanism rely on watching the IP ID's between the pair of IPs? For both fragmented and non-fragmented datagrams? If so, does always setting the IP ID to zero when DF is set affect that mechanism?

rick jones

maintainer
#1 lore raw

From: Rick Jones <[email protected]>
Date: Tue, 20 Jun 2006 16:44:55 -0700

Quoted 3 lines

Doesn't that mechanism rely on watching the IP ID's between the pair of IPs? For both fragmented and non-fragmented datagrams? If so, does always setting the IP ID to zero when DF is set affect that mechanism?

Only the IDs in packets with DF clear matter.

author
#2 lore raw
Quoted 8 lines · David Miller

From: Rick Jones <[email protected]>
Date: Tue, 20 Jun 2006 16:44:55 -0700

Quoted 1 line

Doesn't that mechanism rely on watching the IP ID's between the pair of IPs? For both fragmented and non-fragmented datagrams? If so, does always setting the IP ID to zero when DF is set affect that mechanism?

Only the IDs in packets with DF clear matter.

I thought the ID's even in non-fragmented datagrams gave an idea of how many IP datagrams had been sent along, and so an idea of how "unlikely" it was that a datagram with holes could be reassembled?

rick jones

#3 lore raw
Quoted 3 lines · Rick Jones

....
I thought the ID's even in non-fragmented datagrams gave an idea of how many IP datagrams had been sent along, and so an idea of how "unlikely" it was that a datagram with holes could be reassembled?

Only fragmented datagrams get counted. This is arguably a weakness of the scheme, but it's still a big improvement in practice. And the more common non-fragmented datagram processing doesn't have to pay the price for the extra checks.

Signature · 1 line
Arthur
maintainer
#4 lore raw
In reply to Rick Jones

From: Rick Jones <[email protected]>
Date: Tue, 20 Jun 2006 17:35:50 -0700

Quoted 3 lines

I thought the ID's even in non-fragmented datagrams gave an idea of how many IP datagrams had been sent along, and so an idea of how "unlikely" it was that a datagram with holes could be reassembled?

The code you are thinking about is in net/ipv4/ip_fragment.c and it attempts to avoid ID wrapping corruption. It only looks at IP fragments on input.