Commit 1f141f14 authored by Francis Dupont's avatar Francis Dupont Committed by Tomek Mrugalski
Browse files

[5440] Checkpoint before giving up

parent 71c92cab
......@@ -98,6 +98,11 @@ client and transaction identification information. The second argument
specifies the hostname carried in the Hostname option sent by the
% DHCP4_CLIENT_HOSTNAME_EMPTY %1: client sent bogus empty Hostname option
This informational message is issued when the server receives an
empty Hostname option. Such option is bogus (size is required to be
at least one) and is ignored.
% DHCP4_CLIENT_HOSTNAME_PROCESS %1: processing client's Hostname option
This debug message is issued when the server starts processing the Hostname
option sent in the client's query. The argument includes the client and
......@@ -1679,6 +1679,13 @@ Dhcpv4Srv::processHostnameOption(Dhcpv4Exchange& ex) {
OptionStringPtr opt_hostname = boost::dynamic_pointer_cast<OptionString>
// Ignore empty/bogus Hostname option.
if (opt_hostname && opt_hostname->getValue().empty()) {
if (opt_hostname) {
......@@ -412,6 +412,29 @@ public:
// Create a message holding an empty Hostname option.
Pkt4Ptr generatePktWithEmptyHostname(const uint8_t msg_type) {
Pkt4Ptr pkt = Pkt4Ptr(new Pkt4(msg_type, 1234));
// For DISCOVER we don't include server id, because client broadcasts
// the message to all servers.
if (msg_type != DHCPDISCOVER) {
// Create Hostname option.
std::string hostname(" ");
OptionPtr opt = createHostname(hostname);
opt->setData(hostname.begin(), hostname.begin());
return (pkt);
// Create a message holding of a given type
Pkt4Ptr generatePkt(const uint8_t msg_type) {
Pkt4Ptr pkt = Pkt4Ptr(new Pkt4(msg_type, 1234));
......@@ -813,6 +836,15 @@ TEST_F(NameDhcpv4SrvTest, serverUpdateWrongHostname) {
// Test that the server skips processing of an empty Hostname option.
TEST_F(NameDhcpv4SrvTest, serverUpdateEmptyHostname) {
Pkt4Ptr query;
ASSERT_NO_THROW(query = generatePktWithEmptyHostname(DHCPREQUEST));
OptionStringPtr hostname;
ASSERT_NO_THROW(hostname = processHostname(query));
// Test that server generates the fully qualified domain name for the client
// if client supplies the partial name.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment