]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[master] Merge branch 'trac4212' trac4268a_base
authorMarcin Siodelski <marcin@isc.org>
Wed, 23 Mar 2016 12:51:55 +0000 (13:51 +0100)
committerMarcin Siodelski <marcin@isc.org>
Wed, 23 Mar 2016 12:51:55 +0000 (13:51 +0100)
14 files changed:
1  2 
AUTHORS
src/lib/dhcp/classify.cc
src/lib/dhcp/classify.h
src/lib/dhcp/tests/classify_unittest.cc
src/lib/dhcpsrv/host.cc
src/lib/dhcpsrv/host.h
src/lib/dhcpsrv/mysql_connection.cc
src/lib/dhcpsrv/mysql_connection.h
src/lib/dhcpsrv/mysql_host_data_source.cc
src/lib/dhcpsrv/mysql_host_data_source.h
src/lib/dhcpsrv/tests/generic_host_data_source_unittest.cc
src/lib/dhcpsrv/tests/generic_host_data_source_unittest.h
src/lib/dhcpsrv/tests/host_unittest.cc
src/lib/dhcpsrv/tests/mysql_host_data_source_unittest.cc

diff --cc AUTHORS
Simple merge
index ed499266c0212c6c087a56a6fa3f2f14b625d0aa,f7d0d7ad64be598b2c697f7acbe0b1ee63b691ba..95fc5dd08bcd18b790d3f33c7e5427b1afcf7a50
@@@ -1,8 -1,16 +1,8 @@@
- // Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+ // Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
  //
 -// Permission to use, copy, modify, and/or distribute this software for any
 -// purpose with or without fee is hereby granted, provided that the above
 -// copyright notice and this permission notice appear in all copies.
 -//
 -// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 -// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 -// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 -// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 -// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 -// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 -// PERFORMANCE OF THIS SOFTWARE.
 +// This Source Code Form is subject to the terms of the Mozilla Public
 +// License, v. 2.0. If a copy of the MPL was not distributed with this
 +// file, You can obtain one at http://mozilla.org/MPL/2.0/.
  
  #include <config.h>
  #include <dhcp/classify.h>
index 61911f1047910ef266850d4946a1803f3b62d7ba,f717e492d6493603103ff72c9112a210e50a83da..174930c348433e51b8b16efcc61a554c6e72910d
@@@ -1,8 -1,16 +1,8 @@@
- // Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
 -// Copyright (C) 2014, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
++// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
  //
 -// Permission to use, copy, modify, and/or distribute this software for any
 -// purpose with or without fee is hereby granted, provided that the above
 -// copyright notice and this permission notice appear in all copies.
 -//
 -// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 -// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 -// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 -// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 -// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 -// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 -// PERFORMANCE OF THIS SOFTWARE.
 +// This Source Code Form is subject to the terms of the Mozilla Public
 +// License, v. 2.0. If a copy of the MPL was not distributed with this
 +// file, You can obtain one at http://mozilla.org/MPL/2.0/.
  
  #ifndef CLASSIFY_H
  #define CLASSIFY_H
index 9de2e284c5d8a27f00bf862ce8854b1e83bdcf37,9312d673af57ee2912d207f3a5e370ff3e86e668..215551eb066236b746bf656d8ee8f8b026403092
@@@ -1,8 -1,16 +1,8 @@@
--// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
++// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
  //
 -// Permission to use, copy, modify, and/or distribute this software for any
 -// purpose with or without fee is hereby granted, provided that the above
 -// copyright notice and this permission notice appear in all copies.
 -//
 -// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 -// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 -// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 -// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 -// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 -// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 -// PERFORMANCE OF THIS SOFTWARE.
 +// This Source Code Form is subject to the terms of the Mozilla Public
 +// License, v. 2.0. If a copy of the MPL was not distributed with this
 +// file, You can obtain one at http://mozilla.org/MPL/2.0/.
  
  #include <config.h>
  #include <dhcp/classify.h>
index be6e8439b646f4a26be74aa56b4a9796545be61e,4ab549fd18433bba106d6b2935ea1f41ce5d006c..38aa8aa5935688e8377913ab2d93d5223d1f00af
@@@ -78,8 -86,7 +78,8 @@@ Host::Host(const uint8_t* identifier, c
        ipv6_subnet_id_(ipv6_subnet_id),
        ipv4_reservation_(asiolink::IOAddress::IPV4_ZERO_ADDRESS()),
        hostname_(hostname), dhcp4_client_classes_(dhcp4_client_classes),
-       dhcp6_client_classes_(dhcp6_client_classes),
 -      dhcp6_client_classes_(dhcp6_client_classes), host_id_(0) {
++      dhcp6_client_classes_(dhcp6_client_classes), host_id_(0),
 +      cfg_option4_(), cfg_option6_() {
  
      // Initialize HWAddr or DUID
      setIdentifier(identifier, identifier_len, identifier_type);
@@@ -100,8 -107,7 +100,8 @@@ Host::Host(const std::string& identifie
        ipv6_subnet_id_(ipv6_subnet_id),
        ipv4_reservation_(asiolink::IOAddress::IPV4_ZERO_ADDRESS()),
        hostname_(hostname), dhcp4_client_classes_(dhcp4_client_classes),
-       dhcp6_client_classes_(dhcp6_client_classes),
 -      dhcp6_client_classes_(dhcp6_client_classes), host_id_(0) {
++      dhcp6_client_classes_(dhcp6_client_classes), host_id_(0),
 +      cfg_option4_(new CfgOption()), cfg_option6_(new CfgOption()) {
  
      // Initialize HWAddr or DUID
      setIdentifier(identifier, identifier_name);
index b3622a8a568e1f4e96a141e812b7dc5318b588a5,f04ec847fd956ccf0c1495a90ab9d92abcb3f614..93cd4816fec0a22f4883c250d513456f8be493ca
@@@ -482,10 -470,10 +497,15 @@@ private
      ClientClasses dhcp4_client_classes_;
      /// @brief Collection of classes associated with a DHCPv6 client.
      ClientClasses dhcp6_client_classes_;
+     /// @brief HostID (a unique identifier assigned when the host is stored in
+     ///                MySQL or Pgsql)
+     uint64_t host_id_;
++
 +    /// @brief Pointer to the DHCPv4 option data configuration for this host.
 +    CfgOptionPtr cfg_option4_;
 +    /// @brief Pointer to the DHCPv6 option data configuration for this host.
 +    CfgOptionPtr cfg_option6_;
  };
  
  /// @brief Pointer to the @c Host object.
index 5b114e3069aee535af21eae8724492102a9fa2b2,fbfb345f25edd5b542f6baa83ebf056406fd7c49..196ecce850d8a4f9c874a1f3f64dbe2a5de108dc
@@@ -1,8 -1,16 +1,8 @@@
--// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
++// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
  //
 -// Permission to use, copy, modify, and/or distribute this software for any
 -// purpose with or without fee is hereby granted, provided that the above
 -// copyright notice and this permission notice appear in all copies.
 -//
 -// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 -// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 -// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 -// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 -// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 -// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 -// PERFORMANCE OF THIS SOFTWARE.
 +// This Source Code Form is subject to the terms of the Mozilla Public
 +// License, v. 2.0. If a copy of the MPL was not distributed with this
 +// file, You can obtain one at http://mozilla.org/MPL/2.0/.
  
  
  #include <dhcpsrv/dhcpsrv_log.h>
index 23f3a92f208ac2fb8c23a0c17d84dbdaacd2f6b0,8d208234ff34ecf7c7198c40d663fb7afa10e922..a630529d70fbe36b961b4da324f4114bcc684ffe
@@@ -1,8 -1,16 +1,8 @@@
--// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
++// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
  //
 -// Permission to use, copy, modify, and/or distribute this software for any
 -// purpose with or without fee is hereby granted, provided that the above
 -// copyright notice and this permission notice appear in all copies.
 -//
 -// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 -// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 -// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 -// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 -// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 -// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 -// PERFORMANCE OF THIS SOFTWARE.
 +// This Source Code Form is subject to the terms of the Mozilla Public
 +// License, v. 2.0. If a copy of the MPL was not distributed with this
 +// file, You can obtain one at http://mozilla.org/MPL/2.0/.
  
  #ifndef MYSQL_CONNECTION_H
  #define MYSQL_CONNECTION_H
index 17518df8c41a0d20ba7b791b0c23badc79a7e28e,3f1f5ab5852b6a0c44b23a2dc4fefc7f2bc94ac4..104c0a3c2e0a6bd4c4e746a338c0e5ca00bb4d84
@@@ -1,8 -1,16 +1,8 @@@
--// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
++// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
  //
 -// Permission to use, copy, modify, and/or distribute this software for any
 -// purpose with or without fee is hereby granted, provided that the above
 -// copyright notice and this permission notice appear in all copies.
 -//
 -// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 -// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 -// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 -// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 -// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 -// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 -// PERFORMANCE OF THIS SOFTWARE.
 +// This Source Code Form is subject to the terms of the Mozilla Public
 +// License, v. 2.0. If a copy of the MPL was not distributed with this
 +// file, You can obtain one at http://mozilla.org/MPL/2.0/.
  
  #include <config.h>
  
index 890ae72fa00037321af889bca0edc0bb9c50dbd2,3f729f8df6219064a58c0006e41683a9e97f58b4..656b7c747bb8114148dd0a06bb378a8fb09b5cc6
@@@ -1,8 -1,16 +1,8 @@@
--// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
++// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
  //
 -// Permission to use, copy, modify, and/or distribute this software for any
 -// purpose with or without fee is hereby granted, provided that the above
 -// copyright notice and this permission notice appear in all copies.
 -//
 -// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 -// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 -// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 -// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 -// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 -// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 -// PERFORMANCE OF THIS SOFTWARE.
 +// This Source Code Form is subject to the terms of the Mozilla Public
 +// License, v. 2.0. If a copy of the MPL was not distributed with this
 +// file, You can obtain one at http://mozilla.org/MPL/2.0/.
  
  #ifndef MYSQL_HOST_DATA_SOURCE_H
  #define MYSQL_HOST_DATA_SOURCE_H
@@@ -221,13 -219,14 +211,14 @@@ public
      ///
      /// The contents of the enum are indexes into the list of SQL statements
      enum StatementIndex {
 -        INSERT_HOST,          // Insert new host to collection
 +        INSERT_HOST,            // Insert new host to collection
+         INSERT_V6_RESRV,        // Insert v6 reservation
          GET_HOST_HWADDR_DUID,   // Gets hosts by DUID and/or HW address
 -        GET_HOST_ADDR,                // Gets hosts by IPv4 address
 -        GET_HOST_SUBID4_DHCPID,       // Gets host by IPv4 SubnetID, HW address/DUID
 -        GET_HOST_SUBID6_DHCPID,       // Gets host by IPv6 SubnetID, HW address/DUID
 +        GET_HOST_ADDR,          // Gets hosts by IPv4 address
 +        GET_HOST_SUBID4_DHCPID, // Gets host by IPv4 SubnetID, HW address/DUID
 +        GET_HOST_SUBID6_DHCPID, // Gets host by IPv6 SubnetID, HW address/DUID
          GET_HOST_SUBID_ADDR,    // Gets host by IPv4 SubnetID and IPv4 address
 -        GET_HOST_PREFIX,      // Gets host by IPv6 prefix
 +        GET_HOST_PREFIX,        // Gets host by IPv6 prefix
          GET_VERSION,            // Obtain version number
          NUM_STATEMENTS          // Number of statements
      };
index 29e9152f57dfe7faf137b04c4b567ececfec58cd,a178b63c0d5af709e0221b364a2b3a66a3cc8188..80ac5934cd722165ca29253207aa97512bf658df
@@@ -1,8 -1,16 +1,8 @@@
--// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
++// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
  //
 -// Permission to use, copy, modify, and/or distribute this software for any
 -// purpose with or without fee is hereby granted, provided that the above
 -// copyright notice and this permission notice appear in all copies.
 -//
 -// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 -// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 -// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 -// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 -// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 -// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 -// PERFORMANCE OF THIS SOFTWARE.
 +// This Source Code Form is subject to the terms of the Mozilla Public
 +// License, v. 2.0. If a copy of the MPL was not distributed with this
 +// file, You can obtain one at http://mozilla.org/MPL/2.0/.
  
  #include <dhcpsrv/tests/generic_host_data_source_unittest.h>
  #include <dhcpsrv/tests/test_utils.h>
index 06173aff1ddb54d2000fe21f10d03b08c2df12fb,ed136c5be0f53c838710cb794221f66f35499fdc..c40b29a00aab6837be139ea21de74d1a3328b0f4
@@@ -1,8 -1,16 +1,8 @@@
--// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
++// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
  //
 -// Permission to use, copy, modify, and/or distribute this software for any
 -// purpose with or without fee is hereby granted, provided that the above
 -// copyright notice and this permission notice appear in all copies.
 -//
 -// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 -// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 -// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 -// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 -// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 -// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 -// PERFORMANCE OF THIS SOFTWARE.
 +// This Source Code Form is subject to the terms of the Mozilla Public
 +// License, v. 2.0. If a copy of the MPL was not distributed with this
 +// file, You can obtain one at http://mozilla.org/MPL/2.0/.
  
  #ifndef GENERIC_HOST_DATA_SOURCE_UNITTEST_H
  #define GENERIC_HOST_DATA_SOURCE_UNITTEST_H