Commit 828ef399 authored by Francis Dupont's avatar Francis Dupont

[4106_update] Addressed last comments

parent d8280d80
......@@ -62,7 +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 += dhcp4to6_ipc.cc dhcp4to6_ipc.h
libdhcp4_la_SOURCES += kea_controller.cc
......
......@@ -8,7 +8,7 @@
#include <cc/data.h>
#include <dhcp4/ctrl_dhcp4_srv.h>
#include <dhcp4/dhcp4_log.h>
#include <dhcp4/dhcp4_dhcp4o6_ipc.h>
#include <dhcp4/dhcp4to6_ipc.h>
#include <hooks/hooks_manager.h>
#include <dhcp4/json_config_parser.h>
#include <dhcpsrv/cfgmgr.h>
......
......@@ -9,7 +9,7 @@
#include <util/buffer.h>
#include <dhcp/iface_mgr.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcp4/dhcp4_dhcp4o6_ipc.h>
#include <dhcp4/dhcp4to6_ipc.h>
using namespace std;
......
......@@ -4,10 +4,10 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef DHCP4_DHCP4O6_IPC_H
#define DHCP4_DHCP4O6_IPC_H
#ifndef DHCP4TO6_IPC_H
#define DHCP4TO6_IPC_H
/// @file dhcp4_dhcp4o6_ipc.h Defines the Dhcp4o6Ipc class.
/// @file dhcp4to6_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.
///
......
......@@ -93,7 +93,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 += dhcp4o6_ipc_unittest.cc
dhcp4_unittests_SOURCES += dhcp4to6_ipc_unittest.cc
nodist_dhcp4_unittests_SOURCES = marker_file.h test_libraries.h
......
......@@ -9,7 +9,7 @@
#include <dhcp/pkt4o6.h>
#include <dhcp/pkt6.h>
#include <dhcp/tests/iface_mgr_test_config.h>
#include <dhcp4/dhcp4_dhcp4o6_ipc.h>
#include <dhcp4/dhcp4to6_ipc.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/testutils/dhcp4o6_test_ipc.h>
#include <gtest/gtest.h>
......
......@@ -63,7 +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 += dhcp6to4_ipc.cc dhcp6to4_ipc.h
libdhcp6_la_SOURCES += kea_controller.cc
......
......@@ -11,7 +11,7 @@
#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/cfg_db_access.h>
#include <dhcp6/ctrl_dhcp6_srv.h>
#include <dhcp6/dhcp6_dhcp4o6_ipc.h>
#include <dhcp6/dhcp6to4_ipc.h>
#include <dhcp6/dhcp6_log.h>
#include <dhcp6/json_config_parser.h>
#include <hooks/hooks_manager.h>
......
......@@ -25,7 +25,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/dhcp6to4_ipc.h>
#include <dhcp6/dhcp6_log.h>
#include <dhcp6/dhcp6_srv.h>
#include <dhcpsrv/callout_handle_store.h>
......
......@@ -9,7 +9,7 @@
#include <util/buffer.h>
#include <dhcp/iface_mgr.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcp6/dhcp6_dhcp4o6_ipc.h>
#include <dhcp6/dhcp6to4_ipc.h>
using namespace std;
......
......@@ -4,10 +4,10 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef DHCP6_DHCP4O6_IPC_H
#define DHCP6_DHCP4O6_IPC_H
#ifndef DHCP6TO4_IPC_H
#define DHCP6TO4_IPC_H
/// @file dhcp6_dhcp4o6_ipc.h Defines the Dhcp6to4Ipc class.
/// @file dhcp6to4_ipc.h Defines the Dhcp6to4Ipc class.
/// This file defines the class Kea uses to act as the DHCPv6 server
/// side of DHCPv4-over-DHCPv6 communication between servers.
///
......
......@@ -95,7 +95,7 @@ dhcp6_unittests_SOURCES += infrequest_unittest.cc
dhcp6_unittests_SOURCES += decline_unittest.cc
dhcp6_unittests_SOURCES += dhcp6_message_test.cc dhcp6_message_test.h
dhcp6_unittests_SOURCES += kea_controller_unittest.cc
dhcp6_unittests_SOURCES += dhcp4o6_ipc_unittest.cc
dhcp6_unittests_SOURCES += dhcp6to4_ipc_unittest.cc
nodist_dhcp6_unittests_SOURCES = marker_file.h test_libraries.h
......
......@@ -10,7 +10,7 @@
#include <dhcp/iface_mgr.h>
#include <dhcp/tests/iface_mgr_test_config.h>
#include <dhcp/tests/pkt_filter6_test_stub.h>
#include <dhcp6/dhcp6_dhcp4o6_ipc.h>
#include <dhcp6/dhcp6to4_ipc.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/testutils/dhcp4o6_test_ipc.h>
#include <gtest/gtest.h>
......@@ -51,6 +51,9 @@ public:
/// @brief Creates an instance of the DHCPv4o6 Message option.
///
/// The option will contain an empty DHCPREQUEST message, with
/// just the Message Type option inside and nothing else.
///
/// @return Pointer to the instance of the DHCPv4-query Message option.
OptionPtr createDHCPv4MsgOption() const;
......
......@@ -13,7 +13,10 @@
#include <dhcp/option_string.h>
#include <dhcp/option_vendor.h>
#include <dhcpsrv/dhcp4o6_ipc.h>
#include <dhcpsrv/dhcpsrv_log.h>
#include <boost/pointer_cast.hpp>
#include <errno.h>
#include <netinet/in.h>
#include <sys/fcntl.h>
......@@ -151,6 +154,8 @@ Pkt6Ptr Dhcp4o6IpcBase::receive() {
// Vendor option must exist.
if (!option_vendor) {
LOG_WARN(dhcpsrv_logger, DHCPSRV_DHCP4O6_RECEIVED_BAD_PACKET)
.arg("no ISC vendor option");
isc_throw(Dhcp4o6IpcError, "option " << D6O_VENDOR_OPTS
<< " with ISC enterprise id is not present in the DHCP4o6"
" message sent between the servers");
......@@ -160,6 +165,8 @@ Pkt6Ptr Dhcp4o6IpcBase::receive() {
OptionStringPtr ifname = boost::dynamic_pointer_cast<
OptionString>(option_vendor->getOption(ISC_V6_4O6_INTERFACE));
if (!ifname) {
LOG_WARN(dhcpsrv_logger, DHCPSRV_DHCP4O6_RECEIVED_BAD_PACKET)
.arg("no interface suboption");
isc_throw(Dhcp4o6IpcError, "option " << D6O_VENDOR_OPTS
<< " doesn't contain the " << ISC_V6_4O6_INTERFACE
<< " option required in the DHCP4o6 message sent"
......@@ -169,6 +176,8 @@ Pkt6Ptr Dhcp4o6IpcBase::receive() {
// Check if this interface is present in the system.
IfacePtr iface = IfaceMgr::instance().getIface(ifname->getValue());
if (!iface) {
LOG_WARN(dhcpsrv_logger, DHCPSRV_DHCP4O6_RECEIVED_BAD_PACKET)
.arg("can't get interface " + ifname->getValue());
isc_throw(Dhcp4o6IpcError, "option " << ISC_V6_4O6_INTERFACE
<< " sent in the DHCP4o6 message contains non-existing"
" interface name '" << ifname->getValue() << "'");
......@@ -178,6 +187,8 @@ Pkt6Ptr Dhcp4o6IpcBase::receive() {
OptionCustomPtr srcs = boost::dynamic_pointer_cast<
OptionCustom>(option_vendor->getOption(ISC_V6_4O6_SRC_ADDRESS));
if (!srcs) {
LOG_WARN(dhcpsrv_logger, DHCPSRV_DHCP4O6_RECEIVED_BAD_PACKET)
.arg("no source address suboption");
isc_throw(Dhcp4o6IpcError, "option " << D6O_VENDOR_OPTS
<< " doesn't contain the " << ISC_V6_4O6_SRC_ADDRESS
<< " option required in the DHCP4o6 message sent"
......
......@@ -84,6 +84,7 @@ protected:
/// @param endpoint_type Endpoint type (DHCPv4 or DHCPv6 server).
///
/// @return New socket descriptor.
/// @throw isc::dhcp::Dhcp4o6IpcError on system call errors.
int open(uint16_t port, EndpointType endpoint_type);
public:
......@@ -98,6 +99,8 @@ public:
///
/// @return a pointer to a DHCPv6 message with interface and remote
/// address set from the IPC message
/// @throw isc::dhcp::Dhcp4o6IpcError on system call error or
/// malformed packets.
Pkt6Ptr receive();
/// @brief Send message over IPC.
......@@ -110,6 +113,7 @@ public:
///
/// @param pkt Pointer to a DHCPv6 message with interface and remote
/// address.
/// @throw isc::dhcp::Dhcp4o6IpcError.
void send(const Pkt6Ptr& pkt);
protected:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment