Subject: Re: IP_HDRINCL send on little-endian machine causes kernel panic
To: Jonathan Stone <jonathan@dsg.stanford.edu>
From: Charles M. Hannum <mycroft@MIT.EDU>
List: tech-kern
Date: 07/27/1996 19:27:46
Jonathan Stone <jonathan@dsg.stanford.edu> writes:

> 
> ... I just  searched the source tree. The only user-level code I found
> that uses IP_HDRINCL is traceroute and mrouted, both of which pass
> in zero for ip_off, and pass in ip_len in native byte order.
> 
> If that's the intended user/kernel interface, [...]

Certainly not.  It should accept the fields in network byte order.  It
also seems like the ip_output() interface should be changed to use
network order for consistency.

> I didn't say so explicitly the first time, but I just think the
> endian-ness of the interface should be (a) documented, [...]

It's an IP header.  The header format is well-defined.

> and (b)
> shouldn't panic if the user injects a bad packet with a "bad" IP
> length.

That's a bug.

I'll look at this in more detail in a bit.