|
@@ -49,6 +49,7 @@ Dhcp4Client::Dhcp4Client(const Dhcp4Client::State& state) :
|
|
curr_transid_(0),
|
|
curr_transid_(0),
|
|
dest_addr_("255.255.255.255"),
|
|
dest_addr_("255.255.255.255"),
|
|
hwaddr_(generateHWAddr()),
|
|
hwaddr_(generateHWAddr()),
|
|
|
|
+ clientid_(),
|
|
iface_name_("eth0"),
|
|
iface_name_("eth0"),
|
|
relay_addr_("192.0.2.2"),
|
|
relay_addr_("192.0.2.2"),
|
|
requested_options_(),
|
|
requested_options_(),
|
|
@@ -66,6 +67,7 @@ Dhcp4Client::Dhcp4Client(boost::shared_ptr<NakedDhcpv4Srv> srv,
|
|
dest_addr_("255.255.255.255"),
|
|
dest_addr_("255.255.255.255"),
|
|
fqdn_(),
|
|
fqdn_(),
|
|
hwaddr_(generateHWAddr()),
|
|
hwaddr_(generateHWAddr()),
|
|
|
|
+ clientid_(),
|
|
iface_name_("eth0"),
|
|
iface_name_("eth0"),
|
|
relay_addr_("192.0.2.2"),
|
|
relay_addr_("192.0.2.2"),
|
|
requested_options_(),
|
|
requested_options_(),
|
|
@@ -153,6 +155,8 @@ Dhcp4Client::doDiscover(const boost::shared_ptr<IOAddress>& requested_addr) {
|
|
includePRL();
|
|
includePRL();
|
|
// Include FQDN or Hostname.
|
|
// Include FQDN or Hostname.
|
|
includeName();
|
|
includeName();
|
|
|
|
+ // Include Client Identifier
|
|
|
|
+ includeClientId();
|
|
if (requested_addr) {
|
|
if (requested_addr) {
|
|
addRequestedAddress(*requested_addr);
|
|
addRequestedAddress(*requested_addr);
|
|
}
|
|
}
|
|
@@ -244,6 +248,8 @@ Dhcp4Client::doRequest() {
|
|
includePRL();
|
|
includePRL();
|
|
// Include FQDN or Hostname.
|
|
// Include FQDN or Hostname.
|
|
includeName();
|
|
includeName();
|
|
|
|
+ // Include Client Identifier
|
|
|
|
+ includeClientId();
|
|
// Send the message to the server.
|
|
// Send the message to the server.
|
|
sendMsg(context_.query_);
|
|
sendMsg(context_.query_);
|
|
// Expect response.
|
|
// Expect response.
|
|
@@ -255,6 +261,25 @@ Dhcp4Client::doRequest() {
|
|
}
|
|
}
|
|
|
|
|
|
void
|
|
void
|
|
|
|
+Dhcp4Client::includeClientId(const std::string& clientid) {
|
|
|
|
+ clientid_ = ClientId::fromText(clientid);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void
|
|
|
|
+Dhcp4Client::includeClientId() {
|
|
|
|
+ if (!context_.query_) {
|
|
|
|
+ isc_throw(Dhcp4ClientError, "pointer to the query must not be NULL"
|
|
|
|
+ " when adding Client Identifier option");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (clientid_) {
|
|
|
|
+ OptionPtr opt(new Option(Option::V4, DHO_DHCP_CLIENT_IDENTIFIER,
|
|
|
|
+ clientid_->getClientId()));
|
|
|
|
+ context_.query_->addOption(opt);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void
|
|
Dhcp4Client::includeFQDN(const uint8_t flags, const std::string& fqdn_name,
|
|
Dhcp4Client::includeFQDN(const uint8_t flags, const std::string& fqdn_name,
|
|
Option4ClientFqdn::DomainNameType fqdn_type) {
|
|
Option4ClientFqdn::DomainNameType fqdn_type) {
|
|
fqdn_.reset(new Option4ClientFqdn(flags, Option4ClientFqdn::RCODE_CLIENT(),
|
|
fqdn_.reset(new Option4ClientFqdn(flags, Option4ClientFqdn::RCODE_CLIENT(),
|