shill: fix crash when disabling cellular
As part of disabling Cellular, we deregister the CellularService
from the Manager. Manager::DeregisterService checks that the
Service does not have a Connection. We were crashing, because
this check failed.
The reason the check failed is that we were failing to drop the
Connection of the CellularService. The reason that we weren't
dropping the Connection is that we were calling DropConnection
on Cellular, rather than PPPDevice. And it's PPPDevice that
has the CellularService plumbed in the appropriate way (via
SelectService.)
Fix this by having Cellular::DropConnection punt over to
PPPDevice::DropConnection, if (and only if) we're using PPP.
While there: add some comments to crbug.com/246456, and close
it out. (I think I now understand enough of how Service and
Device interact to make a decision on that question.)
BUG=chromium:249085,chromium:246456
TEST=new unit tests, manual (see below)
Manual testing
--------------
- grab a device without built-in 3g
(if the device has built-in 3g, verification will fail
due to crbug.com/258206)
- log in
- plug in 3g ppp dongle
- wait to connect
- after connecting: ash-tray -> "Connected to" -> toggle
state of 3g (triangle icon in lower right)
- wait for disconnect
- observe that the 3g network is no longer in the ash-tray
menu
- check that shill has not crashed
- check that ifconfig no longer shows a ppp device (e.g. ppp0, ppp1)
Change-Id: I3fc3b6dc0ce1d90b5e34522543fe2116a32bf539
Reviewed-on: https://gerrit.chromium.org/gerrit/61602
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
4 files changed