From nobody Mon Aug 14 09:35:23 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 4RPTlb4dgsz4qD02; Mon, 14 Aug 2023 09:35:23 +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 4RPTlb3v1Qz4My4; Mon, 14 Aug 2023 09:35:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692005723; 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=Q2jqxhYpL9UqU3SS/FHH1mSBrx7dSEeJRyJuKEGE14o=; b=QAwakrhGKq51MIzVpNOkEfz22hxY8DHpxFrEjRHv4wiG1XwTW/6lltpuhy37yudxeuNDYt 6FlX7zgImoBXYRVYl7gmV3Y5lTNGcSpahNrYunlxa6yuamy8UF65otYNA4H3Vt2zQ0wr0a wOzC1Rc69MwN74sd9Ao7eQdh6vmUUwy7QcachIoAf3UozMFVA+i9nkGxXB/FSEU0soQGT0 L20u5TRK3KizJ2/YGFyhuVT/cX10urn94Y1bPnbPwknOwP8b1yGnZpf7+8qoE3+BFAQo9j qgUdyPAPfo+KH33U5eVz/w2PPnLPMYokfXMWLw5NPA0rVUnXtS6pevU8tWbDkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692005723; 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=Q2jqxhYpL9UqU3SS/FHH1mSBrx7dSEeJRyJuKEGE14o=; b=Nw7n0SOxs6gSKbfkAVlWKypiJVpHlT0ZfEIFg4YzYZIV56gOJcJo7y0qF3pcJvY3DMXMxf DRM+9VcM2K7AsMvwsE8RRd34DL11XzLH+TEl4g6M3pzhrKpjJWm6ZiigUJh0eS/tD+Uuvz sQp4r8R4+M+Z56k5OYXmQo7K1WJc/aRSIPk5Q1Y+LjDtWHRxwJQSieJwPj/R48kR+oC+Oi xhpXEgiRKGpssKhgh7/As+FXVrSC5+wCH78KsTMTqAWTvk5BSnW7cH5cgwOtSow9bI6mES VjWjHgQR0FnErw2FlPkwX/ey+nxJKCMowabwP5FSjJP1XNdTTeFed2CPRNrVIg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692005723; a=rsa-sha256; cv=none; b=lsHFrkeRNjE0GJ3vgp/nHAKlSJYlO7dX7QNFvvXC3d5AJyqOTaea5qp27wMWnHsmNklBsa 6H85x7Odve641mjyd0c3NtAPT4DoU66SNA7JRitvMnMi0PYR+ycuwjPBqV+TiIJv6+5Ky+ 1xkk8t5KRRoqVtR42qpGMRpvUEk9sQXNGm3v9zaiHEiL6f2+YlOYBZ7y2NSphYNJkrB4LR 0xM0+pCazByBBroPCGq8Pbr5q8mxaUMbIoWlBXCVlMcRVUA00vjeL/3mhj+pBfhYKSDOeN +G8p6pAMhno/2TaBhb0YGw6iAOSpHYbO89HK6orySV7cgrP2mESbJMzd3mURJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RPTlb2wwJz7rD; Mon, 14 Aug 2023 09:35:23 +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 37E9ZNP2028730; Mon, 14 Aug 2023 09:35:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37E9ZN6X028727; Mon, 14 Aug 2023 09:35:23 GMT (envelope-from git) Date: Mon, 14 Aug 2023 09:35:23 GMT Message-Id: <202308140935.37E9ZN6X028727@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 110b2f4d47dd - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 110b2f4d47dddadebd71ed327bd9a10f9acbbbfe Auto-Submitted: auto-generated The branch stable/13 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=110b2f4d47dddadebd71ed327bd9a10f9acbbbfe commit 110b2f4d47dddadebd71ed327bd9a10f9acbbbfe Author: Richard Scheffenegger AuthorDate: 2023-07-26 22:41:25 +0000 Commit: Richard Scheffenegger CommitDate: 2023-08-14 08:48:52 +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 (cherry picked from commit b352ef58c29b1f2967e358c147e0f7faf8cfbef3) --- 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 bb2a0e497dcf..f2890dff7290 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2021,6 +2021,10 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, * 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 b3c2fbeb927e..59a8df134f80 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -619,18 +619,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 (th->th_flags & (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