changeset 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 6b17302318b9
children 2b1bb792cd4d 234cf769bcb3
files dbutil.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dbutil.c	Tue Nov 08 21:06:29 2011 +0800
+++ b/dbutil.c	Thu Nov 10 18:17:00 2011 +0800
@@ -164,7 +164,7 @@
 	/* set the TOS bit for either ipv4 or ipv6 */
 #ifdef IPTOS_LOWDELAY
 	val = IPTOS_LOWDELAY;
-#ifdef IPPROTO_IPV6
+#if defined(IPPROTO_IPV6) && defined(IPV6_TCLASS)
 	setsockopt(sock, IPPROTO_IPV6, IPV6_TCLASS, (void*)&val, sizeof(val));
 #endif
 	setsockopt(sock, IPPROTO_IP, IP_TOS, (void*)&val, sizeof(val));
@@ -256,7 +256,7 @@
 		linger.l_linger = 5;
 		setsockopt(sock, SOL_SOCKET, SO_LINGER, (void*)&linger, sizeof(linger));
 
-#ifdef IPV6_V6ONLY
+#if defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
 		if (res->ai_family == AF_INET6) {
 			int on = 1;
 			if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,