[netfilter-cvslog] r4318 - trunk/nfsim/tools

rusty at netfilter.org rusty at netfilter.org
Thu Oct 6 11:39:34 CEST 2005


Author: rusty at netfilter.org
Date: 2005-10-06 11:39:34 +0200 (Thu, 06 Oct 2005)
New Revision: 4318

Modified:
   trunk/nfsim/tools/tcpsession.c
Log:
>From Max Kellerman:

I implemented a RESET command for the tcpsession command.  It can be
used to quickly purge TCP connections.



Modified: trunk/nfsim/tools/tcpsession.c
===================================================================
--- trunk/nfsim/tools/tcpsession.c	2005-10-06 09:38:37 UTC (rev 4317)
+++ trunk/nfsim/tools/tcpsession.c	2005-10-06 09:39:34 UTC (rev 4318)
@@ -248,6 +248,15 @@
 	return true;
 }
 
+static bool reset_session(struct tcp_endpoint *in, struct tcp_endpoint *out)
+{
+	if (!tcp_send(in, out, 0, "RST", NULL, 0, NULL))
+		return false;
+	talloc_free(curr);
+	curr = NULL;
+	return true;
+}
+
 static bool tcpsession(int argc, char *argv[])
 {
 	if (argc < 2) {
@@ -314,6 +323,20 @@
 		if (streq(argv[2], "reply"))
 			return close_session(&curr->reply, &curr->original);
 	}
+	if (streq(argv[1], "RESET")) {
+		if (!curr) {
+			nfsim_log(LOG_ALWAYS, "Session not open!");
+			return false;
+		}
+		if (argc != 3) {
+			tcpsession_help(argc, argv);
+			return false;
+		}
+		if (streq(argv[2], "original"))
+			return reset_session(&curr->original, &curr->reply);
+		if (streq(argv[2], "reply"))
+			return reset_session(&curr->reply, &curr->original);
+	}
 	if (streq(argv[1], "ABANDON")) {
 		if (!curr) {
 			nfsim_log(LOG_ALWAYS, "Session not open!");




More information about the netfilter-cvslog mailing list