Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
445
Issues
445
List
Boards
Labels
Service Desk
Milestones
Merge Requests
71
Merge Requests
71
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
Kea
Commits
fe611daf
Commit
fe611daf
authored
Jan 12, 2017
by
Francis Dupont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[5033] Various fixes mostly cosmetic
parent
ee50101f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
32 deletions
+30
-32
doc/examples/kea6/with-ddns.json
doc/examples/kea6/with-ddns.json
+3
-2
src/lib/dhcpsrv/parsers/dhcp_parsers.cc
src/lib/dhcpsrv/parsers/dhcp_parsers.cc
+8
-8
src/lib/dhcpsrv/parsers/dhcp_parsers.h
src/lib/dhcpsrv/parsers/dhcp_parsers.h
+4
-8
src/lib/dhcpsrv/srv_config.h
src/lib/dhcpsrv/srv_config.h
+1
-1
src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
+4
-11
src/lib/dhcpsrv/tests/srv_config_unittest.cc
src/lib/dhcpsrv/tests/srv_config_unittest.cc
+3
-1
src/lib/dhcpsrv/testutils/config_result_check.cc
src/lib/dhcpsrv/testutils/config_result_check.cc
+7
-1
No files found.
doc/examples/kea6/with-ddns.json
View file @
fe611daf
...
...
@@ -39,8 +39,9 @@
"subnet"
:
"2001:db8:1::/64"
,
"interface"
:
"ethX"
}
]
]
,
#
Enable
dynamic
DNS
updates
"dhcp-ddns"
:
{
"enable-updates"
:
true
,
"server-ip"
:
"3001::1"
,
...
...
@@ -56,7 +57,7 @@
"replace-client-name"
:
"when-present"
,
"generated-prefix"
:
"test.prefix"
,
"qualifying-suffix"
:
"test.suffix."
}
,
}
},
...
...
src/lib/dhcpsrv/parsers/dhcp_parsers.cc
View file @
fe611daf
...
...
@@ -1335,7 +1335,7 @@ D2ClientConfigParser::parse(isc::data::ConstElementPtr client_config) {
qualifying_suffix
=
getString
(
client_config
,
current_param
);
}
catch
(
const
std
::
exception
&
ex
)
{
isc_throw
(
D2ClientError
,
"D2ClientConfig error: "
<<
ex
.
what
()
<<
" "
<<
getPosition
(
current_param
,
client_config
)
);
<<
" ("
<<
getPosition
(
current_param
,
client_config
)
<<
")"
);
}
// Now we check for logical errors. This repeats what is done in
...
...
@@ -1343,16 +1343,16 @@ D2ClientConfigParser::parse(isc::data::ConstElementPtr client_config) {
// emit meaningful parameter position info in the error.
if
(
ncr_format
!=
dhcp_ddns
::
FMT_JSON
)
{
isc_throw
(
D2ClientError
,
"D2ClientConfig error: NCR Format: "
<<
dhcp_ddns
::
ncrFormatToString
(
ncr_format
)
<<
" is not supported.
"
<<
" "
<<
getPosition
(
"ncr-format"
,
client_config
)
);
<<
dhcp_ddns
::
ncrFormatToString
(
ncr_format
)
<<
" is not supported. (
"
<<
getPosition
(
"ncr-format"
,
client_config
)
<<
")"
);
}
if
(
ncr_protocol
!=
dhcp_ddns
::
NCR_UDP
)
{
isc_throw
(
D2ClientError
,
"D2ClientConfig error: NCR Protocol: "
<<
dhcp_ddns
::
ncrProtocolToString
(
ncr_protocol
)
<<
" is not supported."
<<
" "
<<
getPosition
(
"ncr-protocol"
,
client_config
)
);
<<
" is not supported.
(
"
<<
getPosition
(
"ncr-protocol"
,
client_config
)
<<
")"
);
}
if
(
sender_ip
.
getFamily
()
!=
server_ip
.
getFamily
())
{
...
...
@@ -1361,14 +1361,14 @@ D2ClientConfigParser::parse(isc::data::ConstElementPtr client_config) {
<<
" is: "
<<
(
server_ip
.
isV4
()
?
"IPv4"
:
"IPv6"
)
<<
" while sender-ip: "
<<
sender_ip
.
toText
()
<<
" is: "
<<
(
sender_ip
.
isV4
()
?
"IPv4"
:
"IPv6"
)
<<
"
"
<<
getPosition
(
"sender-ip"
,
client_config
)
);
<<
"
("
<<
getPosition
(
"sender-ip"
,
client_config
)
<<
")"
);
}
if
(
server_ip
==
sender_ip
&&
server_port
==
sender_port
)
{
isc_throw
(
D2ClientError
,
"D2ClientConfig error: server and sender cannot"
" share the exact same IP address/port: "
<<
server_ip
.
toText
()
<<
"/"
<<
server_port
<<
"
"
<<
getPosition
(
"sender-ip"
,
client_config
)
);
<<
"
("
<<
getPosition
(
"sender-ip"
,
client_config
)
<<
")"
);
}
try
{
...
...
src/lib/dhcpsrv/parsers/dhcp_parsers.h
View file @
fe611daf
...
...
@@ -1024,16 +1024,10 @@ protected:
/// @brief Parser for D2ClientConfig
///
/// This class parses the configuration element "dhcp-ddns" common to the
///
spec
files for both dhcp4 and dhcp6. It creates an instance of a
///
config
files for both dhcp4 and dhcp6. It creates an instance of a
/// D2ClientConfig.
class
D2ClientConfigParser
:
public
isc
::
data
::
SimpleParser
{
public:
/// @brief Constructor
///
D2ClientConfigParser
(){};
/// @brief Destructor
virtual
~
D2ClientConfigParser
(){};
/// @brief Parses a given dhcp-ddns element into D2ClientConfig.
///
...
...
@@ -1045,9 +1039,11 @@ public:
/// -# qualifying-suffix
/// -# server-ip
/// -# server-port
/// -# sender-ip
/// -# sender-port
/// -# max-queue-size
/// -# ncr-protocol
/// -# ncr-format
/// -# remove-on-renew
/// -# always-include-fqdn
/// -# allow-client-update
/// -# override-no-update
...
...
src/lib/dhcpsrv/srv_config.h
View file @
fe611daf
...
...
@@ -482,7 +482,7 @@ public:
/// @brief Returns DHCP4o6 IPC port
///
/// See @ref setDhcp4o6Port or brief discussion.
/// See @ref setDhcp4o6Port
f
or brief discussion.
/// @return value of DHCP4o6 IPC port
uint32_t
getDhcp4o6Port
()
{
return
(
dhcp4o6_port_
);
...
...
src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
View file @
fe611daf
...
...
@@ -458,17 +458,10 @@ public:
ConstElementPtr
d2_client
=
global
->
get
(
"dhcp-ddns"
);
/// @todo - what if it's not in global? should we add it?
if
(
d2_client
)
{
// Because "dhcp-ddns" is a MapElement and global->get()
// returns a ConstElementPtr, then we get a map we can't
// change. So go thru gyrations to create a non-const
// map, update it with default values and then replace
// the one in global with the new one. Ick.
std
::
map
<
std
::
string
,
ConstElementPtr
>
d2_map
;
d2_client
->
getValue
(
d2_map
);
ElementPtr
new_map
(
new
MapElement
());
new_map
->
setValue
(
d2_map
);
cnt
+=
SimpleParser
::
setDefaults
(
new_map
,
d2_client_defaults
);
global
->
set
(
"dhcp-ddns"
,
new_map
);
// Get the mutable form of d2 client config
ElementPtr
mutable_d2
=
boost
::
const_pointer_cast
<
Element
>
(
d2_client
);
cnt
+=
SimpleParser
::
setDefaults
(
mutable_d2
,
d2_client_defaults
);
}
...
...
src/lib/dhcpsrv/tests/srv_config_unittest.cc
View file @
fe611daf
...
...
@@ -141,7 +141,9 @@ SrvConfigTest::addSubnet6(const unsigned int index) {
void
SrvConfigTest
::
enableDDNS
(
const
bool
enable
)
{
conf_
.
getD2ClientConfig
()
->
enableUpdates
(
enable
);
const
D2ClientConfigPtr
&
d2_config
=
conf_
.
getD2ClientConfig
();
ASSERT_TRUE
(
d2_config
);
d2_config
->
enableUpdates
(
enable
);
}
// Check that by default there are no logging entries
...
...
src/lib/dhcpsrv/testutils/config_result_check.cc
View file @
fe611daf
// Copyright (C) 2014-201
7
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2014-201
5
Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
...
...
@@ -67,6 +67,12 @@ bool errorContainsPosition(ConstElementPtr error_element,
++
i
;
}
// Make sure that there has been at least one digit and that the
// position is followed by the paren.
if
((
i
==
0
)
||
(
split_pos
[
2
][
i
]
!=
')'
))
{
return
(
false
);
}
// All checks passed.
return
(
true
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment