diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index 4e0056deaa..2209df4e2d 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -198,6 +198,8 @@ Dhcpv4Exchange::copyDefaultFields() { if (dst_hw_addr) { resp_->setRemoteHWAddr(dst_hw_addr); } + + resp_->setFlags(query_->getFlags()); } void diff --git a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc index a039b3d0b0..ab64cfdb7c 100644 --- a/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/dhcp4_srv_unittest.cc @@ -395,6 +395,7 @@ TEST_F(Dhcpv4SrvTest, initResponse) { const HWAddr& dst_hw = HWAddr::fromText("e8:ab:cd:78:9a:bc"); HWAddrPtr dst_hw_addr(new HWAddr(dst_hw)); query->setRemoteHWAddr(dst_hw_addr); + query->setFlags(BOOTP_BROADCAST); // Add options which must be copied // client-id echo is optional @@ -423,6 +424,7 @@ TEST_F(Dhcpv4SrvTest, initResponse) { EXPECT_EQ(IOAddress("10.10.10.10"), response->getGiaddr()); EXPECT_TRUE(src_hw == *response->getLocalHWAddr()); EXPECT_TRUE(dst_hw == *response->getRemoteHWAddr()); + EXPECT_TRUE(BOOTP_BROADCAST == response->getFlags()); // Check options (i.e., subnet selection option) OptionPtr resp_sbnsel = response->getOption(DHO_SUBNET_SELECTION);