A question about linux/net/ipv4/ipcomp.c
Subsystems (2)
Hello, everyone.
I'm having fun reading RFC's and looking through linux source code for implementation examples.
What I'm not able to understand is this piece of code :
union {
struct iphdr iph;
char buf[60];
} tmp_iph;and corresponding RFC 791 statement : "The maximal internet header is 60 octets."
Would you please say why it's 60, and not 52?
Well, what I came up with is this :
RFC791: "The option-length octet counts the option-type octet and the option-length octet as well as the option-data octets". [i.e. options' total length may be up to 2^8/8 octets (32)]. Then, header lenght without options is 20 octets. So, a maximum header length is 32+20=52 octets. RFC791: "Internet Header Length is the length of the internet header in 32 bit words..." 52 octets is 52*8 bits and it's a multiple of 32.
Thanks in advance
Quoted 2 lines · Igor V. Liferenko
Would you please say why it's 60, and not 52?
The header length / 4 must fit within a single hexadecimal digit. Therefore the maximum is 15 * 4 = 60.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt