mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
ctdb-daemon: Remove implementation of CTDB_CONTROL_KILL_TCP
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
f0a83d865c
commit
d8398b04b5
@ -94,8 +94,6 @@ struct ctdb_vnn {
|
||||
/* a context to hang sending gratious arp events off */
|
||||
TALLOC_CTX *takeover_ctx;
|
||||
|
||||
struct ctdb_kill_tcp *killtcp;
|
||||
|
||||
/* Set to true any time an update to this VNN is in flight.
|
||||
This helps to avoid races. */
|
||||
bool update_in_flight;
|
||||
@ -1011,7 +1009,6 @@ int32_t ctdb_control_set_iface_link(struct ctdb_context *ctdb,
|
||||
struct ctdb_req_control_old *c,
|
||||
TDB_DATA indata);
|
||||
|
||||
int32_t ctdb_control_kill_tcp(struct ctdb_context *ctdb, TDB_DATA indata);
|
||||
int32_t ctdb_control_set_tcp_tickle_list(struct ctdb_context *ctdb,
|
||||
TDB_DATA indata);
|
||||
int32_t ctdb_control_get_tcp_tickle_list(struct ctdb_context *ctdb,
|
||||
|
@ -407,9 +407,8 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
|
||||
CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_node_flag_change));
|
||||
return ctdb_control_modflags(ctdb, indata);
|
||||
|
||||
case CTDB_CONTROL_KILL_TCP:
|
||||
CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_connection));
|
||||
return ctdb_control_kill_tcp(ctdb, indata);
|
||||
case CTDB_CONTROL_KILL_TCP:
|
||||
return control_not_implemented("KILL_TCP", NULL);
|
||||
|
||||
case CTDB_CONTROL_GET_TCP_TICKLE_LIST:
|
||||
CHECK_CONTROL_DATA_SIZE(sizeof(ctdb_sock_addr));
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "common/system.h"
|
||||
#include "common/common.h"
|
||||
#include "common/logging.h"
|
||||
#include "killtcp.h"
|
||||
|
||||
#include "server/ipalloc.h"
|
||||
|
||||
@ -2627,106 +2626,6 @@ int32_t ctdb_control_set_iface_link(struct ctdb_context *ctdb,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
destroy the killtcp structure
|
||||
*/
|
||||
struct ctdb_killtcp_destructor_data {
|
||||
struct ctdb_vnn *vnn;
|
||||
struct ctdb_context *ctdb;
|
||||
};
|
||||
|
||||
static int ctdb_killtcp_destructor(struct ctdb_kill_tcp *killtcp)
|
||||
{
|
||||
struct ctdb_killtcp_destructor_data *dd =
|
||||
talloc_get_type_abort(killtcp->destructor_data,
|
||||
struct ctdb_killtcp_destructor_data);
|
||||
struct ctdb_vnn *tmpvnn;
|
||||
|
||||
/* verify that this vnn is still active */
|
||||
for (tmpvnn = dd->ctdb->vnn; tmpvnn; tmpvnn = tmpvnn->next) {
|
||||
if (tmpvnn == dd->vnn) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tmpvnn == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (dd->vnn->killtcp != killtcp) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
dd->vnn->killtcp = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
add a tcp socket to the list of connections we want to RST
|
||||
*/
|
||||
static int ctdb_killtcp_add_connection(struct ctdb_context *ctdb,
|
||||
ctdb_sock_addr *s,
|
||||
ctdb_sock_addr *d)
|
||||
{
|
||||
ctdb_sock_addr src, dst;
|
||||
struct ctdb_vnn *vnn;
|
||||
const char *iface;
|
||||
struct ctdb_killtcp_destructor_data *dd;
|
||||
int ret;
|
||||
|
||||
ctdb_canonicalize_ip(s, &src);
|
||||
ctdb_canonicalize_ip(d, &dst);
|
||||
|
||||
vnn = find_public_ip_vnn(ctdb, &dst);
|
||||
if (vnn == NULL) {
|
||||
vnn = find_public_ip_vnn(ctdb, &src);
|
||||
}
|
||||
if (vnn == NULL) {
|
||||
/* if it is not a public ip it could be our 'single ip' */
|
||||
if (ctdb->single_ip_vnn) {
|
||||
if (ctdb_same_ip(&ctdb->single_ip_vnn->public_address, &dst)) {
|
||||
vnn = ctdb->single_ip_vnn;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vnn == NULL) {
|
||||
DEBUG(DEBUG_ERR,(__location__ " Could not killtcp, not a public address\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
iface = ctdb_vnn_iface_string(vnn);
|
||||
|
||||
ret = ctdb_killtcp(ctdb->ev, vnn, iface, &src, &dst, &vnn->killtcp);
|
||||
if (ret != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
dd = talloc(vnn->killtcp, struct ctdb_killtcp_destructor_data);
|
||||
if (dd == NULL) {
|
||||
DEBUG(DEBUG_ERR, (__location__ " out of memory\n"));
|
||||
TALLOC_FREE(vnn->killtcp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
dd->vnn = vnn;
|
||||
dd->ctdb = ctdb;
|
||||
vnn->killtcp->destructor_data = dd;
|
||||
talloc_set_destructor(vnn->killtcp, ctdb_killtcp_destructor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
kill a TCP connection.
|
||||
*/
|
||||
int32_t ctdb_control_kill_tcp(struct ctdb_context *ctdb, TDB_DATA indata)
|
||||
{
|
||||
struct ctdb_connection *killtcp = (struct ctdb_connection *)indata.dptr;
|
||||
|
||||
return ctdb_killtcp_add_connection(ctdb, &killtcp->src, &killtcp->dst);
|
||||
}
|
||||
|
||||
/*
|
||||
called by a daemon to inform us of the entire list of TCP tickles for
|
||||
a particular public address.
|
||||
|
@ -75,7 +75,6 @@ bool fast_start;
|
||||
#include "server/ctdb_update_record.c"
|
||||
#include "server/ctdb_lock.c"
|
||||
#include "server/ctdb_fork.c"
|
||||
#include "server/killtcp.c"
|
||||
|
||||
/* CTDB_CLIENT_OBJ */
|
||||
#include "client/ctdb_client.c"
|
||||
|
@ -401,7 +401,7 @@ def build(bld):
|
||||
ctdb_vacuum.c ctdb_banning.c
|
||||
ctdb_statistics.c
|
||||
ctdb_update_record.c
|
||||
ctdb_lock.c ctdb_fork.c killtcp.c'''),
|
||||
ctdb_lock.c ctdb_fork.c'''),
|
||||
includes='include',
|
||||
deps='ctdb-ipalloc replace popt talloc tevent tdb talloc_report')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user