On Mar 05, Russ Allbery <rra@debian.org> wrote:
> This is probably referring to binding an IPv6 :: socket and getting IPv4
> for free, so that a subsequent bind to an IPv4 0.0.0.0 address fails. So
> far as I know, this is still the Linux IPv6 behavior.
Yes, but it can be controlled with code like this (and every program
which binds a listening socket should do it, because the system could be
configured both ways!):
#ifndef IPV6_V6ONLY
#define IPV6_V6ONLY 26
#endif
#ifndef IPPROTO_IPV6
#define IPPROTO_IPV6 41
#endif
fd = socket(AF_INET6, SOCK_STREAM, IPPROTO_IP);
if (fd < 0) {
printf("ERROR (socket) %d: %s", errno, strerror(errno));
return 1;
}
if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &opt, sizeof(opt)) < 0) {
/* ignore failures */
}
--
ciao,
Marco
Attachment:
signature.asc
Description: Digital signature