From a0ff782b2f9c5f4d7fd3b7297164f3ec1c36d1024c778e871aff78981f30b894 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 10 Nov 2011 16:06:21 +0000 Subject: [PATCH] Add IPv6 patch, avoid calling setsockopt on non-IPv6 sockets OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/gsoap?expand=0&rev=12 --- gsoap-05-ipv6.diff | 32 ++++++++++++++++++++++++++++++++ gsoap.changes | 2 ++ gsoap.spec | 5 +++-- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 gsoap-05-ipv6.diff diff --git a/gsoap-05-ipv6.diff b/gsoap-05-ipv6.diff new file mode 100644 index 0000000..e85780c --- /dev/null +++ b/gsoap-05-ipv6.diff @@ -0,0 +1,32 @@ +From: Jan Engelhardt +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; diff --git a/gsoap.changes b/gsoap.changes index 55ceec0..4161741 100644 --- a/gsoap.changes +++ b/gsoap.changes @@ -11,6 +11,8 @@ Thu Nov 10 11:40:07 UTC 2011 - jengelh@medozas.de soap_wsse_add_EncryptedKey_encrypt_only). * Improved HTTP proxy authentication support (digest and NTLM). - Added patch to fix empty error strings (gsoap-04-strerror.diff) +- Added patch to avoid calling IPv6-only socket options on non-IPv6 + sockets (gsoap-05-ipv6.diff) ------------------------------------------------------------------- Tue Oct 18 15:39:46 UTC 2011 - jengelh@medozas.de diff --git a/gsoap.spec b/gsoap.spec index 66a86e4..1bef6f6 100644 --- a/gsoap.spec +++ b/gsoap.spec @@ -13,6 +13,7 @@ Patch1: gsoap-01-sharedlibs.diff Patch2: gsoap-02-typepuns.diff Patch3: gsoap-03-initext.diff Patch4: gsoap-04-strerror.diff +Patch5: gsoap-05-ipv6.diff BuildRoot: %_tmppath/%name-%version-build BuildRequires: bison, fdupes flex, gcc-c++, pkgconfig %if 0%{?suse_version} >= 1130 @@ -78,13 +79,13 @@ symlinks for libgsoap. tar -xf "%{S:0}" --use=xz; %setup -DTq %endif -%patch -P 1 -P 2 -P 3 -P 4 -p1 +%patch -P 1 -P 2 -P 3 -P 4 -P 5 -p1 %build # Rebuild configure - fix that utterly long mktime test. autoreconf -fi; -%configure --enable-ipv6 --disable-static CFLAGS="-O0 -ggdb3" CXXFLAGS="-O0 -ggdb3" +%configure --enable-ipv6 --disable-static CFLAGS="-O0 -ggdb3 -DWITH_NO_IPV6_V6ONLY" CXXFLAGS="-O0 -ggdb3 -DWITH_NO_IPV6_V6ONLY" pushd gsoap/src/; make soapcpp2_yacc.c; popd;