Subject: Re: strangeness while using SOCK_RAW
To: Eric Auge <>
From: Ignatios Souvatzis <>
List: tech-net
Date: 02/11/2007 13:06:38
On Fri, Feb 09, 2007 at 04:33:01PM +0100, Eric Auge wrote:
> Ignatios Souvatzis wrote:

> > [...] I think I read a comment somewhere (Stevens Vol. 2 ?) that programs
> > get the same environment they would get in the kernel at a some calling
> > point.
> I don't really understand what you mean here.
> ok but why the ip_len field is modified then ? (i guess u speak about SOCK_RAW)

Stevens/Fenner/Rudolph, Unix Network Programming Vol.1, p.739

"... All IP datagrams with a protocol vield that the kkernel does not
understand are passed to a raw socket. The only kernel processing done 
on these packets is the minimal verification of some IP header fiels: IP
version, IPv54 header chesum, header length, and destination IP address
(pp. 213-220 of TCPv2). [...]
Whenever a receive ddatagram is passed to a raw IPv4 socket, the
entire datagram, including the IP header, is passed to the process.
For a raw IPv6 socket, only the payload (i.e., no IPv6 header or any
extension headers) is passed to the socket..."

(TCPv2 is Stevens/Wright, TCP/IP Illustrated, VOl. 2)

No, why the header is changed in your example, I didn't discover yet.