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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
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
Adam Osuchowski
Kea
Commits
71d40d82
Commit
71d40d82
authored
Aug 02, 2017
by
Tomek Mrugalski
🛰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[5241] Minor changes after review.
parent
59410c49
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
73 deletions
+69
-73
doc/guide/dhcp4-srv.xml
doc/guide/dhcp4-srv.xml
+1
-1
doc/guide/dhcp6-srv.xml
doc/guide/dhcp6-srv.xml
+1
-1
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
+33
-36
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
+34
-35
No files found.
doc/guide/dhcp4-srv.xml
View file @
71d40d82
...
...
@@ -1007,7 +1007,7 @@ temporarily override a list of interface names and listen on all interfaces.
]
}
</screen>
The effect is the same
than adding
the option code in the
The effect is the same
as if the client added
the option code in the
Parameter Request List option (or its equivalent for vendor
options) so in:
<screen>
...
...
doc/guide/dhcp6-srv.xml
View file @
71d40d82
...
...
@@ -1035,7 +1035,7 @@ temporarily override a list of interface names and listen on all interfaces.
]
}
</screen>
The effect is the same
than adding
the option code in the
The effect is the same
as if the client added
the option code in the
Option Request Option (or its equivalent for vendor options) so in:
<screen>
"Dhcp6": {
...
...
src/bin/dhcp4/tests/dhcp4_srv_unittest.cc
View file @
71d40d82
...
...
@@ -93,8 +93,33 @@ const char* CONFIGS[] = {
"
\"
valid-lifetime
\"
: 4000,"
"
\"
interface
\"
:
\"
eth0
\"
"
" } ],"
"
\"
valid-lifetime
\"
: 4000 }"
};
"
\"
valid-lifetime
\"
: 4000 }"
,
// Configuration 2:
// - 1 subnet, 2 global options (one forced with always-send)
"{"
"
\"
interfaces-config
\"
: {"
"
\"
interfaces
\"
: [
\"
*
\"
] }, "
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
valid-lifetime
\"
: 4000, "
"
\"
subnet4
\"
: [ {"
"
\"
pools
\"
: [ {
\"
pool
\"
:
\"
192.0.2.1 - 192.0.2.100
\"
} ], "
"
\"
subnet
\"
:
\"
192.0.2.0/24
\"
"
" } ], "
"
\"
option-data
\"
: ["
" {"
"
\"
name
\"
:
\"
default-ip-ttl
\"
, "
"
\"
data
\"
:
\"
FF
\"
, "
"
\"
csv-format
\"
: false"
" }, "
" {"
"
\"
name
\"
:
\"
ip-forwarding
\"
, "
"
\"
data
\"
:
\"
false
\"
, "
"
\"
always-send
\"
: true"
" }"
" ]"
"}"
};
// This test verifies that the destination address of the response
// message is set to giaddr, when giaddr is set to non-zero address
...
...
@@ -751,7 +776,7 @@ TEST_F(Dhcpv4SrvTest, discoverEchoClientId) {
CfgMgr
::
instance
().
getStagingCfg
()
->
getCfgSubnets4
()
->
add
(
subnets
->
at
(
0
));
CfgMgr
::
instance
().
getStagingCfg
()
->
setEchoClientId
(
false
);
CfgMgr
::
instance
().
commit
();
offer
=
srv
.
processDiscover
(
dis
);
// Check if we get response at all
...
...
@@ -2175,35 +2200,7 @@ TEST_F(Dhcpv4SrvTest, prlPersistency) {
IfaceMgrTestConfig
test_config
(
true
);
IfaceMgr
::
instance
().
openSockets4
();
NakedDhcpv4Srv
srv
(
0
);
string
config
=
"{
\"
interfaces-config
\"
: {"
"
\"
interfaces
\"
: [
\"
*
\"
] }, "
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
valid-lifetime
\"
: 4000, "
"
\"
subnet4
\"
: [ "
"{
\"
pools
\"
: [ {
\"
pool
\"
:
\"
192.0.2.1 - 192.0.2.100
\"
} ], "
"
\"
subnet
\"
:
\"
192.0.2.0/24
\"
} ], "
"
\"
option-data
\"
: ["
" {
\"
name
\"
:
\"
default-ip-ttl
\"
, "
"
\"
data
\"
:
\"
FF
\"
, "
"
\"
csv-format
\"
: false }, "
" {
\"
name
\"
:
\"
ip-forwarding
\"
, "
"
\"
data
\"
:
\"
false
\"
, "
"
\"
always-send
\"
: true } ] }"
;
ConstElementPtr
json
;
ASSERT_NO_THROW
(
json
=
parseDHCP4
(
config
));
ConstElementPtr
status
;
// Configure the server and make sure the config is accepted
EXPECT_NO_THROW
(
status
=
configureDhcp4Server
(
srv
,
json
));
ASSERT_TRUE
(
status
);
comment_
=
config
::
parseAnswer
(
rcode_
,
status
);
ASSERT_EQ
(
0
,
rcode_
);
CfgMgr
::
instance
().
commit
();
ASSERT_NO_THROW
(
configure
(
CONFIGS
[
2
]));
// Create a packet with enough to select the subnet and go through
// the DISCOVER processing
...
...
@@ -2225,8 +2222,8 @@ TEST_F(Dhcpv4SrvTest, prlPersistency) {
ASSERT_TRUE
(
hostname
);
query
->
addOption
(
hostname
);
//
Process the query
Pkt4Ptr
response
=
srv
.
processDiscover
(
query
);
//
Let the server process it.
Pkt4Ptr
response
=
srv
_
.
processDiscover
(
query
);
// Processing should add an ip-forwarding option
ASSERT_TRUE
(
response
->
getOption
(
DHO_IP_FORWARDING
));
...
...
@@ -2240,8 +2237,8 @@ TEST_F(Dhcpv4SrvTest, prlPersistency) {
prl
->
addValue
(
DHO_DEFAULT_IP_TTL
);
query
->
addOption
(
prl
);
//
Process query
response
=
srv
.
processDiscover
(
query
);
//
Let the server process it again.
response
=
srv
_
.
processDiscover
(
query
);
// Processing should add an ip-forwarding option
ASSERT_TRUE
(
response
->
getOption
(
DHO_IP_FORWARDING
));
...
...
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
View file @
71d40d82
...
...
@@ -99,7 +99,33 @@ const char* CONFIGS[] = {
"
\"
pools
\"
: [ {
\"
pool
\"
:
\"
2001:db8:1::/64
\"
} ],"
"
\"
subnet
\"
:
\"
2001:db8:1::/48
\"
"
" } ],"
"
\"
valid-lifetime
\"
: 4000 }"
"
\"
valid-lifetime
\"
: 4000 }"
,
// Configuration 2:
// - a single subnet
// - two global options (one enforced with always-send)
"{"
"
\"
interfaces-config
\"
: {
\"
interfaces
\"
: [
\"
*
\"
] }, "
"
\"
preferred-lifetime
\"
: 3000, "
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
valid-lifetime
\"
: 4000, "
"
\"
subnet6
\"
: [ {"
"
\"
pools
\"
: [ {
\"
pool
\"
:
\"
2001:db8:1::/64
\"
} ], "
"
\"
subnet
\"
:
\"
2001:db8:1::/48
\"
"
" } ], "
"
\"
option-data
\"
: ["
" {"
"
\"
name
\"
:
\"
dns-servers
\"
, "
"
\"
data
\"
:
\"
2001:db8:1234:FFFF::1
\"
"
" }, "
" {"
"
\"
name
\"
:
\"
subscriber-id
\"
, "
"
\"
data
\"
:
\"
1234
\"
, "
"
\"
always-send
\"
: true"
" }"
" ]"
"}"
};
// This test verifies that incoming SOLICIT can be handled properly when
...
...
@@ -1506,35 +1532,7 @@ TEST_F(Dhcpv6SrvTest, portsRelayedTraffic) {
TEST_F
(
Dhcpv6SrvTest
,
prlPersistency
)
{
IfaceMgrTestConfig
test_config
(
true
);
NakedDhcpv6Srv
srv
(
0
);
string
config
=
"{
\"
interfaces-config
\"
: {"
"
\"
interfaces
\"
: [
\"
*
\"
] }, "
"
\"
preferred-lifetime
\"
: 3000, "
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
valid-lifetime
\"
: 4000, "
"
\"
subnet6
\"
: [ "
"{
\"
pools
\"
: [ {
\"
pool
\"
:
\"
2001:db8:1::/64
\"
} ], "
"
\"
subnet
\"
:
\"
2001:db8:1::/48
\"
} ], "
"
\"
option-data
\"
: ["
" {
\"
name
\"
:
\"
dns-servers
\"
, "
"
\"
data
\"
:
\"
2001:db8:1234:FFFF::1
\"
}, "
" {
\"
name
\"
:
\"
subscriber-id
\"
, "
"
\"
data
\"
:
\"
1234
\"
, "
"
\"
always-send
\"
: true } ] }"
;
ConstElementPtr
json
;
ASSERT_NO_THROW
(
json
=
parseDHCP6
(
config
));
ConstElementPtr
status
;
// Configure the server and make sure the config is accepted
EXPECT_NO_THROW
(
status
=
configureDhcp6Server
(
srv
,
json
));
ASSERT_TRUE
(
status
);
comment_
=
config
::
parseAnswer
(
rcode_
,
status
);
ASSERT_EQ
(
0
,
rcode_
);
CfgMgr
::
instance
().
commit
();
ASSERT_NO_THROW
(
configure
(
CONFIGS
[
2
]));
// Create a packet with enough to select the subnet and go through
// the SOLICIT processing
...
...
@@ -1551,10 +1549,10 @@ TEST_F(Dhcpv6SrvTest, prlPersistency) {
oro
->
addValue
(
D6O_SNTP_SERVERS
);
sol
->
addOption
(
oro
);
//
Process the solicit
Pkt6Ptr
response
=
srv
.
processSolicit
(
sol
);
//
Let the server process it and generate a response.
Pkt6Ptr
response
=
srv
_
.
processSolicit
(
sol
);
//
Processing should ad
d a subscriber-id option
//
The server shoul
d a subscriber-id option
ASSERT_TRUE
(
response
->
getOption
(
D6O_SUBSCRIBER_ID
));
// But no dns-servers
ASSERT_FALSE
(
response
->
getOption
(
D6O_NAME_SERVERS
));
...
...
@@ -1566,8 +1564,9 @@ TEST_F(Dhcpv6SrvTest, prlPersistency) {
oro
->
addValue
(
D6O_NAME_SERVERS
);
sol
->
addOption
(
oro
);
// Process solicit
response
=
srv
.
processSolicit
(
sol
);
// Let the server process it again. This time the name-servers
// option should be present.
response
=
srv_
.
processSolicit
(
sol
);
// Processing should add a subscriber-id option
ASSERT_TRUE
(
response
->
getOption
(
D6O_SUBSCRIBER_ID
));
...
...
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