From: Marcin Siodelski Date: Thu, 12 Mar 2015 19:20:37 +0000 (+0100) Subject: [3688] DHCPv4 server uses clientid from the exchange where possible. X-Git-Tag: trac3764_base~12^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a0abd643c1c8bdeddfc82d1ac10956ce79ffcd4;p=thirdparty%2Fkea.git [3688] DHCPv4 server uses clientid from the exchange where possible. --- diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 95a26066e3..a1d987c03e 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -1067,14 +1067,8 @@ Dhcpv4Srv::assignLease(Dhcpv4Exchange& ex) { LOG_DEBUG(dhcp4_logger, DBG_DHCP4_DETAIL_DATA, DHCP4_SUBNET_SELECTED) .arg(subnet->toText()); - // Get client-id option - ClientIdPtr client_id; - OptionPtr opt = query->getOption(DHO_DHCP_CLIENT_IDENTIFIER); - if (opt) { - client_id = ClientIdPtr(new ClientId(opt->getData())); - } - - // client-id is not mandatory in DHCPv4 + // Get client-id. It is not mandatory in DHCPv4. + ClientIdPtr client_id = ex.getContext()->clientid_; // Get the server identifier. It will be used to determine the state // of the client. @@ -1246,8 +1240,8 @@ Dhcpv4Srv::assignLease(Dhcpv4Exchange& ex) { } // IP Address Lease time (type 51) - opt.reset(new OptionUint32(Option::V4, DHO_DHCP_LEASE_TIME, - lease->valid_lft_)); + OptionPtr opt(new OptionUint32(Option::V4, DHO_DHCP_LEASE_TIME, + lease->valid_lft_)); resp->addOption(opt); // Subnet mask (type 1)