Re: A question about linux/net/ipv4/ipcomp.c

2006-07-21 Thread Herbert Xu
Igor V. Liferenko <[EMAIL PROTECTED]> wrote:
>
> 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,
-- 
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
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


A question about linux/net/ipv4/ipcomp.c

2006-07-20 Thread Igor V. Liferenko
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 iphdriph;
charbuf[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
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html