QNetworkInterface/Win: fix MTU of Windows loopback interfaces

We document that -1 is not a valid value. The Windows structure's type
is unsigned, so the value is actually ULONG_MAX.

Change-Id: Ic632b4163d784b83951cfffd14f668645c4da3a9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Thiago Macieira 2017-11-12 09:58:25 -08:00
parent 9db46732a8
commit aa494d826a
2 changed files with 3 additions and 1 deletions

View File

@ -151,7 +151,7 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
else if (ptr->IfIndex != 0)
iface->index = ptr->IfIndex;
iface->mtu = ptr->Mtu;
iface->mtu = qMin<qint64>(ptr->Mtu, INT_MAX);
iface->flags = QNetworkInterface::CanBroadcast;
if (ptr->OperStatus == IfOperStatusUp)
iface->flags |= QNetworkInterface::IsUp | QNetworkInterface::IsRunning;

View File

@ -184,6 +184,8 @@ void tst_QNetworkInterface::consistencyCheck()
if (iface.index())
interfaceIndexes << iface.index();
QVERIFY(iface.maxTransmissionUnit() >= 0);
const QList<QNetworkAddressEntry> addresses = iface.addressEntries();
for (auto entry : addresses) {
QVERIFY(entry.ip().protocol() != QAbstractSocket::UnknownNetworkLayerProtocol);