shill: Pass a parameter to dhcp client to request a hostname
This will enable dynamic DNS, or at the very least allow DHCP
requests to be identified and distinguished at the server side.
BUG=chromium-os:23741
TEST=New unit tests monitor hostname arg passed to dhcpcd,
and to assure values are being loaded/saved. Also double
checked on real system by doing a dbus-send to set manager.HostName
and checked that the name was persisted, and that the next
DHCP server we connected to stored this hostname.
CQ-DEPEND=Ic807a2235e0cdcb32a08f9c2c760a86c3579431c
Change-Id: Ic127b65d8563b15e55549a0f029385d0632eaf6c
Reviewed-on: https://gerrit.chromium.org/gerrit/14045
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
diff --git a/dhcp_config.h b/dhcp_config.h
index 8b81ddd..4ea147b 100644
--- a/dhcp_config.h
+++ b/dhcp_config.h
@@ -31,6 +31,7 @@
EventDispatcher *dispatcher,
DHCPProvider *provider,
const std::string &device_name,
+ const std::string &request_hostname,
GLib *glib);
virtual ~DHCPConfig();
@@ -61,6 +62,8 @@
FRIEND_TEST(DHCPConfigTest, Restart);
FRIEND_TEST(DHCPConfigTest, RestartNoClient);
FRIEND_TEST(DHCPConfigTest, StartFail);
+ FRIEND_TEST(DHCPConfigTest, StartWithHostname);
+ FRIEND_TEST(DHCPConfigTest, StartWithoutHostname);
FRIEND_TEST(DHCPConfigTest, StartSuccess);
FRIEND_TEST(DHCPConfigTest, Stop);
FRIEND_TEST(DHCPProviderTest, CreateConfig);
@@ -121,6 +124,10 @@
DHCPProvider *provider_;
+ // Hostname to be used in the request. This will be passed to the DHCP
+ // server in the request.
+ std::string request_hostname_;
+
// The PID of the spawned DHCP client. May be 0 if no client has been spawned
// yet or the client has died.
int pid_;