From: Marcin Siodelski Date: Thu, 21 Sep 2017 06:58:36 +0000 (+0200) Subject: [5307] DHCPv6 server assigns shared network specific options. X-Git-Tag: trac5363_base~11^2~5 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=686b415d7dda9b4b4f4b62562dcd5b9b9277432f;p=thirdparty%2Fkea.git [5307] DHCPv6 server assigns shared network specific options. --- diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index 9dde04b4d5..c15c87c2f8 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -879,9 +879,18 @@ Dhcpv6Srv::buildCfgOptionList(const Pkt6Ptr& question, } }; - // Next, subnet configured options. - if (ctx.subnet_ && !ctx.subnet_->getCfgOption()->empty()) { - co_list.push_back(ctx.subnet_->getCfgOption()); + if (ctx.subnet_) { + // Next, subnet configured options. + if (!ctx.subnet_->getCfgOption()->empty()) { + co_list.push_back(ctx.subnet_->getCfgOption()); + } + + // Then, shared network specific options. + SharedNetwork6Ptr network; + ctx.subnet_->getSharedNetwork(network); + if (network && !network->getCfgOption()->empty()) { + co_list.push_back(network->getCfgOption()); + } } // Each class in the incoming packet diff --git a/src/bin/dhcp6/tests/shared_network_unittest.cc b/src/bin/dhcp6/tests/shared_network_unittest.cc index 771278ef39..bfcbf1f0c5 100644 --- a/src/bin/dhcp6/tests/shared_network_unittest.cc +++ b/src/bin/dhcp6/tests/shared_network_unittest.cc @@ -1002,7 +1002,7 @@ TEST_F(Dhcpv6SharedNetworkTest, optionsDerivation) { client3.setInterface("eth0"); // Request an address from the subnet outside of the shared network. - ASSERT_NO_THROW(client2.requestAddress(0xabca, IOAddress("3000::1"))); + ASSERT_NO_THROW(client3.requestAddress(0xabca, IOAddress("3000::1"))); // Request all configured options. ASSERT_NO_THROW(client3.requestOption(D6O_NIS_SERVERS));