struct ctdb_packet_context *pkt;
struct tevent_fd *fde;
- void (*release_ip_handler)(const char *ip_addr, void *private_data);
+ bool (*release_ip_handler)(const char *ip_addr, void *private_data);
void *release_ip_priv;
};
if ((conn->release_ip_handler != NULL)
&& (msg->srvid == CTDB_SRVID_RELEASE_IP)) {
+ bool ret;
+
/* must be dispatched immediately */
DEBUG(10, ("received CTDB_SRVID_RELEASE_IP\n"));
- conn->release_ip_handler((const char *)msg->data,
- conn->release_ip_priv);
+ ret = conn->release_ip_handler((const char *)msg->data,
+ conn->release_ip_priv);
+ if (ret) {
+ /*
+ * We need to release the ip,
+ * so return an error to the upper layers.
+ *
+ * We make sure we don't trigger this again.
+ */
+ conn->release_ip_handler = NULL;
+ conn->release_ip_priv = NULL;
+ return NT_STATUS_ADDRESS_CLOSED;
+ }
TALLOC_FREE(hdr);
goto next_pkt;
}
if ((conn->release_ip_handler != NULL)
&& (msg->srvid == CTDB_SRVID_RELEASE_IP)) {
+ bool ret;
+
/* must be dispatched immediately */
DEBUG(10, ("received CTDB_SRVID_RELEASE_IP\n"));
- conn->release_ip_handler((const char *)msg->data,
- conn->release_ip_priv);
+ ret = conn->release_ip_handler((const char *)msg->data,
+ conn->release_ip_priv);
+ if (ret) {
+ /*
+ * We need to release the ip.
+ *
+ * We make sure we don't trigger this again.
+ */
+ conn->release_ip_handler = NULL;
+ conn->release_ip_priv = NULL;
+ }
TALLOC_FREE(buf);
return NT_STATUS_OK;
}
NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
const struct sockaddr_storage *_server,
const struct sockaddr_storage *_client,
- void (*release_ip_handler)(const char *ip_addr,
+ bool (*release_ip_handler)(const char *ip_addr,
void *private_data),
void *private_data)
{
/****************************************************************************
received when we should release a specific IP
****************************************************************************/
-static void release_ip(const char *ip, void *priv)
+static bool release_ip(const char *ip, void *priv)
{
struct smbd_release_ip_state *state =
talloc_get_type_abort(priv,
*/
smbd_server_connection_terminate(state->sconn,
"CTDB_SRVID_RELEASE_IP");
- return;
+ return true;
}
+
+ return false;
}
static NTSTATUS smbd_register_ips(struct smbd_server_connection *sconn,