From: Marcin Siodelski Date: Thu, 21 Sep 2017 07:39:19 +0000 (+0200) Subject: [5307] DHCPv6 server uses reserved client classes in shared network case. X-Git-Tag: trac5363_base~11^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b7b40a2eb11c122403cb16ca90379ee29fe37ae;p=thirdparty%2Fkea.git [5307] DHCPv6 server uses reserved client classes in shared network case. --- diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index c15c87c2f8..9c90bc92d3 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -912,10 +912,12 @@ Dhcpv6Srv::buildCfgOptionList(const Pkt6Ptr& question, // Skip it continue; } + if (ccdef->getCfgOption()->empty()) { // Skip classes which don't configure options continue; } + co_list.push_back(ccdef->getCfgOption()); } @@ -2441,7 +2443,6 @@ Dhcpv6Srv::processSolicit(const Pkt6Ptr& solicit) { // Let's create a simplified client context here. AllocEngine::ClientContext6 ctx; initContext(solicit, ctx); - setReservedClientClasses(solicit, ctx); Pkt6Ptr response(new Pkt6(DHCPV6_ADVERTISE, solicit->getTransid())); @@ -2463,6 +2464,8 @@ Dhcpv6Srv::processSolicit(const Pkt6Ptr& solicit) { processClientFqdn(solicit, response, ctx); assignLeases(solicit, response, ctx); + setReservedClientClasses(solicit, ctx); + copyClientOptions(solicit, response); CfgOptionList co_list; buildCfgOptionList(solicit, ctx, co_list); @@ -2489,13 +2492,14 @@ Dhcpv6Srv::processRequest(const Pkt6Ptr& request) { // Let's create a simplified client context here. AllocEngine::ClientContext6 ctx; initContext(request, ctx); - setReservedClientClasses(request, ctx); Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, request->getTransid())); processClientFqdn(request, reply, ctx); assignLeases(request, reply, ctx); + setReservedClientClasses(request, ctx); + copyClientOptions(request, reply); CfgOptionList co_list; buildCfgOptionList(request, ctx, co_list); @@ -2518,13 +2522,14 @@ Dhcpv6Srv::processRenew(const Pkt6Ptr& renew) { // Let's create a simplified client context here. AllocEngine::ClientContext6 ctx; initContext(renew, ctx); - setReservedClientClasses(renew, ctx); Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, renew->getTransid())); processClientFqdn(renew, reply, ctx); extendLeases(renew, reply, ctx); + setReservedClientClasses(renew, ctx); + copyClientOptions(renew, reply); CfgOptionList co_list; buildCfgOptionList(renew, ctx, co_list); @@ -2547,13 +2552,14 @@ Dhcpv6Srv::processRebind(const Pkt6Ptr& rebind) { // Let's create a simplified client context here. AllocEngine::ClientContext6 ctx; initContext(rebind, ctx); - setReservedClientClasses(rebind, ctx); Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, rebind->getTransid())); processClientFqdn(rebind, reply, ctx); extendLeases(rebind, reply, ctx); + setReservedClientClasses(rebind, ctx); + copyClientOptions(rebind, reply); CfgOptionList co_list; buildCfgOptionList(rebind, ctx, co_list); diff --git a/src/bin/dhcp6/tests/shared_network_unittest.cc b/src/bin/dhcp6/tests/shared_network_unittest.cc index bfcbf1f0c5..9a60fad10f 100644 --- a/src/bin/dhcp6/tests/shared_network_unittest.cc +++ b/src/bin/dhcp6/tests/shared_network_unittest.cc @@ -1097,6 +1097,7 @@ TEST_F(Dhcpv6SharedNetworkTest, variousFieldsInReservation) { client.setInterface("eth1"); client.setDUID("00:03:00:01:11:22:33:44:55:66"); ASSERT_NO_THROW(client.requestAddress(0xabcd)); + ASSERT_NO_THROW(client.requestOption(D6O_NAME_SERVERS)); ASSERT_NO_THROW(client.useFQDN(Option6ClientFqdn::FLAG_S, "bird.example.org",