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
450
Issues
450
List
Boards
Labels
Service Desk
Milestones
Merge Requests
75
Merge Requests
75
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
bfaf5c81
Commit
bfaf5c81
authored
Sep 01, 2017
by
Marcin Siodelski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[5305] Added shared-networks configuration to server config.
parent
1328552a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
1 deletion
+40
-1
src/lib/dhcpsrv/srv_config.cc
src/lib/dhcpsrv/srv_config.cc
+13
-1
src/lib/dhcpsrv/srv_config.h
src/lib/dhcpsrv/srv_config.h
+25
-0
src/lib/dhcpsrv/tests/srv_config_unittest.cc
src/lib/dhcpsrv/tests/srv_config_unittest.cc
+2
-0
No files found.
src/lib/dhcpsrv/srv_config.cc
View file @
bfaf5c81
...
...
@@ -25,6 +25,8 @@ SrvConfig::SrvConfig()
:
sequence_
(
0
),
cfg_iface_
(
new
CfgIface
()),
cfg_option_def_
(
new
CfgOptionDef
()),
cfg_option_
(
new
CfgOption
()),
cfg_subnets4_
(
new
CfgSubnets4
()),
cfg_subnets6_
(
new
CfgSubnets6
()),
cfg_shared_networks4_
(
new
CfgSharedNetworks4
()),
cfg_shared_networks6_
(
new
CfgSharedNetworks6
()),
cfg_hosts_
(
new
CfgHosts
()),
cfg_rsoo_
(
new
CfgRSOO
()),
cfg_expiration_
(
new
CfgExpiration
()),
cfg_duid_
(
new
CfgDUID
()),
cfg_db_access_
(
new
CfgDbAccess
()),
...
...
@@ -39,6 +41,8 @@ SrvConfig::SrvConfig(const uint32_t sequence)
:
sequence_
(
sequence
),
cfg_iface_
(
new
CfgIface
()),
cfg_option_def_
(
new
CfgOptionDef
()),
cfg_option_
(
new
CfgOption
()),
cfg_subnets4_
(
new
CfgSubnets4
()),
cfg_subnets6_
(
new
CfgSubnets6
()),
cfg_shared_networks4_
(
new
CfgSharedNetworks4
()),
cfg_shared_networks6_
(
new
CfgSharedNetworks6
()),
cfg_hosts_
(
new
CfgHosts
()),
cfg_rsoo_
(
new
CfgRSOO
()),
cfg_expiration_
(
new
CfgExpiration
()),
cfg_duid_
(
new
CfgDUID
()),
cfg_db_access_
(
new
CfgDbAccess
()),
...
...
@@ -228,14 +232,22 @@ SrvConfig::toElement() const {
dhcp
->
set
(
"option-def"
,
cfg_option_def_
->
toElement
());
// Set option-data
dhcp
->
set
(
"option-data"
,
cfg_option_
->
toElement
());
// Set subnets
// Set subnets and shared networks.
ConstElementPtr
subnets
;
if
(
family
==
AF_INET
)
{
subnets
=
cfg_subnets4_
->
toElement
();
dhcp
->
set
(
"subnet4"
,
subnets
);
ConstElementPtr
shared_networks
=
cfg_shared_networks4_
->
toElement
();
dhcp
->
set
(
"shared-networks"
,
shared_networks
);
}
else
{
subnets
=
cfg_subnets6_
->
toElement
();
dhcp
->
set
(
"subnet6"
,
subnets
);
ConstElementPtr
shared_networks
=
cfg_shared_networks6_
->
toElement
();
dhcp
->
set
(
"shared-networks"
,
shared_networks
);
}
// Insert reservations
CfgHostsList
resv_list
;
...
...
src/lib/dhcpsrv/srv_config.h
View file @
bfaf5c81
...
...
@@ -17,6 +17,7 @@
#include <dhcpsrv/cfg_option.h>
#include <dhcpsrv/cfg_option_def.h>
#include <dhcpsrv/cfg_rsoo.h>
#include <dhcpsrv/cfg_shared_networks.h>
#include <dhcpsrv/cfg_subnets4.h>
#include <dhcpsrv/cfg_subnets6.h>
#include <dhcpsrv/cfg_mac_source.h>
...
...
@@ -201,6 +202,24 @@ public:
return
(
cfg_subnets4_
);
}
/// @brief Returns pointer to non-const object holding configuration of
/// shared networks in DHCPv4;
///
/// @return Pointer to the object holding shared networks configuration
/// for DHCPv4.
CfgSharedNetworks4Ptr
getCfgSharedNetworks4
()
const
{
return
(
cfg_shared_networks4_
);
}
/// @brief Returns pointer to non-const object holding configuration of
/// shared networks in DHCPv6.
///
/// @return Pointer to the object holding shared networks configuration
/// for DHCPv6.
CfgSharedNetworks6Ptr
getCfgSharedNetworks6
()
const
{
return
(
cfg_shared_networks6_
);
}
/// @brief Returns pointer to const object holding subnets configuration for
/// DHCPv4.
///
...
...
@@ -573,6 +592,12 @@ private:
/// @brief Pointer to subnets configuration for IPv6.
CfgSubnets6Ptr
cfg_subnets6_
;
/// @brief Pointer to IPv4 shared networks configuration.
CfgSharedNetworks4Ptr
cfg_shared_networks4_
;
/// @brief Pointer to IPv4 shared networks configuration.
CfgSharedNetworks6Ptr
cfg_shared_networks6_
;
/// @brief Pointer to the configuration for hosts reservation.
///
/// This object holds a list of @c Host objects representing host
...
...
src/lib/dhcpsrv/tests/srv_config_unittest.cc
View file @
bfaf5c81
...
...
@@ -448,11 +448,13 @@ TEST_F(SrvConfigTest, unparse) {
defaults
+=
conf
.
getD2ClientConfig
()
->
toElement
()
->
str
()
+
",
\n
"
;
std
::
string
defaults4
=
"
\"
echo-client-id
\"
: true,
\n
"
;
defaults4
+=
"
\"
shared-networks
\"
: [ ],
\n
"
;
defaults4
+=
"
\"
subnet4
\"
: [ ],
\n
"
;
defaults4
+=
"
\"
host-reservation-identifiers
\"
: "
;
defaults4
+=
"[
\"
hw-address
\"
,
\"
duid
\"
,
\"
circuit-id
\"
,
\"
client-id
\"
],
\n
"
;
std
::
string
defaults6
=
"
\"
relay-supplied-options
\"
: [
\"
65
\"
],
\n
"
;
defaults6
+=
"
\"
shared-networks
\"
: [ ],
\n
"
;
defaults6
+=
"
\"
subnet6
\"
: [ ],
\n
"
;
defaults6
+=
"
\"
server-id
\"
: "
;
defaults6
+=
conf
.
getCfgDUID
()
->
toElement
()
->
str
()
+
",
\n
"
;
...
...
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