From 126d489f7f561bc3967ee2a36624c3b1fa26f974 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 24 Dec 2014 16:43:57 -0200 Subject: Adjust the socket address family before bind()/connect()/sendto() If our socket is already of a given type (probably due to a previous call to bind()), then constrain the incoming target address to be of the same family. On some OSs, trying to send or connect to an IPv4 address from an IPv6 socket will fail with EINVAL, even if the socket is not in "v6only" mode. bind() can't be called after already being bound, but the function can still be called on a socket created by the user and passed on with setSocketDescriptor(). Change-Id: I209a1f8d0c782c6b6de2b39ea4cfad74d63f3293 Reviewed-by: Richard J. Moore --- src/network/socket/qnativesocketengine_p.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/network/socket/qnativesocketengine_p.h') diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index 4ec6023d4b..24909bf310 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -232,6 +232,7 @@ public: }; void setError(QAbstractSocket::SocketError error, ErrorString errorString) const; + QHostAddress adjustAddressProtocol(const QHostAddress &address) const; // native functions int option(QNativeSocketEngine::SocketOption option) const; -- cgit v1.2.3