summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qnativesocketengine_win.cpp
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2012-05-09 17:13:59 +0100
committerQt by Nokia <qt-info@nokia.com>2012-05-11 17:39:13 +0200
commit6abc66e076826b24cc3700c3a0702f552ab50429 (patch)
tree6d6800b5cb4f0b10ffc776f16a7b5afdcf0d88ad /src/network/socket/qnativesocketengine_win.cpp
parentb72c8dd8a248d67b1192e3baa1fca07244a3719d (diff)
Fix sending UDP packets to link local addresses
When the scope ID is not set, Mac and Windows will not transmit packets to link local addresses. This patch implements setting the scope in the native socket engines and adds a test case. (it was partially implemented already, though UDP specific code paths were missed in the unix engine) Task-number: QTBUG-25634 Change-Id: I23300bdc9856e38458078e913daaa59cd05a74b5 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
Diffstat (limited to 'src/network/socket/qnativesocketengine_win.cpp')
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index 4bf2a6c6e3..bd9550e207 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -170,10 +170,12 @@ static inline void qt_socket_getPortAndAddress(SOCKET socketDescriptor, const qt
Q_IPV6ADDR tmp;
for (int i = 0; i < 16; ++i)
tmp.c[i] = sa6->sin6_addr.qt_s6_addr[i];
- QHostAddress a;
- a.setAddress(tmp);
- if (address)
- *address = a;
+ if (address) {
+ QHostAddress a;
+ a.setAddress(tmp);
+ a.setScopeId(QString::number(sa6->sin6_scope_id));
+ *address = a;
+ }
if (port)
WSANtohs(socketDescriptor, sa6->sin6_port, port);
} else