From: Cambda Zhu <cambda@linux•alibaba.com>
To: netdev@vger•kernel.org
Cc: Eric Dumazet <edumazet@google•com>,
Xuan Zhuo <xuanzhuo@linux•alibaba.com>,
Dust Li <dust.li@linux•alibaba.com>,
Tony Lu <tonylu@linux•alibaba.com>,
Cambda Zhu <cambda@linux•alibaba.com>,
Jack Yang <mingliang@linux•alibaba.com>
Subject: [PATCH net-next] net: Return user_mss for TCP_MAXSEG in CLOSE/LISTEN state
Date: Fri, 19 May 2023 16:01:18 +0800 [thread overview]
Message-ID: <20230519080118.25539-1-cambda@linux.alibaba.com> (raw)
In-Reply-To: <34BAAED6-5CD0-42D0-A9FB-82A01962A2D7@linux.alibaba.com>
This patch removes the tp->mss_cache check in getting TCP_MAXSEG of
CLOSE/LISTEN sock. Checking if tp->mss_cache is zero is probably a bug,
since tp->mss_cache is initialized with TCP_MSS_DEFAULT. Getting
TCP_MAXSEG of sock in other state will still return tp->mss_cache.
Signed-off-by: Cambda Zhu <cambda@linux•alibaba.com>
Reported-by: Jack Yang <mingliang@linux•alibaba.com>
---
net/ipv4/tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 3d18e295bb2f..713854f1f061 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -4083,7 +4083,7 @@ int do_tcp_getsockopt(struct sock *sk, int level,
switch (optname) {
case TCP_MAXSEG:
val = tp->mss_cache;
- if (!val && ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN)))
+ if ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))
val = tp->rx_opt.user_mss;
if (tp->repair)
val = tp->rx_opt.mss_clamp;
--
2.16.6
next prev parent reply other threads:[~2023-05-19 8:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-17 11:08 net: getsockopt(TCP_MAXSEG) on listen sock returns wrong MSS? Cambda Zhu
2023-05-17 15:58 ` Eric Dumazet
2023-05-17 17:37 ` Cambda Zhu
2023-05-19 8:01 ` Cambda Zhu [this message]
2023-05-23 10:28 ` [PATCH net-next] net: Return user_mss for TCP_MAXSEG in CLOSE/LISTEN state Paolo Abeni
2023-05-23 11:52 ` Eric Dumazet
2023-05-24 7:10 ` Cambda Zhu
2023-05-24 9:30 ` Jason Xing
2023-05-23 13:45 ` Paolo Abeni
2023-05-24 1:04 ` Cambda Zhu
2023-05-24 2:11 ` Jason Xing
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=20230519080118.25539-1-cambda@linux.alibaba.com \
--to=cambda@linux$(echo .)alibaba.com \
--cc=dust.li@linux$(echo .)alibaba.com \
--cc=edumazet@google$(echo .)com \
--cc=mingliang@linux$(echo .)alibaba.com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=tonylu@linux$(echo .)alibaba.com \
--cc=xuanzhuo@linux$(echo .)alibaba.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