shill: LinkEvent shouldn't call DestroyService
In Cellular::LinkEvent, if shill sees that the network interface has
gone down, it now calls DropConnection instead of calling DestroyService.
In addition, shill no longer takes down the network interface in
Cellular::DisconnectCleanup.
BUG=chromium-os:36573
TEST=unit tests and network_3GModemControl
Change-Id: Id64a3cc0245cfb75cfbd68529473683a7313af22
Reviewed-on: https://gerrit.chromium.org/gerrit/38756
Commit-Ready: Arman Uguray <armansito@chromium.org>
Reviewed-by: Arman Uguray <armansito@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
diff --git a/cellular.cc b/cellular.cc
index a244595..80a15b5 100644
--- a/cellular.cc
+++ b/cellular.cc
@@ -546,6 +546,9 @@
}
// TODO(petkov): Provide a timeout for a failed link-up request.
rtnl_handler()->SetInterfaceFlags(interface_index(), IFF_UP, IFF_UP);
+
+ // Set state to associating.
+ OnConnecting();
}
void Cellular::LinkEvent(unsigned int flags, unsigned int change) {
@@ -560,8 +563,9 @@
LOG(ERROR) << "Unable to acquire DHCP config.";
}
} else if ((flags & IFF_UP) == 0 && state_ == kStateLinked) {
+ LOG(INFO) << link_name() << " is down.";
SetState(kStateConnected);
- DestroyService();
+ DropConnection();
}
}
@@ -663,7 +667,6 @@
SetState(kStateRegistered);
SetServiceFailureSilent(Service::kFailureUnknown);
DestroyIPConfig();
- rtnl_handler()->SetInterfaceFlags(interface_index(), 0, IFF_UP);
return true;
}
return false;