Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
7d46d891
Commit
7d46d891
authored
Dec 11, 2017
by
Marcin Siodelski
Browse files
[5442] Addressed review comments.
parent
075aedce
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp4/dhcp4_srv.cc
View file @
7d46d891
...
...
@@ -805,10 +805,11 @@ Dhcpv4Srv::run_one() {
}
// If the DHCP service has been globally disabled, drop the packet.
if
(
network_state_
.
isServiceEnabled
())
{
if
(
!
network_state_
.
isServiceEnabled
())
{
LOG_DEBUG
(
bad_packet4_logger
,
DBG_DHCP4_BASIC
,
DHCP4_PACKET_DROP_0008
)
.
arg
(
query
->
getLabel
());
}
else
{
processPacket
(
query
,
rsp
);
}
...
...
src/bin/dhcp6/ctrl_dhcp6_srv.cc
View file @
7d46d891
...
...
@@ -418,7 +418,7 @@ ControlledDhcpv6Srv::commandDhcpDisableHandler(const std::string&,
if
(
message
.
tellp
()
==
0
)
{
network_state_
.
disableService
();
message
<<
"DHCPv
4
service disabled"
;
message
<<
"DHCPv
6
service disabled"
;
if
(
max_period
>
0
)
{
message
<<
" for "
<<
max_period
<<
" seconds"
;
}
...
...
src/bin/dhcp6/dhcp6_messages.mes
View file @
7d46d891
...
...
@@ -416,7 +416,7 @@ service may be enabled by the "dhcp-enable" control command or automatically
after a specified amount of time since receiving "dhcp-disable" command.
% DHCP6_PACKET_DROP_PARSE_FAIL failed to parse packet from %1 to %2, received over interface %3, reason: %4
The DHCPv
4
server has received a packet that it is unable to
The DHCPv
6
server has received a packet that it is unable to
interpret. The reason why the packet is invalid is included in the message.
% DHCP6_PACKET_DROP_SERVERID_MISMATCH %1: dropping packet with server identifier: %2, server is using: %3
...
...
src/bin/dhcp6/dhcp6_srv.cc
View file @
7d46d891
...
...
@@ -469,10 +469,11 @@ void Dhcpv6Srv::run_one() {
}
// If the DHCP service has been globally disabled, drop the packet.
if
(
network_state_
.
isServiceEnabled
())
{
if
(
!
network_state_
.
isServiceEnabled
())
{
LOG_DEBUG
(
bad_packet6_logger
,
DBG_DHCP6_DETAIL_DATA
,
DHCP6_PACKET_DROP_DHCP_DISABLED
)
.
arg
(
query
->
getLabel
());
}
else
{
processPacket
(
query
,
rsp
);
}
...
...
src/lib/dhcpsrv/network_state.cc
View file @
7d46d891
...
...
@@ -52,7 +52,7 @@ public:
destroyTimer
();
}
/// @brief Creates a timer couting the time when @c enableAll should be
/// @brief Creates a timer cou
n
ting the time when @c enableAll should be
/// automatically called.
///
/// If the timer has been already scheduled, it is destroyed and replaced
...
...
@@ -67,7 +67,7 @@ public:
shared_from_this
()),
seconds
*
1000
,
asiolink
::
IntervalTimer
::
ONE_SHOT
);
timer_mgr_
->
setup
(
"network-state-timer"
);
timer_mgr_
->
setup
(
NETWORK_STATE_TIMER_NAME
);
}
/// @brief Destroys a timer if present.
...
...
src/lib/dhcpsrv/network_state.h
View file @
7d46d891
...
...
@@ -23,7 +23,7 @@ class NetworkStateImpl;
/// When the DHCP server receives a command to disable DHCP service entirely
/// or for specific networks, this has to be recorded to allow for re-enabling
/// DHCP service for these networks as a result of receiving a command from
/// the administrator or when the ti
e
mout for re-enabling the service occurs.
/// the administrator or when the tim
e
out for re-enabling the service occurs.
///
/// In the future, it will be possible to specify "disabled" parameter for
/// a subnet (or network) in the configuration file to indicate that this subnet
...
...
src/lib/dhcpsrv/tests/network_state_unittest.cc
View file @
7d46d891
...
...
@@ -49,7 +49,7 @@ public:
/// @brief Runs IO service with a timeout.
///
/// @param timeout_ms Timeout for runnin
r
IO service in milliseconds.
/// @param timeout_ms Timeout for runnin
g
IO service in milliseconds.
void
runIOService
(
const
long
timeout_ms
)
{
test_timer_
.
setup
(
boost
::
bind
(
&
NetworkStateTest
::
testTimerCallback
,
this
),
timeout_ms
,
IntervalTimer
::
ONE_SHOT
);
...
...
@@ -63,8 +63,8 @@ public:
IntervalTimer
test_timer_
;
};
// This test verifies that it is possible to disable and then enable service.
TEST_F
(
NetworkStateTest
,
disableEnableService
)
{
// This test verifies that it is possible to disable and then enable
DHCPv4
service.
TEST_F
(
NetworkStateTest
,
disableEnableService
4
)
{
NetworkState
state
(
NetworkState
::
DHCPv4
);
state
.
disableService
();
EXPECT_FALSE
(
state
.
isServiceEnabled
());
...
...
@@ -72,6 +72,15 @@ TEST_F(NetworkStateTest, disableEnableService) {
EXPECT_TRUE
(
state
.
isServiceEnabled
());
}
// This test verifies that it is possible to disable and then enable DHCPv6 service.
TEST_F
(
NetworkStateTest
,
disableEnableService6
)
{
NetworkState
state
(
NetworkState
::
DHCPv6
);
state
.
disableService
();
EXPECT_FALSE
(
state
.
isServiceEnabled
());
state
.
enableService
();
EXPECT_TRUE
(
state
.
isServiceEnabled
());
}
// This test verifies that enableAll() enables the service. This test will be extended
// in the future to verify that it also enables disabled scopes.
TEST_F
(
NetworkStateTest
,
enableAll
)
{
...
...
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