All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Kellermann <max@duempel.org>
To: netfilter-devel@lists.netfilter.org
Subject: [PATCH nfsim] tcpsession: implement the RESET command
Date: Thu, 22 Sep 2005 10:24:04 +0200	[thread overview]
Message-ID: <20050922082404.GC21617@roonstrasse.net> (raw)

[-- 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!");


             reply	other threads:[~2005-09-22  8:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-22  8:24 Max Kellermann [this message]
2005-10-07 17:53 ` [PATCH nfsim] tcpsession: implement the RESET command 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050922082404.GC21617@roonstrasse.net \
    --to=max@duempel.org \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.