Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jan 2024 12:30:59 GMT
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 31acdb17668e - stable/13 - sctp: remove duplicate code
Message-ID:  <202401111230.40BCUxWd011288@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=31acdb17668ec28798fdace1f1f192d18ec50765

commit 31acdb17668ec28798fdace1f1f192d18ec50765
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2023-08-08 11:05:39 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-01-11 12:30:20 +0000

    sctp: remove duplicate code
    
    No functional change intended.
    
    (cherry picked from commit 9ade2745db8be213e9da2225795cafb8e7575e29)
---
 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 10af0c669f04..4e43c8c72f40 100644
--- a/sys/netinet/sctp_usrreq.c
+++ b/sys/netinet/sctp_usrreq.c
@@ -424,8 +424,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;
@@ -463,6 +462,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 144ab77c5dec..0177dd5ac227 100644
--- a/sys/netinet/sctp_var.h
+++ b/sys/netinet/sctp_var.h
@@ -319,6 +319,7 @@ struct sctp_tcb;
 struct sctphdr;
 
 void sctp_close(struct socket *so);
+void sctp_abort(struct socket *so);
 int sctp_disconnect(struct socket *so);
 void sctp_ctlinput(int, struct sockaddr *, void *);
 int sctp_ctloutput(struct socket *, struct sockopt *);
diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c
index aeebe712b1ce..dca38401c02b 100644
--- a/sys/netinet6/sctp6_usrreq.c
+++ b/sys/netinet6/sctp6_usrreq.c
@@ -460,52 +460,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)
 {
@@ -1191,7 +1145,7 @@ sctp6_getpeeraddr(struct socket *so, struct sockaddr **nam)
 }
 
 struct pr_usrreqs sctp6_usrreqs = {
-	.pru_abort = sctp6_abort,
+	.pru_abort = sctp_abort,
 	.pru_accept = sctp_accept,
 	.pru_attach = sctp6_attach,
 	.pru_bind = sctp6_bind,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401111230.40BCUxWd011288>