diff -ru dfly/netinet/sctp_asconf.c dfly-nospl/netinet/sctp_asconf.c
--- dfly/netinet/sctp_asconf.c	2005-06-18 12:41:43.000000000 +0000
+++ dfly-nospl/netinet/sctp_asconf.c	2005-06-18 13:27:43.000000000 +0000
@@ -54,6 +54,7 @@
 #include <sys/socketvar.h>
 #include <sys/kernel.h>
 #include <sys/sysctl.h>
+#include <sys/thread2.h>
 
 #include <net/if.h>
 #include <net/if_types.h>
@@ -1804,7 +1805,6 @@
 sctp_addr_mgmt_ep(struct sctp_inpcb *inp, struct ifaddr *ifa, uint16_t type)
 {
 	struct sctp_tcb *stcb;
-	int s;
 
 	SCTP_INP_WLOCK(inp);
 	/* make sure we're "allowed" to add this type of addr */
@@ -1878,18 +1878,14 @@
 		}
 	}
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	/* process for all associations for this endpoint */
 	LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
 		SCTP_TCB_LOCK(stcb);
 		sctp_addr_mgmt_assoc(inp, stcb, ifa, type);
 		SCTP_TCB_UNLOCK(stcb);
 	} /* for each stcb */
-	splx(s);
+	crit_exit();
 	SCTP_INP_WUNLOCK(inp);
 }
 
@@ -1900,7 +1896,6 @@
 sctp_addr_mgmt_restrict_ep(struct sctp_inpcb *inp, struct ifaddr *ifa)
 {
 	struct sctp_tcb *stcb;
-	int s;
 
 	/* is this endpoint bound to all? */
 	if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0) {
@@ -1911,11 +1906,7 @@
 		return;
 	}
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	SCTP_INP_RLOCK(inp);
 	/* process for all associations for this endpoint */
 	LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
@@ -1929,7 +1920,7 @@
 		}
 #endif /* SCTP_DEBUG */
 	} /* for each stcb */
-	splx(s);
+	crit_exit();
 	SCTP_INP_RUNLOCK(inp);
 }
 
diff -ru dfly/netinet/sctp_input.c dfly-nospl/netinet/sctp_input.c
--- dfly/netinet/sctp_input.c	2005-06-18 12:41:43.000000000 +0000
+++ dfly-nospl/netinet/sctp_input.c	2005-06-18 13:27:43.000000000 +0000
@@ -58,6 +58,7 @@
 #include <sys/kernel.h>
 #include <sys/errno.h>
 #include <sys/syslog.h>
+#include <sys/thread2.h>
 
 #if (defined(__FreeBSD__) && __FreeBSD_version >= 500000)
 #include <sys/limits.h>
@@ -4086,7 +4087,9 @@
 #endif
 {
 	int iphlen;
+#ifdef __OpenBSD__
 	int s;
+#endif
 	u_int8_t ecn_bits;
 	struct ip *ip;
 	struct sctphdr *sh;
@@ -4382,15 +4385,11 @@
 	offset -= sizeof(struct sctp_chunkhdr);
 
 	ecn_bits = ip->ip_tos;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	sctp_common_input_processing(&m, iphlen, offset, length, sh, ch,
 	    inp, stcb, net, ecn_bits);
 	/* inp's ref-count reduced && stcb unlocked */
-	splx(s);
+	crit_exit();
 	if (m) {
 		sctp_m_freem(m);
 	}
diff -ru dfly/netinet/sctp_output.c dfly-nospl/netinet/sctp_output.c
--- dfly/netinet/sctp_output.c	2005-06-18 12:41:43.000000000 +0000
+++ dfly-nospl/netinet/sctp_output.c	2005-06-18 13:27:43.000000000 +0000
@@ -63,6 +63,7 @@
 #ifdef INET6
 #include <sys/domain.h>
 #endif
+#include <sys/thread2.h>
 
 #if (defined(__FreeBSD__) && __FreeBSD_version >= 500000)
 #include <sys/limits.h>
@@ -7213,18 +7214,13 @@
 	struct sctp_association *asoc;
 	int create_lock_applied = 0;
 	int queue_only, error = 0;
-	int s;
 	struct sctp_sndrcvinfo srcv;
 	int un_sent = 0;
 	int use_rcvinfo = 0;
 	t_inp = inp;
 	/*  struct route ro;*/
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	queue_only = 0;
 	ip_inp = (struct inpcb *)inp;
 	stcb = NULL;
@@ -7246,7 +7242,7 @@
 			control = NULL;
 		}
 		sctp_m_freem(m);
-		splx(s);
+		crit_exit();
 		return (EFAULT);
 	}
 	/* Can't allow a V6 address on a non-v6 socket */
@@ -7262,7 +7258,7 @@
 				control = NULL;
 			}
 			sctp_m_freem(m);
-			splx(s);
+			crit_exit();
 			return (EFAULT);
 		}
 		create_lock_applied = 1;
@@ -7275,7 +7271,7 @@
 				control = NULL;
 			}
 			sctp_m_freem(m);
-			splx(s);
+			crit_exit();
 			return (EINVAL);
 		}
 	}
@@ -7287,7 +7283,7 @@
 				/* its a sendall */
 				sctppcbinfo.mbuf_track--;
 				sctp_m_freem(control);
-				splx(s);
+				crit_exit();
 				if (create_lock_applied) {
 					SCTP_ASOC_CREATE_UNLOCK(inp);
 					create_lock_applied = 0;
@@ -7310,7 +7306,7 @@
 						sctppcbinfo.mbuf_track--;
 						sctp_m_freem(control);
 						sctp_m_freem(m);
-						splx(s);
+						crit_exit();
 						return (ENOTCONN);
 					}
 					net = stcb->asoc.primary_destination;
@@ -7343,7 +7339,7 @@
 				SCTP_TCB_LOCK(stcb);
 			SCTP_INP_RUNLOCK(inp);
 			if (stcb == NULL) {
-				splx(s);
+				crit_exit();
 				if (create_lock_applied) {
 					SCTP_ASOC_CREATE_UNLOCK(inp);
 					create_lock_applied = 0;
@@ -7390,7 +7386,7 @@
 			create_lock_applied = 0;
 		}
 		sctp_m_freem(m);
-		splx(s);
+		crit_exit();
 		return (ENOTCONN);
 	} else if ((stcb == NULL) &&
 		   (addr == NULL)) {
@@ -7404,7 +7400,7 @@
 			create_lock_applied = 0;
 		}
 		sctp_m_freem(m);
-		splx(s);
+		crit_exit();
 		return (ENOENT);
 	} else if (stcb == NULL) {
 		/* UDP mode, we must go ahead and start the INIT process */
@@ -7420,7 +7416,7 @@
 				create_lock_applied = 0;
 			}
 			sctp_m_freem(m);
-			splx(s);
+			crit_exit();
 			return (ENOENT);
 		}
 		stcb = sctp_aloc_assoc(inp, addr, 1, &error, 0);
@@ -7435,7 +7431,7 @@
 				create_lock_applied = 0;
 			}
 			sctp_m_freem(m);
-			splx(s);
+			crit_exit();
 			return (error);
 		}
 		if (create_lock_applied) {
@@ -7535,7 +7531,7 @@
 					sctp_m_freem(m);
 				error = ECONNRESET;
 			}
-			splx(s);
+			crit_exit();
 			SCTP_TCB_UNLOCK(stcb);
 			return (error);
 		}
@@ -7575,7 +7571,7 @@
 	}
 	if ((error = sctp_msg_append(stcb, net, m, &srcv, flags))) {
 		SCTP_TCB_UNLOCK(stcb);
-		splx(s);
+		crit_exit();
 		return (error);
 	}
 	if (net->flight_size > net->cwnd) {
@@ -7629,7 +7625,7 @@
 	}
 #endif
 	SCTP_TCB_UNLOCK(stcb);
-	splx(s);
+	crit_exit();
 	return (0);
 }
 
@@ -9522,7 +9518,6 @@
 	 */
 	struct socket *so;
 	int error = 0;
-	int s;
 	int frag_size, mbcnt = 0, mbcnt_e = 0;
 	unsigned int sndlen;
 	unsigned int tot_demand;
@@ -9533,11 +9528,7 @@
 	uint32_t my_vtag;
 	int resv_in_first;
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	so = stcb->sctp_socket;
 	chk = NULL;
 	mm = NULL;
@@ -9553,7 +9544,7 @@
 	if (sndlen > so->so_snd.sb_hiwat) {
 		/* It will NEVER fit */
 		error = EMSGSIZE;
-		splx(s);
+		crit_exit();
 		goto release;
 	}
 	/* Do I need to block? */
@@ -9622,23 +9613,23 @@
 				 * here for us
 				 */
  				error = inp->error_on_block;
-				splx(s);
+				crit_exit();
 				goto out_locked;
 			}
 			if (error) {
-				splx(s);
+				crit_exit();
 				goto out_locked;
 			}
 			/* did we encounter a socket error? */
 			if (so->so_error) {
 				error = so->so_error;
-				splx(s);
+				crit_exit();
 				goto out_locked;
 			}
 			error = sblock(&so->so_snd, M_WAITOK);
 			if (error) {
 				/* Can't aquire the lock */
-				splx(s);
+				crit_exit();
 				goto out_locked;
 			}
 #if defined(__FreeBSD__) && __FreeBSD_version >= 502115
@@ -9648,12 +9639,12 @@
 #endif
 				/* The socket is now set not to sendmore.. its gone */
 				error = EPIPE;
-				splx(s);
+				crit_exit();
 				goto release;
 			}
 			if (so->so_error) {
 				error = so->so_error;
-				splx(s);
+				crit_exit();
 				goto release;
 			}
 			if (asoc->peer_supports_prsctp) {
@@ -9721,10 +9712,10 @@
 						  SCTP_RESPONSE_TO_USER_REQ,
 						  mm);
 			mm = NULL;
-			splx(s);
+			crit_exit();
 			goto out_notlocked;
 		}
-		splx(s);
+		crit_exit();
 		goto release;
 	}
 
@@ -9735,14 +9726,14 @@
 	    (asoc->state & SCTP_STATE_SHUTDOWN_PENDING)) {
 		/* got data while shutting down */
 		error = ECONNRESET;
-		splx(s);
+		crit_exit();
 		goto release;
  	}
  	/* Is the stream no. valid? */
 	if (srcv->sinfo_stream >= asoc->streamoutcnt) {
  		/* Invalid stream number */
 		error = EINVAL;
-		splx(s);
+		crit_exit();
 		goto release;
  	}
 	if (asoc->strmout == NULL) {
@@ -9753,19 +9744,19 @@
  		}
 #endif
 		error = EFAULT;
-		splx(s);
+		crit_exit();
 		goto release;
 	}
 	if ((srcv->sinfo_flags & MSG_EOF) &&
 	    (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
 	    (tot_out == 0)) {
-		splx(s);
+		crit_exit();
 		goto zap_by_it_now;
 	}
  	if (tot_out == 0) {
  		/* not allowed */
  		error = EMSGSIZE;
-		splx(s);
+		crit_exit();
 		goto release;
  	}
 	/* save off the tag */
@@ -9777,7 +9768,7 @@
 	/* two choices here, it all fits in one chunk or
 	 * we need multiple chunks.
 	 */
-	splx(s);
+	crit_exit();
 	SOCKBUF_UNLOCK(&so->so_snd);
 	if (tot_out <= frag_size) {
 		/* no need to setup a template */
@@ -9821,17 +9812,13 @@
 		if (chk->flags & SCTP_PR_SCTP_BUFFER) {
 			asoc->sent_queue_cnt_removeable++;
 		}
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-		s = splsoftnet();
-#else
-		s = splnet();
-#endif
+		crit_enter();
 		if ((asoc->state == 0) ||
 		    (my_vtag != asoc->my_vtag) ||
 		    (so != inp->sctp_socket) ||
 		    (inp->sctp_socket == 0)) {
 			/* connection was aborted */
-			splx(s);
+			crit_exit();
 			error = ECONNRESET;
 			goto clean_up;
 		}
@@ -9845,7 +9832,7 @@
 			 */
 			sctp_insert_on_wheel(asoc, strq);
 		}
-		splx(s);
+		crit_exit();
 clean_up:
 		if (error) {
 			SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
@@ -9922,17 +9909,13 @@
 
 		/* now move it to the streams actual queue */
 		/* first stop protocol processing */
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- 		s = splsoftnet();
-#else
- 		s = splnet();
-#endif
+ 		crit_enter();
 		if ((asoc->state == 0) ||
 		    (my_vtag != asoc->my_vtag) ||
 		    (so != inp->sctp_socket) ||
 		    (inp->sctp_socket == 0)) {
 			/* connection was aborted */
-			splx(s);
+			crit_exit();
 			error = ECONNRESET;
 			goto temp_clean_up;
 		}
@@ -9953,7 +9936,7 @@
 			sctp_insert_on_wheel(asoc, strq);
 		}
 		/* Ok now we can allow pping */
-		splx(s);
+		crit_exit();
 temp_clean_up:
 		if (error) {
 			SOCKBUF_LOCK(&so->so_snd);
@@ -9984,11 +9967,7 @@
 		       asoc->total_output_mbuf_queue_size,
 		       mbcnt);
 #endif
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	SOCKBUF_LOCK(&so->so_snd);
 	asoc->total_output_queue_size += dataout;
 	asoc->total_output_mbuf_queue_size += mbcnt;
@@ -10047,7 +10026,7 @@
 			asoc->state |= SCTP_STATE_SHUTDOWN_PENDING;
 		}
 	}
-	splx(s);
+	crit_exit();
 #ifdef SCTP_DEBUG
 	if (sctp_debug_on & SCTP_DEBUG_OUTPUT2) {
 		printf("++total out:%d total_mbuf_out:%d\n",
@@ -10091,7 +10070,7 @@
 {
  	unsigned int sndlen;
 	int error, use_rcvinfo;
-	int s, queue_only = 0, queue_only_for_init=0;
+	int queue_only = 0, queue_only_for_init=0;
 	int un_sent = 0;
 	int now_filled=0;
 	struct sctp_inpcb *inp;
@@ -10122,17 +10101,13 @@
 		sndlen = top->m_pkthdr.len;
 
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 
 	if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
 	    (inp->sctp_flags & SCTP_PCB_FLAGS_ACCEPTING)) {
 		/* The listner can NOT send */
 		error = EFAULT;
-		splx(s);
+		crit_exit();
 		goto out;
 	}
 	if (addr) {
@@ -10141,7 +10116,7 @@
 		    (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
 			/* Should I really unlock ? */
 			error = EFAULT;
-			splx(s);
+			crit_exit();
 			goto out;
 
 		}
@@ -10149,7 +10124,7 @@
 		if (((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) &&
 		    (addr->sa_family == AF_INET6)) {
 			error = EINVAL;
-			splx(s);
+			crit_exit();
 			goto out;
 		}
 	}
@@ -10160,7 +10135,7 @@
 		if (stcb == NULL) {
 			SCTP_INP_RUNLOCK(inp);
 			error = ENOTCONN;
-			splx(s);
+			crit_exit();
 			goto out;
 		}
 		SCTP_TCB_LOCK(stcb);
@@ -10222,11 +10197,11 @@
 	if ((stcb == NULL) &&
 	    (inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE)) {
 		error = ENOTCONN;
-		splx(s);
+		crit_exit();
 		goto out;
 	} else if ((stcb == NULL) && (addr == NULL)) {
 		error = ENOENT;
-		splx(s);
+		crit_exit();
 		goto out;
 	} else if (stcb == NULL) {
 		/* UDP style, we must go ahead and start the INIT process */
@@ -10234,14 +10209,14 @@
 		    (srcv.sinfo_flags & MSG_ABORT)) {
 			/* User asks to abort a non-existant asoc */
 			error = ENOENT;
-			splx(s);
+			crit_exit();
 			goto out;
 		}
 		/* get an asoc/stcb struct */
 		stcb = sctp_aloc_assoc(inp, addr, 1, &error, 0);
 		if (stcb == NULL) {
 			/* Error is setup for us in the call */
-			splx(s);
+			crit_exit();
 			goto out;
 		}
 		if (create_lock_applied) {
@@ -10350,7 +10325,7 @@
 			;
 		} else {
 			error = ECONNRESET;
-			splx(s);
+			crit_exit();
 			goto out;
 		}
 	}
@@ -10377,7 +10352,7 @@
 		 * protocol processing until we are ready to
 		 * send/queue it.
 		 */
- 		splx(s);
+ 		crit_exit();
 		error = sctp_copy_it_in(inp, stcb, asoc, net, &srcv, uio, flags);
 		if (error)
 			goto out;
@@ -10386,7 +10361,7 @@
 		 * buffers, or use top to do a msg_append.
 		 */
  		error = sctp_msg_append(stcb, net, top, &srcv, flags);
- 		splx(s);
+ 		crit_exit();
 		if (error)
 			goto out;
 		/* zap the top since it is now being used */
@@ -10439,39 +10414,27 @@
 			printf("USR Send calls sctp_chunk_output\n");
 		}
 #endif
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-		s = splsoftnet();
-#else
-		s = splnet();
-#endif
+		crit_enter();
 		sctp_pegs[SCTP_OUTPUT_FRM_SND]++;
 		sctp_chunk_output(inp, stcb, 0);
-		splx(s);
+		crit_exit();
 	} else if ((queue_only == 0) &&
 		   (stcb->asoc.peers_rwnd == 0) &&
 		   (stcb->asoc.total_flight == 0)) {
 		/* We get to have a probe outstanding */
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-		s = splsoftnet();
-#else
-		s = splnet();
-#endif
+		crit_enter();
 		sctp_from_user_send = 1;
 		sctp_chunk_output(inp, stcb, 0);
 		sctp_from_user_send = 0;
-		splx(s);
+		crit_exit();
 
 	} else if (!TAILQ_EMPTY(&stcb->asoc.control_send_queue)) {
 		int num_out, reason, cwnd_full;
 		/* Here we do control only */
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-		s = splsoftnet();
-#else
-		s = splnet();
-#endif
+		crit_enter();
 		sctp_med_chunk_output(inp, stcb, &stcb->asoc, &num_out,
 				      &reason, 1, &cwnd_full, 1, &now, &now_filled);
-		splx(s);
+		crit_exit();
 	}
 #ifdef SCTP_DEBUG
 	if (sctp_debug_on & SCTP_DEBUG_OUTPUT1) {
diff -ru dfly/netinet/sctp_pcb.c dfly-nospl/netinet/sctp_pcb.c
--- dfly/netinet/sctp_pcb.c	2005-06-18 12:41:43.000000000 +0000
+++ dfly-nospl/netinet/sctp_pcb.c	2005-06-18 13:27:43.000000000 +0000
@@ -59,6 +59,7 @@
 #include <sys/proc.h>
 #include <sys/kernel.h>
 #include <sys/sysctl.h>
+#include <sys/thread2.h>
 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 #include <sys/random.h>
 #endif
@@ -2237,19 +2238,15 @@
 #if !defined(__FreeBSD__) || __FreeBSD_version < 500000
  	struct rtentry *rt;
 #endif
-	int s, cnt;
+	int cnt;
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	SCTP_ASOC_CREATE_LOCK(inp);
 	SCTP_INP_WLOCK(inp);
 
 	if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) {
 		/* been here before */
-		splx(s);
+		crit_exit();
 		printf("Endpoint was all gone (dup free)?\n");
 		SCTP_INP_WUNLOCK(inp);
 		SCTP_ASOC_CREATE_UNLOCK(inp);
@@ -2339,7 +2336,7 @@
 		/* now is there some left in our SHUTDOWN state? */
 		if (cnt_in_sd) {
 			inp->sctp_flags |= SCTP_PCB_FLAGS_SOCKET_GONE;
-			splx(s);
+			crit_exit();
 			SCTP_INP_WUNLOCK(inp);
 			SCTP_ASOC_CREATE_UNLOCK(inp);
 			return;
@@ -2365,7 +2362,7 @@
 #ifdef IPSEC
 #ifdef __OpenBSD__
 	/* XXX IPsec cleanup here */
-		int s2 = spltdb();
+		crit_enter();
 		if (ip_pcb->inp_tdb_in)
 		    TAILQ_REMOVE(&ip_pcb->inp_tdb_in->tdb_inp_in,
 				 ip_pcb, inp_tdb_in_next);
@@ -2384,7 +2381,7 @@
 		    ipsp_reffree(ip_pcb->inp_ipsec_localauth);
 		if (ip_pcb->inp_ipsec_remoteauth)
 		    ipsp_reffree(ip_pcb->inp_ipsec_remoteauth);
-		splx(s2);
+		crit_exit();
 #else
 		ipsec4_delete_pcbpolicy(ip_pcb);
 #endif
@@ -2522,7 +2519,7 @@
 	sctppcbinfo.ipi_count_ep--;
 
 	SCTP_INP_INFO_WUNLOCK();
-	splx(s);
+	crit_exit();
 }
 
 
@@ -3319,18 +3316,13 @@
 	struct sctp_tmit_chunk *chk;
 	struct sctp_asconf_addr *aparam;
 	struct sctp_socket_q_list *sq;
-	int s;
 
 	/* first, lets purge the entry from the hash table. */
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	if (stcb->asoc.state == 0) {
 		printf("Freeing already free association:%p - huh??\n",
 		    stcb);
-		splx(s);
+		crit_exit();
 		return;
 	}
 	asoc = &stcb->asoc;
@@ -3634,7 +3626,7 @@
 	if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) {
 		sctp_inpcb_free(inp, 0);
 	}
-	splx(s);
+	crit_exit();
 }
 
 
@@ -3929,18 +3921,12 @@
 int
 sctp_insert_laddr(struct sctpladdr *list, struct ifaddr *ifa) {
 	struct sctp_laddr *laddr;
-	int s;
-
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
 
+	crit_enter();
 	laddr = (struct sctp_laddr *)SCTP_ZONE_GET(sctppcbinfo.ipi_zone_laddr);
 	if (laddr == NULL) {
 		/* out of memory? */
-		splx(s);
+		crit_exit();
 		return (EINVAL);
 	}
 	sctppcbinfo.ipi_count_laddr++;
@@ -3950,7 +3936,7 @@
 	/* insert it */
 	LIST_INSERT_HEAD(list, laddr, sctp_nxt_addr);
 
-	splx(s);
+	crit_exit();
 	return (0);
 }
 
@@ -3960,19 +3946,13 @@
 void
 sctp_remove_laddr(struct sctp_laddr *laddr)
 {
-	int s;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	/* remove from the list */
 	LIST_REMOVE(laddr, sctp_nxt_addr);
 	SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_laddr, laddr);
 	sctppcbinfo.ipi_count_laddr--;
 	sctppcbinfo.ipi_gencnt_laddr++;
-
-	splx(s);
+	crit_exit();
 }
 
 /*
@@ -5049,7 +5029,7 @@
 		       struct sctp_inpcb *s_inp)
 {
 	struct sctp_iterator *it=NULL;
-	int s;
+
 	if (af == NULL) {
 		return (-1);
 	}
@@ -5085,13 +5065,9 @@
 	SCTP_INP_INFO_WLOCK();
 	LIST_INSERT_HEAD(&sctppcbinfo.iteratorhead, it, sctp_nxt_itr);
 	SCTP_INP_INFO_WUNLOCK();
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	sctp_iterator_timer(it);
-	splx(s);
+	crit_exit();
 	return (0);
 }
 
@@ -5113,9 +5089,7 @@
 void
 callout_reset(struct callout *c, int to_ticks, void (*ftn)(void *), void *arg)
 {
-	int s;
-
-	s = splhigh();
+	crit_enter();
 	if (c->c_flags & CALLOUT_PENDING)
 		callout_stop(c);
 
@@ -5137,21 +5111,19 @@
 	c->c_time = ticks + to_ticks;
 	TAILQ_INSERT_TAIL(&sctppcbinfo.callqueue, c, tqe);
 #endif
-	splx(s);
+	crit_exit();
 }
 
 int
 callout_stop(struct callout *c)
 {
-	int	s;
-
-	s = splhigh();
+	crit_enter();
 	/*
 	 * Don't attempt to delete a callout that's not on the queue.
 	 */
 	if (!(c->c_flags & CALLOUT_PENDING)) {
 		c->c_flags &= ~CALLOUT_ACTIVE;
-		splx(s);
+		crit_exit();
 		return (0);
 	}
 	c->c_flags &= ~(CALLOUT_ACTIVE | CALLOUT_PENDING| CALLOUT_FIRED);
@@ -5162,7 +5134,7 @@
 	TAILQ_REMOVE(&sctppcbinfo.callqueue, c, tqe);
 	c->c_func = NULL;
 #endif
-	splx(s);
+	crit_exit();
 	return (1);
 }
 
@@ -5173,8 +5145,8 @@
 	struct callout *c, *n;
 	struct calloutlist locallist;
 	int inited = 0;
-	int s;
-	s = splhigh();
+
+	crit_enter();
 	/* run through and subtract and mark all callouts */
 	c = TAILQ_FIRST(&sctppcbinfo.callqueue);
 	while (c) {
@@ -5201,14 +5173,14 @@
 			/* now validate that it did not get canceled */
 			if (c->c_flags & CALLOUT_FIRED) {
 				c->c_flags &= ~CALLOUT_PENDING;
-				splx(s);
+				crit_exit();
 				(*c->c_func)(c->c_arg);
-				s = splhigh();
+				crit_enter();
 			}
 			c = TAILQ_FIRST(&locallist);
 		}
 	}
-	splx(s);
+	crit_exit();
 }
 #endif
 #endif /* _SCTP_NEEDS_CALLOUT_ */
diff -ru dfly/netinet/sctp_usrreq.c dfly-nospl/netinet/sctp_usrreq.c
--- dfly/netinet/sctp_usrreq.c	2005-06-18 12:41:43.000000000 +0000
+++ dfly-nospl/netinet/sctp_usrreq.c	2005-06-18 13:27:43.000000000 +0000
@@ -60,6 +60,7 @@
 #include <sys/socketvar.h>
 #include <sys/sysctl.h>
 #include <sys/syslog.h>
+#include <sys/thread2.h>
 #include <net/if.h>
 #include <net/if_types.h>
 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
@@ -456,7 +457,6 @@
 {
 	struct ip *ip = vip;
 	struct sctphdr *sh;
-	int s;
 
 
 	if (sa->sa_family != AF_INET ||
@@ -498,11 +498,7 @@
 		 * 'from' holds our local endpoint address.
 		 * Thus we reverse the to and the from in the lookup.
 		 */
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-		s = splsoftnet();
-#else
-		s = splnet();
-#endif
+		crit_enter();
 		stcb = sctp_findassociation_addr_sa((struct sockaddr *)&from,
 						    (struct sockaddr *)&to,
 						    &inp, &net, 1);
@@ -537,7 +533,7 @@
 			}
 
 		}
-		splx(s);
+		crit_exit();
 	}
 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 	return;
@@ -554,7 +550,7 @@
 	struct sctp_inpcb *inp;
 	struct sctp_nets *net;
 	struct sctp_tcb *stcb;
-	int error, s;
+	int error;
 
 #if __FreeBSD_version >= 500000 || defined(__DragonFly__)
 	error = suser(req->td);
@@ -567,7 +563,7 @@
 	if (error)
 		return (error);
 
-	s = splnet();
+	crit_enter();
 	stcb = sctp_findassociation_addr_sa(sintosa(&addrs[0]),
 					   sintosa(&addrs[1]),
 					   &inp, &net, 1);
@@ -583,8 +579,8 @@
 	}
 	error = SYSCTL_OUT(req, inp->sctp_socket->so_cred, sizeof(struct ucred));
 	SCTP_TCB_UNLOCK(stcb);
- out:
-	splx(s);
+out:
+	crit_exit();
 	return (error);
 }
 
@@ -706,19 +702,14 @@
 sctp_abort(struct socket *so)
 {
 	struct sctp_inpcb *inp;
-	int s;
 
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (inp == 0)
 		return EINVAL;	/* ??? possible? panic instead? */
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	sctp_inpcb_free(inp, 1);
-	splx(s);
+	crit_exit();
 	return 0;
 }
 
@@ -733,26 +724,22 @@
 {
 	struct sctp_inpcb *inp;
 	struct inpcb *ip_inp;
-	int s, error;
+	int error;
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (inp != 0) {
-		splx(s);
+		crit_exit();
 		return EINVAL;
 	}
 	error = soreserve(so, sctp_sendspace, sctp_recvspace, NULL);
 	if (error) {
-		splx(s);
+		crit_exit();
 		return error;
 	}
 	error = sctp_inpcb_alloc(so);
 	if (error) {
-		splx(s);
+		crit_exit();
 		return error;
 	}
 	inp = (struct sctp_inpcb *)so->so_pcb;
@@ -781,7 +768,7 @@
 #if defined(__NetBSD__)
 	so->so_send = sctp_sosend;
 #endif
-	splx(s);
+	crit_exit();
 	return 0;
 }
 
@@ -798,7 +785,7 @@
 	struct sockaddr *addr = nam ? mtod(nam, struct sockaddr *) : NULL;
 #endif
 	struct sctp_inpcb *inp;
-	int s, error;
+	int error;
 
 #ifdef INET6
 	if (addr && addr->sa_family != AF_INET)
@@ -810,13 +797,9 @@
 	if (inp == 0)
 		return EINVAL;
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	error = sctp_inpcb_bind(so, addr, p);
-	splx(s);
+	crit_exit();
 	return error;
 }
 
@@ -825,22 +808,18 @@
 sctp_detach(struct socket *so)
 {
 	struct sctp_inpcb *inp;
-	int s;
+
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (inp == 0)
 		return EINVAL;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	if (((so->so_options & SO_LINGER) && (so->so_linger == 0)) ||
 	    (so->so_rcv.sb_cc > 0)) {
 		sctp_inpcb_free(inp, 1);
 	} else {
 		sctp_inpcb_free(inp, 0);
 	}
-	splx(s);
+	crit_exit();
 	return 0;
 }
 
@@ -962,23 +941,18 @@
 sctp_disconnect(struct socket *so)
 {
 	struct sctp_inpcb *inp;
-	int s;
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (inp == NULL) {
-		splx(s);
+		crit_exit();
 		return (ENOTCONN);
 	}
 	SCTP_INP_RLOCK(inp);
 	if (inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) {
 		if (LIST_EMPTY(&inp->sctp_asoc_list)) {
 			/* No connection */
-			splx(s);
+			crit_exit();
 			SCTP_INP_RUNLOCK(inp);
 			return (0);
 		} else {
@@ -988,7 +962,7 @@
 
 			stcb = LIST_FIRST(&inp->sctp_asoc_list);
 			if (stcb == NULL) {
-				splx(s);
+				crit_exit();
 				SCTP_INP_RUNLOCK(inp);
 				return (EINVAL);
 			}
@@ -1016,7 +990,7 @@
 				SCTP_INP_RUNLOCK(inp);
 				sctp_free_assoc(inp, stcb);
 				/* No unlock tcb assoc is gone */
-				splx(s);
+				crit_exit();
 				return (0);
 			}
 			if (!TAILQ_EMPTY(&asoc->out_wheel)) {
@@ -1074,14 +1048,14 @@
 			}
 			SCTP_TCB_UNLOCK(stcb);
 			SCTP_INP_RUNLOCK(inp);
-			splx(s);
+			crit_exit();
 			return (0);
 		}
 		/* not reached */
 	} else {
 		/* UDP model does not support this */
 		SCTP_INP_RUNLOCK(inp);
-		splx(s);
+		crit_exit();
 		return EOPNOTSUPP;
 	}
 }
@@ -1090,16 +1064,11 @@
 sctp_shutdown(struct socket *so)
 {
 	struct sctp_inpcb *inp;
-	int s;
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (inp == 0) {
-		splx(s);
+		crit_exit();
 		return EINVAL;
 	}
 	SCTP_INP_RLOCK(inp);
@@ -1112,7 +1081,7 @@
 		so->so_state &= ~SS_CANTRCVMORE;
 #endif
 		/* This proc will wakeup for read and do nothing (I hope) */
-		splx(s);
+		crit_exit();
 		SCTP_INP_RUNLOCK(inp);
 		return (EOPNOTSUPP);
 	}
@@ -1132,7 +1101,7 @@
 			 * Ok we hit the case that the shutdown call was made
 			 * after an abort or something. Nothing to do now.
 			 */
-			splx(s);
+			crit_exit();
 			return (0);
 		}
 		SCTP_TCB_LOCK(stcb);
@@ -1183,7 +1152,7 @@
 		SCTP_TCB_UNLOCK(stcb);
 	}
 	SCTP_INP_RUNLOCK(inp);
-	splx(s);
+	crit_exit();
 	return 0;
 }
 
@@ -1459,11 +1428,6 @@
 		  int delay
 	)
 {
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-        int s = splsoftnet();
-#else
-	int s = splnet();
-#endif
         int error = 0;
 	struct sctp_tcb *stcb = NULL;
 	struct sockaddr *sa;
@@ -1474,10 +1438,11 @@
 	}
 #endif /* SCTP_DEBUG */
 
+	crit_enter();
 	if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
 	    (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED)) {
 		/* We are already connected AND the TCP model */
-		splx(s);
+		crit_exit();
 		return (EADDRINUSE);
 	}
 	if (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) {
@@ -1486,7 +1451,7 @@
 		SCTP_INP_RUNLOCK(inp);
 	}
 	if (stcb) {
-		splx(s);
+		crit_exit();
 		return (EALREADY);
 
 	}
@@ -1494,7 +1459,7 @@
 	if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) ||
 	    (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
 		SCTP_ASOC_CREATE_UNLOCK(inp);
-		splx(s);
+		crit_exit();
 		return (EFAULT);
 	}
 
@@ -1516,7 +1481,7 @@
 			if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
 				/* Must be non-mapped for connectx */
 				SCTP_ASOC_CREATE_UNLOCK(inp);
-				splx(s);
+				crit_exit();
 				return EINVAL;
 			}
 			num_v6++;
@@ -1530,7 +1495,7 @@
 			/* Already have or am bring up an association */
 			SCTP_ASOC_CREATE_UNLOCK(inp);
 			SCTP_TCB_UNLOCK(stcb);
-			splx(s);
+			crit_exit();
 			return (EALREADY);
 		}
 		if ((at + incr) > m->m_len) {
@@ -1546,7 +1511,7 @@
 #ifdef INET6
 	if (((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) &&
 	    (num_v6 > 0)) {
-		splx(s);
+		crit_exit();
 		SCTP_INP_WUNLOCK(inp);
 		SCTP_ASOC_CREATE_UNLOCK(inp);
 		return (EINVAL);
@@ -1570,7 +1535,7 @@
 			 */
 			SCTP_INP_WUNLOCK(inp);
 			SCTP_ASOC_CREATE_UNLOCK(inp);
-			splx(s);
+			crit_exit();
 			return EINVAL;
 		}
 	}
@@ -1582,7 +1547,7 @@
 		error = sctp_inpcb_bind(so, NULL, p);
 		if (error) {
 			SCTP_ASOC_CREATE_UNLOCK(inp);
-			splx(s);
+			crit_exit();
 			return (error);
 		}
 	} else {
@@ -1593,7 +1558,7 @@
 	if (stcb == NULL) {
 		/* Gak! no memory */
 		SCTP_ASOC_CREATE_UNLOCK(inp);
-		splx(s);
+		crit_exit();
 		return (error);
 	}
 	/* move to second address */
@@ -1609,7 +1574,7 @@
 				/* assoc gone no un-lock */
 				sctp_free_assoc(inp, stcb);
 				SCTP_ASOC_CREATE_UNLOCK(inp);
-				splx(s);
+				crit_exit();
 				return (ENOBUFS);
 			}
 
@@ -1619,7 +1584,7 @@
 				/* assoc gone no un-lock */
 				sctp_free_assoc(inp, stcb);
 				SCTP_ASOC_CREATE_UNLOCK(inp);
-				splx(s);
+				crit_exit();
 				return (ENOBUFS);
 			}
 		}
@@ -1641,7 +1606,7 @@
 		soisconnecting(so);
 	}
 	SCTP_ASOC_CREATE_UNLOCK(inp);
-	splx(s);
+	crit_exit();
 	return error;
 }
 
@@ -2718,7 +2683,7 @@
 #endif
 	)
 {
-	int error, *mopt, set_opt, s;
+	int error, *mopt, set_opt;
 	struct mbuf *m;
 	struct sctp_tcb *stcb = NULL;
         struct sctp_inpcb *inp;
@@ -2900,14 +2865,10 @@
 		}
 		sctp_send_str_reset_req(stcb, strrst->strrst_num_streams,
 					strrst->strrst_list, two_way, not_peer);
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-		s = splsoftnet();
-#else
-		s = splnet();
-#endif
+		crit_enter();
 		sctp_chunk_output(inp, stcb, 12);
 		SCTP_TCB_UNLOCK(stcb);
-		splx(s);
+		crit_exit();
 
 	}
 	break;
@@ -3606,16 +3567,12 @@
 {
 	struct mbuf *m = NULL;
 	struct sctp_inpcb *inp;
-	int s, error;
+	int error;
 
 	inp = (struct sctp_inpcb *)so->so_pcb;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	if (inp == 0) {
-		splx(s);
+		crit_exit();
 		/* I made the same as TCP since we are not setup? */
 		return (ECONNRESET);
 	}
@@ -3627,7 +3584,7 @@
 		else
 #endif /* INET6 */
 			error = ip_ctloutput(so, sopt);
-		splx(s);
+		crit_exit();
 		return (error);
 	}
 	if (sopt->sopt_valsize > MCLBYTES) {
@@ -3644,7 +3601,7 @@
 			MCLGET(m, MB_DONTWAIT);
 			if ((m->m_flags & M_EXT) == 0) {
 				sctp_m_freem(m);
-				splx(s);
+				crit_exit();
 				return (ENOBUFS);
 			}
 		}
@@ -3678,7 +3635,7 @@
 		sctp_m_freem(m);
 	}
  out:
-	splx(s);
+	crit_exit();
 	return (error);
 }
 
@@ -3700,11 +3657,7 @@
 
 	family = so->so_proto->pr_domain->dom_family;
 	error = 0;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_exit();
 	switch (family) {
 	case PF_INET:
 		inp = sotoinpcb(so);
@@ -3719,7 +3672,7 @@
 		break;
 #endif
 	default:
-		splx(s);
+		crit_exit();
 		return EAFNOSUPPORT;
 	}
 #ifndef INET6
@@ -3728,7 +3681,7 @@
 		if (inp == NULL && in6p == NULL)
 #endif
 		{
-			splx(s);
+			crit_exit();
 			if (op == PRCO_SETOPT && *mp)
 				(void) m_free(*mp);
 			return (ECONNRESET);
@@ -3744,7 +3697,7 @@
 			break;
 #endif
 		}
-		splx(s);
+		crit_exit();
 		return (error);
 	}
 	/* Ok if we reach here it is a SCTP option we hope */
@@ -3757,7 +3710,7 @@
 	} else {
 		error = EINVAL;
 	}
-	splx(s);
+	crit_exit();
 	return (error);
 }
 
@@ -3777,11 +3730,6 @@
 	struct sockaddr *addr = mtod(nam, struct sockaddr *);
 #endif
 #endif
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	int s = splsoftnet();
-#else
-	int s = splnet();
-#endif
 	int error = 0;
 	struct sctp_inpcb *inp;
 	struct sctp_tcb *stcb;
@@ -3793,9 +3741,10 @@
 		printf("Port %d\n", ntohs(((struct sockaddr_in *)addr)->sin_port));
 	}
 #endif /* SCTP_DEBUG */
+	crit_enter();
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (inp == 0) {
-		splx(s);
+		crit_exit();
 		/* I made the same as TCP since we are not setup? */
 		return (ECONNRESET);
 	}
@@ -3806,7 +3755,7 @@
 		/* Should I really unlock ? */
 		SCTP_INP_WUNLOCK(inp);
 		SCTP_ASOC_CREATE_UNLOCK(inp);
-		splx(s);
+		crit_exit();
 		return (EFAULT);
 	}
 #ifdef INET6
@@ -3814,7 +3763,7 @@
 	    (addr->sa_family == AF_INET6)) {
 		SCTP_INP_WUNLOCK(inp);
 		SCTP_ASOC_CREATE_UNLOCK(inp);
-		splx(s);
+		crit_exit();
 		return (EINVAL);
 	}
 #endif /* INET6 */
@@ -3825,7 +3774,7 @@
 		error = sctp_inpcb_bind(so, NULL, p);
 		if (error) {
 			SCTP_ASOC_CREATE_UNLOCK(inp);
-			splx(s);
+			crit_exit();
 			return (error);
 		}
 		SCTP_INP_WLOCK(inp);
@@ -3834,7 +3783,7 @@
 	if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
 	    (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED)) {
 		/* We are already connected AND the TCP model */
-		splx(s);
+		crit_exit();
 		SCTP_INP_WUNLOCK(inp);
 		SCTP_ASOC_CREATE_UNLOCK(inp);
 		return (EADDRINUSE);
@@ -3858,14 +3807,14 @@
 		/* Already have or am bring up an association */
 		SCTP_ASOC_CREATE_UNLOCK(inp);
 		SCTP_TCB_UNLOCK(stcb);
-		splx(s);
+		crit_exit();
 		return (EALREADY);
 	}
 	/* We are GOOD to go */
 	stcb = sctp_aloc_assoc(inp, addr, 1, &error, 0);
 	if (stcb == NULL) {
 		/* Gak! no memory */
-		splx(s);
+		crit_exit();
 		return (error);
 	}
 	if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) {
@@ -3878,14 +3827,13 @@
 	sctp_send_initiate(inp, stcb);
 	SCTP_ASOC_CREATE_UNLOCK(inp);
 	SCTP_TCB_UNLOCK(stcb);
-	splx(s);
+	crit_exit();
 	return error;
 }
 
 int
 sctp_usr_recvd(struct socket *so, int flags)
 {
-	int s;
 	struct sctp_socket_q_list *sq=NULL;
 	/*
 	 * The user has received some data, we may be able to stuff more
@@ -3909,11 +3857,7 @@
 #endif
 		return (ECONNRESET);
 	}
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	/*
 	 * Grab the first one on the list. It will re-insert itself if
 	 * it runs out of room
@@ -4022,7 +3966,7 @@
 	if (stcb)
 		SCTP_TCB_UNLOCK(stcb);
 	SCTP_INP_WUNLOCK(inp);
-	splx(s);
+	crit_exit();
 	return (0);
 }
 
@@ -4041,18 +3985,13 @@
 	 * to the sys/kern/uipc_socket.c module to reverse this but this
 	 * MUST be in place if the socket API for SCTP is to work properly.
 	 */
-	printf("listenthingy\n");
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	int s = splsoftnet();
-#else
-	int s = splnet();
-#endif
 	int error = 0;
 	struct sctp_inpcb *inp;
 
+	crit_enter();
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (inp == 0) {
-		splx(s);
+		crit_exit();
 		/* I made the same as TCP since we are not setup? */
 		return (ECONNRESET);
 	}
@@ -4060,7 +3999,7 @@
 	if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
 	    (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED)) {
 		/* We are already connected AND the TCP model */
-		splx(s);
+		crit_exit();
 		SCTP_INP_RUNLOCK(inp);
 		return (EADDRINUSE);
 	}
@@ -4069,7 +4008,7 @@
 		SCTP_INP_RUNLOCK(inp);
 		if ((error = sctp_inpcb_bind(so, NULL, p))) {
 			/* bind error, probably perm */
-			splx(s);
+			crit_exit();
 			return (error);
 		}
 	} else {
@@ -4103,7 +4042,7 @@
 	}
 	SCTP_INP_WUNLOCK(inp);
 	SOCK_UNLOCK(so);
-	splx(s);
+	crit_exit();
 	return (error);
 }
 
@@ -4116,31 +4055,26 @@
 {
 	struct sockaddr *addr = mtod(nam, struct sockaddr *);
 #endif
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	int s = splsoftnet();
-#else
-	int s = splnet();
-#endif
 	struct sctp_tcb *stcb;
 	struct sockaddr *prim;
 	struct sctp_inpcb *inp;
 
-	printf("hei hei\n");
+	crit_enter();
 	inp = (struct sctp_inpcb *)so->so_pcb;
 
 	if (inp == 0) {
-		splx(s);
+		crit_exit();
 		return (ECONNRESET);
 	}
 	SCTP_INP_RLOCK(inp);
 	if (so->so_state & SS_ISDISCONNECTED) {
-		splx(s);
+		crit_exit();
 		SCTP_INP_RUNLOCK(inp);
 		return (ECONNABORTED);
 	}
 	stcb = LIST_FIRST(&inp->sctp_asoc_list);
 	if (stcb == NULL) {
-		splx(s);
+		crit_exit();
 		SCTP_INP_RUNLOCK(inp);
 		return (ECONNRESET);
 	}
@@ -4213,7 +4147,7 @@
 
 	}
 	SCTP_INP_WUNLOCK(inp);
-	splx(s);
+	crit_exit();
 	return (0);
 }
 
@@ -4229,7 +4163,6 @@
 #else
 	struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *);
 #endif
-	int s;
 	struct sctp_inpcb *inp;
 	/*
 	 * Do the malloc first in case it blocks.
@@ -4243,14 +4176,10 @@
 #endif
 	sin->sin_family = AF_INET;
 	sin->sin_len = sizeof(*sin);
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (!inp) {
-		splx(s);
+		crit_exit();
 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 		FREE(sin, M_SONAME);
 #endif
@@ -4307,7 +4236,7 @@
 			}
 		}
 		if (!fnd) {
-			splx(s);
+			crit_exit();
 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 			FREE(sin, M_SONAME);
 #endif
@@ -4316,7 +4245,7 @@
 		}
 	}
 	SCTP_INP_RUNLOCK(inp);
-	splx(s);
+	crit_exit();
 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 	(*addr) = (struct sockaddr *)sin;
 #endif
@@ -4333,7 +4262,7 @@
 {
 	struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *);
 #endif
-	int s, fnd;
+	int fnd;
 	struct sockaddr_in *sin_a;
 	struct sctp_inpcb *inp;
 	struct sctp_tcb *stcb;
@@ -4346,11 +4275,7 @@
 		/* UDP type and listeners will drop out here */
 		return (ENOTCONN);
 	}
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 
 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 	MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, M_WAITOK |
@@ -4365,7 +4290,7 @@
 	/* We must recapture incase we blocked */
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (!inp) {
-		splx(s);
+		crit_exit();
 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 		FREE(sin, M_SONAME);
 #endif
@@ -4377,7 +4302,7 @@
 		SCTP_TCB_LOCK(stcb);
 	SCTP_INP_RUNLOCK(inp);
 	if (stcb == NULL) {
-		splx(s);
+		crit_exit();
 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 		FREE(sin, M_SONAME);
 #endif
@@ -4396,13 +4321,13 @@
 	SCTP_TCB_UNLOCK(stcb);
 	if (!fnd) {
 		/* No IPv4 address */
-		splx(s);
+		crit_exit();
 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 		FREE(sin, M_SONAME);
 #endif
 		return ENOENT;
 	}
-	splx(s);
+	crit_exit();
 	return (0);
 }
 
@@ -4448,17 +4373,12 @@
 {
 	struct proc *p = curproc;
 #endif
-	int s;
 	int error = 0;
 	int family;
 
 	family = so->so_proto->pr_domain->dom_family;
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	if (req == PRU_CONTROL) {
 		switch (family) {
 		case PF_INET:
@@ -4478,7 +4398,7 @@
 		default:
 			error =  EAFNOSUPPORT;
 		}
-		splx(s);
+		crit_exit();
 		return (error);
 	}
 #ifdef __NetBSD__
@@ -4501,10 +4421,10 @@
 			break;
 #endif /* INET6 */
 		default:
-			splx(s);
+			crit_exit();
 			return (EAFNOSUPPORT);
 		}
-		splx(s);
+		crit_exit();
 		return (0);
 	}
 #endif
@@ -4517,7 +4437,7 @@
 		break;
 	case PRU_BIND:
 		if (nam == NULL) {
-			splx(s);
+			crit_exit();
 			return (EINVAL);
 		}
 		error  = sctp_bind(so, nam, p);
@@ -4527,7 +4447,7 @@
 		break;
 	case PRU_CONNECT:
 		if (nam == NULL) {
-			splx(s);
+			crit_exit();
 			return (EINVAL);
 		}
 		error = sctp_connect(so, nam, p);
@@ -4537,7 +4457,7 @@
 		break;
 	case PRU_ACCEPT:
 		if (nam == NULL) {
-			splx(s);
+			crit_exit();
 			return (EINVAL);
 		}
 		error = sctp_accept(so, nam);
@@ -4598,7 +4518,7 @@
 	default:
 		break;
 	}
-	splx(s);
+	crit_exit();
 	return (error);
 }
 #endif
diff -ru dfly/netinet/sctputil.c dfly-nospl/netinet/sctputil.c
--- dfly/netinet/sctputil.c	2005-06-18 12:41:43.000000000 +0000
+++ dfly-nospl/netinet/sctputil.c	2005-06-18 13:27:43.000000000 +0000
@@ -63,6 +63,7 @@
 #include <sys/proc.h>
 #include <sys/kernel.h>
 #include <sys/sysctl.h>
+#include <sys/thread2.h>
 
 #if defined(__FreeBSD__) || defined(__DragonFly__)
 #include <sys/callout.h>
@@ -587,19 +588,14 @@
 void
 sctp_audit_log(u_int8_t ev, u_int8_t fd)
 {
-	int s;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	sctp_audit_data[sctp_audit_indx][0] = ev;
 	sctp_audit_data[sctp_audit_indx][1] = fd;
 	sctp_audit_indx++;
 	if (sctp_audit_indx >= SCTP_AUDIT_SIZE) {
 		sctp_audit_indx = 0;
 	}
-	splx(s);
+	crit_exit();
 }
 
 #endif
@@ -913,7 +909,7 @@
 	struct sctp_tcb *stcb;
 	struct sctp_nets *net;
 	struct sctp_timer *tmr;
-	int s, did_output, typ;
+	int did_output, typ;
 #if defined(__APPLE__)
 	boolean_t funnel_state;
 
@@ -921,11 +917,7 @@
 	funnel_state = thread_funnel_set(network_flock, TRUE);
 #endif
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	tmr = (struct sctp_timer *)t;
 	inp = (struct sctp_inpcb *)tmr->ep;
 	stcb = (struct sctp_tcb *)tmr->tcb;
@@ -945,7 +937,7 @@
 
 	SCTP_INP_WLOCK(inp);
 	if (inp->sctp_socket == 0) {
-		splx(s);
+		crit_exit();
 #if defined(__APPLE__)
 		/* release BSD kernel funnel/mutex */
 		(void) thread_funnel_set(network_flock, FALSE);
@@ -955,7 +947,7 @@
 	}
 	if (stcb) {
 		if (stcb->asoc.state == 0) {
-			splx(s);
+			crit_exit();
 #if defined(__APPLE__)
 			/* release BSD kernel funnel/mutex */
 			(void) thread_funnel_set(network_flock, FALSE);
@@ -971,7 +963,7 @@
 #endif /* SCTP_DEBUG */
 #ifndef __NetBSD__
 	if (!callout_active(&tmr->timer)) {
-		splx(s);
+		crit_exit();
 #if defined(__APPLE__)
 		/* release BSD kernel funnel/mutex */
 		(void) thread_funnel_set(network_flock, FALSE);
@@ -1196,7 +1188,7 @@
 	}
 #endif /* SCTP_DEBUG */
 
-	splx(s);
+	crit_exit();
 #if defined(__APPLE__)
 	/* release BSD kernel funnel/mutex */
 	(void) thread_funnel_set(network_flock, FALSE);
diff -ru dfly/netinet6/sctp6_usrreq.c dfly-nospl/netinet6/sctp6_usrreq.c
--- dfly/netinet6/sctp6_usrreq.c	2005-06-18 12:41:43.000000000 +0000
+++ dfly-nospl/netinet6/sctp6_usrreq.c	2005-06-18 13:27:40.000000000 +0000
@@ -64,6 +64,7 @@
 #include <sys/systm.h>
 #include <sys/syslog.h>
 #include <sys/proc.h>
+#include <sys/thread2.h>
 #include <net/if.h>
 #include <net/route.h>
 #include <net/if_types.h>
@@ -199,7 +200,6 @@
 	u_int8_t ecn_bits;
 	struct sctp_tcb *stcb = NULL;
 	int off = *offp;
-	int s;
 
 	ip6 = mtod(m, struct ip6_hdr *);
 #ifndef PULLDOWN_TEST
@@ -340,12 +340,12 @@
 		struct m_tag *mtag;
 		struct tdb_ident *tdbi;
 		struct tdb *tdb;
-		int error, s;
+		int error;
 
 		/* Find most recent IPsec tag */
 		i_inp = (struct inpcb *)in6p;
 		mtag = m_tag_find(m, PACKET_TAG_IPSEC_IN_DONE, NULL);
-		s = splnet();
+		crit_enter();
 		if (mtag != NULL) {
 			tdbi = (struct tdb_ident *)(mtag + 1);
 			tdb = gettdb(tdbi->spi, &tdbi->dst, tdbi->proto);
@@ -355,7 +355,7 @@
 		ipsp_spd_lookup(m, af, iphlen, &error, IPSP_DIRECTION_IN,
 		    tdb, i_inp);
 		if (error) {
-			splx(s);
+			crit_exit();
 			goto bad;
 		}
 
@@ -367,7 +367,7 @@
 					i_inp->inp_ipo = ipsec_add_policy(i_inp,
 					    af, IPSP_DIRECTION_OUT);
 					if (i_inp->inp_ipo == NULL) {
-						splx(s);
+						crit_exit();
 						goto bad;
 					}
 				}
@@ -395,7 +395,7 @@
 				i_inp->inp_tdb_in = NULL;
 			}
 		}
-		splx(s);
+		crit_exit();
 	}
 #else
 	if (ipsec6_in_reject_so(m, in6p->sctp_socket)) {
@@ -438,15 +438,11 @@
 	length = ntohs(ip6->ip6_plen) + iphlen;
 	offset -= sizeof(*ch);
 	ecn_bits = ((ntohl(ip6->ip6_flow) >> 20) & 0x000000ff);
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	(void)sctp_common_input_processing(&m, iphlen, offset, length, sh, ch,
 	    in6p, stcb, net, ecn_bits);
 	/* inp's ref-count reduced && stcb unlocked */
-	splx(s);
+	crit_exit();
 	/* XXX this stuff below gets moved to appropriate parts later... */
 	if (m)
 		m_freem(m);
@@ -578,7 +574,7 @@
 {
 	struct sctphdr sh;
 	struct ip6ctlparam *ip6cp = NULL;
-	int s, cm;
+	int cm;
 
 	if (pktdst->sa_family != AF_INET6 ||
 	    pktdst->sa_len != sizeof(struct sockaddr_in6))
@@ -629,11 +625,7 @@
 		final.sin6_addr = ((struct sockaddr_in6 *)pktdst)->sin6_addr;
 #endif /* __FreeBSD_cc_version */
 		final.sin6_port = sh.dest_port;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-		s = splsoftnet();
-#else
-		s = splnet();
-#endif
+		crit_enter();
 		stcb = sctp_findassociation_addr_sa((struct sockaddr *)ip6cp->ip6c_src,
 						    (struct sockaddr *)&final,
 						    &inp, &net, 1);
@@ -676,7 +668,7 @@
 			if (stcb)
 				SCTP_TCB_UNLOCK(stcb);
 		}
-		splx(s);
+		crit_exit();
 	}
 }
 
@@ -692,7 +684,7 @@
 	struct sctp_inpcb *inp;
 	struct sctp_nets *net;
 	struct sctp_tcb *stcb;
-	int error, s;
+	int error;
 
 #if defined(__FreeBSD__) && __FreeBSD_version >= 500000
 	error = suser(req->td);
@@ -709,11 +701,7 @@
 	error = SYSCTL_IN(req, addrs, sizeof(addrs));
 	if (error)
 		return (error);
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 
         stcb = sctp_findassociation_addr_sa(sin6tosa(&addrs[0]),
                                            sin6tosa(&addrs[1]),
@@ -731,8 +719,8 @@
 			   sizeof(struct ucred));
 
 	SCTP_TCB_UNLOCK (stcb);
- out:
-	splx(s);
+out:
+	crit_exit();
 	return (error);
 }
 
@@ -747,19 +735,14 @@
 sctp6_abort(struct socket *so)
 {
 	struct sctp_inpcb *inp;
-	int s;
 
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (inp == 0)
 		return EINVAL;	/* ??? possible? panic instead? */
 	soisdisconnected(so);
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	sctp_inpcb_free(inp, 1);
-	splx(s);
+	crit_exit();
 	return 0;
 }
 
@@ -773,7 +756,7 @@
 #endif
 {
 	struct in6pcb *inp6;
-	int s, error;
+	int error;
 	struct sctp_inpcb *inp;
 
 	inp = (struct sctp_inpcb *)so->so_pcb;
@@ -785,13 +768,9 @@
 		if (error)
 			return error;
 	}
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	error = sctp_inpcb_alloc(so);
-	splx(s);
+	crit_exit();
 	if (error)
 		return error;
 	inp = (struct sctp_inpcb *)so->so_pcb;
@@ -851,7 +830,7 @@
 #endif
 	struct sctp_inpcb *inp;
 	struct in6pcb *inp6;
-	int s, error;
+	int error;
 
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (inp == 0)
@@ -924,13 +903,9 @@
 				inp->inp_vflag &= ~INP_IPV6;
 #endif
 #endif
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-				s = splsoftnet();
-#else
-				s = splnet();
-#endif
+				crit_enter();
 				error = sctp_inpcb_bind(so, (struct sockaddr *)&sin, p);
-				splx(s);
+				crit_exit();
 				return error;
 			}
 		}
@@ -949,13 +924,9 @@
 				return EINVAL;
 		}
 	}
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	error = sctp_inpcb_bind(so, addr, p);
-	splx(s);
+	crit_exit();
 	return error;
 }
 
@@ -964,22 +935,17 @@
 sctp6_detach(struct socket *so)
 {
 	struct sctp_inpcb *inp;
-	int s;
 
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (inp == 0)
 		return EINVAL;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	if (((so->so_options & SO_LINGER) && (so->so_linger == 0)) ||
 	    (so->so_rcv.sb_cc > 0))
 		sctp_inpcb_free(inp, 1);
 	else
 		sctp_inpcb_free(inp, 0);
-	splx(s);
+	crit_exit();
 	return 0;
 }
 
@@ -987,22 +953,17 @@
 sctp6_disconnect(struct socket *so)
 {
 	struct sctp_inpcb *inp;
-	int s;
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();		/* XXX */
-#endif
+	crit_enter();
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (inp == NULL) {
-		splx(s);
+		crit_exit();
 		return (ENOTCONN);
 	}
 	if (inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) {
 		if (LIST_EMPTY(&inp->sctp_asoc_list)) {
 			/* No connection */
-			splx(s);
+			crit_exit();
 			return (ENOTCONN);
 		} else {
 			int some_on_streamwheel = 0;
@@ -1011,7 +972,7 @@
 
 			stcb = LIST_FIRST(&inp->sctp_asoc_list);
 			if (stcb == NULL) {
-				splx(s);
+				crit_exit();
 				return (EINVAL);
 			}
 			asoc = &stcb->asoc;
@@ -1067,12 +1028,12 @@
 				 */
 				asoc->state |= SCTP_STATE_SHUTDOWN_PENDING;
 			}
-			splx(s);
+			crit_exit();
 			return (0);
 		}
 	} else {
 		/* UDP model does not support this */
-		splx(s);
+		crit_exit();
 		return EOPNOTSUPP;
 	}
 }
@@ -1248,11 +1209,6 @@
 	struct sockaddr *addr = mtod(nam, struct sockaddr *);
 #endif
 #endif
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	int s = splsoftnet();
-#else
-	int s = splnet();
-#endif
 	int error = 0;
 	struct sctp_inpcb *inp;
 	struct in6pcb *inp6;
@@ -1262,10 +1218,11 @@
 	struct sockaddr_storage ss;
 #endif /* INET */
 
+	crit_enter();
 	inp6 = (struct in6pcb *)so->so_pcb;
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (inp == 0) {
-		splx(s);
+		crit_exit();
 		return (ECONNRESET);	/* I made the same as TCP since
 					 * we are not setup? */
 	}
@@ -1277,7 +1234,7 @@
 		SCTP_INP_RUNLOCK(inp);
 		error = sctp6_bind(so, NULL, p);
 		if (error) {
-			splx(s);
+			crit_exit();
 			SCTP_ASOC_CREATE_UNLOCK(inp);
 
 			return (error);
@@ -1288,7 +1245,7 @@
 	if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
 	    (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED)) {
 		/* We are already connected AND the TCP model */
-		splx(s);
+		crit_exit();
 		SCTP_INP_RUNLOCK(inp);
 		SCTP_ASOC_CREATE_UNLOCK(inp);
 		return (EADDRINUSE);
@@ -1310,13 +1267,13 @@
 		 * destined to a v4 addr or v4-mapped addr
 		 */
 		if (addr->sa_family == AF_INET) {
-			splx(s);
+			crit_exit();
 			SCTP_INP_RUNLOCK(inp);
 			SCTP_ASOC_CREATE_UNLOCK(inp);
 			return EINVAL;
 		}
 		if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
-			splx(s);
+			crit_exit();
 			SCTP_INP_RUNLOCK(inp);
 			SCTP_ASOC_CREATE_UNLOCK(inp);
 			return EINVAL;
@@ -1330,7 +1287,7 @@
 			addr = (struct sockaddr *)&ss;
 		} else {
 			/* mapped addresses aren't enabled */
-			splx(s);
+			crit_exit();
 			SCTP_INP_RUNLOCK(inp);
 			SCTP_ASOC_CREATE_UNLOCK(inp);
 			return EINVAL;
@@ -1362,7 +1319,7 @@
 		/* Already have or am bring up an association */
 		SCTP_ASOC_CREATE_UNLOCK(inp);
 		SCTP_TCB_UNLOCK (stcb);
-		splx(s);
+		crit_exit();
 		return (EALREADY);
 	}
 	/* We are GOOD to go */
@@ -1370,7 +1327,7 @@
 	SCTP_ASOC_CREATE_UNLOCK(inp);
 	if (stcb == NULL) {
 		/* Gak! no memory */
-		splx(s);
+		crit_exit();
 		return (error);
 	}
 	if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) {
@@ -1382,7 +1339,7 @@
 	SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
 	sctp_send_initiate(inp, stcb);
 	SCTP_TCB_UNLOCK (stcb);
-	splx(s);
+	crit_exit();
 	return error;
 }
 
@@ -1567,23 +1524,19 @@
 	struct sockaddr *addr = mtod(nam, struct sockaddr *);
 #endif
 	struct in6pcb *inp6 = sotoin6pcb(so);
-	int	error, s;
+	int error;
 
 	if (inp6 == NULL)
 		return EINVAL;
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	/* allow v6 addresses precedence */
 	error = sctp6_getaddr(so, nam);
 	if (error) {
 		/* try v4 next if v6 failed */
 		error = sctp_ingetaddr(so, nam);
 		if (error) {
-			splx(s);
+			crit_exit();
 			return (error);
 		}
 #if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
@@ -1615,7 +1568,7 @@
 		nam->m_len = sizeof(struct sockaddr_in6);
 #endif
 	}
-	splx(s);
+	crit_exit();
 	return (error);
 }
 
@@ -1631,23 +1584,19 @@
 	struct sockaddr *addr = mtod(nam, struct sockaddr *);
 #endif
 	struct in6pcb *inp6 = sotoin6pcb(so);
-	int	error, s;
+	int error;
 
 	if (inp6 == NULL)
 		return EINVAL;
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-	s = splsoftnet();
-#else
-	s = splnet();
-#endif
+	crit_enter();
 	/* allow v6 addresses precedence */
 	error = sctp6_peeraddr(so, nam);
 	if (error) {
 		/* try v4 next if v6 failed */
 		error = sctp_peeraddr(so, nam);
 		if (error) {
-			splx(s);
+			crit_exit();
 			return (error);
 		}
 		/* if I'm V6ONLY, convert it to v4-mapped */
@@ -1676,7 +1625,7 @@
 		nam->m_len = sizeof(struct sockaddr_in6);
 #endif
 	}
-	splx(s);
+	crit_exit();
 	return error;
 }
 
