]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
fixed minor issues
authormayya <mayya@itwm.fraunhofer.de>
Mon, 16 Jul 2018 21:53:29 +0000 (23:53 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Mon, 23 Jul 2018 11:39:16 +0000 (13:39 +0200)
12 files changed:
src/lib/dhcpsrv/host.cc
src/lib/dhcpsrv/host.h
src/lib/dhcpsrv/memfile_lease_mgr.h
src/lib/dhcpsrv/mysql_host_data_source.cc
src/lib/dhcpsrv/mysql_lease_mgr.h
src/lib/dhcpsrv/pgsql_lease_mgr.h
src/lib/dhcpsrv/tests/alloc_engine_expiration_unittest.cc
src/lib/dhcpsrv/tests/host_unittest.cc
src/share/database/scripts/cql/dhcpdb_create.cql
src/share/database/scripts/mysql/dhcpdb_create.mysql
src/share/database/scripts/mysql/upgrade_5.2_to_6.0.sh.in
src/share/database/scripts/pgsql/upgrade_4.0_to_5.0.sh.in

index f7d2664dfa4d8fbfa3c65729cf1a2c9f59d5e874..4ec23c0d818928882bf5b35d7058e5ab590cd5e4 100644 (file)
@@ -73,8 +73,7 @@ AuthKey::operator!=(const AuthKey& other) const {
 IPv6Resrv::IPv6Resrv(const Type& type,
                      const asiolink::IOAddress& prefix,
                      const uint8_t prefix_len)
-    : type_(type), prefix_(asiolink::IOAddress("::")), 
-      prefix_len_(128){
+    : type_(type), prefix_(asiolink::IOAddress("::")), prefix_len_(128) {
     // Validate and set the actual values.
     set(type, prefix, prefix_len);
 }
index 42bc096540929e8276fe94067f94139ea9cdfce0..065df92400d0005d2124b3a7f00f59a93a1dbae1 100644 (file)
@@ -696,6 +696,8 @@ private:
     std::string server_host_name_;
     /// @brief Boot file name (a.k.a. file, carried in DHCPv4 message)
     std::string boot_file_name_;
+            
+    /// @brief HostID (a unique identifier assigned when the host is stored in
     ///     MySQL, PostgreSQL or Cassandra)
     uint64_t host_id_;
 
@@ -710,15 +712,14 @@ private:
     /// we queried other backends for specific host and there was no
     /// entry for it.
     bool negative_;
-    /// @brief keys for authentication .
+    /// @brief key for authentication .
     ///
-    /// This key is a 16 byte value to be used in the authentication field
-    /// During server replies specified in the RFC 3315bis authentication field will
-    /// contain the below key. While sending reconfigure message authentication field 
+    /// key is a 16 byte value to be used in the authentication field.
+    /// Server replies will contain the below key in authentication field as specified in the RFC 3315bis. 
+    //  While sending reconfigure message authentication field 
     /// shall contain MD5 hash computed using this key.
     AuthKey key_;
 
-    /// @brief HostID (a unique identifier assigned when the host is stored in
 };
 
 /// @brief Pointer to the @c Host object.
index 6a1008b4e806d2015b7dff70575f4d55f45424f0..23a12d299f17f0cf78309aa4a307f24391649adb 100644 (file)
@@ -312,6 +312,12 @@ public:
     /// @return Lease collection (may be empty if no IPv6 lease found).
     virtual Lease6Collection getLeases6() const;
 
+    /// @brief Returns IPv6 leases for the DUID.
+    ///
+    /// @todo: implement an optimised of the query using index.
+    /// @return Lease collection (may be empty if no IPv6 lease found) for the DUID.
+    virtual Lease6Collection getLeases6(const DUID& duid) const;
+    
     /// @brief Returns range of IPv6 leases using paging.
     ///
     /// This method implements paged browsing of the lease database. The first
index 372c93ea802cf130b06837ddb7df2900f86cf024..e4bc90aaf828759956a17d73dad805120dda7e1d 100644 (file)
@@ -76,7 +76,6 @@ const size_t BOOT_FILE_NAME_MAX_LEN = 128;
 /// @brief Maximum length of keys.
 const size_t KEY_LEN = 16;
 
-/// @brief Numeric value representing last supported identifier.
 /// @brief Numeric value representing last supported identifier.
 ///
 /// This value is used to validate whether the identifier type stored in
index f9d9286c05dcfd0f369d1b9e45c065077b341d3f..2a0b71f7e75d4bdacb604d2b469c4ac75803e05b 100644 (file)
@@ -309,6 +309,12 @@ public:
     /// @return Lease collection (may be empty if no IPv6 lease found).
     virtual Lease6Collection getLeases6() const;
 
+    /// @brief Returns all IPv6 leases for the DUID.
+    ///
+    /// @todo: implement an optimised of the query using index.
+    /// @return Lease collection (may be empty if no IPv6 lease found) for the DUID.
+    virtual Lease6Collection getLeases6(const DUID& duid) const;
+    
     /// @brief Returns range of IPv6 leases using paging.
     ///
     /// This method implements paged browsing of the lease database. The first
index 423f820bcf89421cf9c8be30589594d788e09387..d67cac1b7be713a80bfa8816b5fa771192502312 100644 (file)
@@ -281,6 +281,12 @@ public:
     /// @return Lease collection (may be empty if no IPv6 lease found).
     virtual Lease6Collection getLeases6() const;
 
+    /// @brief Returns IPv6 leases for the DUID.
+    ///
+    /// @todo: implement an optimised of the query using index.
+    /// @return Lease collection (may be empty if no IPv6 lease found) for the DUID
+    virtual Lease6Collection getLeases6(const DUID& duid) const;
+    
     /// @brief Returns range of IPv6 leases using paging.
     ///
     /// This method implements paged browsing of the lease database. The first
index 81dc571dac71205e9dbbd9bfc44bc3ea8f923d25..49d471b52719380b369a11ba1b7ac97d47522441 100644 (file)
@@ -1590,9 +1590,9 @@ TEST_F(ExpirationAllocEngine6Test, reclaimDeclinedStats) {
 
 // This test verifies that expired leases are reclaimed before they are
 // allocated to another client sending a Request message.
-//TEST_F(ExpirationAllocEngine6Test, reclaimReusedLeases) {
-  //  testReclaimReusedLeases(DHCPV6_REQUEST, false);
-//}
+/TEST_F(ExpirationAllocEngine6Test, reclaimReusedLeases) {
+    testReclaimReusedLeases(DHCPV6_REQUEST, false);
+}
 
 // This test verifies that allocation engine detects that the expired
 // lease has been reclaimed already when it reuses this lease.
index d957afbaa4e23e5b06e54aab02491da508714159..be5af1bc58c291641db0280afab6e88f66041b10 100644 (file)
@@ -1285,5 +1285,3 @@ TEST(AuthKeyTest, basicTest) {
 }
 
 } // end of anonymous namespace
-
-// Test verifies if 
index bdb74b2d7c81a6870f9bdea5453be7267e346ad1..56c1ce8c9c2c5f98219b1178cf08724363a74488 100644 (file)
@@ -276,6 +276,9 @@ INSERT INTO schema_version (version, minor) VALUES(2, 0);
 
 -- This line starts database upgrade to version 3.0
 
+-- This line adds auth_key column into host reservation table 
+ALTER TABLE host_reservations ADD auth_key text;
+
 -- Add a column holding leases for user context.
 ALTER TABLE lease4 ADD user_context text;
 ALTER TABLE lease6 ADD user_context text;
index ab9153705b24045b5ab8b53de24372c3bfb721f8..a6d50a3a42947c227877cc1a099cc056bc277de0 100644 (file)
@@ -679,6 +679,10 @@ SET version = '6', minor = '0';
 
 # This line concludes database upgrade to version 6.0.
 
+#add auth key in host tables
+ALTER TABLE hosts  
+    ADD COLUMN auth_key VARCHAR(16) NULL; 
+
 # Add user context into tables holding leases
 ALTER TABLE lease4 ADD COLUMN user_context TEXT NULL;
 ALTER TABLE lease6 ADD COLUMN user_context TEXT NULL;
index 41736c9b6ecbabd9de5197facb81c716088da96d..3bf129cce432a58813604a254687713ca553a055 100644 (file)
@@ -23,7 +23,6 @@ ALTER TABLE hosts ADD COLUMN user_context TEXT NULL;
 # Add user contexts into tables holding DHCP options
 ALTER TABLE dhcp4_options ADD COLUMN user_context TEXT NULL;
 ALTER TABLE dhcp6_options ADD COLUMN user_context TEXT NULL;
-ALTER TABLE  ipv6_reservations ADD COLUMN auth_key VARCHAR(128) NOT NULL;
 
 # Create index for searching leases by subnet identifier.
 CREATE INDEX lease4_by_subnet_id ON lease4 (subnet_id);
index 88a7b7d65b75ad9e51314c1ec5302079e172263a..326522df8d725c7d9e023438bee3fe9a40b2a5ac 100644 (file)
@@ -19,6 +19,9 @@ psql "$@" >/dev/null <<EOF
 
 START TRANSACTION;
 
+-- Create auth_key in hosts table
+ALTER TABLE hosts ADD COLUMN auth_key  VARCHAR(16) DEFAULT NULL;
+
 -- Add a column holding leases for user context.
 ALTER TABLE lease4 ADD COLUMN user_context TEXT;
 ALTER TABLE lease6 ADD COLUMN user_context TEXT;