raw socket, IP_HDRINCL byteorder

[email protected] Mon, 23 Sep 2002 13:21:33 +0900
Newsgroups gmane.os.bsd.api.general
Message-ID <[email protected]>
	raw socket with IP_HDRINCL uses different network byteorder for some
	of the IP header fields (ip_off and ip_len).  i think the behavior
	is confusing, and the culprit is 4.[34]BSD. (4.[34]BSD should have
	cleaned it up before supplying this API to users)

	- openbsd:
		rip_input: host byteorder, ip_len is payload length
		rip_output: network byteorder, ip_len is for the whole packet
	- netbsd:
		rip_input: host byteorder, ip_len is payload length
		rip_output: host byteorder, ip_len is for the whole packet
		(same as 4.4BSD, but internally we use network byteorder all
		the way throughout the IPv4 code)
	- freebsd:
		rip_input: host byteorder, ip_len is payload length
		rip_output: host byteorder, ip_len is for the whole packet
		(same as 4.4BSD)

	i think both case should be network byteorder, and ip_len field
	should reflect the length of the whole packet instead of the payload
	length.

	if we are to switch it, one thing we need to address is how to let
	the thirdparty programs to do the right thing - binary compatibility
	can be provided by using IP_OHDRINCL/HDRINCL (keep the old number)
	trick, but we need some #define symbol to identify the new behavior.
	how do userland programs identify openbsd rip_output behavior change?
	(sys/netinet/raw_ip.c revision 1.9)

	or is it too late to change this?  comments are welcome.

itojun

---------------------------------------------------------------------
The BSD APIs Discussion Mailing List
To unsubscribe:
send "unsubscribe bsd-api-discuss" to majordomo-DZEk9q7Sfju/3pe1ocb+swC/[email protected]