cutter: fix and remove BROKEN flag
authorFelix Fietkau <nbd@openwrt.org>
Fri, 21 Mar 2014 15:47:25 +0000 (15:47 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 21 Mar 2014 15:47:25 +0000 (15:47 +0000)
Cutter was marked as broken a long time ago, cutter is utility used for disconnecting ongoing TCP connections.
Problem was that it didn't support nf_conntrack.

Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 39978

net/cutter/Makefile
net/cutter/patches/001-nf_conntrack.patch [new file with mode: 0644]

index f9830b42df39f1ef5f1c6e1589818d528a18735e..970d5158585f00b39f3c8b9a22f3b6ff4ba629e7 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=cutter
 PKG_VERSION:=1.03
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
 PKG_SOURCE_URL:=http://www.lowth.com/cutter/software/
@@ -22,7 +22,6 @@ define Package/cutter
   CATEGORY:=Network
   TITLE:=allows an user to abort TCP/IP connections
   URL:=http://www.lowth.com/cutter/
-  DEPENDS:=@BROKEN
 endef
 
 define Package/cutter/description
@@ -30,11 +29,11 @@ define Package/cutter/description
        administrators to abort TCP/IP connections routed over the 
        firewall or router on which it is run.
 endef
-       
+
 define Build/Compile
-       $(TARGET_CC) $(PKG_BUILD_DIR)/cutter.c -o $(PKG_BUILD_DIR)/cutter
+       $(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/cutter.c -o $(PKG_BUILD_DIR)/cutter
 endef
-       
+
 define Package/cutter/install
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/cutter $(1)/usr/sbin/
diff --git a/net/cutter/patches/001-nf_conntrack.patch b/net/cutter/patches/001-nf_conntrack.patch
new file mode 100644 (file)
index 0000000..06febe7
--- /dev/null
@@ -0,0 +1,39 @@
+--- a/cutter.c.orig    2005-04-30 09:01:03.000000000 +0200
++++ b/cutter.c 2007-10-26 16:10:04.000000000 +0200
+@@ -476,7 +476,7 @@
+ int scan_conntrack(in_addr_t ip1, int port1, in_addr_t ip2, int port2)
+ {
+-      FILE *id = fopen( "/proc/net/ip_conntrack", "r" );
++      FILE *id = fopen( "/proc/net/nf_conntrack", "r" );
+       char src1[32], dst1[32], src2[32], dst2[32];
+       int sport1, dport1, sport2, dport2, i;
+       int packets1, packets2, bytes1, bytes2;
+@@ -486,12 +486,12 @@
+       int ok = TRUE;
+       if (id == NULL) {
+-              perror( "openning /proc/net/ip_conntrack" );
++              perror( "openning /proc/net/nf_conntrack" );
+               return FALSE;
+       }
+       while (fgets(buff, sizeof(buff), id) != NULL) {
+-              if (memcmp(buff, "tcp ", 4) != 0 || strstr(buff, " ESTABLISHED ") == NULL)
++              if (memcmp(buff, "ipv4     2 tcp ", 15) != 0 || strstr(buff, " ESTABLISHED ") == NULL)
+                       continue;
+               p = buff;
+@@ -537,6 +537,12 @@
+                               ok = send_rst(dst1,dport1,src1,sport1) && ok;
+                               ok = send_rst(dst2,dport2,src2,sport2) && ok;
+                       }
++                      else {
++                              found ++;
++                              printf("For connection %s:%d -> %s:%d\n", dst2, dport2, src2, sport2);
++                              ok = send_rst(dst1,dport1,src1,sport1) && ok;
++                              ok = send_rst(dst2,dport2,src2,sport2) && ok;
++                      }
+               }
+       }