From nobody Tue Aug 08 11:07: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 4RKr4z4bXRz4mBMl; Tue, 8 Aug 2023 11:07: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 4RKr4z27w0z4Yhx; Tue, 8 Aug 2023 11:07:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691492867; 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=oHgETEtsCHSTHQ3plGmGe/BdhoOGh3Pku1SZ8E6t8qM=; b=mvuKaTafPAHY4hb8My/1IwpbSJCC/7O57Dfg/VGdrn4FSYMXFQwpdbjrVDp2ikDkZmwWtZ QzZ5OIMBVKhsvewn6J0t3tuABKBiBFzT+f/W+HCtFetk4h7e35bzLeLodPJfZ8Wchb7qy+ uj0I8ct09DgV2hQ3FAdTAHQOv0CRWbYZ1SltuHUjv/RaHi1ScRFV36b+YGhQHnsmKlt0Je UCI1ZhWQeh85dvgckIZB0adeAXUSQVPDqnfaFjVWx2SzyTq70KCQ+FPM8ZF7AHgdBPzvnK kgc1PSKFreVlCZPTpTaEApWP4V0zBKdSlNdPp7f2PXLDKjQCjiTCbU0LpUiwlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691492867; 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=oHgETEtsCHSTHQ3plGmGe/BdhoOGh3Pku1SZ8E6t8qM=; b=ho2Okod90vdjrPGaJXDBSQM66Q61mOdFqvSXpCq/f9gZN/sswnNyEW5rv5PHXfHfoeiWvS SkRg3PKuspEpGqoi3TTDLku43uONSQhEMiomT6cma1vN0PAsjFARubBjThLCUfYIy53ZN7 keHleJ0oUcBg5M+pkf3m/3BEYjAqcW7knT1suZ2QfxexnUtvWUz95mmvJC5uzvCj3CPJsX otTq0XEqngoDpYt9bOGyN+d36mWvwf8WGZVhYqQKdw2x/2tdP6792xPyBHszFkNaeYybVj DIqSDnRlv8HcJy2rMjvVGkEI5wj0q7jM0scu7v/8OWBdK0M+dYUZQsF4gsqu4Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691492867; a=rsa-sha256; cv=none; b=m8XA6wulK65mz8FuT7RS2n/OKkUTbkqkPX+0LpQxwOxlMV3iuu/c7Eu3D6Q/VZmfCO18f1 i+SoK0lb97/0yrVV2KzrLn7EtVquqt9jKOoM3erhMxpNnYzaxHt4VlvTy5E1r9ynVEKdJI R1+NEzzhlhJl+vgKkpO3Mx/VxtJu8TNWfgmUsug4CVXZKF8ixEOcMbPmitEnYmw7xXpuY5 xz+RiGWw2hb6K0OJUvg6hfza9vZtRX0EbMiGMoadiSZuRviFyPe/BfcWFSOUKkNaDIjNtm 8zCAtrCPIOtr2dSCotASqvQ+8IUl53T305gvDDYcw5DarJV8PGcgdrPJuLPiaQ== 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 4RKr4z1DL3zXYp; Tue, 8 Aug 2023 11:07: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 378B7ldJ092780; Tue, 8 Aug 2023 11:07:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 378B7lf8092779; Tue, 8 Aug 2023 11:07:47 GMT (envelope-from git) Date: Tue, 8 Aug 2023 11:07:47 GMT Message-Id: <202308081107.378B7lf8092779@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 9ade2745db8b - main - sctp: remove duplicate code 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: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ade2745db8be213e9da2225795cafb8e7575e29 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=9ade2745db8be213e9da2225795cafb8e7575e29 commit 9ade2745db8be213e9da2225795cafb8e7575e29 Author: Michael Tuexen AuthorDate: 2023-08-08 11:05:39 +0000 Commit: Michael Tuexen CommitDate: 2023-08-08 11:05:39 +0000 sctp: remove duplicate code No functional change intended. MFC after: 1 week --- sys/netinet/sctp_usrreq.c | 4 ++-- sys/netinet/sctp_var.h | 1 + sys/netinet6/sctp6_usrreq.c | 48 +-------------------------------------------- 3 files changed, 4 insertions(+), 49 deletions(-) diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index aa957ffa9f96..5bbb32534ff0 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -414,8 +414,7 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, getcred, 0, 0, sctp_getcred, "S,ucred", "Get the ucred of a SCTP connection"); -#ifdef INET -static void +void sctp_abort(struct socket *so) { struct epoch_tracker et; @@ -453,6 +452,7 @@ sctp_abort(struct socket *so) NET_EPOCH_EXIT(et); } +#ifdef INET static int sctp_attach(struct socket *so, int proto SCTP_UNUSED, struct thread *p SCTP_UNUSED) { diff --git a/sys/netinet/sctp_var.h b/sys/netinet/sctp_var.h index ef01b0b6c3bd..1dd748b8c798 100644 --- a/sys/netinet/sctp_var.h +++ b/sys/netinet/sctp_var.h @@ -321,6 +321,7 @@ struct sctp_tcb; struct sctphdr; void sctp_close(struct socket *so); +void sctp_abort(struct socket *so); int sctp_disconnect(struct socket *so); ipproto_ctlinput_t sctp_ctlinput; int sctp_ctloutput(struct socket *, struct sockopt *); diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index a105b2897c6c..8e5476c2cae3 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -434,52 +434,6 @@ SYSCTL_PROC(_net_inet6_sctp6, OID_AUTO, getcred, 0, 0, sctp6_getcred, "S,ucred", "Get the ucred of a SCTP6 connection"); -/* This is the same as the sctp_abort() could be made common */ -static void -sctp6_abort(struct socket *so) -{ - struct epoch_tracker et; - struct sctp_inpcb *inp; - uint32_t flags; - - inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == NULL) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); - return; - } - NET_EPOCH_ENTER(et); -sctp_must_try_again: - flags = inp->sctp_flags; -#ifdef SCTP_LOG_CLOSING - sctp_log_closing(inp, NULL, 17); -#endif - if (((flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) && - (atomic_cmpset_int(&inp->sctp_flags, flags, (flags | SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_CLOSE_IP)))) { -#ifdef SCTP_LOG_CLOSING - sctp_log_closing(inp, NULL, 16); -#endif - sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT, - SCTP_CALLED_AFTER_CMPSET_OFCLOSE); - SOCK_LOCK(so); - SCTP_SB_CLEAR(so->so_snd); - /* - * same for the rcv ones, they are only here for the - * accounting/select. - */ - SCTP_SB_CLEAR(so->so_rcv); - /* Now null out the reference, we are completely detached. */ - so->so_pcb = NULL; - SOCK_UNLOCK(so); - } else { - flags = inp->sctp_flags; - if ((flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) { - goto sctp_must_try_again; - } - } - NET_EPOCH_EXIT(et); - return; -} - static int sctp6_attach(struct socket *so, int proto SCTP_UNUSED, struct thread *p SCTP_UNUSED) { @@ -1167,7 +1121,7 @@ sctp6_getpeeraddr(struct socket *so, struct sockaddr **nam) #define SCTP6_PROTOSW \ .pr_protocol = IPPROTO_SCTP, \ .pr_ctloutput = sctp_ctloutput, \ - .pr_abort = sctp6_abort, \ + .pr_abort = sctp_abort, \ .pr_accept = sctp_accept, \ .pr_attach = sctp6_attach, \ .pr_bind = sctp6_bind, \