Commit 79f0d62e authored by Stephen Morris's avatar Stephen Morris
Browse files

[2559] Remove the temporary configuration of the lease database

The DHCP6 server had the lease database configuration temporarily
hard-coded.  With the introduction of database configuration
parameters, that is no longer needed.
parent fdbba41a
......@@ -149,8 +149,8 @@ void ControlledDhcpv6Srv::disconnectSession() {
IfaceMgr::instance().set_session_socket(IfaceMgr::INVALID_SOCKET, NULL);
ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t port, const char* dbconfig)
: Dhcpv6Srv(port, dbconfig), cc_session_(NULL), config_session_(NULL) {
ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t port)
: Dhcpv6Srv(port), cc_session_(NULL), config_session_(NULL) {
server_ = this; // remember this instance for use in callback
......@@ -41,9 +41,7 @@ public:
/// @brief Constructor
/// @param port UDP port to be opened for DHCP traffic
/// @param dbconfig Lease manager database configuration string
ControlledDhcpv6Srv(uint16_t port = DHCP6_SERVER_PORT,
const char* dbconfig = "type=memfile");
ControlledDhcpv6Srv(uint16_t port = DHCP6_SERVER_PORT);
/// @brief Destructor.
......@@ -50,7 +50,7 @@ using namespace std;
namespace isc {
namespace dhcp {
Dhcpv6Srv::Dhcpv6Srv(uint16_t port, const char* dbconfig)
Dhcpv6Srv::Dhcpv6Srv(uint16_t port)
: alloc_engine_(), serverid_(), shutdown_(true) {
LOG_DEBUG(dhcp6_logger, DBG_DHCP6_START, DHCP6_OPEN_SOCKET).arg(port);
......@@ -71,12 +71,6 @@ Dhcpv6Srv::Dhcpv6Srv(uint16_t port, const char* dbconfig)
// Instantiate LeaseMgr
// Instantiate allocation engine
alloc_engine_.reset(new AllocEngine(AllocEngine::ALLOC_ITERATIVE, 100));
......@@ -80,10 +80,7 @@ public:
/// old or create new DUID.
/// @param port port on will all sockets will listen
/// @param dbconfig Lease manager configuration string. The default
/// of the "memfile" manager is used for testing.
Dhcpv6Srv(uint16_t port = DHCP6_SERVER_PORT,
const char* dbconfig = "type=memfile");
Dhcpv6Srv(uint16_t port = DHCP6_SERVER_PORT);
/// @brief Destructor. Used during DHCPv6 service shutdown.
virtual ~Dhcpv6Srv();
......@@ -36,17 +36,6 @@ using namespace std;
/// Dhcpv6Srv and other classes, see \ref dhcpv6Session.
namespace {
// @todo: Replace the next line by extraction from configuration parameters
// This is the "dbconfig" string for the MySQL database. It is likely
// that a long-term solution will be to create the instance of the lease manager
// somewhere other than the Dhcpv6Srv constructor, to give time to extract
// the connection string from the configuration database.
const char* DBCONFIG = "type=mysql name=kea user=kea password=kea host=localhost";
const char* DBCONFIG = "type=memfile";
const char* const DHCP6_NAME = "b10-dhcp6";
......@@ -115,7 +104,7 @@ main(int argc, char* argv[]) {
int ret = EXIT_SUCCESS;
try {
ControlledDhcpv6Srv server(port_number, DBCONFIG);
ControlledDhcpv6Srv server(port_number);
if (!stand_alone) {
try {
......@@ -54,7 +54,16 @@ namespace {
class NakedDhcpv6Srv: public Dhcpv6Srv {
// "naked" Interface Manager, exposes internal members
NakedDhcpv6Srv(uint16_t port):Dhcpv6Srv(port) { }
NakedDhcpv6Srv(uint16_t port) : Dhcpv6Srv(port) {
// Open the "memfile" database for leases
std::string memfile = "type=memfile";
virtual ~NakedDhcpv6Srv() {
// Close the lease database
using Dhcpv6Srv::processSolicit;
using Dhcpv6Srv::processRequest;
......@@ -150,6 +150,13 @@ lease from the memory file database for the specified address.
A debug message issued when the server is attempting to update IPv6
lease from the memory file database for the specified address.
% DHCPSRV_MEMFILE_WARNING using early version of memfile - leases will be lost after a restart
This warning message is issued when the 'memfile' lease database is
opened. The current version of memfile does not store anything
to disk, so lease information will be lost in the event of a restart.
Using this version of memfile in a production environment is NOT
% DHCPSRV_MYSQL_ADD_ADDR4 adding IPv4 lease with address %1
A debug message issued when the server is about to add an IPv4 lease
with the specified address to the MySQL backend database.
......@@ -21,8 +21,7 @@ using namespace isc::dhcp;
Memfile_LeaseMgr::Memfile_LeaseMgr(const ParameterMap& parameters)
: LeaseMgr(parameters) {
std::cout << "Warning: Using memfile database backend. It is usable for limited"
<< " testing only. Leases will be lost after restart." << std::endl;
Memfile_LeaseMgr::~Memfile_LeaseMgr() {
Supports Markdown
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