GTiroadkill / dpkt

Automatically exported from code.google.com/p/dpkt
Other
0 stars 0 forks source link

Fragment offset values for IP packets incorrect #64

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run attached sample program, which parses an IP packet with fragment offset 
0.
2.
3.

What is the expected output? What do you see instead?
Expect .off of the dpkt parsed IP packet to be 0.
Actual .off of the dpkt parsed IP packet is 16384.

What version of the product are you using? On what operating system?
1.6 (1.6+svn54-1) on Ubuntu 10.10 (Maverick)

Please provide any additional information below.

Original issue reported on code.google.com by j...@midokura.jp on 3 Feb 2011 at 6:44

Attachments:

GoogleCodeExporter commented 9 years ago
To get the offset from that bitmask you have to do (16384 & 0x1fff) * 8
The 16 bits are:
yyyx xxxx xxxx xxxx
Where yyy = Flags (bit 0: Reserved, 1: Don't Fragment, 2: More Fragments)
And x... = Offset

Original comment by noro...@gmail.com on 6 Sep 2011 at 8:44

GoogleCodeExporter commented 9 years ago
Attached flags_offset.patch adds new properties .flag_df, .flag_mf and .offset 
which return the expected values. Existing .off is not changed to not break 
running code.

If you don't like the separate DF and MF fields, use offset_only.patch

Original comment by matthaeu...@gmail.com on 15 Jan 2013 at 3:36

Attachments: