]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tools: Drop "ctdb killtcp" command
authorMartin Schwenke <martin@meltin.net>
Fri, 11 Mar 2016 04:37:37 +0000 (15:37 +1100)
committerAmitay Isaacs <amitay@samba.org>
Fri, 1 Apr 2016 02:42:12 +0000 (04:42 +0200)
It is now handled by a standalone helper.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/doc/ctdb.1.xml
ctdb/tests/eventscripts/stubs/ctdb
ctdb/tools/ctdb.c

index 42012b4ce243d1ac83946aff1dd0a76c5b22191b..7c5822cd89d4b2d3218034632ff04cf8c20e4cf3 100644 (file)
@@ -1332,26 +1332,6 @@ dbid:0xb775fff6 name:secrets.tdb path:/usr/local/var/lib/ctdb/persistent/secrets
       </para>
     </refsect2>
 
-    <refsect2>
-      <title>killtcp</title>
-      <para>
-       Read a list of TCP connections, one per line, from standard
-       input and terminate each connection.  A connection is
-       specified as:
-      </para>
-      <synopsis>
-       <parameter>SRC-IPADDR</parameter>:<parameter>SRC-PORT</parameter> <parameter>DST-IPADDR</parameter>:<parameter>DST-PORT</parameter>
-      </synopsis>
-      <para>
-       Each connection is terminated by issuing a TCP RST to the
-       SRC-IPADDR:SRC-PORT endpoint.
-      </para>
-      <para>
-       A single connection can be specified on the command-line
-       rather than on standard input.
-      </para>
-    </refsect2>
-
     <refsect2>
       <title>
        pdelete <parameter>DB</parameter> <parameter>KEY</parameter>
index 825cd042ac3945634b9c246709b1331353d314bc..cd4d3995ffc90a72fd1034fb77a0b58aff01bdbf 100755 (executable)
@@ -59,13 +59,6 @@ setup_tickles ()
     touch "$tickles_file"
 }
 
-ctdb_killtcp ()
-{
-    while read _src _dst ; do
-       sed -i -e "/^$_dst $_src\$/d" "$FAKE_NETSTAT_TCP_ESTABLISHED_FILE"
-    done
-}
-
 parse_nodespec ()
 {
     if [ "$nodespec" = "all" ] ; then
@@ -454,7 +447,6 @@ case "$1" in
        done
        ;;
     gratiousarp) : ;;  # Do nothing for now
-    killtcp)      ctdb_killtcp "$@" ;;
     ip)            ctdb_ip "$@" ;;
     pnn|xpnn)      ctdb_pnn ;;
     enable)        ctdb_enable "$@";;
index 711aad41da30babc3330d9001f22a394e858c3b0..bc7427cab8160021c92eff8a017dd9218e7f7e8c 100644 (file)
@@ -2355,144 +2355,6 @@ static int control_delip(struct ctdb_context *ctdb, int argc, const char **argv)
        return 0;
 }
 
-static int kill_tcp_from_file(struct ctdb_context *ctdb,
-                             int argc, const char **argv)
-{
-       struct ctdb_connection *killtcp;
-       int max_entries, current, i;
-       struct timeval timeout;
-       char line[128], src[128], dst[128];
-       int linenum;
-       TDB_DATA data;
-       struct client_async_data *async_data;
-       struct ctdb_client_control_state *state;
-
-       if (argc != 0) {
-               usage();
-       }
-
-       linenum = 1;
-       killtcp = NULL;
-       max_entries = 0;
-       current = 0;
-       while (!feof(stdin)) {
-               if (fgets(line, sizeof(line), stdin) == NULL) {
-                       continue;
-               }
-
-               /* Silently skip empty lines */
-               if (line[0] == '\n') {
-                       continue;
-               }
-
-               if (sscanf(line, "%s %s\n", src, dst) != 2) {
-                       DEBUG(DEBUG_ERR, ("Bad line [%d]: '%s'\n",
-                                         linenum, line));
-                       talloc_free(killtcp);
-                       return -1;
-               }
-
-               if (current >= max_entries) {
-                       max_entries += 1024;
-                       killtcp = talloc_realloc(ctdb, killtcp,
-                                                struct ctdb_connection,
-                                                max_entries);
-                       CTDB_NO_MEMORY(ctdb, killtcp);
-               }
-
-               if (!parse_ip_port(src, &killtcp[current].src)) {
-                       DEBUG(DEBUG_ERR, ("Bad IP:port on line [%d]: '%s'\n",
-                                         linenum, src));
-                       talloc_free(killtcp);
-                       return -1;
-               }
-
-               if (!parse_ip_port(dst, &killtcp[current].dst)) {
-                       DEBUG(DEBUG_ERR, ("Bad IP:port on line [%d]: '%s'\n",
-                                         linenum, dst));
-                       talloc_free(killtcp);
-                       return -1;
-               }
-
-               current++;
-       }
-
-       async_data = talloc_zero(ctdb, struct client_async_data);
-       if (async_data == NULL) {
-               talloc_free(killtcp);
-               return -1;
-       }
-
-       for (i = 0; i < current; i++) {
-
-               data.dsize = sizeof(struct ctdb_connection);
-               data.dptr  = (unsigned char *)&killtcp[i];
-
-               timeout = TIMELIMIT();
-               state = ctdb_control_send(ctdb, options.pnn, 0,
-                                         CTDB_CONTROL_KILL_TCP, 0, data,
-                                         async_data, &timeout, NULL);
-
-               if (state == NULL) {
-                       DEBUG(DEBUG_ERR,
-                             ("Failed to call async killtcp control to node %u\n",
-                              options.pnn));
-                       talloc_free(killtcp);
-                       return -1;
-               }
-               
-               ctdb_client_async_add(async_data, state);
-       }
-
-       if (ctdb_client_async_wait(ctdb, async_data) != 0) {
-               DEBUG(DEBUG_ERR,("killtcp failed\n"));
-               talloc_free(killtcp);
-               return -1;
-       }
-
-       talloc_free(killtcp);
-       return 0;
-}
-
-
-/*
-  kill a tcp connection
- */
-static int kill_tcp(struct ctdb_context *ctdb, int argc, const char **argv)
-{
-       int ret;
-       struct ctdb_connection killtcp;
-
-       assert_single_node_only();
-
-       if (argc == 0) {
-               return kill_tcp_from_file(ctdb, argc, argv);
-       }
-
-       if (argc < 2) {
-               usage();
-       }
-
-       if (!parse_ip_port(argv[0], &killtcp.src)) {
-               DEBUG(DEBUG_ERR, ("Bad IP:port '%s'\n", argv[0]));
-               return -1;
-       }
-
-       if (!parse_ip_port(argv[1], &killtcp.dst)) {
-               DEBUG(DEBUG_ERR, ("Bad IP:port '%s'\n", argv[1]));
-               return -1;
-       }
-
-       ret = ctdb_ctrl_killtcp(ctdb, TIMELIMIT(), options.pnn, &killtcp);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR, ("Unable to killtcp from node %u\n", options.pnn));
-               return ret;
-       }
-
-       return 0;
-}
-
-
 /*
   send a gratious arp
  */
@@ -6238,7 +6100,6 @@ static const struct {
        { "ipreallocate",    control_ipreallocate,      false,  false,  "force the recovery daemon to perform a ip reallocation procedure" },
        { "thaw",            control_thaw,              true,   false,  "thaw databases", "[priority:1-3]" },
        { "isnotrecmaster",  control_isnotrecmaster,    false,  false,  "check if the local node is recmaster or not" },
-       { "killtcp",         kill_tcp,                  false,  false, "kill a tcp connection.", "[<srcip:port> <dstip:port>]" },
        { "gratiousarp",     control_gratious_arp,      false,  false, "send a gratious arp", "<ip> <interface>" },
        { "tickle",          tickle_tcp,                false,  false, "send a tcp tickle ack", "<srcip:port> <dstip:port>" },
        { "gettickles",      control_get_tickles,       false,  false, "get the list of tickles registered for this ip", "<ip> [<port>]" },