From: Eric Dumazet <eric.dumazet@gmail•com>
To: "David S . Miller" <davem@davemloft•net>,
Jakub Kicinski <kuba@kernel•org>, Paolo Abeni <pabeni@redhat•com>
Cc: netdev <netdev@vger•kernel.org>,
Eric Dumazet <edumazet@google•com>,
Eric Dumazet <eric.dumazet@gmail•com>
Subject: [PATCH net-next 08/10] tcp: make tcp_rcv_synsent_state_process() drop monitor friend
Date: Fri, 15 Apr 2022 17:10:46 -0700 [thread overview]
Message-ID: <20220416001048.2218911-9-eric.dumazet@gmail.com> (raw)
In-Reply-To: <20220416001048.2218911-1-eric.dumazet@gmail.com>
From: Eric Dumazet <edumazet@google•com>
1) A valid RST packet should be consumed, to not confuse drop monitor.
2) Same remark for packet validating cross syn setup,
even if we might ignore part of it.
3) When third packet of 3WHS is delayed, do not pretend
the SYNACK was dropped.
Signed-off-by: Eric Dumazet <edumazet@google•com>
---
net/ipv4/tcp_input.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a1077adeb1b62d74b5f1c9a6fc34def44ae07790..cd9f5c39f85a042751ef78132860a2a6cc96bccc 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6186,7 +6186,9 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
if (th->rst) {
tcp_reset(sk, skb);
- goto discard;
+consume:
+ __kfree_skb(skb);
+ return 0;
}
/* rfc793:
@@ -6275,13 +6277,9 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
tcp_enter_quickack_mode(sk, TCP_MAX_QUICKACKS);
inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
TCP_DELACK_MAX, TCP_RTO_MAX);
-
-discard:
- tcp_drop(sk, skb);
- return 0;
- } else {
- tcp_send_ack(sk);
+ goto consume;
}
+ tcp_send_ack(sk);
return -1;
}
@@ -6350,7 +6348,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
*/
return -1;
#else
- goto discard;
+ goto consume;
#endif
}
/* "fifth, if neither of the SYN or RST bits is set then
@@ -6360,7 +6358,8 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
discard_and_undo:
tcp_clear_options(&tp->rx_opt);
tp->rx_opt.mss_clamp = saved_clamp;
- goto discard;
+ tcp_drop(sk, skb);
+ return 0;
reset_and_undo:
tcp_clear_options(&tp->rx_opt);
--
2.36.0.rc0.470.gd361397f0d-goog
next prev parent reply other threads:[~2022-04-16 0:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-16 0:10 [PATCH net-next 00/10] tcp: drop reason additions Eric Dumazet
2022-04-16 0:10 ` [PATCH net-next 01/10] tcp: consume incoming skb leading to a reset Eric Dumazet
2022-04-16 0:10 ` [PATCH net-next 02/10] tcp: get rid of rst_seq_match Eric Dumazet
2022-04-16 0:10 ` [PATCH net-next 03/10] tcp: add drop reason support to tcp_validate_incoming() Eric Dumazet
2022-04-16 0:10 ` [PATCH net-next 04/10] tcp: make tcp_rcv_state_process() drop monitor friendly Eric Dumazet
2022-04-16 0:10 ` [PATCH net-next 05/10] tcp: add drop reasons to tcp_rcv_state_process() Eric Dumazet
2022-04-16 0:10 ` [PATCH net-next 06/10] tcp: add two drop reasons for tcp_ack() Eric Dumazet
2022-04-16 0:10 ` [PATCH net-next 07/10] tcp: add drop reason support to tcp_prune_ofo_queue() Eric Dumazet
2022-04-16 0:10 ` Eric Dumazet [this message]
2022-04-16 0:10 ` [PATCH net-next 09/10] tcp: add drop reasons to tcp_rcv_synsent_state_process() Eric Dumazet
2022-04-16 0:10 ` [PATCH net-next 10/10] tcp: add drop reason support to tcp_ofo_queue() Eric Dumazet
2022-04-17 12:40 ` [PATCH net-next 00/10] tcp: drop reason additions patchwork-bot+netdevbpf
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=20220416001048.2218911-9-eric.dumazet@gmail.com \
--to=eric.dumazet@gmail$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox