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_provider.h b/dhcp_provider.h
index dea1f77..3ff0bb3 100644
--- a/dhcp_provider.h
+++ b/dhcp_provider.h
@@ -27,7 +27,7 @@
// configurations for devices can be obtained through its CreateConfig
// method. For example, a single DHCP configuration request can be initiated as:
//
-// DHCPProvider::GetInstance()->CreateConfig(device_name)->Request();
+// DHCPProvider::GetInstance()->CreateConfig(device_name, host_name)->Request();
class DHCPProvider {
public:
virtual ~DHCPProvider();
@@ -44,8 +44,11 @@
// Creates a new DHCPConfig for |device_name|. The DHCP configuration for the
// device can then be initiated through DHCPConfig::Request and
- // DHCPConfig::Renew.
- virtual DHCPConfigRefPtr CreateConfig(const std::string &device_name);
+ // DHCPConfig::Renew. If |hostname| is not-empty, it is placed in the DHCP
+ // request to allow the server to map the request to a specific user-named
+ // origin.
+ virtual DHCPConfigRefPtr CreateConfig(const std::string &device_name,
+ const std::string &host_name);
// Returns the DHCP configuration associated with DHCP client |pid|. Return
// NULL if |pid| is not bound to a configuration.