Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.2
-
None
Description
On Linux, the QNetworkInterface::IsUp flag semantics has changed which breaks existing application code.
At some point Qt changed the way that QNetworkInterface::IsUp is obtained from the Linux kernel. Qt 5.12.2 obtains the QNetworkInterface::IsUp flags using a RTM_GETLINK request over a Netlink socket which returned the flags in a ifinfomsg as follows :-
struct ifinfomsg { ... unsigned int ifi_flags; /* Device flags */ ... }
However, if the response also includes a IFLA_OPERSTATE message, then QNetworkInterface::IsUp is overridden by the IFLA_OPERSTATE of the network interface. i.e.
static QList<QNetworkInterfacePrivate *> getInterfaces(int sock, char *buf) { ... case IFLA_OPERSTATE: // operational state if (*payloadPtr != IF_OPER_UNKNOWN) { iface->flags &= ~QNetworkInterface::IsUp; if (*payloadPtr == IF_OPER_UP) { iface->flags |= QNetworkInterface::IsUp; } } break;
In the situation where a network interface is ready aside from the cable being unplugged, then QNetworkInterface::IsUp is cleared whereas in previous Qt versions (e.g. 5.6), it would be set.
I suggest that the operational state should be exposed using a separate and new attribute in QNetworkInterface rather than being used to modify QNetworkInterface::IsUp.