]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[481-remote-subnet4-set-inconsistent-work-when-id-subnet-is-duplicated] Applied Marci...
authorFrancis Dupont <fdupont@isc.org>
Fri, 1 Mar 2019 13:46:16 +0000 (14:46 +0100)
committerFrancis Dupont <fdupont@isc.org>
Tue, 12 Mar 2019 22:20:47 +0000 (18:20 -0400)
src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc

index d4042262b2564ac9ba2cdb91e1927c7ffd0b3ea0..88966bcb1214c1ef20a8ebd5e66d54a98c71ca0c 100644 (file)
@@ -819,7 +819,7 @@ public:
 
         try {
 
-            // Try to insert subnet. If this duplicates primary key, i.e. this
+            // Try to insert subnet. If this duplicates unique key, i.e. this
             // subnet already exists it will throw DuplicateEntry exception in
             // which case we'll try an update.
             conn_.insertQuery(MySqlConfigBackendDHCPv4Impl::INSERT_SUBNET4,
@@ -842,8 +842,9 @@ public:
             deletePools4(subnet);
             deleteOptions4(server_selector, subnet);
 
-            // Need to add one more binding for WHERE clause.
+            // Need to add two more bindings for WHERE clause.
             in_bindings.push_back(MySqlBinding::createInteger<uint32_t>(subnet->getID()));
+            in_bindings.push_back(MySqlBinding::createString(subnet->toText()));
             conn_.updateDeleteQuery(MySqlConfigBackendDHCPv4Impl::UPDATE_SUBNET4,
                                     in_bindings);
         }
@@ -2193,7 +2194,7 @@ TaggedStatementArray tagged_statements = { {
       "  t1_percent = ?,"
       "  t2_percent = ?,"
       "  authoritative = ? "
-      "WHERE subnet_id = ?" },
+      "WHERE subnet_id = ? OR subnet_prefix = ?" },
 
     // Update existing shared network.
     { MySqlConfigBackendDHCPv4Impl::UPDATE_SHARED_NETWORK4,