summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@digia.com>2013-11-27 14:04:09 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-03 16:11:53 (GMT)
commita0930d007c01423daebc5c63fbf8635a8b394fd7 (patch)
treea4b93f7d6da4ffb19c9fc7eb79239d5ca1d63100 /src
parent663b742ca8b289e6456facf8b6a8ca18a4157fb7 (diff)
downloadQt-a0930d007c01423daebc5c63fbf8635a8b394fd7.zip
Qt-a0930d007c01423daebc5c63fbf8635a8b394fd7.tar.gz
Qt-a0930d007c01423daebc5c63fbf8635a8b394fd7.tar.bz2
Fix problem with QNetworkAddressEntry returning a invalid netmask.
The ip address should be set before the netmask. The reason for this is that QNetworkAddressEntry::setNetmask() compares the protocol of the netmask and the ip, if they don't match the netmask won't be set. Task-number: QTBUG-33911 Change-Id: Ic344b3653c5dfdc5df912dee16e4dbe069d57d24 (cherry-picked from qtbase commit e82951611c6d965cc8ef9cbf4ee7fbccf615bb3f) Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
Diffstat (limited to 'src')
-rw-r--r--src/network/kernel/qnetworkinterface_unix.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp
index d928a16..6c2a08a 100644
--- a/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/src/network/kernel/qnetworkinterface_unix.cpp
@@ -266,18 +266,18 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
}
}
- // Get the interface netmask
- if (qt_safe_ioctl(socket, SIOCGIFNETMASK, &req) >= 0) {
- sockaddr *sa = &req.ifr_addr;
- entry.setNetmask(addressFromSockaddr(sa));
- }
-
// Get the address of the interface
if (qt_safe_ioctl(socket, SIOCGIFADDR, &req) >= 0) {
sockaddr *sa = &req.ifr_addr;
entry.setIp(addressFromSockaddr(sa));
}
+ // Get the interface netmask
+ if (qt_safe_ioctl(socket, SIOCGIFNETMASK, &req) >= 0) {
+ sockaddr *sa = &req.ifr_addr;
+ entry.setNetmask(addressFromSockaddr(sa));
+ }
+
iface->addressEntries << entry;
}