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