|
@@ -1,4 +1,4 @@
|
|
-// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
|
|
|
|
|
|
+// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
|
|
//
|
|
//
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
@@ -104,6 +104,12 @@ const size_t ADDRESS6_TEXT_MAX_LEN = 39;
|
|
const my_bool MLM_FALSE = 0; ///< False value
|
|
const my_bool MLM_FALSE = 0; ///< False value
|
|
const my_bool MLM_TRUE = 1; ///< True value
|
|
const my_bool MLM_TRUE = 1; ///< True value
|
|
|
|
|
|
|
|
+/// @brief Maximum length of the hostname stored in DNS.
|
|
|
|
+///
|
|
|
|
+/// This length is restricted by the length of the domain-name carried
|
|
|
|
+/// in the Client FQDN %Option (see RFC4702 and RFC4704).
|
|
|
|
+const size_t HOSTNAME_MAX_LEN = 255;
|
|
|
|
+
|
|
///@}
|
|
///@}
|
|
|
|
|
|
/// @brief MySQL Selection Statements
|
|
/// @brief MySQL Selection Statements
|
|
@@ -123,68 +129,80 @@ TaggedStatement tagged_statements[] = {
|
|
"DELETE FROM lease6 WHERE address = ?"},
|
|
"DELETE FROM lease6 WHERE address = ?"},
|
|
{MySqlLeaseMgr::GET_LEASE4_ADDR,
|
|
{MySqlLeaseMgr::GET_LEASE4_ADDR,
|
|
"SELECT address, hwaddr, client_id, "
|
|
"SELECT address, hwaddr, client_id, "
|
|
- "valid_lifetime, expire, subnet_id "
|
|
|
|
|
|
+ "valid_lifetime, expire, subnet_id, "
|
|
|
|
+ "fqdn_fwd, fqdn_rev, hostname "
|
|
"FROM lease4 "
|
|
"FROM lease4 "
|
|
"WHERE address = ?"},
|
|
"WHERE address = ?"},
|
|
{MySqlLeaseMgr::GET_LEASE4_CLIENTID,
|
|
{MySqlLeaseMgr::GET_LEASE4_CLIENTID,
|
|
"SELECT address, hwaddr, client_id, "
|
|
"SELECT address, hwaddr, client_id, "
|
|
- "valid_lifetime, expire, subnet_id "
|
|
|
|
|
|
+ "valid_lifetime, expire, subnet_id, "
|
|
|
|
+ "fqdn_fwd, fqdn_rev, hostname "
|
|
"FROM lease4 "
|
|
"FROM lease4 "
|
|
"WHERE client_id = ?"},
|
|
"WHERE client_id = ?"},
|
|
{MySqlLeaseMgr::GET_LEASE4_CLIENTID_SUBID,
|
|
{MySqlLeaseMgr::GET_LEASE4_CLIENTID_SUBID,
|
|
"SELECT address, hwaddr, client_id, "
|
|
"SELECT address, hwaddr, client_id, "
|
|
- "valid_lifetime, expire, subnet_id "
|
|
|
|
|
|
+ "valid_lifetime, expire, subnet_id, "
|
|
|
|
+ "fqdn_fwd, fqdn_rev, hostname "
|
|
"FROM lease4 "
|
|
"FROM lease4 "
|
|
"WHERE client_id = ? AND subnet_id = ?"},
|
|
"WHERE client_id = ? AND subnet_id = ?"},
|
|
{MySqlLeaseMgr::GET_LEASE4_HWADDR,
|
|
{MySqlLeaseMgr::GET_LEASE4_HWADDR,
|
|
"SELECT address, hwaddr, client_id, "
|
|
"SELECT address, hwaddr, client_id, "
|
|
- "valid_lifetime, expire, subnet_id "
|
|
|
|
|
|
+ "valid_lifetime, expire, subnet_id, "
|
|
|
|
+ "fqdn_fwd, fqdn_rev, hostname "
|
|
"FROM lease4 "
|
|
"FROM lease4 "
|
|
"WHERE hwaddr = ?"},
|
|
"WHERE hwaddr = ?"},
|
|
{MySqlLeaseMgr::GET_LEASE4_HWADDR_SUBID,
|
|
{MySqlLeaseMgr::GET_LEASE4_HWADDR_SUBID,
|
|
"SELECT address, hwaddr, client_id, "
|
|
"SELECT address, hwaddr, client_id, "
|
|
- "valid_lifetime, expire, subnet_id "
|
|
|
|
|
|
+ "valid_lifetime, expire, subnet_id, "
|
|
|
|
+ "fqdn_fwd, fqdn_rev, hostname "
|
|
"FROM lease4 "
|
|
"FROM lease4 "
|
|
"WHERE hwaddr = ? AND subnet_id = ?"},
|
|
"WHERE hwaddr = ? AND subnet_id = ?"},
|
|
{MySqlLeaseMgr::GET_LEASE6_ADDR,
|
|
{MySqlLeaseMgr::GET_LEASE6_ADDR,
|
|
"SELECT address, duid, valid_lifetime, "
|
|
"SELECT address, duid, valid_lifetime, "
|
|
"expire, subnet_id, pref_lifetime, "
|
|
"expire, subnet_id, pref_lifetime, "
|
|
- "lease_type, iaid, prefix_len "
|
|
|
|
|
|
+ "lease_type, iaid, prefix_len, "
|
|
|
|
+ "fqdn_fwd, fqdn_rev, hostname "
|
|
"FROM lease6 "
|
|
"FROM lease6 "
|
|
"WHERE address = ?"},
|
|
"WHERE address = ?"},
|
|
{MySqlLeaseMgr::GET_LEASE6_DUID_IAID,
|
|
{MySqlLeaseMgr::GET_LEASE6_DUID_IAID,
|
|
"SELECT address, duid, valid_lifetime, "
|
|
"SELECT address, duid, valid_lifetime, "
|
|
"expire, subnet_id, pref_lifetime, "
|
|
"expire, subnet_id, pref_lifetime, "
|
|
- "lease_type, iaid, prefix_len "
|
|
|
|
|
|
+ "lease_type, iaid, prefix_len, "
|
|
|
|
+ "fqdn_fwd, fqdn_rev, hostname "
|
|
"FROM lease6 "
|
|
"FROM lease6 "
|
|
"WHERE duid = ? AND iaid = ?"},
|
|
"WHERE duid = ? AND iaid = ?"},
|
|
{MySqlLeaseMgr::GET_LEASE6_DUID_IAID_SUBID,
|
|
{MySqlLeaseMgr::GET_LEASE6_DUID_IAID_SUBID,
|
|
"SELECT address, duid, valid_lifetime, "
|
|
"SELECT address, duid, valid_lifetime, "
|
|
"expire, subnet_id, pref_lifetime, "
|
|
"expire, subnet_id, pref_lifetime, "
|
|
- "lease_type, iaid, prefix_len "
|
|
|
|
|
|
+ "lease_type, iaid, prefix_len, "
|
|
|
|
+ "fqdn_fwd, fqdn_rev, hostname "
|
|
"FROM lease6 "
|
|
"FROM lease6 "
|
|
"WHERE duid = ? AND iaid = ? AND subnet_id = ?"},
|
|
"WHERE duid = ? AND iaid = ? AND subnet_id = ?"},
|
|
{MySqlLeaseMgr::GET_VERSION,
|
|
{MySqlLeaseMgr::GET_VERSION,
|
|
"SELECT version, minor FROM schema_version"},
|
|
"SELECT version, minor FROM schema_version"},
|
|
{MySqlLeaseMgr::INSERT_LEASE4,
|
|
{MySqlLeaseMgr::INSERT_LEASE4,
|
|
"INSERT INTO lease4(address, hwaddr, client_id, "
|
|
"INSERT INTO lease4(address, hwaddr, client_id, "
|
|
- "valid_lifetime, expire, subnet_id) "
|
|
|
|
- "VALUES (?, ?, ?, ?, ?, ?)"},
|
|
|
|
|
|
+ "valid_lifetime, expire, subnet_id, "
|
|
|
|
+ "fqdn_fwd, fqdn_rev, hostname) "
|
|
|
|
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"},
|
|
{MySqlLeaseMgr::INSERT_LEASE6,
|
|
{MySqlLeaseMgr::INSERT_LEASE6,
|
|
"INSERT INTO lease6(address, duid, valid_lifetime, "
|
|
"INSERT INTO lease6(address, duid, valid_lifetime, "
|
|
"expire, subnet_id, pref_lifetime, "
|
|
"expire, subnet_id, pref_lifetime, "
|
|
- "lease_type, iaid, prefix_len) "
|
|
|
|
- "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"},
|
|
|
|
|
|
+ "lease_type, iaid, prefix_len, "
|
|
|
|
+ "fqdn_fwd, fqdn_rev, hostname) "
|
|
|
|
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"},
|
|
{MySqlLeaseMgr::UPDATE_LEASE4,
|
|
{MySqlLeaseMgr::UPDATE_LEASE4,
|
|
"UPDATE lease4 SET address = ?, hwaddr = ?, "
|
|
"UPDATE lease4 SET address = ?, hwaddr = ?, "
|
|
"client_id = ?, valid_lifetime = ?, expire = ?, "
|
|
"client_id = ?, valid_lifetime = ?, expire = ?, "
|
|
- "subnet_id = ? "
|
|
|
|
|
|
+ "subnet_id = ?, fqdn_fwd = ?, fqdn_rev = ?, "
|
|
|
|
+ "hostname = ? "
|
|
"WHERE address = ?"},
|
|
"WHERE address = ?"},
|
|
{MySqlLeaseMgr::UPDATE_LEASE6,
|
|
{MySqlLeaseMgr::UPDATE_LEASE6,
|
|
"UPDATE lease6 SET address = ?, duid = ?, "
|
|
"UPDATE lease6 SET address = ?, duid = ?, "
|
|
"valid_lifetime = ?, expire = ?, subnet_id = ?, "
|
|
"valid_lifetime = ?, expire = ?, subnet_id = ?, "
|
|
"pref_lifetime = ?, lease_type = ?, iaid = ?, "
|
|
"pref_lifetime = ?, lease_type = ?, iaid = ?, "
|
|
- "prefix_len = ? "
|
|
|
|
|
|
+ "prefix_len = ?, fqdn_fwd = ?, fqdn_rev = ?, "
|
|
|
|
+ "hostname = ? "
|
|
"WHERE address = ?"},
|
|
"WHERE address = ?"},
|
|
// End of list sentinel
|
|
// End of list sentinel
|
|
{MySqlLeaseMgr::NUM_STATEMENTS, NULL}
|
|
{MySqlLeaseMgr::NUM_STATEMENTS, NULL}
|
|
@@ -275,7 +293,7 @@ public:
|
|
|
|
|
|
class MySqlLease4Exchange : public MySqlLeaseExchange {
|
|
class MySqlLease4Exchange : public MySqlLeaseExchange {
|
|
/// @brief Set number of database columns for this lease structure
|
|
/// @brief Set number of database columns for this lease structure
|
|
- static const size_t LEASE_COLUMNS = 6;
|
|
|
|
|
|
+ static const size_t LEASE_COLUMNS = 9;
|
|
|
|
|
|
public:
|
|
public:
|
|
/// @brief Constructor
|
|
/// @brief Constructor
|
|
@@ -294,7 +312,10 @@ public:
|
|
columns_[3] = "valid_lifetime";
|
|
columns_[3] = "valid_lifetime";
|
|
columns_[4] = "expire";
|
|
columns_[4] = "expire";
|
|
columns_[5] = "subnet_id";
|
|
columns_[5] = "subnet_id";
|
|
- BOOST_STATIC_ASSERT(5 < LEASE_COLUMNS);
|
|
|
|
|
|
+ columns_[6] = "fqdn_fwd";
|
|
|
|
+ columns_[7] = "fqdn_rev";
|
|
|
|
+ columns_[8] = "hostname";
|
|
|
|
+ BOOST_STATIC_ASSERT(8 < LEASE_COLUMNS);
|
|
}
|
|
}
|
|
|
|
|
|
/// @brief Create MYSQL_BIND objects for Lease4 Pointer
|
|
/// @brief Create MYSQL_BIND objects for Lease4 Pointer
|
|
@@ -397,11 +418,32 @@ public:
|
|
// bind_[5].is_null = &MLM_FALSE; // commented out for performance
|
|
// bind_[5].is_null = &MLM_FALSE; // commented out for performance
|
|
// reasons, see memset() above
|
|
// reasons, see memset() above
|
|
|
|
|
|
|
|
+ // fqdn_fwd: boolean
|
|
|
|
+ bind_[6].buffer_type = MYSQL_TYPE_TINY;
|
|
|
|
+ bind_[6].buffer = reinterpret_cast<char*>(&lease_->fqdn_fwd_);
|
|
|
|
+ bind_[6].is_unsigned = MLM_TRUE;
|
|
|
|
+ // bind_[6].is_null = &MLM_FALSE; // commented out for performance
|
|
|
|
+ // reasons, see memset() above
|
|
|
|
+
|
|
|
|
+ // fqdn_rev: boolean
|
|
|
|
+ bind_[7].buffer_type = MYSQL_TYPE_TINY;
|
|
|
|
+ bind_[7].buffer = reinterpret_cast<char*>(&lease_->fqdn_rev_);
|
|
|
|
+ bind_[7].is_unsigned = MLM_TRUE;
|
|
|
|
+ // bind_[7].is_null = &MLM_FALSE; // commented out for performance
|
|
|
|
+ // reasons, see memset() above
|
|
|
|
+
|
|
|
|
+ // hostname: varchar(255)
|
|
|
|
+ bind_[8].buffer_type = MYSQL_TYPE_VARCHAR;
|
|
|
|
+ bind_[8].buffer = const_cast<char*>(lease_->hostname_.c_str());
|
|
|
|
+ bind_[8].buffer_length = lease_->hostname_.length();
|
|
|
|
+ // bind_[8].is_null = &MLM_FALSE; // commented out for performance
|
|
|
|
+ // reasons, see memset() above
|
|
|
|
+
|
|
// Add the error flags
|
|
// Add the error flags
|
|
setErrorIndicators(bind_, error_, LEASE_COLUMNS);
|
|
setErrorIndicators(bind_, error_, LEASE_COLUMNS);
|
|
|
|
|
|
// .. and check that we have the numbers correct at compile time.
|
|
// .. and check that we have the numbers correct at compile time.
|
|
- BOOST_STATIC_ASSERT(5 < LEASE_COLUMNS);
|
|
|
|
|
|
+ BOOST_STATIC_ASSERT(8 < LEASE_COLUMNS);
|
|
|
|
|
|
// Add the data to the vector. Note the end element is one after the
|
|
// Add the data to the vector. Note the end element is one after the
|
|
// end of the array.
|
|
// end of the array.
|
|
@@ -470,11 +512,34 @@ public:
|
|
// bind_[5].is_null = &MLM_FALSE; // commented out for performance
|
|
// bind_[5].is_null = &MLM_FALSE; // commented out for performance
|
|
// reasons, see memset() above
|
|
// reasons, see memset() above
|
|
|
|
|
|
|
|
+ // fqdn_fwd: boolean
|
|
|
|
+ bind_[6].buffer_type = MYSQL_TYPE_TINY;
|
|
|
|
+ bind_[6].buffer = reinterpret_cast<char*>(&fqdn_fwd_);
|
|
|
|
+ bind_[6].is_unsigned = MLM_TRUE;
|
|
|
|
+ // bind_[6].is_null = &MLM_FALSE; // commented out for performance
|
|
|
|
+ // reasons, see memset() above
|
|
|
|
+
|
|
|
|
+ // fqdn_rev: boolean
|
|
|
|
+ bind_[7].buffer_type = MYSQL_TYPE_TINY;
|
|
|
|
+ bind_[7].buffer = reinterpret_cast<char*>(&fqdn_rev_);
|
|
|
|
+ bind_[7].is_unsigned = MLM_TRUE;
|
|
|
|
+ // bind_[7].is_null = &MLM_FALSE; // commented out for performance
|
|
|
|
+ // reasons, see memset() above
|
|
|
|
+
|
|
|
|
+ // hostname: varchar(255)
|
|
|
|
+ hostname_length_ = sizeof(hostname_buffer_);
|
|
|
|
+ bind_[8].buffer_type = MYSQL_TYPE_STRING;
|
|
|
|
+ bind_[8].buffer = reinterpret_cast<char*>(hostname_buffer_);
|
|
|
|
+ bind_[8].buffer_length = hostname_length_;
|
|
|
|
+ bind_[8].length = &hostname_length_;
|
|
|
|
+ // bind_[8].is_null = &MLM_FALSE; // commented out for performance
|
|
|
|
+ // reasons, see memset() above
|
|
|
|
+
|
|
// Add the error flags
|
|
// Add the error flags
|
|
setErrorIndicators(bind_, error_, LEASE_COLUMNS);
|
|
setErrorIndicators(bind_, error_, LEASE_COLUMNS);
|
|
|
|
|
|
// .. and check that we have the numbers correct at compile time.
|
|
// .. and check that we have the numbers correct at compile time.
|
|
- BOOST_STATIC_ASSERT(5 < LEASE_COLUMNS);
|
|
|
|
|
|
+ BOOST_STATIC_ASSERT(8 < LEASE_COLUMNS);
|
|
|
|
|
|
// Add the data to the vector. Note the end element is one after the
|
|
// Add the data to the vector. Note the end element is one after the
|
|
// end of the array.
|
|
// end of the array.
|
|
@@ -500,10 +565,16 @@ public:
|
|
client_id_length_ = 0;
|
|
client_id_length_ = 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // Hostname is passed to Lease4 as a string object. We have to create
|
|
|
|
+ // it from the buffer holding hostname and the buffer length.
|
|
|
|
+ std::string hostname(hostname_buffer_,
|
|
|
|
+ hostname_buffer_ + hostname_length_);
|
|
|
|
+
|
|
// note that T1 and T2 are not stored
|
|
// note that T1 and T2 are not stored
|
|
return (Lease4Ptr(new Lease4(addr4_, hwaddr_buffer_, hwaddr_length_,
|
|
return (Lease4Ptr(new Lease4(addr4_, hwaddr_buffer_, hwaddr_length_,
|
|
client_id_buffer_, client_id_length_,
|
|
client_id_buffer_, client_id_length_,
|
|
- valid_lifetime_, 0, 0, cltt, subnet_id_)));
|
|
|
|
|
|
+ valid_lifetime_, 0, 0, cltt, subnet_id_,
|
|
|
|
+ fqdn_fwd_, fqdn_rev_, hostname)));
|
|
}
|
|
}
|
|
|
|
|
|
/// @brief Return columns in error
|
|
/// @brief Return columns in error
|
|
@@ -543,6 +614,15 @@ private:
|
|
Lease4Ptr lease_; ///< Pointer to lease object
|
|
Lease4Ptr lease_; ///< Pointer to lease object
|
|
uint32_t subnet_id_; ///< Subnet identification
|
|
uint32_t subnet_id_; ///< Subnet identification
|
|
uint32_t valid_lifetime_; ///< Lease time
|
|
uint32_t valid_lifetime_; ///< Lease time
|
|
|
|
+
|
|
|
|
+ my_bool fqdn_fwd_; ///< Has forward DNS update been
|
|
|
|
+ ///< performed
|
|
|
|
+ my_bool fqdn_rev_; ///< Has reverse DNS update been
|
|
|
|
+ ///< performed
|
|
|
|
+ char hostname_buffer_[HOSTNAME_MAX_LEN];
|
|
|
|
+ ///< Client hostname
|
|
|
|
+ unsigned long hostname_length_; ///< Client hostname length
|
|
|
|
+
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
@@ -562,7 +642,7 @@ private:
|
|
|
|
|
|
class MySqlLease6Exchange : public MySqlLeaseExchange {
|
|
class MySqlLease6Exchange : public MySqlLeaseExchange {
|
|
/// @brief Set number of database columns for this lease structure
|
|
/// @brief Set number of database columns for this lease structure
|
|
- static const size_t LEASE_COLUMNS = 9;
|
|
|
|
|
|
+ static const size_t LEASE_COLUMNS = 12;
|
|
|
|
|
|
public:
|
|
public:
|
|
/// @brief Constructor
|
|
/// @brief Constructor
|
|
@@ -575,15 +655,18 @@ public:
|
|
std::fill(&error_[0], &error_[LEASE_COLUMNS], MLM_FALSE);
|
|
std::fill(&error_[0], &error_[LEASE_COLUMNS], MLM_FALSE);
|
|
|
|
|
|
// Set the column names (for error messages)
|
|
// Set the column names (for error messages)
|
|
- columns_[0] = "address";
|
|
|
|
- columns_[1] = "duid";
|
|
|
|
- columns_[2] = "valid_lifetime";
|
|
|
|
- columns_[3] = "expire";
|
|
|
|
- columns_[4] = "subnet_id";
|
|
|
|
- columns_[5] = "pref_lifetime";
|
|
|
|
- columns_[6] = "lease_type";
|
|
|
|
- columns_[7] = "iaid";
|
|
|
|
- columns_[8] = "prefix_len";
|
|
|
|
|
|
+ columns_[0] = "address";
|
|
|
|
+ columns_[1] = "duid";
|
|
|
|
+ columns_[2] = "valid_lifetime";
|
|
|
|
+ columns_[3] = "expire";
|
|
|
|
+ columns_[4] = "subnet_id";
|
|
|
|
+ columns_[5] = "pref_lifetime";
|
|
|
|
+ columns_[6] = "lease_type";
|
|
|
|
+ columns_[7] = "iaid";
|
|
|
|
+ columns_[8] = "prefix_len";
|
|
|
|
+ columns_[9] = "fqdn_fwd";
|
|
|
|
+ columns_[10] = "fqdn_rev";
|
|
|
|
+ columns_[11] = "hostname";
|
|
BOOST_STATIC_ASSERT(8 < LEASE_COLUMNS);
|
|
BOOST_STATIC_ASSERT(8 < LEASE_COLUMNS);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -707,11 +790,32 @@ public:
|
|
// bind_[8].is_null = &MLM_FALSE; // commented out for performance
|
|
// bind_[8].is_null = &MLM_FALSE; // commented out for performance
|
|
// reasons, see memset() above
|
|
// reasons, see memset() above
|
|
|
|
|
|
|
|
+ // fqdn_fwd: boolean
|
|
|
|
+ bind_[9].buffer_type = MYSQL_TYPE_TINY;
|
|
|
|
+ bind_[9].buffer = reinterpret_cast<char*>(&lease_->fqdn_fwd_);
|
|
|
|
+ bind_[9].is_unsigned = MLM_TRUE;
|
|
|
|
+ // bind_[7].is_null = &MLM_FALSE; // commented out for performance
|
|
|
|
+ // reasons, see memset() above
|
|
|
|
+
|
|
|
|
+ // fqdn_rev: boolean
|
|
|
|
+ bind_[10].buffer_type = MYSQL_TYPE_TINY;
|
|
|
|
+ bind_[10].buffer = reinterpret_cast<char*>(&lease_->fqdn_rev_);
|
|
|
|
+ bind_[10].is_unsigned = MLM_TRUE;
|
|
|
|
+ // bind_[10].is_null = &MLM_FALSE; // commented out for performance
|
|
|
|
+ // reasons, see memset() above
|
|
|
|
+
|
|
|
|
+ // hostname: varchar(255)
|
|
|
|
+ bind_[11].buffer_type = MYSQL_TYPE_VARCHAR;
|
|
|
|
+ bind_[11].buffer = const_cast<char*>(lease_->hostname_.c_str());
|
|
|
|
+ bind_[11].buffer_length = lease_->hostname_.length();
|
|
|
|
+ // bind_[11].is_null = &MLM_FALSE; // commented out for performance
|
|
|
|
+ // reasons, see memset() above
|
|
|
|
+
|
|
// Add the error flags
|
|
// Add the error flags
|
|
setErrorIndicators(bind_, error_, LEASE_COLUMNS);
|
|
setErrorIndicators(bind_, error_, LEASE_COLUMNS);
|
|
|
|
|
|
// .. and check that we have the numbers correct at compile time.
|
|
// .. and check that we have the numbers correct at compile time.
|
|
- BOOST_STATIC_ASSERT(8 < LEASE_COLUMNS);
|
|
|
|
|
|
+ BOOST_STATIC_ASSERT(11 < LEASE_COLUMNS);
|
|
|
|
|
|
// Add the data to the vector. Note the end element is one after the
|
|
// Add the data to the vector. Note the end element is one after the
|
|
// end of the array.
|
|
// end of the array.
|
|
@@ -805,11 +909,34 @@ public:
|
|
// bind_[8].is_null = &MLM_FALSE; // commented out for performance
|
|
// bind_[8].is_null = &MLM_FALSE; // commented out for performance
|
|
// reasons, see memset() above
|
|
// reasons, see memset() above
|
|
|
|
|
|
|
|
+ // fqdn_fwd: boolean
|
|
|
|
+ bind_[9].buffer_type = MYSQL_TYPE_TINY;
|
|
|
|
+ bind_[9].buffer = reinterpret_cast<char*>(&fqdn_fwd_);
|
|
|
|
+ bind_[9].is_unsigned = MLM_TRUE;
|
|
|
|
+ // bind_[9].is_null = &MLM_FALSE; // commented out for performance
|
|
|
|
+ // reasons, see memset() above
|
|
|
|
+
|
|
|
|
+ // fqdn_rev: boolean
|
|
|
|
+ bind_[10].buffer_type = MYSQL_TYPE_TINY;
|
|
|
|
+ bind_[10].buffer = reinterpret_cast<char*>(&fqdn_rev_);
|
|
|
|
+ bind_[10].is_unsigned = MLM_TRUE;
|
|
|
|
+ // bind_[10].is_null = &MLM_FALSE; // commented out for performance
|
|
|
|
+ // reasons, see memset() above
|
|
|
|
+
|
|
|
|
+ // hostname: varchar(255)
|
|
|
|
+ hostname_length_ = sizeof(hostname_buffer_);
|
|
|
|
+ bind_[11].buffer_type = MYSQL_TYPE_STRING;
|
|
|
|
+ bind_[11].buffer = reinterpret_cast<char*>(hostname_buffer_);
|
|
|
|
+ bind_[11].buffer_length = hostname_length_;
|
|
|
|
+ bind_[11].length = &hostname_length_;
|
|
|
|
+ // bind_[11].is_null = &MLM_FALSE; // commented out for performance
|
|
|
|
+ // reasons, see memset() above
|
|
|
|
+
|
|
// Add the error flags
|
|
// Add the error flags
|
|
setErrorIndicators(bind_, error_, LEASE_COLUMNS);
|
|
setErrorIndicators(bind_, error_, LEASE_COLUMNS);
|
|
|
|
|
|
// .. and check that we have the numbers correct at compile time.
|
|
// .. and check that we have the numbers correct at compile time.
|
|
- BOOST_STATIC_ASSERT(8 < LEASE_COLUMNS);
|
|
|
|
|
|
+ BOOST_STATIC_ASSERT(11 < LEASE_COLUMNS);
|
|
|
|
|
|
// Add the data to the vector. Note the end element is one after the
|
|
// Add the data to the vector. Note the end element is one after the
|
|
// end of the array.
|
|
// end of the array.
|
|
@@ -859,11 +986,17 @@ public:
|
|
// Set up DUID,
|
|
// Set up DUID,
|
|
DuidPtr duid_ptr(new DUID(duid_buffer_, duid_length_));
|
|
DuidPtr duid_ptr(new DUID(duid_buffer_, duid_length_));
|
|
|
|
|
|
|
|
+ // Hostname is passed to Lease6 as a string object, so we have to
|
|
|
|
+ // create it from the hostname buffer and length.
|
|
|
|
+ std::string hostname(hostname_buffer_,
|
|
|
|
+ hostname_buffer_ + hostname_length_);
|
|
|
|
+
|
|
// Create the lease and set the cltt (after converting from the
|
|
// Create the lease and set the cltt (after converting from the
|
|
// expire time retrieved from the database).
|
|
// expire time retrieved from the database).
|
|
Lease6Ptr result(new Lease6(type, addr, duid_ptr, iaid_,
|
|
Lease6Ptr result(new Lease6(type, addr, duid_ptr, iaid_,
|
|
pref_lifetime_, valid_lifetime_, 0, 0,
|
|
pref_lifetime_, valid_lifetime_, 0, 0,
|
|
- subnet_id_, prefixlen_));
|
|
|
|
|
|
+ subnet_id_, fqdn_fwd_, fqdn_rev_,
|
|
|
|
+ hostname, prefixlen_));
|
|
time_t cltt = 0;
|
|
time_t cltt = 0;
|
|
MySqlLeaseMgr::convertFromDatabaseTime(expire_, valid_lifetime_, cltt);
|
|
MySqlLeaseMgr::convertFromDatabaseTime(expire_, valid_lifetime_, cltt);
|
|
result->cltt_ = cltt;
|
|
result->cltt_ = cltt;
|
|
@@ -907,6 +1040,14 @@ private:
|
|
uint32_t pref_lifetime_; ///< Preferred lifetime
|
|
uint32_t pref_lifetime_; ///< Preferred lifetime
|
|
uint32_t subnet_id_; ///< Subnet identification
|
|
uint32_t subnet_id_; ///< Subnet identification
|
|
uint32_t valid_lifetime_; ///< Lease time
|
|
uint32_t valid_lifetime_; ///< Lease time
|
|
|
|
+ my_bool fqdn_fwd_; ///< Has forward DNS update been
|
|
|
|
+ ///< performed
|
|
|
|
+ my_bool fqdn_rev_; ///< Has reverse DNS update been
|
|
|
|
+ ///< performed
|
|
|
|
+ char hostname_buffer_[HOSTNAME_MAX_LEN];
|
|
|
|
+ ///< Client hostname
|
|
|
|
+ unsigned long hostname_length_; ///< Client hostname length
|
|
|
|
+
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|