Commit 5351f5e3 authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[3352] Update b10-dhcp4 to use new D2ClientMgr update direction method

Updated Dhcpv4Srv to use D2ClientMgr::getUpdateDirections method and
adjusted FQDN unit tests to accomodate new client delegation behavior.
parent 9e133929
...@@ -966,8 +966,9 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) { ...@@ -966,8 +966,9 @@ Dhcpv4Srv::assignLease(const Pkt4Ptr& question, Pkt4Ptr& answer) {
Option4ClientFqdn>(answer->getOption(DHO_FQDN)); Option4ClientFqdn>(answer->getOption(DHO_FQDN));
if (fqdn) { if (fqdn) {
hostname = fqdn->getDomainName(); hostname = fqdn->getDomainName();
fqdn_fwd = fqdn->getFlag(Option4ClientFqdn::FLAG_S); CfgMgr::instance().getD2ClientMgr().getUpdateDirections(*fqdn,
fqdn_rev = !fqdn->getFlag(Option4ClientFqdn::FLAG_N); fqdn_fwd,
fqdn_rev);
} else { } else {
opt_hostname = boost::dynamic_pointer_cast<OptionString> opt_hostname = boost::dynamic_pointer_cast<OptionString>
(answer->getOption(DHO_HOST_NAME)); (answer->getOption(DHO_HOST_NAME));
......
...@@ -387,15 +387,16 @@ public: ...@@ -387,15 +387,16 @@ public:
// NCRs cannot be sent to the d2_mgr unless updates are enabled. // NCRs cannot be sent to the d2_mgr unless updates are enabled.
if (d2_mgr_.ddnsEnabled()) { if (d2_mgr_.ddnsEnabled()) {
// There should be an NCR only if response S flag is 1. // There should be an NCR if response S flag is 1 or N flag is 0.
/// @todo This logic will need to change if forward and reverse bool exp_fwd = (response_flags & Option4ClientFqdn::FLAG_S);
/// updates are ever controlled independently. bool exp_rev = (!(response_flags & Option4ClientFqdn::FLAG_N));
if ((response_flags & Option4ClientFqdn::FLAG_S) == 0) { if (!exp_fwd && !exp_rev) {
ASSERT_EQ(0, d2_mgr_.getQueueSize()); ASSERT_EQ(0, d2_mgr_.getQueueSize());
} else { } else {
// Verify that there is one NameChangeRequest as expected. // Verify that there is one NameChangeRequest as expected.
ASSERT_EQ(1, d2_mgr_.getQueueSize()); ASSERT_EQ(1, d2_mgr_.getQueueSize());
verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD, true, true, verifyNameChangeRequest(isc::dhcp_ddns::CHG_ADD,
exp_rev, exp_fwd,
reply->getYiaddr().toText(), reply->getYiaddr().toText(),
"myhost.example.com.", "myhost.example.com.",
"", // empty DHCID means don't check it "", // empty DHCID means don't check it
...@@ -537,13 +538,13 @@ TEST_F(NameDhcpv4SrvTest, overrideNoUpdate) { ...@@ -537,13 +538,13 @@ TEST_F(NameDhcpv4SrvTest, overrideNoUpdate) {
// //
// Server should respect client's delegation request and NOT do updates: // Server should respect client's delegation request and NOT do updates:
// - Response flags should be N = 1, S = 0, O = 0 // - Response flags should be N = 0, S = 0, O = 0
// - Should not queue any NCRs // - Should not queue any NCRs
TEST_F(NameDhcpv4SrvTest, respectClientDelegation) { TEST_F(NameDhcpv4SrvTest, respectClientDelegation) {
flagVsConfigScenario(Option4ClientFqdn::FLAG_E, flagVsConfigScenario(Option4ClientFqdn::FLAG_E,
(Option4ClientFqdn::FLAG_E | Option4ClientFqdn::FLAG_E);
Option4ClientFqdn::FLAG_N)); // Option4ClientFqdn::FLAG_N));
} }
// Tests the following scenario: // Tests the following scenario:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment