Commit 8f2a1f8a authored by Marcin Siodelski's avatar Marcin Siodelski

[master] Merge branch 'trac4106'

parents ed7edadc 96a612f4
......@@ -62,6 +62,7 @@ libdhcp4_la_SOURCES += ctrl_dhcp4_srv.cc ctrl_dhcp4_srv.h
libdhcp4_la_SOURCES += json_config_parser.cc json_config_parser.h
libdhcp4_la_SOURCES += dhcp4_log.cc dhcp4_log.h
libdhcp4_la_SOURCES += dhcp4_srv.cc dhcp4_srv.h
libdhcp4_la_SOURCES += dhcp4_dhcp4o6_ipc.cc dhcp4_dhcp4o6_ipc.h
libdhcp4_la_SOURCES += kea_controller.cc
......
......@@ -16,6 +16,7 @@
#include <cc/data.h>
#include <dhcp4/ctrl_dhcp4_srv.h>
#include <dhcp4/dhcp4_log.h>
#include <dhcp4/dhcp4_dhcp4o6_ipc.h>
#include <hooks/hooks_manager.h>
#include <dhcp4/json_config_parser.h>
#include <dhcpsrv/cfgmgr.h>
......@@ -185,6 +186,16 @@ ControlledDhcpv4Srv::processConfig(isc::data::ConstElementPtr config) {
return (isc::config::createAnswer(1, err.str()));
}
// Setup DHCPv4-over-DHCPv6 IPC
try {
Dhcp4to6Ipc::instance().open();
} catch (const std::exception& ex) {
std::ostringstream err;
err << "error starting DHCPv4-over-DHCPv6 IPC "
" after server reconfiguration: " << ex.what();
return (isc::config::createAnswer(1, err.str()));
}
// Configuration may change active interfaces. Therefore, we have to reopen
// sockets according to new configuration. It is possible that this
// operation will fail for some interfaces but the openSockets function
......
// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include <config.h>
#include <util/buffer.h>
#include <dhcp/iface_mgr.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcp4/dhcp4_dhcp4o6_ipc.h>
using namespace std;
namespace isc {
namespace dhcp {
Dhcp4to6Ipc::Dhcp4to6Ipc() : Dhcp4o6IpcBase() {
}
Dhcp4to6Ipc& Dhcp4to6Ipc::instance() {
static Dhcp4to6Ipc dhcp4to6_ipc;
return (dhcp4to6_ipc);
}
void Dhcp4to6Ipc::open() {
uint32_t port = CfgMgr::instance().getStagingCfg()->getDhcp4o6Port();
if (port == 0) {
Dhcp4o6IpcBase::close();
return;
}
int old_fd = socket_fd_;
socket_fd_ = Dhcp4o6IpcBase::open(static_cast<uint16_t>(port), ENDPOINT_TYPE_V4);
if ((old_fd == -1) && (socket_fd_ != old_fd)) {
IfaceMgr::instance().addExternalSocket(socket_fd_, Dhcp4to6Ipc::handler);
}
}
void Dhcp4to6Ipc::handler() {
Dhcp4to6Ipc& ipc = Dhcp4to6Ipc::instance();
// Reset received message in case we return from this method before the
// received message pointer is updated.
ipc.received_.reset();
// Receive message from the IPC socket.
Pkt6Ptr pkt = ipc.receive();
if (!pkt) {
return;
}
// Each message must contain option holding DHCPv4 message.
OptionCollection msgs = pkt->getOptions(D6O_DHCPV4_MSG);
if (msgs.empty()) {
isc_throw(Dhcp4o6IpcError, "DHCPv4 message option not present in the"
" DHCPv4o6 message received by the DHCPv4 server");
} else if (msgs.size() > 1) {
isc_throw(Dhcp4o6IpcError, "expected exactly one DHCPv4 message within"
" DHCPv4 message option received by the DHCPv4 server");
}
OptionPtr msg = msgs.begin()->second;
if (!msg) {
isc_throw(Dhcp4o6IpcError, "null DHCPv4 message option in the"
" DHCPv4o6 message received by the DHCPv4 server");
}
// Record this message.
ipc.received_.reset(new Pkt4o6(msg->getData(), pkt));
}
Pkt4o6Ptr& Dhcp4to6Ipc::getReceived() {
return (received_);
}
}; // namespace dhcp
}; // namespace isc
// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#ifndef DHCP4_DHCP4O6_IPC_H
#define DHCP4_DHCP4O6_IPC_H
/// @file dhcp4_dhcp4o6_ipc.h Defines the Dhcp4o6Ipc class.
/// This file defines the class Kea uses to act as the DHCPv4 server
/// side of DHCPv4-over-DHCPv6 communication between servers.
///
#include <dhcp/pkt4o6.h>
#include <dhcpsrv/dhcp4o6_ipc.h>
#include <boost/shared_ptr.hpp>
namespace isc {
namespace dhcp {
/// @brief Handles DHCPv4-over-DHCPv6 IPC on the DHCPv4 server side
class Dhcp4to6Ipc : public Dhcp4o6IpcBase {
protected:
/// @brief Constructor
///
/// Default constructor
Dhcp4to6Ipc();
/// @brief Destructor.
virtual ~Dhcp4to6Ipc() { }
public:
/// @brief Returns pointer to the sole instance of Dhcp4o6Ipc
///
/// Dhcp4to6Ipc is a singleton class
///
/// @return the only existing instance of DHCP4o6 IPC
static Dhcp4to6Ipc& instance();
/// @brief Open communication socket
///
/// Call base open method and sets the handler/callback when needed
virtual void open();
/// @brief On receive handler
///
/// The handler processes the DHCPv4-query DHCPv6 packet and
/// sends the DHCPv4-response DHCPv6 packet back to the DHCPv6 server
static void handler();
/// @brief Returns last received packet
///
/// @return a reference to a shared pointer to the last received packet
/// @note This reference should be cleared after use
Pkt4o6Ptr& getReceived();
private:
/// @brief last received packet
Pkt4o6Ptr received_;
};
} // namespace isc
} // namespace dhcp
#endif
......@@ -422,9 +422,10 @@ DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id,
if ((config_id.compare("valid-lifetime") == 0) ||
(config_id.compare("renew-timer") == 0) ||
(config_id.compare("rebind-timer") == 0) ||
(config_id.compare("decline-probation-period") == 0) ) {
(config_id.compare("decline-probation-period") == 0) ||
(config_id.compare("dhcp4o6-port") == 0) ) {
parser = new Uint32Parser(config_id,
globalContext()->uint32_values_);
globalContext()->uint32_values_);
} else if (config_id.compare("interfaces-config") == 0) {
parser = new IfacesConfigParser4();
} else if (config_id.compare("subnet4") == 0) {
......@@ -472,6 +473,7 @@ DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id,
///
/// - echo-client-id
/// - decline-probation-period
/// - dhcp4o6-port
void setGlobalParameters4() {
// Although the function is modest for now, it is certain that the number
// of global switches will increase over time, hence the name.
......@@ -494,6 +496,15 @@ void setGlobalParameters4() {
} catch (...) {
// That's not really needed.
}
// Set the DHCPv4-over-DHCPv6 interserver port.
try {
uint32_t dhcp4o6_port = globalContext()->uint32_values_
->getOptionalParam("dhcp4o6-port", 0);
CfgMgr::instance().getStagingCfg()->setDhcp4o6Port(dhcp4o6_port);
} catch (...) {
// Ignore errors. This flag is optional
}
}
isc::data::ConstElementPtr
......
......@@ -92,6 +92,7 @@ dhcp4_unittests_SOURCES += release_unittest.cc
dhcp4_unittests_SOURCES += out_of_range_unittest.cc
dhcp4_unittests_SOURCES += decline_unittest.cc
dhcp4_unittests_SOURCES += kea_controller_unittest.cc
dhcp4_unittests_SOURCES += dhcp4_dhcp4o6_ipc_unittest.cc
nodist_dhcp4_unittests_SOURCES = marker_file.h test_libraries.h
......
// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include <config.h>
#include <asiolink/io_address.h>
#include <dhcp/pkt4o6.h>
#include <dhcp/pkt6.h>
#include <dhcp/tests/iface_mgr_test_config.h>
#include <dhcp4/dhcp4_dhcp4o6_ipc.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/testutils/dhcp4o6_test_ipc.h>
#include <gtest/gtest.h>
#include <stdint.h>
using namespace isc;
using namespace isc::asiolink;
using namespace isc::dhcp;
using namespace isc::dhcp::test;
using namespace isc::util;
namespace {
/// @brief Port number used in tests.
const uint16_t TEST_PORT = 32000;
/// @brief Define short name for the test IPC.
typedef Dhcp4o6TestIpc TestIpc;
/// @brief Test fixture class for DHCPv4 endpoint of DHCPv4o6 IPC.
class Dhcp4to6IpcTest : public ::testing::Test {
public:
/// @brief Constructor
///
/// Configures IPC to use a test port. It also provides a fake
/// configuration of interfaces.
Dhcp4to6IpcTest()
: iface_mgr_test_config_(true) {
configurePort(TEST_PORT);
}
/// @brief Configure DHCP4o6 port.
///
/// @param port New port.
void configurePort(const uint16_t port);
/// @brief Creates an instance of the DHCPv4o6 Message option.
///
/// @return Pointer to the instance of the DHCPv4-query Message option.
OptionPtr createDHCPv4MsgOption() const;
private:
/// @brief Provides fake configuration of interfaces.
IfaceMgrTestConfig iface_mgr_test_config_;
};
void
Dhcp4to6IpcTest::configurePort(const uint16_t port) {
CfgMgr::instance().getStagingCfg()->setDhcp4o6Port(port);
}
OptionPtr
Dhcp4to6IpcTest::createDHCPv4MsgOption() const {
// Create the DHCPv4 message.
Pkt4Ptr pkt(new Pkt4(DHCPREQUEST, 1234));
// Make a wire representation of the DHCPv4 message.
pkt->pack();
OutputBuffer& output_buffer = pkt->getBuffer();
const uint8_t* data = static_cast<const uint8_t*>(output_buffer.getData());
OptionBuffer option_buffer(data, data + output_buffer.getLength());
// Create the DHCPv4 Message option holding the created message.
OptionPtr opt_msg(new Option(Option::V6, D6O_DHCPV4_MSG, option_buffer));
return (opt_msg);
}
// This test verifies that the DHCPv4 endpoint of the DHCPv4o6 IPC can
// receive messages.
TEST_F(Dhcp4to6IpcTest, receive) {
// Create instance of the IPC endpoint under test.
Dhcp4to6Ipc& ipc = Dhcp4to6Ipc::instance();
// Create instance of the IPC endpoint being used as a source of messages.
TestIpc src_ipc(TEST_PORT, TestIpc::ENDPOINT_TYPE_V6);
// Open both endpoints.
ASSERT_NO_THROW(ipc.open());
ASSERT_NO_THROW(src_ipc.open());
// Create message to be sent over IPC.
Pkt6Ptr pkt(new Pkt6(DHCPV6_DHCPV4_QUERY, 1234));
pkt->addOption(createDHCPv4MsgOption());
pkt->setIface("eth0");
pkt->setRemoteAddr(IOAddress("2001:db8:1::123"));
ASSERT_NO_THROW(pkt->pack());
// Send and wait up to 1 second to receive it.
ASSERT_NO_THROW(src_ipc.send(pkt));
ASSERT_NO_THROW(IfaceMgr::instance().receive6(1, 0));
// Make sure that the message has been received.
Pkt4o6Ptr pkt_received = ipc.getReceived();
ASSERT_TRUE(pkt_received);
Pkt6Ptr pkt6_received = pkt_received->getPkt6();
ASSERT_TRUE(pkt6_received);
EXPECT_EQ("eth0", pkt6_received->getIface());
EXPECT_EQ("2001:db8:1::123", pkt6_received->getRemoteAddr().toText());
}
// This test verifies that message with multiple DHCPv4 query options
// is rejected.
TEST_F(Dhcp4to6IpcTest, receiveMultipleQueries) {
// Create instance of the IPC endpoint under test.
Dhcp4to6Ipc& ipc = Dhcp4to6Ipc::instance();
// Create instance of the IPC endpoint being used as a source of messages.
TestIpc src_ipc(TEST_PORT, TestIpc::ENDPOINT_TYPE_V6);
// Open both endpoints.
ASSERT_NO_THROW(ipc.open());
ASSERT_NO_THROW(src_ipc.open());
// Create message to be sent over IPC.
Pkt6Ptr pkt(new Pkt6(DHCPV6_DHCPV4_QUERY, 1234));
// Add two DHCPv4 query options.
pkt->addOption(createDHCPv4MsgOption());
pkt->addOption(createDHCPv4MsgOption());
pkt->setIface("eth0");
pkt->setRemoteAddr(IOAddress("2001:db8:1::123"));
ASSERT_NO_THROW(pkt->pack());
// Send message.
ASSERT_NO_THROW(src_ipc.send(pkt));
// Reception handler should throw exception.
EXPECT_THROW(IfaceMgr::instance().receive6(1, 0), Dhcp4o6IpcError);
}
// This test verifies that message with no DHCPv4 query options is rejected.
TEST_F(Dhcp4to6IpcTest, receiveNoQueries) {
// Create instance of the IPC endpoint under test.
Dhcp4to6Ipc& ipc = Dhcp4to6Ipc::instance();
// Create instance of the IPC endpoint being used as a source of messages.
TestIpc src_ipc(TEST_PORT, TestIpc::ENDPOINT_TYPE_V6);
// Open both endpoints.
ASSERT_NO_THROW(ipc.open());
ASSERT_NO_THROW(src_ipc.open());
// Create message to be sent over IPC without DHCPv4 query option.
Pkt6Ptr pkt(new Pkt6(DHCPV6_DHCPV4_QUERY, 1234));
pkt->setIface("eth0");
pkt->setRemoteAddr(IOAddress("2001:db8:1::123"));
ASSERT_NO_THROW(pkt->pack());
// Send message.
ASSERT_NO_THROW(src_ipc.send(pkt));
// Reception handler should throw exception.
EXPECT_THROW(IfaceMgr::instance().receive6(1, 0), Dhcp4o6IpcError);
}
} // end of anonymous namespace
......@@ -63,6 +63,7 @@ libdhcp6_la_SOURCES += dhcp6_log.cc dhcp6_log.h
libdhcp6_la_SOURCES += dhcp6_srv.cc dhcp6_srv.h
libdhcp6_la_SOURCES += ctrl_dhcp6_srv.cc ctrl_dhcp6_srv.h
libdhcp6_la_SOURCES += json_config_parser.cc json_config_parser.h
libdhcp6_la_SOURCES += dhcp6_dhcp4o6_ipc.cc dhcp6_dhcp4o6_ipc.h
libdhcp6_la_SOURCES += kea_controller.cc
......
......@@ -18,6 +18,7 @@
#include <dhcp/libdhcp++.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcp6/ctrl_dhcp6_srv.h>
#include <dhcp6/dhcp6_dhcp4o6_ipc.h>
#include <dhcp6/dhcp6_log.h>
#include <dhcp6/json_config_parser.h>
#include <hooks/hooks_manager.h>
......@@ -209,6 +210,16 @@ ControlledDhcpv6Srv::processConfig(isc::data::ConstElementPtr config) {
return (isc::config::createAnswer(1, err.str()));
}
// Setup DHCPv4-over-DHCPv6 IPC
try {
Dhcp6to4Ipc::instance().open();
} catch (const std::exception& ex) {
std::ostringstream err;
err << "error starting DHCPv4-over-DHCPv6 IPC "
" after server reconfiguration: " << ex.what();
return (isc::config::createAnswer(1, err.str()));
}
// Configuration may change active interfaces. Therefore, we have to reopen
// sockets according to new configuration. It is possible that this
// operation will fail for some interfaces but the openSockets function
......
// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include <config.h>
#include <util/buffer.h>
#include <dhcp/iface_mgr.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcp6/dhcp6_dhcp4o6_ipc.h>
using namespace std;
namespace isc {
namespace dhcp {
Dhcp6to4Ipc::Dhcp6to4Ipc() : Dhcp4o6IpcBase() {}
Dhcp6to4Ipc& Dhcp6to4Ipc::instance() {
static Dhcp6to4Ipc dhcp6to4_ipc;
return (dhcp6to4_ipc);
}
void Dhcp6to4Ipc::open() {
uint32_t port = CfgMgr::instance().getStagingCfg()->getDhcp4o6Port();
if (port == 0) {
Dhcp4o6IpcBase::close();
return;
}
int old_fd = socket_fd_;
socket_fd_ = Dhcp4o6IpcBase::open(static_cast<uint16_t>(port), ENDPOINT_TYPE_V6);
if ((old_fd == -1) && (socket_fd_ != old_fd)) {
IfaceMgr::instance().addExternalSocket(socket_fd_, Dhcp6to4Ipc::handler);
}
}
void Dhcp6to4Ipc::handler() {
Dhcp6to4Ipc& ipc = Dhcp6to4Ipc::instance();
// Receive message from IPC.
Pkt6Ptr pkt = ipc.receive();
if (!pkt) {
return;
}
// The received message has been unpacked by the receive() function. This
// method could have modified the message so it's better to pack() it
// again because we'll be forwarding it to a client.
isc::util::OutputBuffer& buf = pkt->getBuffer();
buf.clear();
pkt->pack();
uint8_t msg_type = pkt->getType();
if ((msg_type == DHCPV6_RELAY_FORW) || (msg_type == DHCPV6_RELAY_REPL)) {
pkt->setRemotePort(DHCP6_SERVER_PORT);
} else {
pkt->setRemotePort(DHCP6_CLIENT_PORT);
}
// Forward packet to the client.
IfaceMgr::instance().send(pkt);
// processStatsSent(pkt);
}
}; // namespace dhcp
}; // namespace isc
// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#ifndef DHCP6_DHCP4O6_IPC_H
#define DHCP6_DHCP4O6_IPC_H
/// @file dhcp6_dhcp4o6_ipc.h Defines the Dhcp4o6Ipc class.
/// This file defines the class Kea uses to act as the DHCPv6 server
/// side of DHCPv4-over-DHCPv6 communication between servers.
///
#include <dhcpsrv/dhcp4o6_ipc.h>
#include <boost/shared_ptr.hpp>
namespace isc {
namespace dhcp {
/// @brief Handles DHCPv4-over-DHCPv6 IPC on the DHCPv6 server side
class Dhcp6to4Ipc : public Dhcp4o6IpcBase {
protected:
/// @brief Constructor
///
/// Default constructor
Dhcp6to4Ipc();
/// @brief Destructor.
virtual ~Dhcp6to4Ipc() { }
public:
/// @brief Returns pointer to the sole instance of Dhcp4o6Ipc
///
/// Dhcp4o6Ipc is a singleton class
///
/// @return the only existing instance of DHCP4o6 IPC
static Dhcp6to4Ipc& instance();
/// @brief Open communication socket
///
/// Call base open method and sets the handler/callback when needed
virtual void open();
/// @brief On receive handler
///
/// The handler sends the DHCPv6 packet back to the remote address
static void handler();
};
} // namespace isc
} // namespace dhcp
#endif
......@@ -33,6 +33,7 @@
#include <dhcp/option_vendor_class.h>
#include <dhcp/option_int_array.h>
#include <dhcp/pkt6.h>
#include <dhcp6/dhcp6_dhcp4o6_ipc.h>
#include <dhcp6/dhcp6_log.h>
#include <dhcp6/dhcp6_srv.h>
#include <dhcpsrv/callout_handle_store.h>
......@@ -220,6 +221,13 @@ Dhcpv6Srv::~Dhcpv6Srv() {
LOG_ERROR(dhcp6_logger, DHCP6_SRV_D2STOP_ERROR).arg(ex.what());
}
try {
Dhcp6to4Ipc::instance().close();
} catch(const std::exception& ex) {
// Highly unlikely, but lets Report it but go on
// LOG_ERROR(dhcp6_logger, DHCP6_SRV_DHCP4O6_ERROR).arg(ex.what());
}
IfaceMgr::instance().closeSockets();
LeaseMgrFactory::destroy();
......
......@@ -674,7 +674,8 @@ DhcpConfigParser* createGlobal6DhcpConfigParser(const std::string& config_id,
(config_id.compare("valid-lifetime") == 0) ||
(config_id.compare("renew-timer") == 0) ||
(config_id.compare("rebind-timer") == 0) ||
(config_id.compare("decline-probation-period") == 0) ) {
(config_id.compare("decline-probation-period") == 0) ||
(config_id.compare("dhcp4o6-port") == 0) ) {
parser = new Uint32Parser(config_id,
globalContext()->uint32_values_);
} else if (config_id.compare("interfaces-config") == 0) {
......@@ -725,6 +726,7 @@ DhcpConfigParser* createGlobal6DhcpConfigParser(const std::string& config_id,
/// Currently this method sets the following global parameters:
///
/// - decline-probation-period
/// - dhcp4o6-port
void setGlobalParameters6() {
// Set the probation period for decline handling.
......@@ -736,6 +738,15 @@ void setGlobalParameters6() {
} catch (...) {
// That's not really needed.
}