Commit 7ad95788 authored by Francis Dupont's avatar Francis Dupont
Browse files

[738-kea4-crash-when-remote-network4-del-command-is-issued-with-subnets-action...

[738-kea4-crash-when-remote-network4-del-command-is-issued-with-subnets-action-delete] Fixed: use only ANY
parent 97787f70
......@@ -2482,7 +2482,7 @@ TaggedStatementArray tagged_statements = { {
// Delete all subnets for a shared network.
{ MySqlConfigBackendDHCPv4Impl::DELETE_ALL_SUBNETS4_SHARED_NETWORK_NAME,
MYSQL_DELETE_SUBNET_WITH_TAG(dhcp4, AND s.shared_network_name = ?)
MYSQL_DELETE_SUBNET_ANY(dhcp4, WHERE s.shared_network_name = ?)
},
// Delete associations of a subnet with server.
......@@ -2939,6 +2939,10 @@ MySqlConfigBackendDHCPv4::deleteAllSubnets4(const ServerSelector& server_selecto
uint64_t
MySqlConfigBackendDHCPv4::deleteSharedNetworkSubnets4(const db::ServerSelector& server_selector,
const std::string& shared_network_name) {
if (!server_selector.amAny()) {
isc_throw(InvalidOperation, "deleting all subnets from a shared "
"network is defined only using ANY server");
}
LOG_DEBUG(mysql_cb_logger, DBGLVL_TRACE_BASIC, MYSQL_CB_DELETE_SHARED_NETWORK_SUBNETS4)
.arg(shared_network_name);
uint64_t result = impl_->deleteTransactional(MySqlConfigBackendDHCPv4Impl::DELETE_ALL_SUBNETS4_SHARED_NETWORK_NAME,
......
......@@ -2841,7 +2841,7 @@ TaggedStatementArray tagged_statements = { {
// Delete all subnets for a shared network.
{ MySqlConfigBackendDHCPv6Impl::DELETE_ALL_SUBNETS6_SHARED_NETWORK_NAME,
MYSQL_DELETE_SUBNET_WITH_TAG(dhcp6, AND s.shared_network_name = ?)
MYSQL_DELETE_SUBNET_ANY(dhcp6, WHERE s.shared_network_name = ?)
},
// Delete associations of a subnet with server.
......@@ -3319,6 +3319,10 @@ MySqlConfigBackendDHCPv6::deleteAllSubnets6(const ServerSelector& server_selecto
uint64_t
MySqlConfigBackendDHCPv6::deleteSharedNetworkSubnets6(const db::ServerSelector& server_selector,
const std::string& shared_network_name) {
if (!server_selector.amAny()) {
isc_throw(InvalidOperation, "deleting all subnets from a shared "
"network is defined only using ANY server");
}
LOG_DEBUG(mysql_cb_logger, DBGLVL_TRACE_BASIC, MYSQL_CB_DELETE_SHARED_NETWORK_SUBNETS6)
.arg(shared_network_name);
uint64_t result = impl_->deleteTransactional(MySqlConfigBackendDHCPv6Impl::DELETE_ALL_SUBNETS6_SHARED_NETWORK_NAME,
......
......@@ -2233,7 +2233,7 @@ TEST_F(MySqlConfigBackendDHCPv4Test, getAllSharedNetworks4) {
// Delete first shared network with it subnets and verify it is gone.
// Begin by its subnet.
EXPECT_EQ(1, cbptr_->deleteSharedNetworkSubnets4(ServerSelector::ALL(),
EXPECT_EQ(1, cbptr_->deleteSharedNetworkSubnets4(ServerSelector::ANY(),
test_networks_[1]->getName()));
{
......
......@@ -2248,7 +2248,7 @@ TEST_F(MySqlConfigBackendDHCPv6Test, getAllSharedNetworks6) {
// Delete first shared network with it subnets and verify it is gone.
// Begin by its subnet.
EXPECT_EQ(1, cbptr_->deleteSharedNetworkSubnets6(ServerSelector::ALL(),
EXPECT_EQ(1, cbptr_->deleteSharedNetworkSubnets6(ServerSelector::ANY(),
test_networks_[1]->getName()));
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment