summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@digia.com>2013-11-27 15:04:09 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-03 17:11:53 +0100
commita0930d007c01423daebc5c63fbf8635a8b394fd7 (patch)
treea4b93f7d6da4ffb19c9fc7eb79239d5ca1d63100 /src/network
parent663b742ca8b289e6456facf8b6a8ca18a4157fb7 (diff)
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/network')
-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 d928a165cf..6c2a08a4b0 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;
}