shill: EthernetService: Fix auto-connect-by-default
Fix a nasty typo which prevented EthernetService from overriding
the parent class IsAutoConnectByDefault. Add unit tests. Add
belt-and-suspenders by also overriding the SetAutoConnect RPC
settter to prevent AutoConnect from being set over the control
interface.
BUG=chromium-os:32709
TEST=Unit tests
Change-Id: I683333b915cb747ccb241512f66d2fb3f1efca3a
Reviewed-on: https://gerrit.chromium.org/gerrit/30557
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/ethernet_service.cc b/ethernet_service.cc
index cc163c8..837bde8 100644
--- a/ethernet_service.cc
+++ b/ethernet_service.cc
@@ -54,4 +54,14 @@
kServiceType, ethernet_->address().c_str());
}
+void EthernetService::SetAutoConnect(const bool &connect, Error *error) {
+ if (!connect) {
+ Error::PopulateAndLog(
+ error, Error::kInvalidArguments,
+ "Auto-connect on Ethernet services must not be disabled.");
+ return;
+ }
+ Service::SetAutoConnect(connect, error);
+}
+
} // namespace shill