]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2342] Address comments in second review.
authorStephen Morris <stephen@isc.org>
Mon, 29 Oct 2012 13:43:31 +0000 (13:43 +0000)
committerStephen Morris <stephen@isc.org>
Mon, 29 Oct 2012 13:43:31 +0000 (13:43 +0000)
configure.ac
src/lib/dhcp/lease_mgr.cc
src/lib/dhcp/lease_mgr.h
src/lib/dhcp/lease_mgr_factory.h
src/lib/dhcp/mysql_lease_mgr.cc
src/lib/dhcp/mysql_lease_mgr.h
src/lib/dhcp/tests/mysql_lease_mgr_unittest.cc

index 0c7653675be87b8c49b17680a8f9b1b62532ae4e..1c7c0d81c30c7514a3b3f2aed8f79d94492be4bf 100644 (file)
@@ -1463,6 +1463,18 @@ dnl includes too
                  ${LOG4CPLUS_LIBS}
   SQLite:        $SQLITE_CFLAGS
                  $SQLITE_LIBS
+END
+
+# Avoid confusion on DNS/DHCP and only mention MySQL if it
+# were specified on the command line.
+if test "$MYSQL_CPPFLAGS" != "" ; then
+cat >> config.report << END
+  MySQL:         $MYSQL_CPPFLAGS
+                 $MYSQL_LIBS
+END
+fi
+
+cat >> config.report << END
 
 Features:
   $enable_features
index c86bca3315aca0169bf9e30e96fb59a575968ec0..809c528ef33467031dd6abee5916a64f16cf967a 100644 (file)
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
-#include <algorithm>
-#include <iostream>
-#include <iterator>
-#include <map>
-#include <sstream>
-#include <string>
-#include <utility>
-
-#include <boost/foreach.hpp>
-#include <boost/algorithm/string.hpp>
-
-#include <exceptions/exceptions.h>
 #include <dhcp/lease_mgr.h>
 
 using namespace std;
index fbb1584eb4069aef859d9893c729f3de0b975efe..0f54634835dedd61a5f75783e5c34596dc6371c7 100644 (file)
@@ -12,8 +12,8 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
-#ifndef __LEASE_MGR_H
-#define __LEASE_MGR_H
+#ifndef LEASE_MGR_H
+#define LEASE_MGR_H
 
 #include <fstream>
 #include <map>
@@ -556,4 +556,4 @@ protected:
 }; // end of isc::dhcp namespace
 }; // end of isc namespace
 
-#endif // __LEASE_MGR_H
+#endif // LEASE_MGR_H
index abd1bba60d1896a1573be0145df0f26de3a19164..e9d73bab6cac35f9e9bac2c53263eb6ab56d2837 100644 (file)
@@ -12,8 +12,8 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
-#ifndef __LEASE_MGR_FACTORY_H
-#define __LEASE_MGR_FACTORY_H
+#ifndef LEASE_MGR_FACTORY_H
+#define LEASE_MGR_FACTORY_H
 
 #include <string>
 #include <dhcp/lease_mgr.h>
@@ -120,4 +120,4 @@ private:
 }; // end of isc::dhcp namespace
 }; // end of isc namespace
 
-#endif // __LEASE_MGR_FACTORY_H
+#endif // LEASE_MGR_FACTORY_H
index 6627dfb235e16caeb748b8baaadc330e36f3d9ad..d71de267087a3e8441b91e2f610a2d2fb56ceb13 100644 (file)
@@ -375,6 +375,7 @@ MySqlLeaseMgr::convertToDatabaseTime(time_t cltt, uint32_t valid_lifetime,
                                     MYSQL_TIME& expire) {
 
     // Calculate expiry time and convert to various date/time fields.
+    // @TODO: handle overflows
     time_t expire_time = cltt + valid_lifetime;
 
     // Convert to broken-out time
index 9e28390caaf7bed98d65bba713a1c358be0c0879..e7dc4b2217b2e014016ac607b897833561074066 100644 (file)
@@ -12,8 +12,8 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
-#ifndef __MYSQL_LEASE_MGR_H
-#define __MYSQL_LEASE_MGR_H
+#ifndef MYSQL_LEASE_MGR_H
+#define MYSQL_LEASE_MGR_H
 
 #include <time.h>
 #include <mysql.h>
@@ -402,4 +402,4 @@ private:
 }; // end of isc::dhcp namespace
 }; // end of isc namespace
 
-#endif // __MYSQL_LEASE_MGR_H
+#endif // MYSQL_LEASE_MGR_H
index b267bc3dd9bf567cfb3989e0354676ede917856b..08179d77b23a34a144b3995c3eedd477dd40f9df 100644 (file)
@@ -331,8 +331,13 @@ TEST_F(MySqlLeaseMgrTest, BasicLease6) {
         duid.push_back(i + 5);
     }
     l3->duid_ = boost::shared_ptr<DUID>(new DUID(duid));
-    l3->preferred_lft_ = 0xfffffffc;    // Preferred lifetime
-    l3->valid_lft_ = 0xfffffffd;        // Actual lifetime
+
+    // The times used in the next tests are deliberately restricted - we should
+    // be avle to cope with valid lifetimes up to 0xffffffff.  However, this
+    // will lead to overflows.
+    // @TODO: test overflow conditions when code has been fixed
+    l3->preferred_lft_ = 7200;          // Preferred lifetime
+    l3->valid_lft_ = 7000;              // Actual lifetime
     l3->cltt_ = 234567;                 // Current time of day
     l3->subnet_id_ = l1->subnet_id_;    // Same as l1