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/dhcp_config.h b/dhcp_config.h
index 354dfa2..276469e 100644
--- a/dhcp_config.h
+++ b/dhcp_config.h
@@ -48,6 +48,7 @@
const std::string &request_hostname,
const std::string &lease_file_suffix,
bool arp_gateway,
+ bool is_minimal_config,
GLib *glib);
virtual ~DHCPConfig();
@@ -91,6 +92,7 @@
FRIEND_TEST(DHCPConfigTest, StartFail);
FRIEND_TEST(DHCPConfigTest, StartTimeout);
FRIEND_TEST(DHCPConfigTest, StartWithHostname);
+ FRIEND_TEST(DHCPConfigTest, StartWithMinimalConfig);
FRIEND_TEST(DHCPConfigTest, StartWithoutArpGateway);
FRIEND_TEST(DHCPConfigTest, StartWithoutHostname);
FRIEND_TEST(DHCPConfigTest, StartWithoutLeaseSuffix);
@@ -115,6 +117,7 @@
static const char kDHCPCDPathFormatPID[];
static const int kDHCPTimeoutSeconds;
static const char kDHCPCDUser[];
+ static const char kDHCPCDMinimalConfig[];
static const char kReasonBound[];
static const char kReasonFail[];
@@ -189,6 +192,11 @@
// the acquired IP address using an ARP request to the gateway IP address.
bool arp_gateway_;
+ // Specifies whether to configure the the DHCP client to request the bare
+ // minimum of options in order to escape any MTU issues with the packet size
+ // of the DHCP server's reply.
+ bool is_minimal_config_;
+
// The PID of the spawned DHCP client. May be 0 if no client has been spawned
// yet or the client has died.
int pid_;