s3:lib/util_sock: listen on IPv6 addresses with IPV6_ONLY (bug #7383)
authorStefan Metzmacher <metze@samba.org>
Sat, 23 Apr 2011 09:29:51 +0000 (11:29 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 26 Apr 2011 18:10:36 +0000 (20:10 +0200)
commitb6295b21ebf34a5d80948f51850d212aceb4efe3
treed9803c0c41da11bbf17962c16fa46b6e64a2fd49
parent291f337d4d58e55f00f0b6a3b082fa5128f80126
s3:lib/util_sock: listen on IPv6 addresses with IPV6_ONLY (bug #7383)

This avoids getting IPv4 addresses as mapped IPv6 addresses
(e.g. ::ffff:192.168.0.1).

Before the bahavior was inconsistent between operating system
and distributions. Some system have IPV6_ONLY as default.

Now we consistently get AF_INET for IPv4 addresses and AF_INET6
for IPv6 addresses.

It also makes it possible to listen only on IPv6 now
as "::" doesn't imply "0.0.0.0" anymore. Which also
avoids confusing log messages that we were not able to
bind to "0.0.0.0".

metze
(cherry picked from commit a3a38ee90ab4ab2be68ac71d9c581daa6b9ee189)
(cherry picked from commit c4c49be416aeac890628c9a9f2fd7975860884d4)
source3/lib/util_sock.c