Subject: Deprecated IPv6 socket options
To: None <tech-net@NetBSD.org>
From: Christian Biere <christianbiere@gmx.de>
List: tech-net
Date: 10/28/2006 01:04:59
Hi,


KAME has deprecated these non-standard IPv6 socket options several years ago:

	IPV6_OPTIONS
	IPV6_RECVOPTS
	IPV6_RECVRETOPTS
	IPV6_RECVDSTADDR
	IPV6_RETOPTS

They are still defined in sys/netinet6/in6.h although they are not supported
(anymore). They are commented out in ip6(4). Should these definitions be
removed from in6.h? Due to those, programs might assume these are actually
supported.

	$ grep -Erl 'IPV6_(OPTIONS|RECVOPTS|RECVRETOPTS|RECVDSTADDR|RETOPTS)' .
	./crypto/dist/ipsec-tools/src/racoon/isakmp.c
	./crypto/dist/ipsec-tools/src/racoon/sockmisc.c
	./share/man/man4/ip6.4
	./sys/netinet6/in6.h

The only maybe-user in NetBSD is this one:

	./crypto/dist/ipsec-tools/src/racoon/sockmisc.c

Because it does this:

	#if defined(IP_RECVDSTADDR) && !defined(IPV6_RECVDSTADDR)                       
	#define IPV6_RECVDSTADDR IP_RECVDSTADDR                                         
	#endif

The first line should probably be changed to this:

	#if defined(IP_RECVDSTADDR) && !defined(IPV6_RECVDSTADDR) && !defined(INET6_ADVAPI)

This would prevent potential bugs in case the value of IP_RECVDSTADDR (7) ever matches
another option in the future.

Further, attempts to use the mentioned options fail with ENOPROTOOPT:

     42 ENOPROTOOPT	Protocol not available.  A bad option or level was speci-
			fied in a getsockopt(2) or setsockopt(2) call.

Shouldn't this actually be "Protocol option not available."? Especially in
the context of IPv6 claiming the "protocol" itself not being available is
rather confusing. Google shows that only HP-UX has "corrected" this standard
error message by inserting the expected "option". Would anyone mind if I
changed the string?

-- 
Christian