comparison dbutil.c @ 627:7cc34a52feb8

Try bind IPV6_V6ONLY
author Matt Johnston <matt@ucc.asn.au>
date Thu, 20 Oct 2011 13:45:43 +0000
parents e3ac0a426bd0
children bdadc7f4b97d
comparison
equal deleted inserted replaced
626:d204868e7943 627:7cc34a52feb8
252 setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &val, sizeof(val)); 252 setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &val, sizeof(val));
253 linger.l_onoff = 1; 253 linger.l_onoff = 1;
254 linger.l_linger = 5; 254 linger.l_linger = 5;
255 setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger)); 255 setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger));
256 256
257 #ifdef IPV6_V6ONLY
258 if (res->ai_family == AF_INET6) {
259 int on = 1;
260 if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,
261 &on, sizeof(on)) == -1) {
262 dropbear_log(LOG_WARNING, "Couldn't set IPV6_V6ONLY");
263 }
264 }
265 #endif
266
257 set_sock_priority(sock); 267 set_sock_priority(sock);
258 268
259 if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) { 269 if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) {
260 err = errno; 270 err = errno;
261 close(sock); 271 close(sock);