From nobody Wed Jul 26 23:19:47 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RB8xb3Hzcz4pv26; Wed, 26 Jul 2023 23:19:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RB8xb2sLHz437L; Wed, 26 Jul 2023 23:19:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690413587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Djg3KCXi3DEQqxf6NOB0WZmAQqLMsTvgNw8Jr0qpQG0=; b=bos86lquj6o/3LgGZz+U5CCdPkrGxNvBIOKvS0YaeIe/XgIVk7Zxy02N7Byw9edyoTtGMi jZyqkkbyA+51+v5hq2SYD3l4g8RH9C94rC5JimX7cokLpTcKY6GI+yOkm2NvyNvZdDc6RK jn2kri4gN2CQOwrD3vkb+JgrPeGo8q1CKhMrilwUzRIQlQfm6vXEvNAFotMJXTpRA6siP/ phqxxiCT7OYRhNjZGfZtUdmz/6Dpekjxwx9FtL2Hk/39Jryr+P2N/PgtKOVrUpv7yDy72J ZmzyuTt0MeHe4qDi4mIsa9M3YZ5B0Ws70kbq78uKGFirdXIRbzfIECzIslId4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690413587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Djg3KCXi3DEQqxf6NOB0WZmAQqLMsTvgNw8Jr0qpQG0=; b=XiwuVJe4LIfdReyL5zmFQo+CroO9Vh1SBc9+9YhpSVfYGE2ppTvGIbUBjI+Vuw5ly/9S5F LEy0P9xQnHf/lHS+yaZIrcAeVPv4wORR8v5P3EBVBuWK3a7N4d/VEHw8Xst7MzzeAm1rJO 3rg/J3QB/WjwTqdnCipwI95g2pIOKrMAK+fJ0jGocPMPsSsQNr+ZLV/4ZLtEVa0kNMapBP EBLRopsCqjRE7Kgm5b53kyV30xWFJWjAXcsXXODN21yLAIhdpY4q0pLt8i9w3++0hlBg6c B4vzfEfJt3MtvuE0Uib1KQUSXUcjf7DvcHBl19MTPGZWBf0daoi6vy8+2FjrDw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690413587; a=rsa-sha256; cv=none; b=afzZOvo0RfMaCs9Dd1HXEVPPLtgy5ZKSlnd/7jqVaSzdkno0vfJ8gbz/kbhT4Xm0VmEWIz v6Te64fPqxSkG5flwCkNlBsOZqG6yRK+Tw33rCmIXMi5uAwBl/xdZPMkf0A439Y6Lc6FI2 zUqBOkj1pUe/zRF+cO+C0WdbB6GT2Zsq5i5s0GDCxkfekyLK3iqC039BSHBLhW0beg2V9Z Dx396E3Cb+wUJYCQlQJPmHRhsOGJd8+tnVzjqIS0HYnPvmToSmuLzsH3jWwI0g3w2+Aexj B6OrFen0MHIIJKHp3B3XVWkSyUWSVAGiSfH7yv8y18gy22tthRyYcTIo7uhLOA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RB8xb1yqwz11ps; Wed, 26 Jul 2023 23:19:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36QNJl3p099554; Wed, 26 Jul 2023 23:19:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36QNJli7099553; Wed, 26 Jul 2023 23:19:47 GMT (envelope-from git) Date: Wed, 26 Jul 2023 23:19:47 GMT Message-Id: <202307262319.36QNJli7099553@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: b352ef58c29b - main - tcp: Handle in SYN-RCVD List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b352ef58c29b1f2967e358c147e0f7faf8cfbef3 Auto-Submitted: auto-generated The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=b352ef58c29b1f2967e358c147e0f7faf8cfbef3 commit b352ef58c29b1f2967e358c147e0f7faf8cfbef3 Author: Richard Scheffenegger AuthorDate: 2023-07-26 22:41:25 +0000 Commit: Richard Scheffenegger CommitDate: 2023-07-26 22:42:26 +0000 tcp: Handle in SYN-RCVD Patch base stack to correctly handle the RST bit independently of other header flags per TCP RFC. MFC after: 1 week Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D40982 --- sys/netinet/tcp_input.c | 4 ++++ sys/netinet/tcp_syncache.c | 12 ------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 10daab2d61ba..b66e4e9d17ac 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1963,6 +1963,10 @@ tcp_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th, * if seg contains an ACK, but not for our SYN/ACK, send a RST. */ case TCPS_SYN_RECEIVED: + if (thflags & TH_RST) { + /* Handle RST segments later. */ + break; + } if ((thflags & TH_ACK) && (SEQ_LEQ(th->th_ack, tp->snd_una) || SEQ_GT(th->th_ack, tp->snd_max))) { diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index b9c41eda4d9e..986d4d068f96 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -623,18 +623,6 @@ syncache_chkrst(struct in_conninfo *inc, struct tcphdr *th, struct mbuf *m, sc = syncache_lookup(inc, &sch); /* returns locked sch */ SCH_LOCK_ASSERT(sch); - /* - * Any RST to our SYN|ACK must not carry ACK, SYN or FIN flags. - * See RFC 793 page 65, section SEGMENT ARRIVES. - */ - if (tcp_get_flags(th) & (TH_ACK|TH_SYN|TH_FIN)) { - if ((s = tcp_log_addrs(inc, th, NULL, NULL))) - log(LOG_DEBUG, "%s; %s: Spurious RST with ACK, SYN or " - "FIN flag set, segment ignored\n", s, __func__); - TCPSTAT_INC(tcps_badrst); - goto done; - } - /* * No corresponding connection was found in syncache. * If syncookies are enabled and possibly exclusively