summaryrefslogtreecommitdiffstats
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>2013-11-27 22:40:14 +0100
commite82951611c6d965cc8ef9cbf4ee7fbccf615bb3f (patch)
treef9a3b3c4c87d4e963ff509d85018815d22b10e6a
parent76580659e6468e0b87cdd877d06c6df7ad9f8a9d (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 Reviewed-by: Peter Hartmann <phartmann@blackberry.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-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 01c082059f..d3c830a66f 100644
--- a/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/src/network/kernel/qnetworkinterface_unix.cpp
@@ -277,18 +277,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;
}