]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
Merge branch 'isc-master' into cassandra-update
authorAndrei Pavel <andrei.pavel@qualitance.com>
Thu, 17 Aug 2017 18:15:48 +0000 (21:15 +0300)
committerAndrei Pavel <andrei.pavel@qualitance.com>
Thu, 17 Aug 2017 18:15:48 +0000 (21:15 +0300)
14 files changed:
1  2 
AUTHORS
doc/guide/dhcp4-srv.xml
doc/guide/dhcp6-srv.xml
src/bin/admin/admin-utils.sh
src/bin/admin/kea-admin.in
src/bin/admin/tests/cql_tests.sh.in
src/lib/dhcpsrv/Makefile.am
src/lib/dhcpsrv/cql_connection.cc
src/lib/dhcpsrv/cql_lease_mgr.cc
src/lib/dhcpsrv/cql_lease_mgr.h
src/lib/dhcpsrv/dhcpsrv_messages.mes
src/lib/dhcpsrv/lease_mgr.h
src/lib/dhcpsrv/parsers/dbaccess_parser.cc
src/lib/dhcpsrv/tests/cql_lease_mgr_unittest.cc

diff --cc AUTHORS
index f8fe3e53543c588fab227058c52a1f24982c3df3,cad9cfbd9f75ccdf591a8a97786a04ec611f58af..d38073e35c9750188f6706b0249ce5b1b66a679e
+++ b/AUTHORS
@@@ -131,9 -152,8 +152,9 @@@ Kea uses log4cplus (http://sourceforge.
  Boost (http://www.boost.org/) library for almost everything, and can use Botan
  (http://botan.randombit.net/) or OpenSSL (https://www.openssl.org/) for
  cryptographic operations. It can also optionally use PostgreSQL
 -(http://www.postgresql.org/) and/or MySQL (http://www.mysql.com/) as a database.
 +(http://www.postgresql.org/) and/or MySQL (http://www.mysql.com/) and/or
 +Cassandra (http://cassandra.apache.org/) as a database.
  
- Kea can use googletest for unit-tests (http://code.google.com/p/googletest/).
+ Kea can use googletest for unit-tests (https://github.com/google/googletest).
  
- Kea uses ISC Forge (http://kea.isc.org/wiki/IscForge) for conformance testing.
+ Kea uses ISC Forge (https://github.com/isc-projects/forge/) for conformance testing.
index 49508011beadbe73db4bf60e9033a488afedeb25,49597a559a3e4d37116ad9db527010cfafba0acc..b73a8167999c42b18abb61fa9bf0fef77d7e348c
@@@ -455,10 -459,11 +467,15 @@@ be followed by a comma and another obje
    the DHCPv4 server.  In this case, set the value to the empty string:
  <screen>
  "Dhcp4": { "lease-database": { <userinput>"host" : ""</userinput>, ... }, ... }
 +</screen>
 +  For Cassandra:
 +<screen>
 +"Dhcp4": { "lease-database": { <userinput>"contact_points": ""</userinput>, ... }, ... }
+ </screen>
+   Should the database use a port different than default, it may be
+   specified as well:
+ <screen>
+ "Dhcp4": { "lease-database": { <userinput>"port" : 12345</userinput>, ... }, ... }
  </screen>
    Should the database be located on a different system, you may need to specify a longer interval
    for the connection timeout:
index 5492ff222967ad6072055f3d4df6e4e034de0807,198d3dc4238e9d974d780e50f069b68981a8e418..532beab22decce0882054fa9e026c2dc23cb2b5d
@@@ -450,10 -454,11 +462,16 @@@ be followed by a comma and another obje
    the DHCPv6 server.  In this case, set the value to the empty string:
  <screen>
  "Dhcp6": { "lease-database": { <userinput>"host" : ""</userinput>, ... }, ... }
 +</screen>
 +  For Cassandra:
 +<screen>
 +"Dhcp6": { "lease-database": { <userinput>"contact_points": ""</userinput>, ... }, ... }
+ </screen>
+   Should the database use a port different than default, it may be
+   specified as well:
+ <screen>
+ "Dhcp4": { "lease-database": { <userinput>"port" : 12345</userinput>, ... }, ... }
++>>>>>>> isc-master
  </screen>
    Should the database be located on a different system, you may need to specify a longer interval
    for the connection timeout:
Simple merge
Simple merge
Simple merge
Simple merge
index b4e20c78567e4f1a537550ee40e81ee5353827e9,6959d227a3de6b82b0d62c60190d1ff73081fb83..4e6a410c84b53cad222b8cf2fe0d42f63c118aaa
@@@ -72,12 -67,12 +72,12 @@@ CqlConnection::openDatabase() 
      CassError rc;
      // Set up the values of the parameters
      const char* contact_points = "127.0.0.1";
 -    string scontact_points;
 +    std::string scontact_points;
      try {
-         scontact_points = getParameter("contact_points");
+         scontact_points = getParameter("contact-points");
          contact_points = scontact_points.c_str();
      } catch (...) {
 -        // No host. Fine, we'll use "localhost".
 +        // No host. Fine, we'll use "127.0.0.1".
      }
  
      const char* port = NULL;
index 7175dd23eae24beeba7099aa74afb51336dbbf10,c3030f1b04ca7341f1730b11404bf980c5aa8703..35a79f90b56e4ff0fa783ded5a41e0c9e723c692
@@@ -1768,9 -1882,19 +1768,19 @@@ CqlLeaseMgr::deleteExpiredReclaimedLeas
              result++;
          }
      }
 -    return (result);
 +    return result;
  }
  
+ size_t
+ CqlLeaseMgr::wipeLeases4(const SubnetID& /*subnet_id*/) {
+     isc_throw(NotImplemented, "wipeLeases4 is not implemented for Cassandra backend");
+ }
+ size_t
+ CqlLeaseMgr::wipeLeases6(const SubnetID& /*subnet_id*/) {
+     isc_throw(NotImplemented, "wipeLeases6 is not implemented for Cassandra backend");
+ }
  std::string
  CqlLeaseMgr::getName() const {
      std::string name = "";
index bd5c4b9743c72ccf186545091af420c6ca30cbf6,bff24148a43268664a249dc6688b9169ba1ac75f..ad1f4312a3ebfb8bf12d9e6287c067c0af87c42b
@@@ -322,8 -377,30 +322,30 @@@ public
      /// time will not be deleted.
      ///
      /// @return Number of leases deleted.
 -    virtual uint64_t deleteExpiredReclaimedLeases6(const uint32_t );
 +    virtual uint64_t deleteExpiredReclaimedLeases6(const uint32_t secs);
  
+     /// @brief Removes specified IPv4 leases.
+     ///
+     /// This rather dangerous method is able to remove all leases from specified
+     /// subnet.
+     ///
+     /// @todo: Not implemented yet.
+     ///
+     /// @param subnet_id identifier of the subnet
+     /// @return number of leases removed.
+     virtual size_t wipeLeases4(const SubnetID& subnet_id);
+     /// @brief Removed specified IPv6 leases.
+     ///
+     /// This rather dangerous method is able to remove all leases from specified
+     /// subnet.
+     ///
+     /// @todo: Not implemented yet.
+     ///
+     /// @param subnet_id identifier of the subnet
+     /// @return number of leases removed.
+     virtual size_t wipeLeases6(const SubnetID& subnet_id);
      /// @brief Return backend type
      ///
      /// @return Type of the backend.
Simple merge
Simple merge
index 329d0c50e5f0fe8f8387b3521e3466d8d8d364fb,e4231dc1e28b54e2c370b77342b13760391cf2a4..6a6d0d944d88d7c7e86400951a38a61bbba98017
@@@ -50,11 -55,11 +55,12 @@@ DbAccessParser::parse(CfgDbAccessPtr& c
  
      int64_t lfc_interval = 0;
      int64_t timeout = 0;
+     int64_t port = 0;
      // 2. Update the copy with the passed keywords.
-     BOOST_FOREACH(ConfigPair param, config_value->mapValue()) {
+     BOOST_FOREACH(ConfigPair param, database_config->mapValue()) {
          try {
 -            if ((param.first == "persist") || (param.first == "readonly")) {
 +            if ((param.first == "persist") || (param.first == "readonly") ||
 +                (param.first == "tcp-nodelay")) {
                  values_copy[param.first] = (param.second->boolValue() ?
                                              "true" : "false");
  
                  values_copy[param.first] =
                      boost::lexical_cast<std::string>(timeout);
  
 +            } else if (param.first == "reconnect-wait-time") {
 +                timeout = param.second->intValue();
 +                values_copy[param.first] =
 +                    boost::lexical_cast<std::string>(timeout);
 +
 +            } else if (param.first == "request-timeout") {
 +                timeout = param.second->intValue();
 +                values_copy[param.first] =
 +                    boost::lexical_cast<std::string>(timeout);
 +
 +            } else if (param.first == "tcp-keepalive") {
 +                timeout = param.second->intValue();
 +                values_copy[param.first] =
 +                    boost::lexical_cast<std::string>(timeout);
++
+             } else if (param.first == "port") {
+                 port = param.second->intValue();
+                 values_copy[param.first] =
+                     boost::lexical_cast<std::string>(port);
              } else {
                  values_copy[param.first] = param.second->stringValue();
              }
index a556b9959bb8aa8018a86cef2d9c445d1709816a,3da3658d1e935fd04cb061e37b43deaf2789e3dd..a8902cc346bf36c7bafef5331acf0f1aeb7a841d
@@@ -687,4 -643,14 +687,15 @@@ TEST_F(CqlLeaseMgrTest, deleteExpiredRe
      testDeleteExpiredReclaimedLeases4();
  }
  
 -}; // Of anonymous namespace
+ // Tests that leases from specific subnet can be removed.
+ TEST_F(CqlLeaseMgrTest, DISABLED_wipeLeases4) {
+     testWipeLeases4();
+ }
+ // Tests that leases from specific subnet can be removed.
+ TEST_F(CqlLeaseMgrTest, DISABLED_wipeLeases6) {
+     testWipeLeases6();
+ }
 +}  // namespace
++