From nobody Mon Aug 14 09:39:30 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 4RPTrM14QLz4qDdt; Mon, 14 Aug 2023 09:39:31 +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 4RPTrM0Zstz4Njt; Mon, 14 Aug 2023 09:39:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692005971; 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=3UvcGgW4tIctWg23J9Zdk5yrZELKFmSkHnYx/NtfN0I=; b=rd+yikvwNnXKN1XqKkNjXJPBL44Sp64lsOJ4BsrW5w/ep1TrUQsS4BEicuf5ngHdarC8i3 75FYbXhoy0lFmbfGu45/+mDLBDIRV5ON9rTqNoyYPkv2PpKPYqLJTb+6GRPCzuA6zSCSY2 Cg8pbSPzlZs+HUVrSP0qpfUayaweu7aqUx4gcr6NcTUBPtxERLqEWhP04cFKlluD1VRTgD QoWsel8XPr17O4Yf2+orbZGN9ElfIVdXEgJ+2pg+vLAr//n65KPHJIP1VzWTALVUNS/NMB yHDuv8EzQEnRg54aTwQfdUd4qV9YfwW2XIZvimQEBmcHqnYiEighQFrXG1O1Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692005971; 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=3UvcGgW4tIctWg23J9Zdk5yrZELKFmSkHnYx/NtfN0I=; b=im8vkTj14Avziq56wkag8QPSdfQIsG5AFrCSD+O8z+J9fWjv4acz4duwKDwegLZZClWnxU Yl7W09yFHLhEVn6zqOFQg7m/iOUSJaJv4A35PqqedgkFFBxoqm4Br3FbVJxDqyBnmdWzfr YQYxgx9hRGvyuLQcbj1JHWeeQxim/RcPrNlbChOfHfcmcN9NDTg7uECikc2myRDndxa2Jw skr974llLXfjXvRywLC1dY+seG85zIN7/CdOFUszTcMwU9wiNmnqqDCnEdaZ4iKepSmWdA MjUJpmV9d7B52+e4a/xXX0H5qAQBIT+ePUZtbWTTlo9erdOYw2Fv673HXvrSpQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692005971; a=rsa-sha256; cv=none; b=VChcj/wOKy8uCI051e6EKqLNt0wQ+vyrABNKPHBPLI1SzFFpy1NGx70KpEGQfDWOC51KLR 5TLP/x9uhXgv0b2aS5aA9yvvk9CMw44n6HeBxFOuh479XAB5PFp4HFvsjlmLSLheR8dEZR ie6MwJ2rC2oAswsyOWmEHh6lHS/VSw6dDIdD+/WZQmMRZNWPLI68mijzh0E5kvy+xppsvE Zpzc5robbdzTCaEliK8mqpX7q00mpcx7urG6AFEDTbSq3zpORt5UilgvWQ6dHmziAaaVmL 8ewTDy8ha+5KmerKqnhbgOvoW0T57GOv/ITgdAi9mALmopvf9NdgPssIuryRGQ== 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 4RPTrL6g08z8M4; Mon, 14 Aug 2023 09:39:30 +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 37E9dUxQ029447; Mon, 14 Aug 2023 09:39:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37E9dUfL029444; Mon, 14 Aug 2023 09:39:30 GMT (envelope-from git) Date: Mon, 14 Aug 2023 09:39:30 GMT Message-Id: <202308140939.37E9dUfL029444@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: b2d895f70ded - stable/12 - 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/12 X-Git-Reftype: branch X-Git-Commit: b2d895f70ded2c7c179d6380efb1423fabad5564 Auto-Submitted: auto-generated The branch stable/12 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=b2d895f70ded2c7c179d6380efb1423fabad5564 commit b2d895f70ded2c7c179d6380efb1423fabad5564 Author: Richard Scheffenegger AuthorDate: 2023-07-26 22:41:25 +0000 Commit: Richard Scheffenegger CommitDate: 2023-08-14 09:38:03 +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 fd55a5a09369..0fa2c7ac6562 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1966,6 +1966,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 d06b54cffc1c..a530bbbabb2a 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -558,18 +558,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