]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5208] Multiple fixes as a result of review.
authorMarcin Siodelski <marcin@isc.org>
Mon, 24 Apr 2017 14:19:37 +0000 (16:19 +0200)
committerMarcin Siodelski <marcin@isc.org>
Mon, 24 Apr 2017 14:19:37 +0000 (16:19 +0200)
The most notable change is the update of the MySQL trigger which
deletes options as a consequence of deletion of the host.

doc/guide/hooks.xml
src/lib/dhcpsrv/mysql_host_data_source.cc
src/share/database/scripts/mysql/dhcpdb_create.mysql
src/share/database/scripts/mysql/upgrade_5.0_to_5.1.sh.in

index e63932db425fe1cf2cb7a0d47debebf56fe3f91b..7bfb23e00a6109738b84701ba375f2fce0f6c751 100644 (file)
             <row>
               <entry>Flexible Identifier</entry>
               <entry>Support customers</entry>
-              <entry>Kea 1.2.0 beta</entry>
+              <entry>Kea 1.2.0</entry>
               <entry>Kea software provides a way to handle host reservations
               that include addresses, prefixes, options, client classes and
               other features. The reservation can be based on hardware address,
@@ -582,7 +582,7 @@ link address: 3001::1, hop count: 1, identified by remote-id:
         <para>Currently this library is only available to ISC customers with a
         support contract.</para>
 
-        <para>The library allows defining an expression, using notation
+        <para>The library allows for defining an expression, using notation
         initially used for client classification only. See <xref
         linkend="classification-using-expressions" /> for detailed description
         of the syntax available. One notable difference is that for client
index f571c24d2c51da9c6d4a9a29bc52c128d065404d..8c6efec17ba62e276a1ea62226f9ee3bdc653a33 100644 (file)
@@ -295,11 +295,11 @@ public:
             // The address in the Host structure is an IOAddress object.  Convert
             // this to an integer for storage.
             ipv4_address_ = host->getIPv4Reservation().toUint32();
+            ipv4_address_null_ = ipv4_address_ == 0 ? MLM_TRUE : MLM_FALSE;
             bind_[5].buffer_type = MYSQL_TYPE_LONG;
             bind_[5].buffer = reinterpret_cast<char*>(&ipv4_address_);
             bind_[5].is_unsigned = MLM_TRUE;
-            // bind_[5].is_null = &MLM_FALSE; // commented out for performance
-                                                      // reasons, see memset() above
+            bind_[5].is_null = &ipv4_address_null_;
 
             // hostname : VARCHAR(255) NULL
             strncpy(hostname_, host->getHostname().c_str(), HOSTNAME_MAX_LEN - 1);
index 6ee0df38422a7671bba889f85f99d675d02caf0d..ba946f7b9b42ef8c254f557751f5bb98cb86572a 100644 (file)
@@ -483,6 +483,21 @@ SET version = '5', minor = '0';
 # Add missing 'client-id' host identifier type.
 INSERT INTO host_identifier_type VALUES (3, 'client-id');
 
+# Recreate the trigger removing dependent host entries.
+DROP TRIGGER host_BDEL;
+
+DELIMITER $$
+CREATE TRIGGER host_BDEL BEFORE DELETE ON hosts FOR EACH ROW
+-- Edit trigger body code below this line. Do not edit lines above this one
+BEGIN
+DELETE FROM ipv6_reservations WHERE ipv6_reservations.host_id = OLD.host_id;
+DELETE FROM dhcp4_options WHERE dhcp4_options.host_id = OLD.host_id;
+DELETE FROM dhcp6_options WHERE dhcp6_options.host_id = OLD.host_id;
+END
+$$
+DELIMITER ;
+
+
 # Update the schema version number
 UPDATE schema_version
 SET version = '5', minor = '1';
index 86385badddffefc5c44ae3e19250b431cb0741e0..f8440b3a1222d9f0f8da553a485fb8631366d42a 100644 (file)
@@ -20,6 +20,20 @@ mysql "$@" <<EOF
 # Add missing 'client-id' host identifier type.
 INSERT INTO host_identifier_type VALUES (3, 'client-id');
 
+# Recreate the trigger removing dependent host entries.
+DROP TRIGGER host_BDEL;
+
+DELIMITER $$
+CREATE TRIGGER host_BDEL BEFORE DELETE ON hosts FOR EACH ROW
+-- Edit trigger body code below this line. Do not edit lines above this one
+BEGIN
+DELETE FROM ipv6_reservations WHERE ipv6_reservations.host_id = OLD.host_id;
+DELETE FROM dhcp4_options WHERE dhcp4_options.host_id = OLD.host_id;
+DELETE FROM dhcp6_options WHERE dhcp6_options.host_id = OLD.host_id;
+END
+$$
+DELIMITER ;
+
 # Update the schema version number
 UPDATE schema_version
 SET version = '5', minor = '1';