From 686b415d7dda9b4b4f4b62562dcd5b9b9277432f Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Thu, 21 Sep 2017 08:58:36 +0200 Subject: [PATCH] [5307] DHCPv6 server assigns shared network specific options. --- src/bin/dhcp6/dhcp6_srv.cc | 15 ++++++++++++--- src/bin/dhcp6/tests/shared_network_unittest.cc | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) 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)); -- 2.47.2