All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nfsim] tcpsession: implement the RESET command
@ 2005-09-22  8:24 Max Kellermann
  2005-10-07 17:53 ` Rusty Russell
  0 siblings, 1 reply; 7+ messages in thread
From: Max Kellermann @ 2005-09-22  8:24 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 119 bytes --]

Hi,

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

Max


[-- Attachment #2: nfsim-tcpsession_reset.patch --]
[-- Type: text/plain, Size: 1206 bytes --]

Thu Sep 15 00:06:48 CEST 2005  max@duempel.org
  * implemented tcpsession RESET
diff -rN -u old-nfsim-0/tools/tcpsession.c new-nfsim-0/tools/tcpsession.c
--- old-nfsim-0/tools/tcpsession.c	2005-09-22 10:25:35.000000000 +0200
+++ new-nfsim-0/tools/tcpsession.c	2005-09-22 10:11:23.000000000 +0200
@@ -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!");


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-10-11 10:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-22  8:24 [PATCH nfsim] tcpsession: implement the RESET command Max Kellermann
2005-10-07 17:53 ` Rusty Russell
     [not found]   ` <20051008090622.GA9337@roonstrasse.net>
2005-10-10 10:37     ` Rusty Russell
2005-10-10 11:51       ` Max Kellermann
2005-10-10 13:03         ` Rusty Russell
2005-10-10 13:14           ` Max Kellermann
2005-10-11 10:34             ` Rusty Russell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.