Avoid creating IpClient if ethernet cable is unplugged.

This change avoids calling start() on needNetworkFor() if ethernet
cable is unplugged. Fixed by adding isLinkUp validation.

Test: ./cts-tradefed run cts-dev -d -m CtsSecurityTestCases -t \
      android.security.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningUdpPorts
      adb shell netstat -lnup

Change-Id: I2debd7367a20b665249f9c19d2d8a61737435803
This commit is contained in:
kevinwk_lee
2019-10-18 11:25:29 +08:00
committed by 文楷 李
parent 2afd43ff9f
commit 13d5b86614

View File

@@ -226,7 +226,7 @@ public class EthernetNetworkFactory extends NetworkFactory {
}
} else {
for (NetworkInterfaceState n : mTrackingInterfaces.values()) {
if (n.statisified(request.networkCapabilities)) {
if (n.statisified(request.networkCapabilities) && n.mLinkUp) {
network = n;
break;
}