mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 05:27:55 +00:00
[master] Merge branch 'github54' (various changes)
This commit is contained in:
commit
7e77f043c9
2
doc/guide/.gitignore
vendored
2
doc/guide/.gitignore
vendored
@ -2,3 +2,5 @@
|
||||
/kea-guide.txt
|
||||
/kea-messages.html
|
||||
/kea-messages.xml
|
||||
/kea-guide.pdf
|
||||
/kea-messages.pdf
|
||||
|
@ -49,7 +49,7 @@ $(HTMLDOCS) $(DOCS):
|
||||
@echo Doc generation disabled. Creating dummy $@. Configure with --enable-generate-docs to enable it.
|
||||
@echo Doc generation disabled. Remove this file, configure with --enable-generate-docs, and rebuild Kea > $@
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
if HAVE_DBLATEX
|
||||
|
||||
|
@ -18,12 +18,26 @@
|
||||
mysql_execute() {
|
||||
QUERY=$1
|
||||
shift
|
||||
if [ $# -ge 1 ]; then
|
||||
mysql -N -B $* -e "${QUERY}"
|
||||
if [ $# -gt 1 ]; then
|
||||
mysql -N -B "$@" -e "${QUERY}"
|
||||
retcode=$?
|
||||
else
|
||||
mysql -N -B --host=$db_host --user=$db_user --password=$db_password -e "${QUERY}" $db_name
|
||||
retcode="$?"
|
||||
mysql -N -B --database="${db_name}" --user="${db_user}" --password="${db_password}" -e "${QUERY}"
|
||||
retcode=$?
|
||||
fi
|
||||
|
||||
return $retcode
|
||||
}
|
||||
|
||||
mysql_execute_script() {
|
||||
file=$1
|
||||
shift
|
||||
if [ $# -ge 1 ]; then
|
||||
mysql -N -B "$@" < "${file}"
|
||||
retcode=$?
|
||||
else
|
||||
mysql -N -B --database="${db_name}" --user="${db_user}" --password="${db_password}" < "${file}"
|
||||
retcode=$?
|
||||
fi
|
||||
|
||||
return $retcode
|
||||
@ -47,12 +61,12 @@ mysql_version() {
|
||||
pgsql_execute() {
|
||||
QUERY=$1
|
||||
shift
|
||||
if [ $# -ge 1 ]; then
|
||||
echo $QUERY | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q $*
|
||||
if [ $# -gt 0 ]; then
|
||||
echo "${QUERY}" | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q "$@"
|
||||
retcode=$?
|
||||
else
|
||||
export PGPASSWORD=$db_password
|
||||
echo $QUERY | psql --set ON_ERROR_STOP=1 -A -t -h $db_host -q -U $db_user -d $db_name
|
||||
echo "${QUERY}" | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U "${db_user}" -d "${db_name}"
|
||||
retcode=$?
|
||||
fi
|
||||
return $retcode
|
||||
@ -71,12 +85,12 @@ pgsql_execute() {
|
||||
pgsql_execute_script() {
|
||||
file=$1
|
||||
shift
|
||||
if [ $# -ge 1 ]; then
|
||||
psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -f $file $*
|
||||
if [ $# -gt 0 ]; then
|
||||
psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -f "${file}" "$@"
|
||||
retcode=$?
|
||||
else
|
||||
export PGPASSWORD=$db_password
|
||||
psql --set ON_ERROR_STOP=1 -A -t -h $db_host -q -U $db_user -d $db_name -f $file
|
||||
psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U "${db_user}" -d "${db_name}" -f "${file}"
|
||||
retcode=$?
|
||||
fi
|
||||
return $retcode
|
||||
@ -90,16 +104,16 @@ pgsql_version() {
|
||||
cql_execute() {
|
||||
query=$1
|
||||
shift
|
||||
if [ $# -ge 1 ]; then
|
||||
if [ $# -gt 1 ]; then
|
||||
cqlsh "$@" -e "$query"
|
||||
retcode=$?
|
||||
else
|
||||
cqlsh -u $db_user -p $db_password -k $db_name -e "$query"
|
||||
cqlsh -u "${db_user}" -p "${db_password}" -k "${db_name}" -e "${query}"
|
||||
retcode=$?
|
||||
fi
|
||||
|
||||
if [ $retcode -ne 0 ]; then
|
||||
printf "cqlsh returned with exit status $retcode\n"
|
||||
printf "cqlsh returned with exit status %s\n" "${retcode}"
|
||||
exit $retcode
|
||||
fi
|
||||
|
||||
@ -109,16 +123,16 @@ cql_execute() {
|
||||
cql_execute_script() {
|
||||
file=$1
|
||||
shift
|
||||
if [ $# -ge 1 ]; then
|
||||
cqlsh "$@" -f "$file"
|
||||
if [ $# -gt 1 ]; then
|
||||
cqlsh "$@" -e "$file"
|
||||
retcode=$?
|
||||
else
|
||||
cqlsh -u $db_user -p $db_password -k $db_name -f "$file"
|
||||
cqlsh -u "${db_user}" -p "${db_password}" -k "${db_name}" -f "${file}"
|
||||
retcode=$?
|
||||
fi
|
||||
|
||||
if [ $retcode -ne 0 ]; then
|
||||
printf "cqlsh returned with exit status $retcode\n"
|
||||
printf "cqlsh returned with exit status %s\n" "${retcode}"
|
||||
exit $retcode
|
||||
fi
|
||||
|
||||
@ -126,9 +140,8 @@ cql_execute_script() {
|
||||
}
|
||||
|
||||
cql_version() {
|
||||
version=$(cql_execute "SELECT version, minor FROM schema_version" "$@")
|
||||
error=$?
|
||||
version=$(echo "$version" | grep -A 1 "+" | grep -v "+" | tr -d ' ' | cut -d "|" -f 1-2 --output-delimiter=".")
|
||||
echo "$version"
|
||||
return $error
|
||||
version=$(cql_execute "SELECT version, minor FROM schema_version" "$@")
|
||||
version=$(echo "$version" | grep -A 1 "+" | grep -v "+" | tr -d ' ' | cut -d "|" -f 1-2 --output-delimiter=".")
|
||||
echo "${version}"
|
||||
return $?
|
||||
}
|
||||
|
@ -103,7 +103,6 @@
|
||||
migrating between old and new Kea versions.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>lease-dump</term>
|
||||
@ -114,6 +113,7 @@
|
||||
The first line of file is a header line containing the column names.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -25,21 +25,20 @@ using namespace isc::dns::rdata;
|
||||
using namespace isc::util;
|
||||
|
||||
namespace {
|
||||
|
||||
// @brief Test fixture class for testing D2UpdateMessage object.
|
||||
/// @brief Test fixture class for testing D2UpdateMessage object
|
||||
class D2UpdateMessageTest : public ::testing::Test {
|
||||
public:
|
||||
// @brief Constructor.
|
||||
/// @brief Constructor
|
||||
//
|
||||
// Does nothing.
|
||||
D2UpdateMessageTest() { }
|
||||
|
||||
// @brief Destructor.
|
||||
/// @brief Destructor
|
||||
//
|
||||
// Does nothing.
|
||||
~D2UpdateMessageTest() { };
|
||||
|
||||
// @brief Return string representation of the name encoded in wire format.
|
||||
/// @brief Returns string representation of the name encoded in wire format.
|
||||
//
|
||||
// This function reads the number of bytes specified in the second
|
||||
// argument from the buffer. It doesn't check if buffer has sufficient
|
||||
|
@ -36,8 +36,7 @@ const char* TEST_ADDRESS = "127.0.0.1";
|
||||
const uint16_t TEST_PORT = 5301;
|
||||
const size_t MAX_SIZE = 1024;
|
||||
const long TEST_TIMEOUT = 5 * 1000;
|
||||
|
||||
// @brief Test Fixture class.
|
||||
/// @brief Test Fixture class
|
||||
//
|
||||
// This test fixture class implements DNSClient::Callback so as it can be
|
||||
// installed as a completion callback for tests it implements. This callback
|
||||
@ -64,7 +63,7 @@ public:
|
||||
int received_;
|
||||
int expected_;
|
||||
|
||||
// @brief Constructor.
|
||||
/// @brief Constructor
|
||||
//
|
||||
// This constructor overrides the default logging level of asiodns logger to
|
||||
// prevent it from emitting debug messages from IOFetch class. Such an error
|
||||
@ -88,14 +87,14 @@ public:
|
||||
TEST_TIMEOUT);
|
||||
}
|
||||
|
||||
// @brief Destructor.
|
||||
/// @brief Destructor
|
||||
//
|
||||
// Sets the asiodns logging level back to DEBUG.
|
||||
virtual ~DNSClientTest() {
|
||||
asiodns::logger.setSeverity(isc::log::DEBUG);
|
||||
};
|
||||
|
||||
// @brief Exchange completion callback.
|
||||
/// @brief Exchange completion callback
|
||||
//
|
||||
// This callback is called when the exchange with the DNS server is
|
||||
// complete or an error occurred. This includes the occurrence of a timeout.
|
||||
@ -133,7 +132,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// @brief Handler invoked when test timeout is hit.
|
||||
/// @brief Handler invoked when test timeout is hit
|
||||
//
|
||||
// This callback stops all running (hanging) tasks on IO service.
|
||||
void testTimeoutHandler() {
|
||||
@ -141,7 +140,7 @@ public:
|
||||
FAIL() << "Test timeout hit.";
|
||||
}
|
||||
|
||||
// @brief Handler invoked when test request is received.
|
||||
/// @brief Handler invoked when test request is received
|
||||
//
|
||||
// This callback handler is installed when performing async read on a
|
||||
// socket to emulate reception of the DNS Update request by a server.
|
||||
@ -180,7 +179,7 @@ public:
|
||||
*remote);
|
||||
}
|
||||
|
||||
// @brief Request handler for testing clients using TSIG
|
||||
/// @brief Request handler for testing clients using TSIG
|
||||
//
|
||||
// This callback handler is installed when performing async read on a
|
||||
// socket to emulate reception of the DNS Update request with TSIG by a
|
||||
|
@ -176,6 +176,10 @@ a client's error or a server's purged database.
|
||||
% DHCP4_DHCP4O6_BAD_PACKET received malformed DHCPv4o6 packet: %1
|
||||
A malformed DHCPv4o6 packet was received.
|
||||
|
||||
% DHCP4_DHCP4O6_PACKET_RECEIVED received DHCPv4o6 packet from DHCPv4 server (type %1) for %2 on interface %3
|
||||
This debug message is printed when the server is receiving a DHCPv4o6
|
||||
from the DHCPv4 server over inter-process communication.
|
||||
|
||||
% DHCP4_DHCP4O6_PACKET_SEND %1: trying to send packet %2 (type %3) to %4 on interface %5 encapsulating %6: %7 (type %8)
|
||||
The arguments specify the client identification information (HW address
|
||||
and client identifier), DHCPv6 message name and type, source IPv6
|
||||
@ -706,7 +710,3 @@ will drop its message if the received message was DHCPDISCOVER,
|
||||
and will send DHCPNAK if the received message was DHCPREQUEST.
|
||||
The argument includes the client and the transaction identification
|
||||
information.
|
||||
|
||||
% DHCP6_DHCP4O6_PACKET_RECEIVED received DHCPv4o6 packet from DHCPv6 server (type %1) for %2 on interface %3
|
||||
This debug message is printed when the server is receiving a DHCPv4o6
|
||||
from the DHCPv6 server over inter-process communication.
|
||||
|
@ -236,7 +236,7 @@ public:
|
||||
/// @brief returns Kea version on stdout and exit.
|
||||
/// redeclaration/redefinition. @ref Daemon::getVersion()
|
||||
static std::string getVersion(bool extended);
|
||||
|
||||
|
||||
/// @brief Main server processing loop.
|
||||
///
|
||||
/// Main server processing loop. Call the processing step routine
|
||||
|
@ -63,7 +63,7 @@ void Dhcp4to6Ipc::handler() {
|
||||
|
||||
// from Dhcpv4Srv::run_one() after receivePacket()
|
||||
if (pkt) {
|
||||
LOG_DEBUG(packet4_logger, DBG_DHCP4_BASIC, DHCP6_DHCP4O6_PACKET_RECEIVED)
|
||||
LOG_DEBUG(packet4_logger, DBG_DHCP4_BASIC, DHCP4_DHCP4O6_PACKET_RECEIVED)
|
||||
.arg(static_cast<int>(pkt->getType()))
|
||||
.arg(pkt->getRemoteAddr().toText())
|
||||
.arg(pkt->getIface());
|
||||
@ -89,7 +89,7 @@ void Dhcp4to6Ipc::handler() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the DHCPv4 message
|
||||
// Get the DHCPv4 message.
|
||||
OptionPtr msg = msgs.begin()->second;
|
||||
if (!msg) {
|
||||
LOG_DEBUG(packet4_logger, DBG_DHCP4_DETAIL, DHCP4_DHCP4O6_BAD_PACKET)
|
||||
|
@ -6900,7 +6900,7 @@ outputFormatted(const std::string& config) {
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace isc {
|
||||
namespace dhcp {
|
||||
@ -6931,9 +6931,9 @@ extractConfig(const std::string& config) {
|
||||
++extract_count;
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
} // namespace test
|
||||
} // namespace dhcp
|
||||
} // namespace isc
|
||||
|
||||
namespace {
|
||||
|
||||
@ -7120,8 +7120,16 @@ TEST_P(Dhcp4GetConfigTest, run) {
|
||||
EXPECT_TRUE(isEquivalent(unparsed, unparsed2));
|
||||
}
|
||||
|
||||
/// Define the parameterized test loop
|
||||
INSTANTIATE_TEST_CASE_P(Dhcp4GetConfigTest, Dhcp4GetConfigTest,
|
||||
::testing::Range(static_cast<size_t>(0), max_config_counter));
|
||||
|
||||
class IntToString {
|
||||
public:
|
||||
std::string operator()(const testing::TestParamInfo<size_t>& n) {
|
||||
return to_string(n.param);
|
||||
}
|
||||
};
|
||||
|
||||
/// Define the parameterized test loop.
|
||||
INSTANTIATE_TEST_CASE_P(Dhcp4GetConfigTest, Dhcp4GetConfigTest,
|
||||
::testing::Range(static_cast<size_t>(0),
|
||||
max_config_counter),
|
||||
IntToString());
|
||||
} // namespace
|
||||
|
@ -344,8 +344,16 @@ TEST_P(Dhcp4GetConfigTest, run) {
|
||||
EXPECT_TRUE(isEquivalent(unparsed, unparsed2));
|
||||
}
|
||||
|
||||
/// Define the parameterized test loop
|
||||
INSTANTIATE_TEST_CASE_P(Dhcp4GetConfigTest, Dhcp4GetConfigTest,
|
||||
::testing::Range(static_cast<size_t>(0), max_config_counter));
|
||||
|
||||
class IntToString {
|
||||
public:
|
||||
std::string operator()(const testing::TestParamInfo<size_t>& n) {
|
||||
return to_string(n.param);
|
||||
}
|
||||
};
|
||||
|
||||
/// Define the parameterized test loop.
|
||||
INSTANTIATE_TEST_CASE_P(Dhcp4GetConfigTest, Dhcp4GetConfigTest,
|
||||
::testing::Range(static_cast<size_t>(0),
|
||||
max_config_counter),
|
||||
IntToString());
|
||||
} // namespace
|
||||
|
@ -763,7 +763,7 @@ processing will continue, but the response will only contain generic
|
||||
configuration and no addresses or prefixes. The argument includes
|
||||
the client and the transaction identification information.
|
||||
|
||||
% DHCP6_UNKNOWN_MSG_RECEIVED received unknown message (type %d) on interface %2
|
||||
% DHCP6_UNKNOWN_MSG_RECEIVED received unknown message (type %1) on interface %2
|
||||
This debug message is printed when server receives a message of unknown type.
|
||||
That could either mean missing functionality or invalid or broken relay or client.
|
||||
The list of formally defined message types is available here:
|
||||
|
@ -6459,7 +6459,7 @@ outputFormatted(const std::string& config) {
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
namespace isc {
|
||||
namespace dhcp {
|
||||
@ -6490,9 +6490,9 @@ extractConfig(const std::string& config) {
|
||||
++extract_count;
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
} // namespace test
|
||||
} // namespace dhcp
|
||||
} // namespace isc
|
||||
|
||||
namespace {
|
||||
|
||||
@ -6682,8 +6682,16 @@ TEST_P(Dhcp6GetConfigTest, run) {
|
||||
EXPECT_TRUE(isEquivalent(unparsed, unparsed2));
|
||||
}
|
||||
|
||||
/// Define the parameterized test loop
|
||||
INSTANTIATE_TEST_CASE_P(Dhcp6GetConfigTest, Dhcp6GetConfigTest,
|
||||
::testing::Range(static_cast<size_t>(0), max_config_counter));
|
||||
|
||||
class IntToString {
|
||||
public:
|
||||
std::string operator()(const testing::TestParamInfo<size_t>& n) {
|
||||
return to_string(n.param);
|
||||
}
|
||||
};
|
||||
|
||||
/// Define the parameterized test loop.
|
||||
INSTANTIATE_TEST_CASE_P(Dhcp6GetConfigTest, Dhcp6GetConfigTest,
|
||||
::testing::Range(static_cast<size_t>(0),
|
||||
max_config_counter),
|
||||
IntToString());
|
||||
} // namespace
|
||||
|
@ -348,8 +348,16 @@ TEST_P(Dhcp6GetConfigTest, run) {
|
||||
EXPECT_TRUE(isEquivalent(unparsed, unparsed2));
|
||||
}
|
||||
|
||||
/// Define the parameterized test loop
|
||||
INSTANTIATE_TEST_CASE_P(Dhcp6GetConfigTest, Dhcp6GetConfigTest,
|
||||
::testing::Range(static_cast<size_t>(0), max_config_counter));
|
||||
|
||||
class IntToString {
|
||||
public:
|
||||
std::string operator()(const testing::TestParamInfo<size_t>& n) {
|
||||
return to_string(n.param);
|
||||
}
|
||||
};
|
||||
|
||||
/// Define the parameterized test loop.
|
||||
INSTANTIATE_TEST_CASE_P(Dhcp6GetConfigTest, Dhcp6GetConfigTest,
|
||||
::testing::Range(static_cast<size_t>(0),
|
||||
max_config_counter),
|
||||
IntToString());
|
||||
} // namespace
|
||||
|
1
src/bin/perfdhcp/.gitignore
vendored
1
src/bin/perfdhcp/.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
/perfdhcp
|
||||
/perfdhcp.1
|
||||
/perfdhcp.8
|
||||
|
@ -145,7 +145,7 @@ public:
|
||||
|
||||
/// \brief Creates an address from over wire data.
|
||||
///
|
||||
/// \param family AF_NET for IPv4 or AF_NET6 for IPv6.
|
||||
/// \param family AF_INET for IPv4 or AF_INET6 for IPv6.
|
||||
/// \param data pointer to first char of data
|
||||
///
|
||||
/// \return Created IOAddress object
|
||||
|
@ -1235,7 +1235,7 @@ prettyPrint(ConstElementPtr element, std::ostream& out,
|
||||
|
||||
// open the list
|
||||
out << "[" << (complex ? "\n" : " ");
|
||||
|
||||
|
||||
// iterate on items
|
||||
typedef std::vector<ElementPtr> ListType;
|
||||
const ListType& l = element->listValue();
|
||||
|
@ -5,12 +5,11 @@
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include <config.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <log/logger_support.h>
|
||||
#include <util/unittests/run_all.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
int
|
||||
main(int argc, char* argv[]) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <asiolink/io_address.h>
|
||||
#include <exceptions/exceptions.h>
|
||||
#include <dhcp/dhcp6.h>
|
||||
#include <dhcp/option6_pdexclude.h>
|
||||
#include <exceptions/exceptions.h>
|
||||
|
@ -5,6 +5,7 @@
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <dhcp/dhcp4.h>
|
||||
#include <dhcp/dhcp6.h>
|
||||
#include <dhcp/option4_addrlst.h>
|
||||
@ -39,7 +40,6 @@ using namespace isc::util;
|
||||
namespace isc {
|
||||
namespace dhcp {
|
||||
|
||||
|
||||
OptionDefinition::OptionDefinition(const std::string& name,
|
||||
const uint16_t code,
|
||||
const std::string& type,
|
||||
@ -655,7 +655,6 @@ OptionDefinition::writeToBuffer(Option::Universe u,
|
||||
<< " is not valid.");
|
||||
}
|
||||
|
||||
|
||||
// Write a prefix.
|
||||
OptionDataTypeUtil::writePrefix(PrefixLen(len), address, buf);
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace {
|
||||
/// it around for the future.
|
||||
class OptionDefinitionTest : public ::testing::Test {
|
||||
public:
|
||||
// @brief Constructor.
|
||||
/// @brief Constructor
|
||||
OptionDefinitionTest() { }
|
||||
|
||||
};
|
||||
@ -1611,7 +1611,7 @@ TEST_F(OptionDefinitionTest, tuple4Tokenized) {
|
||||
OpaqueDataTuple tuple(OpaqueDataTuple::LENGTH_1_BYTE);
|
||||
ASSERT_NO_THROW(option_cast->readTuple(tuple));
|
||||
EXPECT_EQ("foobar", tuple.getText());
|
||||
}
|
||||
}
|
||||
|
||||
// This test verifies that a definition of an option with a single DHCPv6
|
||||
// tuple can be created and that the instance of this option can be
|
||||
@ -1640,7 +1640,7 @@ TEST_F(OptionDefinitionTest, tuple6Tokenized) {
|
||||
OpaqueDataTuple tuple(OpaqueDataTuple::LENGTH_2_BYTES);
|
||||
ASSERT_NO_THROW(option_cast->readTuple(tuple));
|
||||
EXPECT_EQ("foobar", tuple.getText());
|
||||
}
|
||||
}
|
||||
|
||||
// This test verifies that a definition of an option with an array
|
||||
// of DHCPv4 tuples can be created and that the instance of this option
|
||||
|
@ -217,9 +217,10 @@ public:
|
||||
result_ = result;
|
||||
received_ncr_ = ncr;
|
||||
}
|
||||
// @brief Handler invoked when test timeout is hit.
|
||||
//
|
||||
// This callback stops all running (hanging) tasks on IO service.
|
||||
|
||||
/// @brief Handler invoked when test timeout is hit
|
||||
///
|
||||
/// This callback stops all running (hanging) tasks on IO service.
|
||||
void testTimeoutHandler() {
|
||||
io_service_.stop();
|
||||
FAIL() << "Test timeout hit.";
|
||||
@ -656,9 +657,9 @@ public:
|
||||
sent_ncrs_.push_back(ncr);
|
||||
}
|
||||
|
||||
// @brief Handler invoked when test timeout is hit.
|
||||
//
|
||||
// This callback stops all running (hanging) tasks on IO service.
|
||||
/// @brief Handler invoked when test timeout is hit
|
||||
///
|
||||
/// This callback stops all running (hanging) tasks on IO service.
|
||||
void testTimeoutHandler() {
|
||||
io_service_.stop();
|
||||
FAIL() << "Test timeout hit.";
|
||||
|
@ -1534,7 +1534,6 @@ private:
|
||||
/// @brief Number of consecutive DHCPv6 leases' reclamations after
|
||||
/// which there are still expired leases in the database.
|
||||
uint16_t incomplete_v6_reclamations_;
|
||||
|
||||
};
|
||||
|
||||
/// @brief A pointer to the @c AllocEngine object.
|
||||
|
@ -7,9 +7,9 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <dhcp/libdhcp++.h>
|
||||
#include <dhcp/option_space.h>
|
||||
#include <dhcpsrv/cfg_option.h>
|
||||
#include <dhcp/dhcp6.h>
|
||||
#include <dhcp/option_space.h>
|
||||
#include <util/encode/hex.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
@ -285,5 +285,5 @@ CfgOption::toElement() const {
|
||||
return (result);
|
||||
}
|
||||
|
||||
} // end of namespace isc::dhcp
|
||||
} // end of namespace isc
|
||||
} // namespace dhcp
|
||||
} // namespace isc
|
||||
|
@ -1607,6 +1607,7 @@ CqlHostDataSourceImpl::getAll(const HWAddrPtr& hwaddr, const DuidPtr& duid) cons
|
||||
// Run statement.
|
||||
ConstHostCollection result = getHostCollection(CqlHostExchange::GET_HOST_BY_HOST_ID,
|
||||
where_values);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
@ -1642,6 +1643,7 @@ CqlHostDataSourceImpl::getAll4(const asiolink::IOAddress& address) const {
|
||||
// Run statement.
|
||||
ConstHostCollection result = getHostCollection(CqlHostExchange::GET_HOST_BY_IPV4_ADDRESS,
|
||||
where_values);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
@ -58,8 +58,7 @@ public:
|
||||
/// @param statement_tag prepared statement being executed; defaults to an
|
||||
/// invalid index
|
||||
virtual void
|
||||
createBindForSelect(AnyArray &data,
|
||||
StatementTag statement_tag = NULL) override = 0;
|
||||
createBindForSelect(AnyArray &data, StatementTag statement_tag = NULL) override = 0;
|
||||
|
||||
/// @brief Copy received data into the derived class' object.
|
||||
///
|
||||
@ -115,8 +114,9 @@ class CqlLease4Exchange : public CqlLeaseExchange {
|
||||
public:
|
||||
/// @brief Constructor
|
||||
///
|
||||
/// The initialization of the variables here is only to satisfy cppcheck -
|
||||
/// all variables are initialized/set in the methods before they are used.
|
||||
/// The initialization of the variables here is only to satisfy
|
||||
/// cppcheck - all variables are initialized/set in the methods before
|
||||
/// they are used.
|
||||
///
|
||||
/// @param connection connection used for this query
|
||||
explicit CqlLease4Exchange(const CqlConnection &connection);
|
||||
@ -138,8 +138,7 @@ public:
|
||||
/// @param lease Updated lease information.
|
||||
/// @param data lease info in CQL format will be stored here
|
||||
/// @param statement_tag tag identifying the query (optional)
|
||||
void createBindForUpdate(const Lease4Ptr &lease,
|
||||
AnyArray &data,
|
||||
void createBindForUpdate(const Lease4Ptr &lease, AnyArray &data,
|
||||
StatementTag statement_tag = NULL);
|
||||
|
||||
/// @brief Create CQL_BIND objects for Lease4 Pointer
|
||||
@ -329,7 +328,7 @@ StatementMap CqlLease4Exchange::tagged_statements_{
|
||||
|
||||
// Gets an IPv4 lease with specified hardware addr and subnet-id
|
||||
{GET_LEASE4_HWADDR_SUBID,
|
||||
{GET_LEASE4_HWADDR_SUBID,
|
||||
{GET_LEASE4_HWADDR_SUBID,
|
||||
"SELECT "
|
||||
"address, hwaddr, client_id, valid_lifetime, expire, subnet_id, "
|
||||
"fqdn_fwd, fqdn_rev, hostname, state "
|
||||
@ -431,10 +430,9 @@ CqlLease4Exchange::createBindForInsert(const Lease4Ptr &lease, AnyArray &data) {
|
||||
data.add(&state_);
|
||||
|
||||
} catch (const Exception &ex) {
|
||||
isc_throw(DbOperationError,
|
||||
"CqlLease4Exchange::createBindForInsert(): "
|
||||
"could not create bind array from Lease4: "
|
||||
<< lease_->addr_.toText() << ", reason: " << ex.what());
|
||||
isc_throw(DbOperationError, "CqlLease4Exchange::createBindForInsert(): "
|
||||
"could not create bind array from Lease4: " << lease_->addr_.toText()
|
||||
<< ", reason: " << ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
@ -541,8 +539,6 @@ CqlLease4Exchange::createBindForDelete(const IOAddress &address, AnyArray &data,
|
||||
|
||||
try {
|
||||
// address: int
|
||||
// The address in the Lease structure is an IOAddress object.
|
||||
// Convert this to an integer for storage.
|
||||
address_ = static_cast<cass_int32_t>(address.toUint32());
|
||||
|
||||
// Start with a fresh array.
|
||||
@ -552,8 +548,8 @@ CqlLease4Exchange::createBindForDelete(const IOAddress &address, AnyArray &data,
|
||||
} catch (const Exception &ex) {
|
||||
isc_throw(DbOperationError,
|
||||
"CqlLease4Exchange::createBindForDelete(): "
|
||||
"could not create bind array from Lease4: "
|
||||
<< lease_->addr_.toText() << ", reason: " << ex.what());
|
||||
"could not create bind array with address: "
|
||||
<< address_ << ", reason: " << ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
@ -639,7 +635,7 @@ CqlLease4Exchange::retrieve() {
|
||||
return (result);
|
||||
} catch (const Exception &ex) {
|
||||
isc_throw(DbOperationError,
|
||||
"CqlLease4Exchange::retrieveLease(): "
|
||||
"CqlLease4Exchange::retrieve(): "
|
||||
"could not convert data to Lease4, reason: "
|
||||
<< ex.what());
|
||||
}
|
||||
@ -732,7 +728,7 @@ class CqlLease6Exchange : public CqlLeaseExchange {
|
||||
public:
|
||||
/// @brief Constructor
|
||||
///
|
||||
/// The initialization of the variables here is nonly to satisfy
|
||||
/// The initialization of the variables here is only to satisfy
|
||||
/// cppcheck - all variables are initialized/set in the methods before
|
||||
/// they are used.
|
||||
///
|
||||
@ -741,7 +737,7 @@ public:
|
||||
|
||||
/// @brief Create CQL_BIND objects for Lease6 Pointer
|
||||
///
|
||||
/// Fills in the CQL_BIND array for sending data in the Lease4 object to
|
||||
/// Fills in the CQL_BIND array for sending data in the Lease6 object to
|
||||
/// the database. Used for INSERT statements.
|
||||
///
|
||||
/// @param lease The lease information to be inserted
|
||||
@ -750,7 +746,7 @@ public:
|
||||
|
||||
/// @brief Create CQL_BIND objects for Lease6 Pointer
|
||||
///
|
||||
/// Fills in the CQL_BIND array for sending data in the Lease4 object to
|
||||
/// Fills in the CQL_BIND array for sending data in the Lease6 object to
|
||||
/// the database. Used for UPDATE statements.
|
||||
///
|
||||
/// @param lease Updated lease information.
|
||||
@ -761,13 +757,14 @@ public:
|
||||
|
||||
/// @brief Create CQL_BIND objects for Lease4 Pointer
|
||||
///
|
||||
/// Fills in the CQL_BIND array for sending data in the Lease4 object to
|
||||
/// Fills in the CQL_BIND array for sending data in the Lease6 object to
|
||||
/// the database. Used for DELETE statements.
|
||||
///
|
||||
/// @param address address of the lease to be deleted
|
||||
/// @param data lease info in CQL format will be stored here
|
||||
/// @param statement_tag tag identifying the query (optional)
|
||||
void createBindForDelete(const IOAddress &address, AnyArray &data,
|
||||
void createBindForDelete(const IOAddress &address,
|
||||
AnyArray &data,
|
||||
StatementTag statement_tag = NULL);
|
||||
|
||||
/// @brief Create BIND array to receive data
|
||||
@ -776,13 +773,13 @@ public:
|
||||
///
|
||||
/// @param data info returned by CQL will be stored here
|
||||
/// @param statement_tag tag identifying the query (optional)
|
||||
void createBindForSelect(AnyArray &data,
|
||||
StatementTag statement_tag = NULL) override;
|
||||
virtual void
|
||||
createBindForSelect(AnyArray &data, StatementTag statement_tag = NULL) override;
|
||||
|
||||
/// @brief Retrieves the Lease6 object in Kea format
|
||||
///
|
||||
/// @return C++ representation of the object being returned
|
||||
boost::any retrieve() override;
|
||||
virtual boost::any retrieve() override;
|
||||
|
||||
/// @brief Retrieves zero or more IPv6 leases
|
||||
///
|
||||
@ -963,7 +960,8 @@ CqlLease6Exchange::CqlLease6Exchange(const CqlConnection &connection)
|
||||
void
|
||||
CqlLease6Exchange::createBindForInsert(const Lease6Ptr &lease, AnyArray &data) {
|
||||
if (!lease) {
|
||||
isc_throw(BadValue, "Lease6 object is NULL");
|
||||
isc_throw(BadValue, "CqlLease6Exchange::createBindForInsert(): "
|
||||
"Lease6 object is NULL");
|
||||
}
|
||||
// Store lease object to ensure it remains valid.
|
||||
lease_ = lease;
|
||||
@ -1087,7 +1085,8 @@ void
|
||||
CqlLease6Exchange::createBindForUpdate(const Lease6Ptr &lease, AnyArray &data,
|
||||
StatementTag /* unused */) {
|
||||
if (!lease) {
|
||||
isc_throw(BadValue, "Lease6 object is NULL");
|
||||
isc_throw(BadValue, "CqlLease6Exchange::createBindForUpdate(): "
|
||||
"Lease6 object is NULL");
|
||||
}
|
||||
// Store lease object to ensure it remains valid.
|
||||
lease_ = lease;
|
||||
@ -1225,8 +1224,6 @@ CqlLease6Exchange::createBindForDelete(const IOAddress &address, AnyArray &data,
|
||||
// structure.
|
||||
try {
|
||||
// address: varchar
|
||||
// The address in the Lease structure is an IOAddress object.
|
||||
// Convert this to an integer for storage.
|
||||
address_ = address.toText();
|
||||
|
||||
// Start with a fresh array.
|
||||
@ -1356,11 +1353,12 @@ CqlLease6Exchange::retrieve() {
|
||||
result->cltt_ = cltt;
|
||||
|
||||
result->state_ = state_;
|
||||
return result;
|
||||
|
||||
return (result);
|
||||
} catch (const Exception &ex) {
|
||||
isc_throw(DbOperationError,
|
||||
"CqlLease6Exchange::retrieve(): "
|
||||
"could not convert data to Lease4, reason: "
|
||||
"could not convert data to Lease6, reason: "
|
||||
<< ex.what());
|
||||
}
|
||||
return Lease6Ptr();
|
||||
@ -1391,11 +1389,10 @@ CqlLease6Exchange::getLease(StatementTag &statement_tag, AnyArray &data,
|
||||
// Return single record if present, else clear the lease.
|
||||
const size_t collection_size = collection.size();
|
||||
if (collection_size >= 2u) {
|
||||
isc_throw(
|
||||
MultipleRecords,
|
||||
"CqlLease6Exchange::getLease(): multiple records were found in "
|
||||
"the database where only one was expected for statement "
|
||||
<< statement_tag);
|
||||
isc_throw(MultipleRecords,
|
||||
"CqlLease6Exchange::getLease(): multiple records were found in "
|
||||
"the database where only one was expected for statement "
|
||||
<< statement_tag);
|
||||
} else if (collection_size == 0u) {
|
||||
result.reset();
|
||||
} else {
|
||||
@ -1467,8 +1464,7 @@ CqlLeaseMgr::addLease(const Lease4Ptr &lease) {
|
||||
|
||||
AnyArray data;
|
||||
|
||||
std::unique_ptr<CqlLease4Exchange> exchange4(
|
||||
new CqlLease4Exchange(dbconn_));
|
||||
std::unique_ptr<CqlLease4Exchange> exchange4(new CqlLease4Exchange(dbconn_));
|
||||
exchange4->createBindForInsert(lease, data);
|
||||
try {
|
||||
exchange4->executeMutation(dbconn_, data, CqlLease4Exchange::INSERT_LEASE4);
|
||||
@ -1578,7 +1574,7 @@ CqlLeaseMgr::getLease4(const ClientId &clientid) const {
|
||||
std::unique_ptr<CqlLease4Exchange> exchange4(new CqlLease4Exchange(dbconn_));
|
||||
exchange4->getLeaseCollection(CqlLease4Exchange::GET_LEASE4_CLIENTID, data, result);
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
Lease4Ptr
|
||||
@ -1684,7 +1680,7 @@ CqlLeaseMgr::getLeases6(Lease::Type lease_type, const DUID &duid, uint32_t iaid)
|
||||
std::unique_ptr<CqlLease6Exchange> exchange6(new CqlLease6Exchange(dbconn_));
|
||||
exchange6->getLeaseCollection(CqlLease6Exchange::GET_LEASE6_DUID_IAID, data, result);
|
||||
|
||||
return result;
|
||||
return (result);
|
||||
}
|
||||
|
||||
Lease6Collection
|
||||
@ -1715,6 +1711,7 @@ CqlLeaseMgr::getLeases6(Lease::Type lease_type, const DUID &duid, uint32_t iaid,
|
||||
Lease6Collection result;
|
||||
std::unique_ptr<CqlLease6Exchange> exchange6(new CqlLease6Exchange(dbconn_));
|
||||
exchange6->getLeaseCollection(CqlLease6Exchange::GET_LEASE6_DUID_IAID_SUBID, data, result);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
@ -1734,8 +1731,7 @@ CqlLeaseMgr::getExpiredLeases6(Lease6Collection &expired_leases,
|
||||
LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, DHCPSRV_CQL_GET_EXPIRED6)
|
||||
.arg(max_leases);
|
||||
|
||||
std::unique_ptr<CqlLease6Exchange> exchange6(
|
||||
new CqlLease6Exchange(dbconn_));
|
||||
std::unique_ptr<CqlLease6Exchange> exchange6(new CqlLease6Exchange(dbconn_));
|
||||
exchange6->getExpiredLeases(max_leases, expired_leases);
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ Pkt6Ptr Dhcp4o6IpcBase::receive() {
|
||||
option_vendor.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Vendor option must exist.
|
||||
if (!option_vendor) {
|
||||
LOG_WARN(dhcpsrv_logger, DHCPSRV_DHCP4O6_RECEIVED_BAD_PACKET)
|
||||
|
@ -11,6 +11,11 @@
|
||||
#include <dhcpsrv/db_exceptions.h>
|
||||
#include <dhcpsrv/mysql_connection.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <utility>
|
||||
#include <string>
|
||||
|
||||
namespace isc {
|
||||
namespace dhcp {
|
||||
|
||||
@ -306,7 +311,6 @@ public:
|
||||
virtual void rollback();
|
||||
|
||||
private:
|
||||
|
||||
/// @brief Pointer to the implementation of the @ref MySqlHostDataSource.
|
||||
MySqlHostDataSourceImpl* impl_;
|
||||
};
|
||||
@ -315,3 +319,4 @@ private:
|
||||
}
|
||||
|
||||
#endif // MYSQL_HOST_DATA_SOURCE_H
|
||||
|
||||
|
@ -27,7 +27,7 @@ const uint32_t PG_SCHEMA_VERSION_MINOR = 0;
|
||||
// statement.
|
||||
const size_t PGSQL_MAX_PARAMETERS_IN_QUERY = 32;
|
||||
|
||||
/// @brief Define a PostgreSQL SQL statement
|
||||
/// @brief Define a PostgreSQL statement.
|
||||
///
|
||||
/// Each statement is associated with an index, which is used to reference the
|
||||
/// associated prepared statement.
|
||||
@ -49,6 +49,7 @@ struct PgSqlTaggedStatement {
|
||||
const char* text;
|
||||
};
|
||||
|
||||
/// @{
|
||||
/// @brief Constants for PostgreSQL data types
|
||||
/// These are defined by PostgreSQL in <catalog/pg_type.h>, but including
|
||||
/// this file is extraordinarily convoluted, so we'll use these to fill-in.
|
||||
@ -62,7 +63,7 @@ const size_t OID_INT4 = 23; // 4 byte int
|
||||
const size_t OID_TEXT = 25;
|
||||
const size_t OID_VARCHAR = 1043;
|
||||
const size_t OID_TIMESTAMP = 1114;
|
||||
///@}
|
||||
/// @}
|
||||
|
||||
/// @brief RAII wrapper for PostgreSQL Result sets
|
||||
///
|
||||
@ -293,7 +294,7 @@ private:
|
||||
/// that use instances of PgSqlConnection.
|
||||
class PgSqlConnection : public DatabaseConnection {
|
||||
public:
|
||||
/// @brief Define the PgSql error state for a duplicate key error
|
||||
/// @brief Define the PgSql error state for a duplicate key error.
|
||||
static const char DUPLICATE_KEY[];
|
||||
|
||||
/// @brief Constructor
|
||||
|
@ -165,10 +165,10 @@ public:
|
||||
/// @brief Test lease retrieval using client id, HW address and subnet id.
|
||||
void testGetLease4ClientIdHWAddrSubnetId();
|
||||
|
||||
// @brief Get lease4 by hardware address (2)
|
||||
//
|
||||
// Check that the system can cope with getting a hardware address of
|
||||
// any size.
|
||||
/// @brief Get lease4 by hardware address (2)
|
||||
///
|
||||
/// Check that the system can cope with getting a hardware address of
|
||||
/// any size.
|
||||
void testGetLease4HWAddrSize();
|
||||
|
||||
/// @brief Check GetLease4 methods - access by Hardware Address & Subnet ID
|
||||
|
@ -169,7 +169,7 @@ public:
|
||||
return (option_universe_);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
/// @brief Flag determining scanner debugging.
|
||||
bool trace_scanning_;
|
||||
|
||||
|
@ -154,7 +154,7 @@ public:
|
||||
return ("");
|
||||
}
|
||||
|
||||
// @brief Destructor
|
||||
/// @brief Destructor
|
||||
virtual ~DStubProcess();
|
||||
};
|
||||
|
||||
|
@ -327,7 +327,7 @@ class StatsMgr : public boost::noncopyable {
|
||||
|
||||
/// @}
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
/// @brief Private constructor.
|
||||
/// StatsMgr is a singleton. It should be accessed using @ref instance
|
||||
|
@ -134,15 +134,13 @@ signalAndWait(CondVar* condvar, Mutex* mutex) {
|
||||
condvar->wait(*mutex);
|
||||
}
|
||||
|
||||
TEST_F(CondVarTest,
|
||||
#ifdef HAS_UNDEFINED_PTHREAD_BEHAVIOR
|
||||
DISABLED_destroyWhileWait
|
||||
TEST_F(CondVarTest, DISABLED_destroyWhileWait) {
|
||||
#else
|
||||
// This tests had to be disabled because it hangs on most of the OS used in lab
|
||||
// TODO fix destroyWhileWait test
|
||||
DISABLED_destroyWhileWait
|
||||
TEST_F(CondVarTest, DISABLED_destroyWhileWait) {
|
||||
#endif
|
||||
) {
|
||||
// We'll destroy a CondVar object while the thread is still waiting
|
||||
// on it. This will trigger an assertion failure.
|
||||
if (!isc::util::unittests::runningOnValgrind()) {
|
||||
|
@ -79,13 +79,11 @@ TEST(MutexTest, lockNonBlocking) {
|
||||
#endif // ENABLE_DEBUG
|
||||
|
||||
// Destroying a locked mutex is a bad idea as well
|
||||
TEST(MutexTest,
|
||||
#ifdef HAS_UNDEFINED_PTHREAD_BEHAVIOR
|
||||
DISABLED_destroyLocked
|
||||
TEST(MutexTest, DISABLED_destroyLocked) {
|
||||
#else
|
||||
destroyLocked
|
||||
TEST(MutexTest, destroyLocked) {
|
||||
#endif
|
||||
) {
|
||||
if (!isc::util::unittests::runningOnValgrind()) {
|
||||
EXPECT_DEATH_IF_SUPPORTED({
|
||||
Mutex* mutex = new Mutex;
|
||||
|
Loading…
x
Reference in New Issue
Block a user