shill: DHCPConfig: Optionally use minimal config
Add another argument to the DHCPConfig constructor to specify
whether a cut-down minimal set of options should be requested
from the DHCP server. This adds a command line argument to
the startup of the DHCP client. Propagate this upwards to the
Device, and add a placeholder Device::ShouldUseMinimalConfig()
method which will decide whether to enable this feature in the
DHCPConfig in a later CL.
A few ancillary changes went into this CL:
- The DHCPProvider needed another argument to CreateConfig
since it constructs DHCPConfig objects.
- Added a unit test for the Device::ShouldUseArpGateway()
superclass function next to Device::ShouldUseMinimalConfig()
test.
- Fixed the DHCPConfigTest::Start* tests to use the IsDHCPCDArgs
matcher. For some reason that matcher sat unused and
atrophied. Added a new test that exercises the minimal config
flag.
BUG=chromium:297607
TEST=Unit tests. Run network_DhcpNegotiationSuccess autotest.
Change-Id: If0dcaf328ca6dfac7127a6badd409a4138c95760
Reviewed-on: https://chromium-review.googlesource.com/174531
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/device.cc b/device.cc
index cfd20bf..d6145dd 100644
--- a/device.cc
+++ b/device.cc
@@ -381,6 +381,10 @@
return false;
}
+bool Device::ShouldUseMinimalDHCPConfig() const {
+ return false;
+}
+
bool Device::AcquireIPConfig() {
return AcquireIPConfigWithLeaseName(string());
}
@@ -392,7 +396,8 @@
ipconfig_ = dhcp_provider_->CreateConfig(link_name_,
manager_->GetHostName(),
lease_name,
- arp_gateway);
+ arp_gateway,
+ ShouldUseMinimalDHCPConfig());
ipconfig_->RegisterUpdateCallback(Bind(&Device::OnIPConfigUpdated,
weak_ptr_factory_.GetWeakPtr()));
dispatcher_->PostTask(Bind(&Device::ConfigureStaticIPTask,