Commit 4fc2c2cb authored by Thomas Markwalder's avatar Thomas Markwalder
Browse files

[3352] Added test to not create NCRs if FQDN flags indicate none required

Dhcpv6Srv::createNameChangeRequests was not catching cases where FQDN flags
indicate NO changes should be made. This causes an exception to thrown by
the NCR constructor stating that both forward and reverse flags cannot be
false. Also moved the check up in the method, above of the options loop.
parent 614d16ac
...@@ -1032,6 +1032,19 @@ Dhcpv6Srv::createNameChangeRequests(const Pkt6Ptr& answer) { ...@@ -1032,6 +1032,19 @@ Dhcpv6Srv::createNameChangeRequests(const Pkt6Ptr& answer) {
return; return;
} }
// Get the update directions that should be performed based on our
// response FQDN flags.
bool do_fwd = false;
bool do_rev = false;
CfgMgr::instance().getD2ClientMgr().getUpdateDirections(*opt_fqdn,
do_fwd, do_rev);
if (!do_fwd && !do_rev) {
// Flags indicate there is Nothing to do, get out now.
// The Most likely scenario is that we are honoring the client's
// request that no updates be done.
return;
}
// Get the Client Id. It is mandatory and a function creating a response // Get the Client Id. It is mandatory and a function creating a response
// would have thrown an exception if it was missing. Thus throwning // would have thrown an exception if it was missing. Thus throwning
// Unexpected if it is missing as it is a programming error. // Unexpected if it is missing as it is a programming error.
...@@ -1071,16 +1084,8 @@ Dhcpv6Srv::createNameChangeRequests(const Pkt6Ptr& answer) { ...@@ -1071,16 +1084,8 @@ Dhcpv6Srv::createNameChangeRequests(const Pkt6Ptr& answer) {
// Create new NameChangeRequest. Use the domain name from the FQDN. // Create new NameChangeRequest. Use the domain name from the FQDN.
// This is an FQDN included in the response to the client, so it // This is an FQDN included in the response to the client, so it
// holds a fully qualified domain-name already (not partial). // holds a fully qualified domain-name already (not partial).
// Get the IP address from the lease. Also, use the S flag to determine // Get the IP address from the lease.
// if forward change should be performed. This flag will always be
// set if server has taken responsibility for the forward update.
// Use the inverse of the N flag to determine if a reverse change
// should be performed.
NameChangeRequestPtr ncr; NameChangeRequestPtr ncr;
bool do_fwd = false;
bool do_rev = false;
CfgMgr::instance().getD2ClientMgr().getUpdateDirections(*opt_fqdn,
do_fwd, do_rev);
ncr.reset(new NameChangeRequest(isc::dhcp_ddns::CHG_ADD, ncr.reset(new NameChangeRequest(isc::dhcp_ddns::CHG_ADD,
do_fwd, do_rev, do_fwd, do_rev,
opt_fqdn->getDomainName(), opt_fqdn->getDomainName(),
......
Supports Markdown
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