From: Marcin Siodelski Date: Tue, 31 May 2016 09:09:29 +0000 (+0200) Subject: [3573] Assign host specific options by the DHCPv6 server. X-Git-Tag: fdxhook_base~1^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e720266dcd16f08f443eb6f9cf47a013367f8631;p=thirdparty%2Fkea.git [3573] Assign host specific options by the DHCPv6 server. Also, fixes in the host unit tests. --- diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index e5dad328b4..44949e0f33 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -794,7 +794,12 @@ void Dhcpv6Srv::buildCfgOptionList(const Pkt6Ptr& question, AllocEngine::ClientContext6& ctx, CfgOptionList& co_list) { - // First subnet configured options + // Firstly, host specific options. + if (ctx.host_ && !ctx.host_->getCfgOption6()->empty()) { + co_list.push_back(ctx.host_->getCfgOption6()); + } + + // Next, subnet configured options. if (ctx.subnet_ && !ctx.subnet_->getCfgOption()->empty()) { co_list.push_back(ctx.subnet_->getCfgOption()); } diff --git a/src/bin/dhcp6/tests/host_unittest.cc b/src/bin/dhcp6/tests/host_unittest.cc index 173dfc0693..8be402809c 100644 --- a/src/bin/dhcp6/tests/host_unittest.cc +++ b/src/bin/dhcp6/tests/host_unittest.cc @@ -139,7 +139,7 @@ const char* CONFIGS[] = { "\"renew-timer\": 1000, " "\"option-data\": [ {" " \"name\": \"nisp-servers\"," - " \"data\": \"3001:3::123\"" + " \"data\": \"3000:3::123\"" "} ]," "\"subnet6\": [ " " { " @@ -148,15 +148,15 @@ const char* CONFIGS[] = { " \"interface\" : \"eth0\"," " \"option-data\": [ {" " \"name\": \"dns-servers\"," - " \"data\": \"3001:2::123\"" + " \"data\": \"3000:2::123\"" " }," " {" " \"name\": \"nis-servers\"," - " \"data\": \"3001:2::123\"" + " \"data\": \"3000:2::123\"" " }," " {" " \"name\": \"sntp-servers\"," - " \"data\": \"3001:2::123\"" + " \"data\": \"3000:2::123\"" " } ]," " \"reservations\": [" " {" @@ -164,11 +164,11 @@ const char* CONFIGS[] = { " \"ip-addresses\": [ \"2001:db8:1::2\" ]," " \"option-data\": [ {" " \"name\": \"dns-servers\"," - " \"data\": \"3001:1::234\"" + " \"data\": \"3000:1::234\"" " }," " {" " \"name\": \"nis-servers\"," - " \"data\": \"3001:1::234\"" + " \"data\": \"3000:1::234\"" " } ]" " } ]" " } ]" @@ -195,11 +195,11 @@ const char* CONFIGS[] = { " \"ip-addresses\": [ \"2001:db8:1::2\" ]," " \"option-data\": [ {" " \"name\": \"dns-servers\"," - " \"data\": \"3001:1::234\"" + " \"data\": \"3000:1::234\"" " }," " {" " \"name\": \"nis-servers\"," - " \"data\": \"3001:1::234\"" + " \"data\": \"3000:1::234\"" " } ]" " } ]" " } ]" @@ -222,7 +222,7 @@ const char* CONFIGS[] = { "{" " \"name\": \"tftp-servers\"," " \"space\": \"vendor-4491\"," - " \"data\": \"3001:3::123\"" + " \"data\": \"3000:3::123\"" "} ]," "\"subnet6\": [ " " { " @@ -240,7 +240,7 @@ const char* CONFIGS[] = { " {" " \"name\": \"tftp-servers\"," " \"space\": \"vendor-4491\"," - " \"data\": \"3001:1::234\"" + " \"data\": \"3000:1::234\"" " } ]" " } ]" " } ]" @@ -490,7 +490,7 @@ HostTest::testOverrideVendorOptions(const uint16_t msg_type) { // Address specified in the host scope should be used. Option6AddrLst::AddressContainer addrs = tftp->getAddresses(); ASSERT_EQ(addrs.size(), 1); - EXPECT_EQ("3001:1::234", addrs[0].toText()); + EXPECT_EQ("3000:1::234", addrs[0].toText()); } // Test basic SARR scenarios against a server configured with one subnet