|
Adam Tkac |
961e87 |
diff -up bind-9.9.0b1/lib/isc/unix/socket.c.v6only bind-9.9.0b1/lib/isc/unix/socket.c
|
|
Adam Tkac |
961e87 |
--- bind-9.9.0b1/lib/isc/unix/socket.c.v6only 2011-11-10 14:35:26.457842491 +0100
|
|
Adam Tkac |
961e87 |
+++ bind-9.9.0b1/lib/isc/unix/socket.c 2011-11-10 14:38:55.928827943 +0100
|
|
Adam Tkac |
961e87 |
@@ -5726,7 +5726,24 @@ isc__socket_ipv6only(isc_socket_t *sock0
|
|
Adam Tkac |
961e87 |
|
|
Adam Tkac |
961e87 |
#ifdef IPV6_V6ONLY
|
|
Adam Tkac |
961e87 |
if (sock->pf == AF_INET6) {
|
|
Adam Tkac |
961e87 |
- if (setsockopt(sock->fd, IPPROTO_IPV6, IPV6_V6ONLY,
|
|
Adam Tkac |
961e87 |
+ int current;
|
|
Adam Tkac |
961e87 |
+ socklen_t len = sizeof(int);
|
|
Adam Tkac |
961e87 |
+ if (getsockopt(sock->fd, IPPROTO_IPV6, IPV6_V6ONLY,
|
|
Adam Tkac |
961e87 |
+ (void *)¤t, &len) < 0 ) {
|
|
Adam Tkac |
961e87 |
+ char strbuf[ISC_STRERRORSIZE];
|
|
Adam Tkac |
961e87 |
+ isc__strerror(errno, strbuf, sizeof(strbuf));
|
|
Adam Tkac |
961e87 |
+ UNEXPECTED_ERROR(__FILE__, __LINE__,
|
|
Adam Tkac |
961e87 |
+ "getsockopt(%d, IPV6_V6ONLY) "
|
|
Adam Tkac |
961e87 |
+ "%s: %s", sock->fd,
|
|
Adam Tkac |
961e87 |
+ isc_msgcat_get(isc_msgcat,
|
|
Adam Tkac |
961e87 |
+ ISC_MSGSET_GENERAL,
|
|
Adam Tkac |
961e87 |
+ ISC_MSG_FAILED,
|
|
Adam Tkac |
961e87 |
+ "failed"),
|
|
Adam Tkac |
961e87 |
+ strbuf);
|
|
Adam Tkac |
961e87 |
+ }
|
|
Adam Tkac |
961e87 |
+
|
|
Adam Tkac |
961e87 |
+ if (current != onoff &&
|
|
Adam Tkac |
961e87 |
+ setsockopt(sock->fd, IPPROTO_IPV6, IPV6_V6ONLY,
|
|
Adam Tkac |
961e87 |
(void *)&onoff, sizeof(int)) < 0) {
|
|
Adam Tkac |
961e87 |
char strbuf[ISC_STRERRORSIZE];
|
|
Adam Tkac |
961e87 |
isc__strerror(errno, strbuf, sizeof(strbuf));
|