Android: prefer wlan IPv6 connection over other interfaces

Android doesn't allow connection from interfaces like (radio0, eth0,
etc.) when wlan0 is already connected, so prefer testing that.

Task-number: QTBUG-125023
Change-Id: Id48a6717755edc22909a4a0d58631d8132a42b1a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Assam Boudjelthia 2024-05-22 13:59:26 +03:00
parent 4370f9f227
commit f1c6c66985

View File

@ -197,6 +197,14 @@ void tst_QNetworkInterface::localAddress_data()
} else if (!ipv6 || entry.prefixLength() != 64) {
continue;
} else {
#ifdef Q_OS_ANDROID
// Android seem to not allow IPv6 connection from interfaces other than wlan,
// if it's connected, and wlan is connected by default on Android emulators,
// so prefer selecting wlan in this test.
const QString scopeId = addr.scopeId();
if (!scopeId.isEmpty() && !scopeId.startsWith("wlan"))
continue;
#endif
// add a random node in this IPv6 network
quint64 randomid = qFromBigEndian(Q_UINT64_C(0x8f41f072e5733caa));
QIPv6Address ip6 = addr.toIPv6Address();