2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

[3328] Addressed review comments

Fixed typos and replaced used of DHCPv<n> with b10-dhcp<n> in
D2 relevant sections of the admin guide.
Added sender_ip and max_queue_size value to dhcp4 and dhcp6 unit
tests.
Added used of DFT constants in D2ClientCfg default constructor.
This commit is contained in:
Thomas Markwalder
2014-04-24 11:46:11 -04:00
parent 94f8425e49
commit 830b726a15
6 changed files with 128 additions and 113 deletions

View File

@@ -3013,7 +3013,7 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
<section id="dhcp4-ddns-config">
<title>Configuring DHCPv4 for DDNS</title>
<para>
As mentioned earlier, DHCPv4 can be configured to generate requests to the
As mentioned earlier, b10-dhcp4 can be configured to generate requests to the
DHCP-DDNS server to update DNS entries. These requests are known as
NameChangeRequests or NCRs. Each NCR contains the following information:
<orderedlist>
@@ -3029,7 +3029,7 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
</para></listitem>
</orderedlist>
The parameters for controlling the generation of NCRs for submission to D2
are contained in the "dhcp-ddns" section of the DHCPv4 server
are contained in the "dhcp-ddns" section of the b10-dhcp4 server
configuration. The default values for this section appears as follows:
<screen>
&gt; <userinput>config show Dhcp4/dhcp-ddns</userinput>
@@ -3049,7 +3049,7 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
</screen>
</para>
<para>
The "enable-updates" parameter determines whether or not DHCPv4 will
The "enable-updates" parameter determines whether or not b10-dhcp4 will
generate NCRs. By default, this value is false hence DDNS updates are
disabled. To enable DDNS updates set this value to true:
</para>
@@ -3060,28 +3060,27 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
<section id="dhcpv4-d2-io-config">
<title>DHCP-DDNS Server Connectivity</title>
<para>
In order for NCRs to reach the D2 server, DHCPv4 must be able
to communicate with it. DHCPv4 uses the following configuration
In order for NCRs to reach the D2 server, b10-dhcp4 must be able
to communicate with it. b10-dhcp4 uses the following configuration
parameters to control how it communications with D2:
<orderedlist>
<listitem><para>
server-ip - IP address on which D2 listens for requests. The default is
the local loopback interface at address 127.0.0.1. (You may specifiy
either an IPv4 or IPv6 address.)
or IPv6 address.)
</para></listitem>
<listitem><para>
server-port - port on which D2 listens for requests. The default value
is 53001.
</para></listitem>
<listitem><para>
sender-ip - IP address which DHCPv4 should use to send requests to D2.
The default value is blank which instructs DHCPv4 to select a suitable
sender-ip - IP address which b10-dhcp4 should use to send requests to D2.
The default value is blank which instructs b10-dhcp4 to select a suitable
address.
</para></listitem>
<listitem><para>
sender-port - port which DHCPv4 should use to send requests to D2. The
default value of 0 instructs DHCPv4 to select suitable port.
sender-port - port which b10-dhcp4 should use to send requests to D2. The
default value of 0 instructs b10-dhcp4 to select suitable port.
</para></listitem>
<listitem><para>
ncr-format - Socket protocol use when sending requests to D2. Currently
@@ -3098,11 +3097,11 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
uncontrollably if they are being generated faster than they can be
delivered. If the number of requests queued for transmission reaches
this value, DDNS updating will be turned off until the queue backlog has
been sufficiently reduced. The intent is allow the DHCPv4 server to
been sufficiently reduced. The intent is allow the b10-dhcp4 server to
continue lease operations. The default value is 1024.
</para></listitem>
</orderedlist>
By default, D2 is assumed to running on the same machine as DHCPv4, and
By default, D2 is assumed to running on the same machine as b10-dhcp4, and
all of the default values mentioned above should be sufficient.
If, however, D2 has been configured to listen on a different address or
port, these values must altered accordingly. For example, if D2 has been
@@ -3116,19 +3115,19 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
</para>
</section>
<section id="dhcpv4-d2-rules-config">
<title>When does the DHCPv4 server generate DDNS requests?</title>
DHCPv4 follows the behavior prescribed for DHCP servers in RFC 4702.
It is important to keep in mind that DHCPv4 provides the initial decision
<title>When does the b10-dhcp4 server generate DDNS requests?</title>
b10-dhcp4 follows the behavior prescribed for DHCP servers in RFC 4702.
It is important to keep in mind that b10-dhcp4 provides the initial decision
making of when and what to update and forwards that information to D2 in
the form of NCRs. Carrying out the actual DNS updates and dealing with
such things as conflict resolution are the purview of D2 (<xref linkend="dhcp-ddns-server"/>).
<para>
This section describes when DHCPv4 will generate NCRs and the
This section describes when b10-dhcp4 will generate NCRs and the
configuration parameters that can be used to influence this decision.
It assumes that the "enable-updates" parameter is true.
</para>
<para>
In general, DHCPv4 will generate DDNS update requests when:
In general, b10-dhcp4 will generate DDNS update requests when:
<orderedlist>
<listitem><para>
A new lease is granted in response to a DHCP REQUEST
@@ -3149,10 +3148,10 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
involved and is discussed next.
</para>
<para>
When a new lease is granted, the DHCPv4 server will generate a DDNS
When a new lease is granted, b10-dhcp4 will generate a DDNS
update request if the DHCP REQUEST contains either the FQDN option
(code 81) or the Host Name option (code 12). If both are present,
the server will use the FQDN option. By default the DHCPv4 server
the server will use the FQDN option. By default b10-dhcp4
will respect the FQDN N and S flags specified by the client as shown
in the following table:
</para>
@@ -3198,11 +3197,11 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
<para>
The first row in the table above represents "client delegation". Here
the DHCP client states that it intends to do the forward DNS updates and
the server should do the reverse updates. By default, DHCPv4 will honor
the server should do the reverse updates. By default, b10-dhcp4 will honor
the client's wishes and generate a DDNS request to D2 to update only
reverse DNS data. The parameter, "override-client-update", can be used
to instruct the server to override client delegation requests. When
this parameter is true, DHCPv4 will disregard requests for client
this parameter is true, b10-dhcp4 will disregard requests for client
delegation and generate a DDNS request to update both forward and
reverse DNS data. In this case, the N-S-O flags in the server's
response to the client will be 0-1-1 respectively.
@@ -3210,7 +3209,7 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
<para>
(Note that the flag combination N=1, S=1 is prohibited according to
RFC 4702. If such a combination is received from the client, the packet
will be dropped by the DHCPv4 server.)
will be dropped by the b10-dhcp4.)
</para>
<para>
To override client delegation, issue the following commands:
@@ -3223,7 +3222,7 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
The third row in the table above describes the case in which the client
requests that no DNS updates be done. The parameter, "override-no-update",
can be used to instruct the server to disregard the client's wishes. When
this parameter is true, DHCPv4 will generate DDNS update request to D2
this parameter is true, b10-dhcp4 will generate DDNS update request to D2
even if the client requests no updates be done. The N-S-O flags in the
server's response to the client will be 0-1-1.
</para>
@@ -3235,7 +3234,7 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
&gt; <userinput>config commit</userinput>
</screen>
<para>
DHCPv4 will always generate DDNS update requests if the client request
b10-dhcp4 will always generate DDNS update requests if the client request
only contains the Host Name option. In addition it will include an FQDN
option in the response to the client with the FQDN N-S-O flags set to
0-1-0 respectively. The domain name portion of the FQDN option will be
@@ -3243,9 +3242,9 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
</para>
</section>
<section id="dhcpv4-fqdn-name-generation">
<title>DHCPv4 name generation for DDNS update requests</title>
<title>b10-dhcp4 name generation for DDNS update requests</title>
Each NameChangeRequest must of course include the fully qualified domain
name whose DNS entries are to be affected. DHCPv4 can be configured to
name whose DNS entries are to be affected. b10-dhcp4 can be configured to
supply a portion or all of that name based upon what it receives from
the client in the DHCP REQUEST.
<para>
@@ -3274,7 +3273,7 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
</orderedlist>
</para></listitem>
</orderedlist>
To instruct DHCPv4 to always generate the FQDN for a client, set the
To instruct b10-dhcp4 to always generate the FQDN for a client, set the
parameter "replace-client-name" to true as follows:
</para>
<screen>
@@ -3302,7 +3301,7 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
</screen>
</section>
<para>
When generating a name, DHCPv4 will construct name of the format:
When generating a name, b10-dhcp4 will construct name of the format:
</para>
<para>
[generated-prefix]-[address-text].[qualifying-suffix].
@@ -3318,7 +3317,7 @@ Dhcp4/dhcp-ddns/qualifying-suffix "example.com" string
</para>
</section>
</section> <!-- end of configuring DHCPv4 server section with many subsections -->
</section> <!-- end of configuring b10-dhcp4 server section with many subsections -->
<section id="dhcp4-serverid">
<title>Server Identifier in DHCPv4</title>
@@ -4599,7 +4598,7 @@ should include options from the isc option space:
<section id="dhcp6-ddns-config">
<title>Configuring DHCPv6 for DDNS</title>
<para>
As mentioned earlier, DHCPv6 can be configured to generate requests to
As mentioned earlier, b10-dhcp6 can be configured to generate requests to
the DHCP-DDNS server (referred to here as the "D2" server) to update
DNS entries. These requests are known as NameChangeRequests or NCRs.
Each NCR contains the following information:
@@ -4616,7 +4615,7 @@ should include options from the isc option space:
</para></listitem>
</orderedlist>
The parameters controlling the generation of NCRs for submission to D2
are contained in the "dhcp-ddns" section of the DHCPv6 server
are contained in the "dhcp-ddns" section of b10-dhcp6
configuration. The default values for this section appears as follows:
<screen>
&gt; <userinput>config show Dhcp6/dhcp-ddns</userinput>
@@ -4636,7 +4635,7 @@ Dhcp6/dhcp-ddns/qualifying-suffix "example.com" string
</screen>
</para>
<para>
The "enable-updates" parameter determines whether or not DHCPv6 will
The "enable-updates" parameter determines whether or not b10-dhcp6 will
generate NCRs. By default, this value is false hence DDNS updates are
disabled. To enable DDNS updates set this value to true as follows:
</para>
@@ -4647,28 +4646,27 @@ Dhcp6/dhcp-ddns/qualifying-suffix "example.com" string
<section id="dhcpv6-d2-io-config">
<title>DHCP-DDNS Server Connectivity</title>
<para>
In order for NCRs to reach the D2 server, DHCPv6 must be able
to communicate with it. DHCPv6 uses the following configuration
In order for NCRs to reach the D2 server, b10-dhcp6 must be able
to communicate with it. b10-dhcp6 uses the following configuration
parameters to control how it communications with D2:
<orderedlist>
<listitem><para>
server-ip - IP address on which D2 listens for requests. The default is
the local loopback interface at address 127.0.0.1. (You may specifiy
either an IPv4 or IPv6 address.)
or IPv6 address.)
</para></listitem>
<listitem><para>
server-port - port on which D2 listens for requests. The default value
is 53001.
</para></listitem>
<listitem><para>
sender-ip - IP address which DHCPv6 should use to send requests to D2.
The default value is blank which instructs DHCPv6 to select a suitable
sender-ip - IP address which b10-dhcp6 should use to send requests to D2.
The default value is blank which instructs b10-dhcp6 to select a suitable
address.
</para></listitem>
<listitem><para>
sender-port - port which DHCPv6 should use to send requests to D2. The
default value of 0 instructs DHCPv6 to select suitable port.
sender-port - port which b10-dhcp6 should use to send requests to D2. The
default value of 0 instructs b10-dhcp6 to select suitable port.
</para></listitem>
<listitem><para>
ncr-format - Socket protocol use when sending requests to D2. Currently
@@ -4685,11 +4683,11 @@ Dhcp6/dhcp-ddns/qualifying-suffix "example.com" string
uncontrollably if they are being generated faster than they can be
delivered. If the number of requests queued for transmission reaches
this value, DDNS updating will be turned off until the queue backlog has
been sufficiently reduced. The intent is allow the DHCPv6 server to
been sufficiently reduced. The intent is allow b10-dhcp6 to
continue lease operations. The default value is 1024.
</para></listitem>
</orderedlist>
By default, D2 is assumed to running on the same machine as DHCPv6, and
By default, D2 is assumed to running on the same machine as b10-dhcp6, and
all of the default values mentioned above should be sufficient.
If, however, D2 has been configured to listen on a different address or
port, these values must altered accordingly. For example, if D2 has been
@@ -4703,28 +4701,28 @@ Dhcp6/dhcp-ddns/qualifying-suffix "example.com" string
</para>
</section>
<section id="dhcpv6-d2-rules-config">
<title>When does DHCPv6 generate DDNS request</title>
DHCPv6 follows the behavior prescribed for DHCP servers in RFC 4704.
It is important to keep in mind that DHCPv6 provides the initial decision
<title>When does b10-dhcp6 generate DDNS request</title>
b10-dhcp6 follows the behavior prescribed for DHCP servers in RFC 4704.
It is important to keep in mind that b10-dhcp6 provides the initial decision
making of when and what to update and forwards that information to D2 in
the form of NCRs. Carrying out the actual DNS updates and dealing with
such things as conflict resolution are the purview of D2 (<xref linkend="dhcp-ddns-server"/>).
<para>
This section describes when DHCPv6 will generate NCRs and the
This section describes when b10-dhcp6 will generate NCRs and the
configuration parameters that can be used to influence this decision.
It assumes that the "enable-updates" parameter is true.
</para>
<note>
<para>
Currently the interface between DHCPv6 and D2 only supports requests
Currently the interface between b10-dhcp6 and D2 only supports requests
which update DNS entries for a single IP address. If a lease grants
more than one address, DHCPv6 will create the DDNS update request for
more than one address, b10-dhcp6 will create the DDNS update request for
only the first of these addresses. Support for multiple address
mappings may be provided in a future release.
</para>
</note>
<para>
In general, DHCPv6 will generate DDNS update requests when:
In general, b10-dhcp6 will generate DDNS update requests when:
<orderedlist>
<listitem><para>
A new lease is granted in response to a DHCP REQUEST
@@ -4745,8 +4743,8 @@ Dhcp6/dhcp-ddns/qualifying-suffix "example.com" string
discussed next.
</para>
<para>
DHCPv6 will generate a DDNS update request only if the DHCP REQUEST
contains the FQDN option (code 39). By default the DHCPv6 server will
b10-dhcp6 will generate a DDNS update request only if the DHCP REQUEST
contains the FQDN option (code 39). By default b10-dhcp6 will
respect the FQDN N and S flags specified by the client as shown in the
following table:
</para>
@@ -4792,11 +4790,11 @@ Dhcp6/dhcp-ddns/qualifying-suffix "example.com" string
<para>
The first row in the table above represents "client delegation". Here
the DHCP client states that it intends to do the forward DNS updates and
the server should do the reverse updates. By default, DHCPv6 will honor
the server should do the reverse updates. By default, b10-dhcp6 will honor
the client's wishes and generate a DDNS request to D2 to update only
reverse DNS data. The parameter, "override-client-update", can be used
to instruct the server to override client delegation requests. When
this parameter is true, DHCPv6 will disregard requests for client
this parameter is true, b10-dhcp6 will disregard requests for client
delegation and generate a DDNS request to update both forward and
reverse DNS data. In this case, the N-S-O flags in the server's
response to the client will be 0-1-1 respectively.
@@ -4804,7 +4802,7 @@ Dhcp6/dhcp-ddns/qualifying-suffix "example.com" string
<para>
(Note that the flag combination N=1, S=1 is prohibited according to
RFC 4702. If such a combination is received from the client, the packet
will be dropped by the DHCPv6 server.)
will be dropped by b10-dhcp6.)
</para>
<para>
To override client delegation, issue the following commands:
@@ -4817,7 +4815,7 @@ Dhcp6/dhcp-ddns/qualifying-suffix "example.com" string
The third row in the table above describes the case in which the client
requests that no DNS updates be done. The parameter, "override-no-update",
can be used to instruct the server to disregard the client's wishes. When
this parameter is true, DHCPv6 will generate DDNS update request to D2
this parameter is true, b10-dhcp6 will generate DDNS update request to D2
even if the client requests no updates be done. The N-S-O flags in the
server's response to the client will be 0-1-1.
</para>
@@ -4830,9 +4828,9 @@ Dhcp6/dhcp-ddns/qualifying-suffix "example.com" string
</screen>
</section>
<section id="dhcpv6-fqdn-name-generation">
<title>DHCPv6 name generation for DDNS update requests</title>
<title>b10-dhcp6 name generation for DDNS update requests</title>
Each NameChangeRequest must of course include the fully qualified domain
name whose DNS entries are to be affected. DHCPv6 can be configured to
name whose DNS entries are to be affected. b10-dhcp6 can be configured to
supply a portion or all of that name based upon what it receives from
the client in the DHCP REQUEST.
<para>
@@ -4860,7 +4858,7 @@ Dhcp6/dhcp-ddns/qualifying-suffix "example.com" string
</orderedlist>
</para></listitem>
</orderedlist>
To instruct DHCPv6 to always generate a FQDN, set the parameter
To instruct b10-dhcp6 to always generate a FQDN, set the parameter
"replace-client-name" to true:
</para>
<screen>
@@ -4888,7 +4886,7 @@ Dhcp6/dhcp-ddns/qualifying-suffix "example.com" string
</screen>
</section>
<para>
When qualifying a partial name, DHCPv6 will construct a name with the
When qualifying a partial name, b10-dhcp6 will construct a name with the
format:
</para>
<para>
@@ -4903,7 +4901,7 @@ Dhcp6/dhcp-ddns/qualifying-suffix "example.com" string
some-computer.example.com.
</para>
<para>
When generating a the entire name, DHCPv6 will construct name of the
When generating a the entire name, b10-dhcp6 will construct name of the
format:
</para>
<para>
@@ -5133,9 +5131,9 @@ Dhcp6/renew-timer 1000 integer (default)
<chapter id="dhcp-ddns-server">
<title>The DHCP-DDNS Server</title>
<para>
The DHCP-DDNS Server (known informally as D2) conducts the client side of
The DHCP-DDNS Server (b10-dhcp-ddns, known informally as D2) conducts the client side of
the DDNS protocol (defined in RFC 2136) on behalf of the DHCPv4 and DHCPv6
servers. The DHCP servers construct
servers (b10-dhcp4 and b10-dhcp6 respectively). The DHCP servers construct
DDNS update requests, known as NameChangeRequests (NCRs), based upon DHCP
lease change events and then post these to D2. D2 attempts to match
each such request to the appropriate DNS server(s) and carry out the

View File

@@ -88,9 +88,11 @@ Dhcp4SrvD2Test::reset() {
void
Dhcp4SrvD2Test::configureD2(bool enable_d2, const bool exp_result,
const std::string& ip_address,
const uint32_t port,
const uint32_t sender_port) {
const std::string& server_ip,
const size_t port,
const std::string& sender_ip,
const size_t sender_port,
const size_t max_queue_size) {
std::ostringstream config;
config <<
"{ \"interfaces\": [ \"*\" ],"
@@ -101,9 +103,11 @@ Dhcp4SrvD2Test::configureD2(bool enable_d2, const bool exp_result,
" \"subnet\": \"192.0.2.0/24\" } ],"
" \"dhcp-ddns\" : {"
" \"enable-updates\" : " << (enable_d2 ? "true" : "false") << ", "
" \"server-ip\" : \"" << ip_address << "\", "
" \"server-ip\" : \"" << server_ip << "\", "
" \"server-port\" : " << port << ", "
" \"sender-ip\" : \"" << sender_ip << "\", "
" \"sender-port\" : " << sender_port << ", "
" \"max-queue-size\" : " << max_queue_size << ", "
" \"ncr-protocol\" : \"UDP\", "
" \"ncr-format\" : \"JSON\", "
" \"always-include-fqdn\" : true, "
@@ -167,10 +171,10 @@ TEST_F(Dhcp4SrvD2Test, enableDisable) {
ASSERT_FALSE(mgr.amSending());
}
// Tests Dhcp4 server's ability to correctly handle a flawed dhcp-ddns configuration.
// It does so by first enabling updates by submitting a valid configuration and then
// ensuring they remain on after submitting a flawed configuration.
// and then invoking its startD2() method.
// Tests Dhcp4 server's ability to correctly handle a flawed dhcp-ddns
// configuration. It does so by first enabling updates by submitting a valid
// configuration and then ensuring they remain on after submitting a flawed
// configuration and then invoking its startD2() method.
TEST_F(Dhcp4SrvD2Test, badConfig) {
// Grab the manager and verify that be default ddns is off
// and a sender was not started.
@@ -297,7 +301,8 @@ TEST_F(Dhcp4SrvD2Test, forceUDPSendFailure) {
// Using server address of 0.0.0.0/0 should induce failure on send.
// Pass in a non-zero sender port to avoid validation error when
// server-ip/port are same as sender-ip/port
ASSERT_NO_FATAL_FAILURE(configureD2(true, SHOULD_PASS, "0.0.0.0", 0, 53001));
ASSERT_NO_FATAL_FAILURE(configureD2(true, SHOULD_PASS, "0.0.0.0", 0,
"0.0.0.0", 53001));
ASSERT_TRUE(mgr.ddnsEnabled());
ASSERT_NO_THROW(srv_.startD2());
ASSERT_TRUE(mgr.amSending());

View File

@@ -77,13 +77,17 @@ public:
///
/// @param enable_updates value to assign to the enable-updates parameter
/// @param exp_result indicates if configuration should pass or fail
/// @param ip_address IP address for the D2 server
/// @param server_ip IP address for the D2 server
/// @param port port for the D2 server
/// @param sender_ip NCR sender's IP address
/// @param sender_port NCR sender port
/// @param max_queue_size maximum number of NCRs allowed in sender's queue
void configureD2(bool enable_updates, bool exp_result = SHOULD_PASS,
const std::string& ip_address = "127.0.0.1",
const uint32_t port = 53001,
const uint32_t sender_port = 0);
const std::string& server_ip = "127.0.0.1",
const size_t port = 53001,
const std::string& sender_ip = "0.0.0.0",
const size_t sender_port = 0,
const size_t max_queue_size = 1024);
/// @brief Configures the server with the given configuration
///

View File

@@ -90,9 +90,11 @@ Dhcp6SrvD2Test::reset() {
void
Dhcp6SrvD2Test::configureD2(bool enable_d2, const bool exp_result,
const std::string& ip_address,
const uint32_t port,
const uint32_t sender_port) {
const std::string& server_ip,
const size_t port,
const std::string& sender_ip,
const size_t sender_port,
const size_t max_queue_size) {
std::ostringstream config;
config <<
"{ \"interfaces\": [ \"*\" ],"
@@ -105,9 +107,11 @@ Dhcp6SrvD2Test::configureD2(bool enable_d2, const bool exp_result,
" \"subnet\": \"2001:db8:1::/64\" } ],"
" \"dhcp-ddns\" : {"
" \"enable-updates\" : " << (enable_d2 ? "true" : "false") << ", "
" \"server-ip\" : \"" << ip_address << "\", "
" \"server-ip\" : \"" << server_ip << "\", "
" \"server-port\" : " << port << ", "
" \"sender-ip\" : \"" << sender_ip << "\", "
" \"sender-port\" : " << sender_port << ", "
" \"max-queue-size\" : " << max_queue_size << ", "
" \"ncr-protocol\" : \"UDP\", "
" \"ncr-format\" : \"JSON\", "
" \"always-include-fqdn\" : true, "
@@ -171,10 +175,10 @@ TEST_F(Dhcp6SrvD2Test, enableDisable) {
ASSERT_FALSE(mgr.amSending());
}
// Tests Dhcp6 server's ability to correctly handle a flawed dhcp-ddns configuration.
// It does so by first enabling updates by submitting a valid configuration and then
// ensuring they remain on after submitting a flawed configuration.
// and then invoking its startD2() method.
// Tests Dhcp6 server's ability to correctly handle a flawed dhcp-ddns
// configuration. It does so by first enabling updates by submitting a valid
// configuration and then ensuring they remain on after submitting a flawed
// configuration and then invoking its startD2() method.
TEST_F(Dhcp6SrvD2Test, badConfig) {
// Grab the manager and verify that be default ddns is off
// and a sender was not started.
@@ -246,7 +250,7 @@ TEST_F(Dhcp6SrvD2Test, differentConfig) {
ASSERT_TRUE(mgr.amSending());
// Now enable it on a different port.
ASSERT_NO_FATAL_FAILURE(configureD2(true, SHOULD_PASS, "127.0.0.1", 54001));
ASSERT_NO_FATAL_FAILURE(configureD2(true, SHOULD_PASS, "::1", 54001));
// Configuration was altered, so ddns should still enabled but not sending.
ASSERT_TRUE(mgr.ddnsEnabled());
@@ -301,7 +305,8 @@ TEST_F(Dhcp6SrvD2Test, forceUDPSendFailure) {
// Using server address of 0.0.0.0/0 should induce failure on send.
// Pass in a non-zero sender port to avoid validation error when
// server-ip/port are same as sender-ip/port
ASSERT_NO_FATAL_FAILURE(configureD2(true, SHOULD_PASS, "0.0.0.0", 0, 53001));
ASSERT_NO_FATAL_FAILURE(configureD2(true, SHOULD_PASS, "::", 0,
"::", 53001));
ASSERT_TRUE(mgr.ddnsEnabled());
ASSERT_NO_THROW(srv_.startD2());
ASSERT_TRUE(mgr.amSending());

View File

@@ -76,14 +76,17 @@ public:
/// parameters given and passes it into the server's configuration handler.
///
/// @param enable_updates value to assign to the enable-updates parameter
/// @param exp_result indicates if configuration should pass or fail
/// @param ip_address IP address for the D2 server
/// @param server_ip IP address for the D2 server
/// @param port port for the D2 server
/// @param sender_ip NCR sender's IP address
/// @param sender_port NCR sender port
/// @param max_queue_size maximum number of NCRs allowed in sender's queue
void configureD2(bool enable_updates, bool exp_result = SHOULD_PASS,
const std::string& ip_address = "127.0.0.1",
const uint32_t port = 53001,
const uint32_t sender_port = 0);
const std::string& server_ip = "::1",
const size_t port = 53001,
const std::string& sender_ip = "::",
const size_t sender_port = 0,
const size_t max_queue_size = 1024);
/// @brief Configures the server with the given configuration
///

View File

@@ -55,19 +55,19 @@ D2ClientConfig::D2ClientConfig(const bool enable_updates,
const std::string& generated_prefix,
const std::string& qualifying_suffix)
: enable_updates_(enable_updates),
server_ip_(server_ip),
server_port_(server_port),
sender_ip_(sender_ip),
sender_port_(sender_port),
max_queue_size_(max_queue_size),
ncr_protocol_(ncr_protocol),
ncr_format_(ncr_format),
always_include_fqdn_(always_include_fqdn),
override_no_update_(override_no_update),
override_client_update_(override_client_update),
replace_client_name_(replace_client_name),
generated_prefix_(generated_prefix),
qualifying_suffix_(qualifying_suffix) {
server_ip_(server_ip),
server_port_(server_port),
sender_ip_(sender_ip),
sender_port_(sender_port),
max_queue_size_(max_queue_size),
ncr_protocol_(ncr_protocol),
ncr_format_(ncr_format),
always_include_fqdn_(always_include_fqdn),
override_no_update_(override_no_update),
override_client_update_(override_client_update),
replace_client_name_(replace_client_name),
generated_prefix_(generated_prefix),
qualifying_suffix_(qualifying_suffix) {
validateContents();
}
@@ -75,17 +75,17 @@ D2ClientConfig::D2ClientConfig()
: enable_updates_(false),
server_ip_(isc::asiolink::IOAddress(DFT_SERVER_IP)),
server_port_(DFT_SERVER_PORT),
sender_ip_(isc::asiolink::IOAddress("0.0.0.0")),
sender_port_(0),
max_queue_size_(0),
ncr_protocol_(dhcp_ddns::NCR_UDP),
ncr_format_(dhcp_ddns::FMT_JSON),
always_include_fqdn_(false),
override_no_update_(false),
override_client_update_(false),
replace_client_name_(false),
generated_prefix_("myhost"),
qualifying_suffix_("example.com") {
sender_ip_(isc::asiolink::IOAddress(DFT_V4_SENDER_IP)),
sender_port_(DFT_SENDER_PORT),
max_queue_size_(DFT_MAX_QUEUE_SIZE),
ncr_protocol_(dhcp_ddns::stringToNcrProtocol(DFT_NCR_PROTOCOL)),
ncr_format_(dhcp_ddns::stringToNcrFormat(DFT_NCR_FORMAT)),
always_include_fqdn_(DFT_ALWAYS_INCLUDE_FQDN),
override_no_update_(DFT_OVERRIDE_NO_UPDATE),
override_client_update_(DFT_OVERRIDE_CLIENT_UPDATE),
replace_client_name_(DFT_REPLACE_CLIENT_NAME),
generated_prefix_(DFT_GENERATED_PREFIX),
qualifying_suffix_(DFT_QUALIFYING_SUFFIX) {
validateContents();
}