#endif
#include <dhcpsrv/memfile_lease_mgr.h>
-#include <boost/algorithm/string/join.hpp>
+#include <boost/algorithm/string.hpp>
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/pointer_cast.hpp>
// send back a hostname option, send this option with a reserved
// name for this client.
if (should_send_hostname) {
- const std::string& hostname =
- d2_mgr.qualifyName(ctx->currentHost()->getHostname(),
- false);
+ std::string hostname =
+ d2_mgr.qualifyName(ctx->currentHost()->getHostname(), false);
+
+ // Convert hostname to lower case.
+ boost::algorithm::to_lower(hostname);
+
LOG_DEBUG(ddns4_logger, DBG_DHCP4_DETAIL_DATA,
DHCP4_RESERVED_HOSTNAME_ASSIGNED)
.arg(ex.getQuery()->getLabel())
hostname = sanitizer->scrub(hostname);
}
+ // Convert hostname to lower case.
+ boost::algorithm::to_lower(hostname);
+
if (label_count == 2) {
// If there are two labels, it means that the client has specified
// the unqualified name. We have to concatenate the unqualified name
IfaceMgrTestConfig test_config(true);
IfaceMgr::instance().openSockets4();
- Pkt4Ptr req1 = generatePktWithHostname(DHCPREQUEST, "myhost.example.com.");
+ // Case in a hostname should be ignored.
+ Pkt4Ptr req1 = generatePktWithHostname(DHCPREQUEST, "Myhost.Example.Com.");
// Set interface for the incoming packet. The server requires it to
// generate client id.
"965B68B6D438D98E680BF10B09F3BCF",
time(NULL), subnet_->getValid(), true);
- // Create another Request message with the same FQDN. Server
- // should generate no NameChangeRequests.
+ // Create another Request message with the same FQDN. Case changes in the
+ // hostname should be ignored. Server should generate no NameChangeRequests.
Pkt4Ptr req2 = generatePktWithFqdn(DHCPREQUEST, Option4ClientFqdn::FLAG_S |
Option4ClientFqdn::FLAG_E,
- "myhost.example.com.",
+ "Myhost.Example.Com.",
Option4ClientFqdn::FULL, true);
ASSERT_NO_THROW(reply = srv_->processRequest(req2));
"965B68B6D438D98E680BF10B09F3BCF",
time(NULL), subnet_->getValid(), true);
- // Create another Request message with the same Hostname. Server
- // should generate no NameChangeRequests.
- Pkt4Ptr req2 = generatePktWithHostname(DHCPREQUEST, "myhost.example.com.");
+ // Create another Request message with the same Hostname. Case changes in the
+ // hostname should be ignored. Server should generate no NameChangeRequests.
+ Pkt4Ptr req2 = generatePktWithHostname(DHCPREQUEST, "Myhost.Example.Com.");
// Set interface for the incoming packet. The server requires it to
// generate client id.