SHA256
1
0
forked from pool/gsoap
gsoap/gsoap-05-ipv6.diff

33 lines
1.4 KiB
Diff

From: Jan Engelhardt <jengelh@medozas.de>
Date: 2011-11-10 16:47:10.249693116 +0100
Upstream: tbd
IPPROTO_IPV6 socket options must only be applied to AF_INET6 sockets
(it fails otherwise).
---
gsoap/stdsoap2.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: gsoap-2.8.4/gsoap/stdsoap2.cpp
===================================================================
--- gsoap-2.8.4.orig/gsoap/stdsoap2.cpp
+++ gsoap-2.8.4/gsoap/stdsoap2.cpp
@@ -4685,14 +4685,14 @@ soap_bind(struct soap *soap, const char
#endif
#ifdef WITH_IPV6
#ifdef WITH_IPV6_V6ONLY
- if (setsockopt(soap->master, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&set, sizeof(int)))
+ if (res.ai_family == AF_INET6 && setsockopt(soap->master, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&set, sizeof(int)) < 0)
{ soap->errnum = soap_socket_errno(soap->master);
soap_set_receiver_error(soap, tcp_error(soap), "setsockopt set IPV6_V6ONLY failed in soap_bind()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;
}
#endif
#ifdef WITH_NO_IPV6_V6ONLY
- if (setsockopt(soap->master, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&unset, sizeof(int)))
+ if (res.ai_family == AF_INET6 && setsockopt(soap->master, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&unset, sizeof(int)) < 0)
{ soap->errnum = soap_socket_errno(soap->master);
soap_set_receiver_error(soap, tcp_error(soap), "setsockopt unset IPV6_V6ONLY failed in soap_bind()", SOAP_TCP_ERROR);
return SOAP_INVALID_SOCKET;