Parcourir la source

[2342] Address comments in second review.

Stephen Morris il y a 12 ans
Parent
commit
a0f0141e8e

+ 12 - 0
configure.ac

@@ -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

+ 0 - 12
src/lib/dhcp/lease_mgr.cc

@@ -12,18 +12,6 @@
 // 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;

+ 3 - 3
src/lib/dhcp/lease_mgr.h

@@ -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

+ 3 - 3
src/lib/dhcp/lease_mgr_factory.h

@@ -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

+ 1 - 0
src/lib/dhcp/mysql_lease_mgr.cc

@@ -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

+ 3 - 3
src/lib/dhcp/mysql_lease_mgr.h

@@ -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

+ 7 - 2
src/lib/dhcp/tests/mysql_lease_mgr_unittest.cc

@@ -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