comparison dbutil.c @ 639:452bcf810e44

Put better #if guards around IPv6 socket options for IPV6_TCLASS and IPV6_V6ONLY. From Gustavo Zacarias.
author Matt Johnston <matt@ucc.asn.au>
date Thu, 10 Nov 2011 18:17:00 +0800
parents bdadc7f4b97d
children df11cb6a3665 76e780c74a5e
comparison
equal deleted inserted replaced
638:6b17302318b9 639:452bcf810e44
162 setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val)); 162 setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void*)&val, sizeof(val));
163 163
164 /* set the TOS bit for either ipv4 or ipv6 */ 164 /* set the TOS bit for either ipv4 or ipv6 */
165 #ifdef IPTOS_LOWDELAY 165 #ifdef IPTOS_LOWDELAY
166 val = IPTOS_LOWDELAY; 166 val = IPTOS_LOWDELAY;
167 #ifdef IPPROTO_IPV6 167 #if defined(IPPROTO_IPV6) && defined(IPV6_TCLASS)
168 setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, (void*)&val, sizeof(val)); 168 setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, (void*)&val, sizeof(val));
169 #endif 169 #endif
170 setsockopt(sock, IPPROTO_IP, IP_TOS, (void*)&val, sizeof(val)); 170 setsockopt(sock, IPPROTO_IP, IP_TOS, (void*)&val, sizeof(val));
171 #endif 171 #endif
172 172
254 setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &val, sizeof(val)); 254 setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void*) &val, sizeof(val));
255 linger.l_onoff = 1; 255 linger.l_onoff = 1;
256 linger.l_linger = 5; 256 linger.l_linger = 5;
257 setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger)); 257 setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger));
258 258
259 #ifdef IPV6_V6ONLY 259 #if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
260 if (res->ai_family == AF_INET6) { 260 if (res->ai_family == AF_INET6) {
261 int on = 1; 261 int on = 1;
262 if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, 262 if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,
263 &on, sizeof(on)) == -1) { 263 &on, sizeof(on)) == -1) {
264 dropbear_log(LOG_WARNING, "Couldn't set IPV6_V6ONLY"); 264 dropbear_log(LOG_WARNING, "Couldn't set IPV6_V6ONLY");