This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
*/
static int kill_tcp(struct ctdb_context *ctdb, int argc, const char **argv)
{
- int i, ret;
+ int i, ret, numrst;
struct sockaddr_in src, dst;
- if (argc < 2) {
+ if (argc < 3) {
usage();
}
if (!parse_ip_port(argv[0], &src)) {
- printf("Bad IP:port '%s'\n", argv[1]);
+ printf("Bad IP:port '%s'\n", argv[0]);
return -1;
}
return -1;
}
- for (i=0;i<5;i++) {
+ numrst = strtoul(argv[2], NULL, 0);
+
+ for (i=0;i<numrst;i++) {
ret = ctdb_sys_kill_tcp(ctdb->ev, &src, &dst);
printf("ret:%d\n", ret);
return -1;
}
+/*
+ send a tcp tickle ack
+ */
+static int tickle_tcp(struct ctdb_context *ctdb, int argc, const char **argv)
+{
+ int ret;
+ struct sockaddr_in src, dst;
+
+ if (argc < 2) {
+ usage();
+ }
+
+ if (!parse_ip_port(argv[0], &src)) {
+ printf("Bad IP:port '%s'\n", argv[0]);
+ return -1;
+ }
+
+ if (!parse_ip_port(argv[1], &dst)) {
+ printf("Bad IP:port '%s'\n", argv[1]);
+ return -1;
+ }
+
+ ret = ctdb_sys_send_tcp(&src, &dst, 0, 0, 0);
+ if (ret==0) {
+ return 0;
+ }
+ printf("Error while sending tickle ack\n");
+
+ return -1;
+}
+
/*
display public ip status
*/
{ "recover", control_recover, true, "force recovery" },
{ "freeze", control_freeze, true, "freeze all databases" },
{ "thaw", control_thaw, true, "thaw all databases" },
- { "killtcp", kill_tcp, false, "kill a tcp connection", "<srcip:port> <dstip:port>" },
+ { "killtcp", kill_tcp, false, "kill a tcp connection. Try <num> times.", "<srcip:port> <dstip:port> <num>" },
+ { "tickle", tickle_tcp, false, "send a tcp tickle ack", "<srcip:port> <dstip:port>" },
};
/*
" -t <timelimit> set timelimit for control in seconds (default %u)\n", options.timelimit);
printf("Controls:\n");
for (i=0;i<ARRAY_SIZE(ctdb_commands);i++) {
- printf(" %-15s %-20s %s\n",
+ printf(" %-15s %-27s %s\n",
ctdb_commands[i].name,
ctdb_commands[i].args?ctdb_commands[i].args:"",
ctdb_commands[i].msg);