2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-29 13:07:50 +00:00

[5208] Multiple fixes as a result of review.

The most notable change is the update of the MySQL trigger which
deletes options as a consequence of deletion of the host.
This commit is contained in:
Marcin Siodelski 2017-04-24 16:19:37 +02:00
parent 401d36348b
commit 20d70ed0b3
4 changed files with 33 additions and 4 deletions

View File

@ -207,7 +207,7 @@
<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

View 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);

View 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';

View 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';