From: Razvan Becheriu Date: Tue, 6 Dec 2016 09:41:25 +0000 (+0200) Subject: Merge remote-tracking branch 'isc-kea/master' into isc-kea-cassandra-update X-Git-Tag: kea5574_base~10^2~1^2~34 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7d84550e70e1008a9c5242e04fabebf8159c07e4;p=thirdparty%2Fkea.git Merge remote-tracking branch 'isc-kea/master' into isc-kea-cassandra-update --- 7d84550e70e1008a9c5242e04fabebf8159c07e4 diff --cc doc/guide/install.xml index 023b563e26,96fc40c54e..a578964812 --- a/doc/guide/install.xml +++ b/doc/guide/install.xml @@@ -144,7 -150,37 +150,37 @@@ Debian and Ubuntu - The development tools "make". + The development tools automake, libtool, pkg-config. + + + + + + The MySQL client and the client development libraries, when using - the --with-dhcp-mysql configuration flag to build the Kea MySQL ++ the --with-mysql configuration flag to build the Kea MySQL + database backend. In this case an instance of the MySQL server + running locally or on a machine reachable over a network + is required. Note that + running the unit tests requires a local MySQL server. + + + + + + The PostgreSQL client and the client development libraries, when - using the --with-dhcp-pgsql configuration flag to build the Kea ++ using the --with-pgsql configuration flag to build the Kea + PostgreSQL database backend. In this case an instance of the + PostgreSQL server running locally or on some other machine, + reachable over the network from the machine running Kea, is + required. Note that running the unit tests requires a local + PostgreSQL server. + + + + + + googletest (version 1.6 or later), when using the --with-gtest configuration + option to build the unit tests. @@@ -268,19 -321,21 +321,21 @@@ - --with-boost-lib-dir - --with-dhcp-mysql ++ --with-mysql - Specify the path to Boost libraries to link with - (usually there should be no reason to specify this option). + + Build Kea with code to allow it to store leases (and access + host reservations) in a MySQL database. - --with-botan-config - --with-dhcp-pgsql ++ --with-pgsql - Specify the path to the botan-config - script to build with Botan for the crypto code. + + Build Kea with code to allow it to store leases (and access + host reservations) in a PostgreSQL database. @@@ -479,11 -525,12 +525,12 @@@ Build and install Kea as described in , with the following modification. To enable the MySQL database code, at the - "configure" step (see ), do: - "configure" step (see ), the --with-dhcp-mysql switch ++ "configure" step (see ), the --with-mysql switch + should be specified: - ./configure [other-options] --with-dhcp-mysql + ./configure [other-options] --with-mysql - Or specify the location of the MySQL configuration program - "mysql_config" if MySQL was not installed in the default location: + If MySQL was not installed in the default location, the location of the MySQL + configuration program "mysql_config" should be included with the switch, i.e. - ./configure [other-options] --with-dhcp-mysql=path-to-mysql_config + ./configure [other-options] --with-mysql=path-to-mysql_config See for details regarding @@@ -500,12 -547,12 +547,12 @@@ Build and install Kea as described in , with the following modification. To enable the PostgreSQL database code, at the - "configure" step (see ), do: - "configure" step (see ), the --with-dhcp-pgsql switch ++ "configure" step (see ), the --with-pgsql switch + should be specified: - ./configure [other-options] --with-dhcp-pgsql + ./configure [other-options] --with-pgsql - Or specify the location of the PostgreSQL configuration - program "pg_config" if PostgreSQL was not installed in - the default location: + If PostgreSQL was not installed in the default location, the location of the PostgreSQL + configuration program "pg_config" should be included with the switch, i.e. - ./configure [other-options] --with-dhcp-pgsql=path-to-pg_config + ./configure [other-options] --with-pgsql=path-to-pg_config See for details regarding diff --cc src/lib/dhcpsrv/cql_lease_mgr.cc index 2b6119c74c,f7486c6054..9f47231208 --- a/src/lib/dhcpsrv/cql_lease_mgr.cc +++ b/src/lib/dhcpsrv/cql_lease_mgr.cc @@@ -451,19 -563,19 +451,19 @@@ public // address: int // The address in the Lease structure is an IOAddress object. // Convert this to an integer for storage. - addr4_ = static_cast(uint32_t(lease_->addr_)); - addr4_ = lease_->addr_.toUint32(); - data.add(&addr4_); ++ addr4_ = static_cast(lease_->addr_.toUint32()); + data.add(reinterpret_cast(&addr4_)); // hwaddr: blob - HWAddrPtr hwaddr = lease_->hwaddr_; - if (hwaddr) { - if (hwaddr->hwaddr_.size() > HWAddr::MAX_HWADDR_LEN) { - isc_throw(DbOperationError, "Hardware address length " << + if (lease_->hwaddr_) { + if (lease_->hwaddr_->hwaddr_.size() > HWAddr::MAX_HWADDR_LEN) { + isc_throw(DbOperationError, "hardware address " << + lease_->hwaddr_->toText() << " of length " << lease_->hwaddr_->hwaddr_.size() << - " exceeds maximum allowed of " << + " exceeds maximum allowed length of " << HWAddr::MAX_HWADDR_LEN); } - hwaddr_ = hwaddr->hwaddr_; + hwaddr_ = lease_->hwaddr_->hwaddr_; } else { hwaddr_.clear(); } @@@ -1123,8 -1387,8 +1123,8 @@@ CqlLeaseMgr::getLease4(const isc::asiol // Set up the WHERE clause value CqlDataArray data; - cass_int32_t addr4_data = static_cast(uint32_t(addr)); - uint32_t addr4_data = addr.toUint32(); - data.add(&addr4_data); ++ cass_int32_t addr4_data = static_cast(addr.toUint32()); + data.add(reinterpret_cast(&addr4_data)); // Get the data Lease4Ptr result; @@@ -1426,8 -1707,8 +1426,8 @@@ CqlLeaseMgr::updateLease4(const Lease4P data.remove(0); // Set up the WHERE clause and append it to the SQL_BIND array - cass_int32_t addr4_data = static_cast(uint32_t(lease->addr_)); - uint32_t addr4_data = lease->addr_.toUint32(); - data.add(&addr4_data); ++ cass_int32_t addr4_data = static_cast(lease->addr_.toUint32()); + data.add(reinterpret_cast(&addr4_data)); // Drop to common update code updateLeaseCommon(stindex, data, lease, *exchange4_); @@@ -1506,18 -1805,22 +1506,18 @@@ CqlLeaseMgr::deleteLease(const isc::asi CqlDataArray data; if (addr.isV4()) { - cass_int32_t addr4_data = static_cast(uint32_t(addr)); - uint32_t addr4_data = addr.toUint32(); - data.add(&addr4_data); ++ cass_int32_t addr4_data = static_cast(addr.toUint32()); + data.add(reinterpret_cast(&addr4_data)); - return deleteLeaseCommon(DELETE_LEASE4, data, *exchange4_); + return (deleteLeaseCommon(DELETE_LEASE4, data, *exchange4_)); } else { - std::string text_buffer = addr.toText(); - uint32_t addr6_length = text_buffer.size(); - char addr6_buffer[ADDRESS6_TEXT_MAX_LEN + 1]; - if (addr6_length >= sizeof(addr6_buffer)) { - isc_throw(BadValue, "address value is too large: " << text_buffer); + if (addr_data.size() > ADDRESS6_TEXT_MAX_LEN) { + isc_throw(BadValue, "deleteLease(): " << + "address " << addr_data << " of length " << + addr_data.size() << " exceeds maximum allowed length of " << + ADDRESS6_TEXT_MAX_LEN); } - if (addr6_length) { - memcpy(addr6_buffer, text_buffer.c_str(), addr6_length); - } - addr6_buffer[addr6_length] = '\0'; - data.add(addr6_buffer); + data.add(reinterpret_cast(&addr_data)); - return deleteLeaseCommon(DELETE_LEASE6, data, *exchange6_); + return (deleteLeaseCommon(DELETE_LEASE6, data, *exchange6_)); } }