From nobody Fri Oct 7 02:35:39 2022 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 4MkC8r3b3Nz4f59x; Fri, 7 Oct 2022 02:35:40 +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 4MkC8r2FNkz4GBc; Fri, 7 Oct 2022 02:35:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665110140; 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=VGvN53CkvsEgFAAgaTNkvUgYDMI5SFjn5ZXdDio59aM=; b=awpalyvX4FbakywLnUPMW+9GSkZa6fSIbFbMRnE71dzB4mBT8EWI1refHj5zVQr6J6Gma6 hdAzAmg09huY0XnDUbAh2f9MnpffgdMaaDG6cbGQMy6QkDigyeg49jdCsiVbBhAKZ+iONv srDKIBE1eLDl6nIh0cU/aRjed6KmslOdj5brpLfkRlN6CBDN8X6PBZINIOi9u9Sb+qgBcA 3vdmx/yQWlND3JcPJPXKAl0+8hB8rEsGLHcpstATHIf7w/DIU5KW8+zxq6A/ZKqPYFU7D/ 2v/IgkQ+K/TPuOi/QBumQ1JxMy7eEUe3rt9+QqDeuJH4F21ife9R3e+Aa3r+iA== 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 4MkC8r0JJ1zRn0; Fri, 7 Oct 2022 02:35:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2972ZdI1090624; Fri, 7 Oct 2022 02:35:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2972ZdaN090623; Fri, 7 Oct 2022 02:35:39 GMT (envelope-from git) Date: Fri, 7 Oct 2022 02:35:39 GMT Message-Id: <202210070235.2972ZdaN090623@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 9c3507f91987 - main - tcp: in tcp_usr_detach() remove special handling of compressed time-wait 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9c3507f91987b7c8ce3b895a5ee46a1de6bc42f2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665110140; 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=VGvN53CkvsEgFAAgaTNkvUgYDMI5SFjn5ZXdDio59aM=; b=weDx+nHADgPnsfIcJNzswKexyl5Lr6pePOcsEJtowB0eGNh3UWeMKPcwiSu32wannyj2j0 pITP+MaQ9bc1rB/TmQi97nTFIYIouD6HMEF6dio2biSyf0Gwhju/1nqaEcUP/Zf/7SVn7u gVUruBqqcft84zHkNPhKozzyMZ8d4KiqN8kN+V/8nohYbpHyCFDaqUkjsh02NbhuqsEVgS CS7RgR3jMt47UWfQHXJ37cYjWyaQVq4aGXcYghaLGTUEdCKs1L5toSgeUVEKYBw/8nG/Li OjZl+V+AxzRQio6zfPcfhYY11cEwsr1ABU4JGaWONX6JeAVrnUn+pVu5LyCXGA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665110140; a=rsa-sha256; cv=none; b=Qr9j3vQyxBpGcHRuNhUsAMto+pX8qp5CkkB6bOtAazPgScKI3g5huHW2zYLVCAmVwCLMpe OpAfmGVE0nfhzQIHPNVl9XTkE61rCTJDHPni5WCDA2uQ/eX6w1kAgi+1wBFkuUaEbbBDeS 0lDe3zs+/LnME18kkwlfg85lhYGEgBvCItuGEHBdYBPizSJqQ0GDsTnYeXW0xCi70CQ4Xp bGaGLXzYSVXgynWpIiAHxbvsGMUWArVDbkmQFJfkRQC3IWi3gQ6JpvGgEf6bgBabnvG+4Z QBl5bHQa9wQjMSguj690H+MY8tsHS3a1Q3ftItSJHSm88W2ppb8QMDJe5algLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=9c3507f91987b7c8ce3b895a5ee46a1de6bc42f2 commit 9c3507f91987b7c8ce3b895a5ee46a1de6bc42f2 Author: Gleb Smirnoff AuthorDate: 2022-10-07 02:22:23 +0000 Commit: Gleb Smirnoff CommitDate: 2022-10-07 02:24:32 +0000 tcp: in tcp_usr_detach() remove special handling of compressed time-wait Differential revision: https://reviews.freebsd.org/D36399 --- sys/netinet/tcp_usrreq.c | 59 ++++++------------------------------------------ 1 file changed, 7 insertions(+), 52 deletions(-) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 2c8b04aa2953..43acc0ad1719 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -216,58 +216,13 @@ tcp_usr_detach(struct socket *so) tp = intotcpcb(inp); - if (inp->inp_flags & INP_TIMEWAIT) { - /* - * There are two cases to handle: one in which the time wait - * state is being discarded (INP_DROPPED), and one in which - * this connection will remain in timewait. In the former, - * it is time to discard all state (except tcptw, which has - * already been discarded by the timewait close code, which - * should be further up the call stack somewhere). In the - * latter case, we detach from the socket, but leave the pcb - * present until timewait ends. - * - * XXXRW: Would it be cleaner to free the tcptw here? - * - * Astute question indeed, from twtcp perspective there are - * four cases to consider: - * - * #1 tcp_usr_detach is called at tcptw creation time by - * tcp_twstart, then do not discard the newly created tcptw - * and leave inpcb present until timewait ends - * #2 tcp_usr_detach is called at tcptw creation time by - * tcp_twstart, but connection is local and tw will be - * discarded immediately - * #3 tcp_usr_detach is called at timewait end (or reuse) by - * tcp_twclose, then the tcptw has already been discarded - * (or reused) and inpcb is freed here - * #4 tcp_usr_detach is called() after timewait ends (or reuse) - * (e.g. by soclose), then tcptw has already been discarded - * (or reused) and inpcb is freed here - * - * In all three cases the tcptw should not be freed here. - */ - if (inp->inp_flags & INP_DROPPED) { - KASSERT(tp == NULL, ("tcp_detach: INP_TIMEWAIT && " - "INP_DROPPED && tp != NULL")); - in_pcbdetach(inp); - in_pcbfree(inp); - } else { - in_pcbdetach(inp); - INP_WUNLOCK(inp); - } - } else { - /* - * If the connection is not in timewait, it must be either - * dropped or embryonic. - */ - KASSERT(inp->inp_flags & INP_DROPPED || - tp->t_state < TCPS_SYN_SENT, - ("%s: inp %p not dropped or embryonic", __func__, inp)); - tcp_discardcb(tp); - in_pcbdetach(inp); - in_pcbfree(inp); - } + KASSERT(inp->inp_flags & INP_DROPPED || + tp->t_state < TCPS_SYN_SENT, + ("%s: inp %p not dropped or embryonic", __func__, inp)); + + tcp_discardcb(tp); + in_pcbdetach(inp); + in_pcbfree(inp); } #ifdef INET