Browse Source

[5307] DHCPv6 server assigns shared network specific options.

Marcin Siodelski 7 years ago
parent
commit
686b415d7d
2 changed files with 13 additions and 4 deletions
  1. 12 3
      src/bin/dhcp6/dhcp6_srv.cc
  2. 1 1
      src/bin/dhcp6/tests/shared_network_unittest.cc

+ 12 - 3
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

+ 1 - 1
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));