Closed kkrime closed 7 months ago
In an IP header, If the first 3 bits from the 7th byte are flags not related to the fragment offset, then they should be blocked out (using bitwise &) and the rest should remain, hence:
ntohs((((p)->opt_off_high & 0x1f) << 8)|(p)->off_low)
In the original:
ntohs((((p)->opt_off_high & 0x13) << 8)|(p)->off_low)
I'm really having trouble understanding why we & with 0x13, won't this unset some of the fragmentation offset bits?
&
0x13
Maybe this is something I don't understand (I'm new to low level network programming), if so, please let me know why it's done this way.
Thanks
In an IP header, If the first 3 bits from the 7th byte are flags not related to the fragment offset, then they should be blocked out (using bitwise &) and the rest should remain, hence:
ntohs((((p)->opt_off_high & 0x1f) << 8)|(p)->off_low)
In the original:
ntohs((((p)->opt_off_high & 0x13) << 8)|(p)->off_low)
I'm really having trouble understanding why we
&
with0x13
, won't this unset some of the fragmentation offset bits?Maybe this is something I don't understand (I'm new to low level network programming), if so, please let me know why it's done this way.
Thanks