Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ipv4 addr plus port #63

Open
wants to merge 56 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
233950b
added address plus port
Feb 1, 2018
43f201b
fixed merge
Feb 1, 2018
a238b7c
add static casts
Feb 1, 2018
67483dc
minor changes
Feb 1, 2018
0868823
minor changes
Feb 1, 2018
6012b29
fixed unit tests
Feb 2, 2018
62ce579
updated unit tests
Feb 2, 2018
26e8bf4
removed unsupported options
Feb 3, 2018
a875ea1
updated cql schema and added minor changes (including spelling mistak…
Feb 7, 2018
f804d7e
minor chnages
Feb 9, 2018
7ecf8fb
Merge remote-tracking branch 'isc-kea/master' into cql_clean_code
Feb 15, 2018
01d56b8
Merge remote-tracking branch 'isc-kea/master' into cql_clean_code
Feb 15, 2018
098865d
Merge remote-tracking branch 'isc-kea/master' into HEAD
Feb 15, 2018
10e19f3
Merge branch 'cql_clean_code' of https://github.com/razvan-becheriu/k…
Feb 15, 2018
e2317a1
Merge remote-tracking branch 'isc-kea/master' into ipv4_addr_plus_port
Feb 19, 2018
448cf73
Merge remote-tracking branch 'isc-kea/master' into ipv4_addr_plus_port
Feb 28, 2018
ae60f3f
Merge remote-tracking branch 'isc-kea/master' into cql_clean_code
Feb 28, 2018
14c3a55
minor changes - fixed eventual memory leak
Mar 1, 2018
45464c5
minor changes
Mar 1, 2018
16c80de
minor changes
Mar 1, 2018
5637d01
minor changes
Mar 1, 2018
4637a23
refactored cql recount leases plus minor changes
Mar 1, 2018
d3f8281
minor changes
Mar 1, 2018
b2d80eb
minor changes
Mar 1, 2018
ffc8c78
Merge remote-tracking branch 'isc-kea/master' into cassandra_improvem…
Mar 2, 2018
afddd8a
Merge remote-tracking branch 'isc-kea/master' into cql_clean_code
Mar 7, 2018
d32a318
Merge remote-tracking branch 'isc-kea/master' into cassandra_improvem…
Mar 7, 2018
c3e4fe2
enabled tests for cql
Mar 7, 2018
e728823
Merge remote-tracking branch 'isc-kea/master' into ipv4_addr_plus_port
Mar 7, 2018
8b1f21a
src/lib/dhcpsrv/tests/generic_host_data_source_unittest.cc
Mar 7, 2018
55a57d4
enabled tests for cql
Mar 7, 2018
38b5430
fixed unit tests
Mar 7, 2018
400abf1
fixed merge
Mar 13, 2018
33e4b4f
Merge remote-tracking branch 'isc-kea/master' into cassandra_improvem…
Mar 13, 2018
42d8ad3
minor changes
Mar 13, 2018
1b6df23
Merge remote-tracking branch 'isc-kea/master' into ipv4_addr_plus_port
Mar 13, 2018
39bc0b7
fixed merge
Mar 13, 2018
61f9562
Merge branch 'cql_clean_code' into ipv4_addr_plus_port
Mar 13, 2018
b65cd1f
fixed merge
Mar 13, 2018
a1ab751
fixed comments
Mar 13, 2018
387ffa4
minor changes
Mar 13, 2018
746acc8
minor changes
Mar 13, 2018
78f3ad6
Merge branch 'cassandra_improvements' into cql_clean_code
Mar 13, 2018
38a837f
minor changes
Mar 14, 2018
9ed1f3d
minor changes
Mar 14, 2018
d61a05b
minor changes
Mar 14, 2018
cc59e9a
minor changes
Mar 14, 2018
365e64f
minor changes
Mar 14, 2018
85e88a2
Merge remote-tracking branch 'isc-kea/master' into cql_clean_code
Mar 15, 2018
594bd9e
Merge branch 'cql_clean_code' into ipv4_addr_plus_port
Mar 15, 2018
053d2f3
Merge remote-tracking branch 'isc-kea/master' into ipv4_addr_plus_port
Mar 19, 2018
aac7d46
Merge remote-tracking branch 'isc-kea/master' into ipv4_addr_plus_port
May 24, 2018
8670f46
minor changes
May 24, 2018
552f467
Merge remote-tracking branch 'isc-kea/master' into ipv4_addr_plus_port
Jun 5, 2018
3d23cef
minor changes
Jun 14, 2018
0872bf5
Merge remote-tracking branch 'isc-kea/master' into ipv4_addr_plus_port
Jun 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed merge
  • Loading branch information
Razvan Becheriu committed Mar 13, 2018
commit 400abf1585bd0996d26e26317d917543268272de
7 changes: 5 additions & 2 deletions src/bin/dhcp4/dhcp4_parser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ using namespace std;
CONTACT_POINTS "contact-points"
KEYSPACE "keyspace"
MAX_RECONNECT_TRIES "max-reconnect-tries"
RECONNECT_WAIT_TIME "reconnect-wait-time"

VALID_LIFETIME "valid-lifetime"
RENEW_TIMER "renew-timer"
Expand Down Expand Up @@ -593,7 +592,6 @@ database_map_param: database_type
| tcp_keepalive
| contact_points
| max_reconnect_tries
| reconnect_wait_time
| keyspace
| unknown_map_entry
;
Expand Down Expand Up @@ -704,6 +702,11 @@ keyspace: KEYSPACE {
ctx.leave();
};

max_reconnect_tries: MAX_RECONNECT_TRIES COLON INTEGER {
ElementPtr n(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("max-reconnect-tries", n);
};

host_reservation_identifiers: HOST_RESERVATION_IDENTIFIERS {
ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("host-reservation-identifiers", l);
Expand Down
18 changes: 5 additions & 13 deletions src/bin/dhcp6/dhcp6_parser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ using namespace std;
REQUEST_TIMEOUT "request-timeout"
TCP_KEEPALIVE "tcp-keepalive"
CONTACT_POINTS "contact-points"
MAX_RECONNECT_TRIES "max-reconnect-tries"
RECONNECT_WAIT_TIME "reconnect-wait-time"
KEYSPACE "keyspace"
MAX_RECONNECT_TRIES "max-reconnect-tries"

PREFERRED_LIFETIME "preferred-lifetime"
VALID_LIFETIME "valid-lifetime"
Expand Down Expand Up @@ -563,7 +562,6 @@ database_map_param: database_type
| tcp_keepalive
| contact_points
| max_reconnect_tries
| reconnect_wait_time
| keyspace
| unknown_map_entry
;
Expand Down Expand Up @@ -666,16 +664,6 @@ contact_points: CONTACT_POINTS {
ctx.leave();
};

max_reconnect_tries: MAX_RECONNECT_TRIES COLON INTEGER {
ElementPtr n(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("max-reconnect-tries", n);
};

reconnect_wait_time: RECONNECT_WAIT_TIME COLON INTEGER {
ElementPtr n(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("reconnect-wait-time", n);
};

keyspace: KEYSPACE {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
Expand All @@ -684,6 +672,10 @@ keyspace: KEYSPACE {
ctx.leave();
};

max_reconnect_tries: MAX_RECONNECT_TRIES COLON INTEGER {
ElementPtr n(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("max-reconnect-tries", n);
};

mac_sources: MAC_SOURCES {
ElementPtr l(new ListElement(ctx.loc2pos(@1)));
Expand Down
20 changes: 19 additions & 1 deletion src/lib/dhcpsrv/cql_host_data_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,25 @@ CqlHostExchange::retrieve() {
HostPtr host(new Host(host_identifier.data(), host_identifier.size(),
host_identifier_type, ipv4_subnet_id, ipv6_subnet_id,
ipv4_reservation, hostname_,
host_ipv4_client_classes_, host_ipv6_client_classes_));
host_ipv4_client_classes_, host_ipv6_client_classes_,
static_cast<uint32_t>(host_ipv4_next_server_),
host_ipv4_server_hostname_, host_ipv4_boot_file_name_));

// Set the user context if there is one.
if (!user_context_.empty()) {
try {
ConstElementPtr ctx = Element::fromJSON(user_context_);
if (!ctx || (ctx->getType() != Element::map)) {
isc_throw(BadValue, "user context '" << user_context_
<< "' is not a JSON map");
}
host->setContext(ctx);
} catch (const isc::data::JSONError& ex) {
isc_throw(BadValue, "user context '" << user_context_
<< "' is invalid JSON: " << ex.what());
}
}

host->setHostId(id);

const IPv6Resrv reservation = retrieveReservation();
Expand Down
111 changes: 50 additions & 61 deletions src/lib/dhcpsrv/mysql_lease_mgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -663,36 +663,29 @@ class MySqlLease4Exchange : public MySqlLeaseExchange {
// Note: All array lengths are equal to the corresponding variable in the
// schema.
// Note: Arrays are declared fixed length for speed of creation
uint32_t addr4_; ///< IPv4 address
MYSQL_BIND bind_[LEASE_COLUMNS]; ///< Bind array
std::string columns_[LEASE_COLUMNS]; ///< Column names
my_bool error_[LEASE_COLUMNS]; ///< Error array
std::vector<uint8_t> hwaddr_; ///< Hardware address
uint8_t hwaddr_buffer_[HWAddr::MAX_HWADDR_LEN];
///< Hardware address buffer
unsigned long hwaddr_length_; ///< Hardware address length
std::vector<uint8_t> client_id_; ///< Client identification
uint8_t client_id_buffer_[ClientId::MAX_CLIENT_ID_LEN];
///< Client ID buffer
unsigned long client_id_length_; ///< Client ID address length
my_bool client_id_null_; ///< Is Client ID null?

MYSQL_TIME expire_; ///< Lease expiry time
Lease4Ptr lease_; ///< Pointer to lease object
uint32_t subnet_id_; ///< Subnet identification
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
uint32_t state_; ///< Lease state
uint32_t addr4_; ///< IPv4 address
MYSQL_BIND bind_[LEASE_COLUMNS]; ///< Bind array
std::string columns_[LEASE_COLUMNS]; ///< Column names
my_bool error_[LEASE_COLUMNS]; ///< Error array
std::vector<uint8_t> hwaddr_; ///< Hardware address
uint8_t hwaddr_buffer_[HWAddr::MAX_HWADDR_LEN]; ///< Hardware address buffer
unsigned long hwaddr_length_; ///< Hardware address length
my_bool hwaddr_null_; ///< Used when HWAddr is null
std::vector<uint8_t> client_id_; ///< Client identification
uint8_t client_id_buffer_[ClientId::MAX_CLIENT_ID_LEN]; ///< Client ID buffer
unsigned long client_id_length_; ///< Client ID address length
my_bool client_id_null_; ///< Is Client ID null?
MYSQL_TIME expire_; ///< Lease expiry time
Lease4Ptr lease_; ///< Pointer to lease object
uint32_t subnet_id_; ///< Subnet identification
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
uint32_t state_; ///< Lease state
};


/// @brief Exchange MySQL and Lease6 Data
///
/// On any MySQL operation, arrays of MYSQL_BIND structures must be built to
Expand Down Expand Up @@ -1212,39 +1205,35 @@ class MySqlLease6Exchange : public MySqlLeaseExchange {
// Note: All array lengths are equal to the corresponding variable in the
// schema.
// Note: arrays are declared fixed length for speed of creation
std::string addr6_; ///< String form of address
char addr6_buffer_[ADDRESS6_TEXT_MAX_LEN + 1]; ///< Character
///< array form of V6 address
unsigned long addr6_length_; ///< Length of the address
MYSQL_BIND bind_[LEASE_COLUMNS]; ///< Bind array
std::string columns_[LEASE_COLUMNS]; ///< Column names
std::vector<uint8_t> duid_; ///< Client identification
uint8_t duid_buffer_[DUID::MAX_DUID_LEN]; ///< Buffer form of DUID
unsigned long duid_length_; ///< Length of the DUID
my_bool error_[LEASE_COLUMNS]; ///< Error indicators
MYSQL_TIME expire_; ///< Lease expiry time
uint32_t iaid_; ///< Identity association ID
Lease6Ptr lease_; ///< Pointer to lease object
uint8_t lease_type_; ///< Lease type
uint8_t prefixlen_; ///< Prefix length
uint32_t pref_lifetime_; ///< Preferred lifetime
uint32_t subnet_id_; ///< Subnet identification
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
uint8_t hwaddr_buffer_[HWAddr::MAX_HWADDR_LEN];
///< Buffer for Hardware address
std::vector<uint8_t> hwaddr_; ///< Hardware address (optional)
unsigned long hwaddr_length_; ///< Aux. variable denoting hwaddr_ size()
my_bool hwaddr_null_; ///< Used when HWAddr is null
uint16_t hwtype_; ///< Hardware type
uint32_t hwaddr_source_; ///< Source of the hardware address
uint32_t state_; ///< Lease state.
std::string addr6_; ///< String form of address
char addr6_buffer_[ADDRESS6_TEXT_MAX_LEN + 1]; ///< Character
///< array form of V6 address
unsigned long addr6_length_; ///< Length of the address
MYSQL_BIND bind_[LEASE_COLUMNS]; ///< Bind array
std::string columns_[LEASE_COLUMNS]; ///< Column names
std::vector<uint8_t> duid_; ///< Client identification
uint8_t duid_buffer_[DUID::MAX_DUID_LEN]; ///< Buffer form of DUID
unsigned long duid_length_; ///< Length of the DUID
my_bool error_[LEASE_COLUMNS]; ///< Error indicators
MYSQL_TIME expire_; ///< Lease expiry time
uint32_t iaid_; ///< Identity association ID
Lease6Ptr lease_; ///< Pointer to lease object
uint8_t lease_type_; ///< Lease type
uint8_t prefixlen_; ///< Prefix length
uint32_t pref_lifetime_; ///< Preferred lifetime
uint32_t subnet_id_; ///< Subnet identification
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
uint8_t hwaddr_buffer_[HWAddr::MAX_HWADDR_LEN]; ///< Buffer form of Hardware address
std::vector<uint8_t> hwaddr_; ///< Hardware address (optional)
unsigned long hwaddr_length_; ///< Aux. variable denoting hwaddr_ size()
my_bool hwaddr_null_; ///< Used when HWAddr is null
uint16_t hwtype_; ///< Hardware type
uint32_t hwaddr_source_; ///< Source of the hardware address
uint32_t state_; ///< Lease state.
};

/// @brief MySql derivation of the statistical lease data query
Expand Down
4 changes: 3 additions & 1 deletion src/lib/dhcpsrv/pgsql_lease_mgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ PgSqlTaggedStatement tagged_statements[] = {
"extract(epoch from expire)::bigint, subnet_id, pref_lifetime, "
"lease_type, iaid, prefix_len, "
"fqdn_fwd, fqdn_rev, hostname, "
"hwaddr, hwtype, hwaddr_source, "
"state "
"FROM lease6 "
"WHERE state != $1 AND expire < $2 "
Expand Down Expand Up @@ -202,8 +203,9 @@ PgSqlTaggedStatement tagged_statements[] = {
"INSERT INTO lease6(address, duid, valid_lifetime, "
"expire, subnet_id, pref_lifetime, "
"lease_type, iaid, prefix_len, fqdn_fwd, fqdn_rev, hostname, "
"hwaddr, hwtype, hwaddr_source, "
"state) "
"VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)"},
"VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)"},

// UPDATE_LEASE4
{ 11, { OID_INT8, OID_BYTEA, OID_BYTEA, OID_INT8, OID_TIMESTAMP, OID_INT8,
Expand Down
1 change: 1 addition & 0 deletions src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,7 @@ GenericLeaseMgrTest::testGetLease4HWAddrSubnetId() {
EXPECT_THROW(returned = lmptr_->getLease4(*leases[1]->hwaddr_,
leases[1]->subnet_id_),
isc::dhcp::MultipleRecords);

}

void
Expand Down
5 changes: 0 additions & 5 deletions src/lib/dhcpsrv/tests/mysql_lease_mgr_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,6 @@ TEST_F(MySqlLeaseMgrTest, deleteExpiredReclaimedLeases6) {
testDeleteExpiredReclaimedLeases6();
}

/// @brief Check that expired reclaimed DHCPv4 leases are removed.
TEST_F(MySqlLeaseMgrTest, deleteExpiredReclaimedLeases4) {
testDeleteExpiredReclaimedLeases4();
}

/// @brief Verifies that IPv4 lease statistics can be recalculated.
TEST_F(MySqlLeaseMgrTest, recountLeaseStats4) {
testRecountLeaseStats4();
Expand Down
5 changes: 5 additions & 0 deletions src/lib/dhcpsrv/tests/pgsql_lease_mgr_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,11 @@ TEST_F(PgSqlLeaseMgrTest, getExpiredLeases6) {
testGetExpiredLeases6();
}

/// @brief Check that expired reclaimed DHCPv6 leases are removed.
TEST_F(PgSqlLeaseMgrTest, deleteExpiredReclaimedLeases6) {
testDeleteExpiredReclaimedLeases6();
}

/// @brief Verifies that IPv4 lease statistics can be recalculated.
TEST_F(PgSqlLeaseMgrTest, recountLeaseStats4) {
testRecountLeaseStats4();
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.