listening to IPv4 & 6 sockets

"Cory C. Albrecht" <[email protected]> Sat, 13 Sep 2003 12:57:15 -0400
Newsgroups gmane.os.openbsd.ipv6
Message-ID <3F63142B.7549.2854D808@localhost>
Hello all,

I recently tried to compile my MUSH (pennmush-1.7.7p19) server so that 
it could accept IPv6 connections as well as IPv4, but unfortunately it 
was a no go.

Pennmush has, in its prebuild configure script a note that if it 
detects IPv6 capability but is being compiled on OpenBSD to force use 
of IPv4 only. This is because on OpenBSD you can't just bind to and 
listen on a IPv6 socket and get the IPv4 connections on that same 
socket like other OSes can do. I wrote a silly little program in C to 
test this, just something that wrote "Hi, how are you?" to any 
connector and when bound to an IPv6 address socket it didn't accept 
IPv4 connections opn that port. Compiling and running the exact same 
code on my ISP's shell machine (FreeBSD) accepted connections for both 
IPV4 & 6. (I used AF_UNSPEC in the hints arg for getaddrinfo(), just 
like the pennmush code does.)

The first thopught that blindly entered my head was that maybe this was 
a problem with the KAME code for IPv6, but since this forcing back to 
IPv4 only doesn't happen when building pennmush on FreeBSD or NetBSD, 
that really doesn't seem likely to me.

Is this behaviour by design on OpenBSD, or is it a fault in the 
implementation? And if it is by design, what was the reasoning behind 
it? Offhand, I can't think of a reason for this. Or if there is 
something special you have to do on OpenBSD  to open up a single socket 
that listens for both IPv4 & 6 sockets, I'd appreciate a few pointers 
on how to do this.

Thanks in advance.
--
Cory C. Albrecht
The trouble with doing something right the first time is that nobody 
appreciates how difficult it was.