}
// 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);
}
if (message.tellp() == 0) {
network_state_.disableService();
- message << "DHCPv4 service disabled";
+ message << "DHCPv6 service disabled";
if (max_period > 0) {
message << " for " << max_period << " seconds";
}
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 DHCPv4 server has received a packet that it is unable to
+The DHCPv6 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
}
// 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);
}
destroyTimer();
}
- /// @brief Creates a timer couting the time when @c enableAll should be
+ /// @brief Creates a timer counting the time when @c enableAll should be
/// automatically called.
///
/// If the timer has been already scheduled, it is destroyed and replaced
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.
/// 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 tiemout for re-enabling the service occurs.
+/// the administrator or when the timeout 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
/// @brief Runs IO service with a timeout.
///
- /// @param timeout_ms Timeout for runninr IO service in milliseconds.
+ /// @param timeout_ms Timeout for running IO service in milliseconds.
void runIOService(const long timeout_ms) {
test_timer_.setup(boost::bind(&NetworkStateTest::testTimerCallback, this), timeout_ms,
IntervalTimer::ONE_SHOT);
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, disableEnableService4) {
NetworkState state(NetworkState::DHCPv4);
state.disableService();
EXPECT_FALSE(state.isServiceEnabled());
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) {