ethernet: prevent provisioning failure loop
Adds check to restart() to prevent an endless provisioning failure loop that could occur when link disappears while an interface is provisioning (triggering a subsequent provisioning failure, restart, and so on). Test: atest EthernetManagerTest Bug: 265255745 Change-Id: I83decad4eae5bb1070204997bb0acd35ba4cc9f4
This commit is contained in:
parent
5708b1c7df
commit
2390fb24df
1 changed files with 11 additions and 1 deletions
|
|
@ -657,7 +657,17 @@ public class EthernetNetworkFactory {
|
|||
}
|
||||
|
||||
void restart() {
|
||||
if (DBG) Log.d(TAG, "reconnecting Ethernet");
|
||||
if (DBG) Log.d(TAG, "restart IpClient");
|
||||
|
||||
if (mIpClient == null) {
|
||||
// If restart() is called from a provisioning failure, it is
|
||||
// possible that link disappeared in the meantime. In that
|
||||
// case, stop() has already been called and IpClient should not
|
||||
// get restarted to prevent a provisioning failure loop.
|
||||
Log.i(TAG, String.format("restart() was called on stopped interface %s", name));
|
||||
return;
|
||||
}
|
||||
|
||||
stop();
|
||||
start();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue