BIND 10 trac2472, updated. 487d2cb888f96ca8ab5325dbfa7dfc620e16db54 [2472] Move choice of DHCP6 lease manager to main
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Nov 14 12:45:39 UTC 2012
The branch, trac2472 has been updated
via 487d2cb888f96ca8ab5325dbfa7dfc620e16db54 (commit)
from aa753912fc89315d57601cf73ee18f88afced529 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 487d2cb888f96ca8ab5325dbfa7dfc620e16db54
Author: Stephen Morris <stephen at isc.org>
Date: Wed Nov 14 12:43:15 2012 +0000
[2472] Move choice of DHCP6 lease manager to main
Before this change, the choice of lease manager was set in
ControlledDhcpv6Srv. This means that unit tests for that code
always used the MySQL lease manager (if present). This change
ensures that unit tests always use the Memfile manager.
-----------------------------------------------------------------------
Summary of changes:
src/bin/dhcp6/ctrl_dhcp6_srv.cc | 17 ++---------------
src/bin/dhcp6/ctrl_dhcp6_srv.h | 4 +++-
src/bin/dhcp6/main.cc | 12 +++++++++++-
3 files changed, 16 insertions(+), 17 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc
index 555c9ec..5bcd69e 100644
--- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc
+++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc
@@ -39,19 +39,6 @@ using namespace isc::log;
using namespace isc::util;
using namespace std;
-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.
-#ifdef HAVE_MYSQL
-const char* DBCONFIG = "type=mysql name=kea user=kea password=kea host=localhost";
-#else
-const char* DBCONFIG = "type=memfile";
-#endif
-};
-
namespace isc {
namespace dhcp {
@@ -163,8 +150,8 @@ void ControlledDhcpv6Srv::disconnectSession() {
IfaceMgr::instance().set_session_socket(IfaceMgr::INVALID_SOCKET, NULL);
}
-ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t port)
- : Dhcpv6Srv(port, DBCONFIG), cc_session_(NULL), config_session_(NULL) {
+ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t port, const char* dbconfig)
+ : Dhcpv6Srv(port, dbconfig), cc_session_(NULL), config_session_(NULL) {
server_ = this; // remember this instance for use in callback
}
diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.h b/src/bin/dhcp6/ctrl_dhcp6_srv.h
index 91fc80a..df3b851 100644
--- a/src/bin/dhcp6/ctrl_dhcp6_srv.h
+++ b/src/bin/dhcp6/ctrl_dhcp6_srv.h
@@ -41,7 +41,9 @@ public:
/// @brief Constructor
///
/// @param port UDP port to be opened for DHCP traffic
- ControlledDhcpv6Srv(uint16_t port = DHCP6_SERVER_PORT);
+ /// @param dbconfig Lease manager database configuration string
+ ControlledDhcpv6Srv(uint16_t port = DHCP6_SERVER_PORT,
+ const char* dbconfig = "type=memfile");
/// @brief Destructor.
~ControlledDhcpv6Srv();
diff --git a/src/bin/dhcp6/main.cc b/src/bin/dhcp6/main.cc
index 8eaf60c..c216924 100644
--- a/src/bin/dhcp6/main.cc
+++ b/src/bin/dhcp6/main.cc
@@ -34,6 +34,16 @@ 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.
+#ifdef HAVE_MYSQL
+const char* DBCONFIG = "type=mysql name=kea user=kea password=kea host=localhost";
+#else
+const char* DBCONFIG = "type=memfile";
+#endif
const char* const DHCP6_NAME = "b10-dhcp6";
@@ -102,7 +112,7 @@ main(int argc, char* argv[]) {
int ret = EXIT_SUCCESS;
try {
- ControlledDhcpv6Srv server(port_number);
+ ControlledDhcpv6Srv server(port_number, DBCONFIG);
if (!stand_alone) {
try {
server.establishSession();
More information about the bind10-changes
mailing list