Subject: Re: [PATCH] IPv4 raw_hdrincl_nomangle sysctl

From: Kris Katterjohn <[email-masked]>
Date: Wed, 17 Dec 2008 15:11:25 -0600

On 12/17/2008 02:48 PM, David Miller wrote:
> From: Kris Katterjohn <[email-masked]>
> Date: Wed, 17 Dec 2008 14:44:58 -0600
> 
>> I've attached a patch to add a net.ipv4.raw_hdrincl_nomangle sysctl (defaults
>> to 0) to control whether or not Linux changes the header passed using
>> IP_HDRINCL (checksum, IPID, etc).  This way it's not required to build a
>> special kernel simply to have control over what you send.  This was needed,
>> for example, in this discussion[1] on Nmap's packet handling.
> 
> If you want full control, use AF_PACKET to send your frames.
> 
> Yes, this means you'll need to choose the outgoing device and compose
> the link level header, but that's the price for control.
> 
> Using IPV4 RAW sockets implies you want some help from that
> part of the stack, if you don't then simply use direct pure
> packet sends via AF_PACKET.

Indeed I guess I will just use PF_PACKET from now on.  It's just that the
convenience of SOCK_RAW/IP_HDRINCL compared to doing the same thing with
AF_PACKET makes it a good choice for this in my mind, as long as the default
behavior is to still make the modifications as it is now.

Of course I still think 'sysctl net.ipv4.raw_hdrincl_nomangle=1' is price
enough for control :)

Thanks for the very speedy response,
Kris Katterjohn