Re: PF_INET6 on non-ipv6 kernels

Keith Owens (kaos@ocs.com.au)
Mon, 29 Mar 1999 20:46:04 -0800


On Mon, 29 Mar 1999 19:38:48 -0800,
jgmyers@netscape.com (John Myers) wrote:
>On kernels without IPv6 enabled, socket(PF_INET6, SOCK_STREAM, 0) is
>returning EINVAL when the man page implies it should return
>EPROTONOSUPPORT.

That is probably a bug.

>I am requesting that when IPv6 is not compiled in, the call still
>succeed, returning a socket which only handles sin6_addr's in the
>"IPv4-mapped IPv6 address" format defined in section 2.4.4 of RFC 1884.
>(It should also accept as input the Unspecified Address and the Loopback
>Address.)
>
>The IPv6 API has a wonderful facility, the "IPv4-mapped IPv6 address,"
>which allows IPv4 to be accessed through the IPv6 API. I would like to
>port code to IPv6 by writing it entirely to the IPv6 interface. On OS's
>which don't support the IPv6 API, I would provide my own compatibility
>layer which maps the IPv6 API to the IPv4 API.

But if you are going to add your own compatibility layer anyway for
non-IPv6 systems, why not use the same layer for systems which may or
may not have IPv6? Call your wrapper ns_socket instead of socket,
ns_socket tries IPv6, if that fails, try IPv4, doing your own V6 to V4
mapping. Same with ns_getaddrinfo as a wrapper to getaddrinfo etc.

>I don't want to have to write and maintain a mess of run-time
>conditionals which try to figure out which API needs to be called at any
>given time. I also consider it impractical to require customers to
>rebuild their kernels with IPv6 enabled, just to be able to run our
>products.

So call your compatibility layer. Only that layer needs any
conditionals and is required anyway for pure IPv4 systems. It strikes
me that this is application policy and should be dealt with in the app,
not the kernel.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/