From d8398b04b520724d89a4107027e49dfd22f25a43 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 11 Mar 2016 15:57:44 +1100 Subject: [PATCH] ctdb-daemon: Remove implementation of CTDB_CONTROL_KILL_TCP Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/include/ctdb_private.h | 3 -- ctdb/server/ctdb_control.c | 5 +- ctdb/server/ctdb_takeover.c | 101 ------------------------------------ ctdb/tests/src/ctdbd_test.c | 1 - ctdb/wscript | 2 +- 5 files changed, 3 insertions(+), 109 deletions(-) diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 04574fe9c4c..bf45246c548 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -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, diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c index 7d18969b1b0..c795a3f9b84 100644 --- a/ctdb/server/ctdb_control.c +++ b/ctdb/server/ctdb_control.c @@ -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)); diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index 1256c162e92..d8f09ddb2fb 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -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. diff --git a/ctdb/tests/src/ctdbd_test.c b/ctdb/tests/src/ctdbd_test.c index 5a3f6b85c93..5fa70144ed4 100644 --- a/ctdb/tests/src/ctdbd_test.c +++ b/ctdb/tests/src/ctdbd_test.c @@ -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" diff --git a/ctdb/wscript b/ctdb/wscript index 88fe59d4dd5..a73910b8193 100755 --- a/ctdb/wscript +++ b/ctdb/wscript @@ -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') -- 2.47.3