[Ns-bugs] [Bug 1102] IPv4 header doesn't handle correctly the fragment offset field
code@nsnam.ece.gatech.edu
code at nsnam.ece.gatech.edu
Tue Apr 19 11:03:43 PDT 2011
http://www.nsnam.org/bugzilla/show_bug.cgi?id=1102
--- Comment #2 from Tommaso Pecorella <tommaso.pecorella at unifi.it> 2011-04-19 14:03:43 EDT ---
Hi,
mmm... maybe you're right, but then the bug is elsewhere... in the doxygen !
>From the doxygen:
void ns3::Ipv4Header::SetFragmentOffset ( uint16_t offset )
Parameters: offset the ipv4 fragment offset
To me "the ipv4 fragment offset" is the **raw** number (13 bits) of the
Fragment Offset field, and it has to be in 8-bytes units.
For the function (as it is) it is the offset in bytes.
If we want to use the second interpretation, then the function works as it is.
Otherwise it have to be corrected.
In either case, the doxygen need a clearer explanation, as if we leave the
function as it is (it's perfectly fine indeed), then a dumb user (me in this
case) could try to fragment and set the offset to an impossible value, like
1234 (not a multiple of 8 bytes) or to the "right" unit but in 8-bytes units.
And end up with rather strange results.
I honestly didn't even think to the bytes unit thing, as during fragmentation I
keep the counter in 8-bytes units to make sure of having a "right aligned"
fragment, so it was natural to me to pass that to the SetFragmentOffset.
Anyway, a documented bug is a feature. Let's update the doxygen and consider
this as a feature.
BTW; the Ipv4Header::Print will show the offset in 8-bytes units, this might as
well be confusing... if someone doesn't know what he/she is doing. On the other
hand we can safely assume that anyone willing to look at those fields should
have some IP header field knowledge, isn't it ?
I'll close the bug and I'll add some doxygen clarification in the upcoming IPv4
fragmentation patch. Right now SetFragmentOffset isn't used by anyone anyway.
Cheers,
T.
--
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Ns-bugs
mailing list