]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
add a killtcp command to the ctdb tool
authorRonnie Sahlberg <sahlberg@ronnie>
Wed, 4 Jul 2007 04:14:48 +0000 (14:14 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Wed, 4 Jul 2007 04:14:48 +0000 (14:14 +1000)
(This used to be ctdb commit 01987b51fed0dc0b9a5e254fa734bdeb19debf6f)

ctdb/Makefile.in
ctdb/tools/ctdb.c

index 87adb7e243cd83f1e16977c7056bdb5c4984b2bf..c4bfc79023e455f088e61aa5417fc5e1d54fa122 100644 (file)
@@ -83,9 +83,9 @@ bin/scsi_io: $(CLIENT_OBJS) scsi/scsi_io.o
        @echo Linking $@
        @$(CC) $(CFLAGS) -o $@ scsi/scsi_io.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
 
-bin/ctdb: $(CLIENT_OBJS) tools/ctdb.o 
+bin/ctdb: $(CLIENT_OBJS) tools/ctdb.o takeover/system.o 
        @echo Linking $@
-       @$(CC) $(CFLAGS) -o $@ tools/ctdb.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
+       @$(CC) $(CFLAGS) -o $@ tools/ctdb.o takeover/system.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
 
 bin/socketkiller: $(CLIENT_OBJS) tools/socketkiller.o 
        @echo Linking $@
index e6c1b392e4571316c2542ae6d5a1672df6f4fa7d..b283789103566faef215115f76ac3026d10e6ebc 100644 (file)
@@ -303,6 +303,38 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
        return 0;
 }
 
+/*
+  kill a tcp connection
+ */
+static int kill_tcp(struct ctdb_context *ctdb, int argc, const char **argv)
+{
+       int i, ret;
+       struct sockaddr_in src, dst;
+
+       if (argc < 4) {
+               usage();
+       }
+
+       src.sin_family=AF_INET;
+       src.sin_port=htons(atoi(argv[1]));
+       inet_aton(argv[0], &src.sin_addr);
+
+       dst.sin_family=AF_INET;
+       dst.sin_port=htons(atoi(argv[3]));
+       inet_aton(argv[2], &dst.sin_addr);
+
+       for (i=0;i<5;i++) {
+               ret = ctdb_sys_kill_tcp(ctdb->ev, &src, &dst);
+
+               printf("ret:%d\n", ret);
+               if (ret==0) {
+                       return 0;
+               }
+       }
+
+       return -1;
+}
+
 /*
   display public ip status
  */
@@ -824,6 +856,7 @@ static const struct {
        { "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> <srcport> <dstip> <dstport>" },
 };
 
 /*