Subject: IP_HDRINCL
To: None <tech-kern@netbsd.org>
From: Jun-ichiro itojun Hagino <itojun@iijlab.net>
List: tech-kern
Date: 08/13/2002 03:54:45
	i'm in the process of avoiding NTOHS() in ip_input() - mbuf always
	contain ip_len and ip_off in network byteorder.

	IP_HDRINCL for raw ip socket receives host endian value for ip_len
	and ip_off from userland.

	i'm wondering what should i do about it.  my preference is in the
	first option, due to the wide use of IP_HDRINCL in random thirdparty
	apps (any ping/traceroute/whatever tools use IP_HDRINCL).
	- define IP_HDRINCL2 (or whatever) which uses network byteorder for
	  these fields.  keep IP_HDRINCL behavior the same.
	- rename IP_HDRINCL to IP_OHDRINCL.  assign a new value to IP_HDRINCL,
	  which now uses network byteorder.

	of course you can't specify both IP_HDRINCL and IP_HDRINCL2 (or
	OHDRINCL).

	looking at what other BSD does:
	- freebsd: same as netbsd, uses host byteorder
	- openbsd: uses network byteorder, no backward compat
		(i dunno how people adapted to this change)

itojun