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>
This commit is contained in:
parent
76580659e6
commit
e82951611c
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user