IP networking single socket, both IPv4 and V6?
Karl Denninger
karl at denninger.net
Thu Jan 4 16:24:56 UTC 2018
I've written a fair bit of code that binds to both Ipv4 and v6 for
incoming connections, using two sockets (one for each.)
Perusing around the 'net I see an implementation note written by IBM
that implies that on their Unix implementation you can set up an INET6
listener and it will open listeners on *both* IPv4 and v6; you code it
as an Ipv6 socket/bind/listen/accept, and if an Ipv4 connection comes in
you get a prefix'd IPv4 address back when you call getpeername().
This would obviously shorten up code and remove the need to open the
second listener socket, but playing with this on FreeBSD it doesn't
appear to work -- I only get the IPv6 listener in "netstat -a -n"
showing up and as expected a connection to a v4 address on that port
fails (refused, since there's no listener.)
Is this something that *should* work on FreeBSD?
Ref:
https://www.ibm.com/support/knowledgecenter/en/ssw_i5_54/rzab6/xacceptboth.htm
--
Karl Denninger
karl at denninger.net <mailto:karl at denninger.net>
/The Market Ticker/
/[S/MIME encrypted email preferred]/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4897 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20180104/f92ff4f1/attachment.bin>
More information about the freebsd-net
mailing list