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, \