All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kris Katterjohn <katterjohn@gmail.com>
To: netdev@vger.kernel.org
Subject: [PATCH] Reorder ACK/RST checking in LISTEN state
Date: Wed, 13 Feb 2008 00:38:13 -0600	[thread overview]
Message-ID: <47B29055.8060409@gmail.com> (raw)

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

Hey everyone,

[I'm not subscribed, so please CC me on any replies]

I've attached a patch that changes the order of the ACK and RST checking 
in the LISTEN state in tcp_rcv_state_process() in tcp_input.c

Before:  If an ACK/RST packet is received, then tcp_rcv_state_process() 
would return 1 because of the ACK.  Then (following the function calls 
in tcp_ipv4.c and tcp_minisocks.c), tcp_v4_send_reset() is called--but 
since there is a RST in the packet it just returns.  After this, the 
kfree_skb() is called.  The same goes in tcp_ipv6.c as well.

But if the order of the ACK and RST checking is reversed, __kfree_skb() 
is called in tcp_rcv_state_process() because of the RST and the function 
returns 0, which skips that other useless stuff.

This is the order specified on page 65 of RFC 793 anyway.

Signed-off-by: Kris Katterjohn <katterjohn@gmail.com>

Thanks,
Kris Katterjohn

[-- Attachment #2: ackrst.patch --]
[-- Type: text/x-patch, Size: 412 bytes --]

--- net/ipv4/tcp_input.c	2008-02-13 00:05:59.000000000 -0600
+++ net/ipv4/tcp_input.c	2008-02-13 00:10:40.000000000 -0600
@@ -4962,12 +4962,12 @@ int tcp_rcv_state_process(struct sock *s
 		goto discard;
 
 	case TCP_LISTEN:
-		if (th->ack)
-			return 1;
-
 		if (th->rst)
 			goto discard;
 
+		if (th->ack)
+			return 1;
+
 		if (th->syn) {
 			if (icsk->icsk_af_ops->conn_request(sk, skb) < 0)
 				return 1;

             reply	other threads:[~2008-02-13  6:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-13  6:38 Kris Katterjohn [this message]
2008-02-13  7:08 ` [PATCH] Reorder ACK/RST checking in LISTEN state David Miller

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=47B29055.8060409@gmail.com \
    --to=katterjohn@gmail.com \
    --cc=netdev@vger.kernel.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.