Index: sctp.h =================================================================== RCS file: /data/cvs/src/sys/netinet/sctp.h,v retrieving revision 1.4 diff -u -r1.4 sctp.h --- sctp.h 22 Apr 2007 12:12:38 -0000 1.4 +++ sctp.h 2 May 2007 04:44:54 -0000 @@ -400,6 +400,7 @@ #define SCTP_PCB_FLAGS_BOUNDALL 0x00000004 #define SCTP_PCB_FLAGS_ACCEPTING 0x00000008 #define SCTP_PCB_FLAGS_UNBOUND 0x00000010 +#define SCTP_PCB_FLAGS_LISTENING 0x00000020 #define SCTP_PCB_FLAGS_CLOSE_IP 0x00040000 #define SCTP_PCB_FLAGS_WAS_CONNECTED 0x00080000 #define SCTP_PCB_FLAGS_WAS_ABORTED 0x00100000 Index: sctp_pcb.c =================================================================== RCS file: /data/cvs/src/sys/netinet/sctp_pcb.c,v retrieving revision 1.21 diff -u -r1.21 sctp_pcb.c --- sctp_pcb.c 22 Apr 2007 11:06:27 -0000 1.21 +++ sctp_pcb.c 2 May 2007 04:44:54 -0000 @@ -1611,6 +1611,20 @@ return (stcb); } +/* + * be careful deadlock when you call this function. + */ +void +sctp_inpcb_set_flags(struct sctp_inpcb *inp, int flags) +{ + SCTP_INP_INFO_WLOCK(); + SCTP_INP_WLOCK(inp); + + inp->sctp_flags |= flags; + + SCTP_INP_WUNLOCK(inp); + SCTP_INP_INFO_WUNLOCK(); +} /* * allocate a sctp_inpcb and setup a temporary binding to a port/all Index: sctp_pcb.h =================================================================== RCS file: /data/cvs/src/sys/netinet/sctp_pcb.h,v retrieving revision 1.12 diff -u -r1.12 sctp_pcb.h --- sctp_pcb.h 22 Apr 2007 12:12:38 -0000 1.12 +++ sctp_pcb.h 2 May 2007 04:44:54 -0000 @@ -453,6 +453,8 @@ sctp_findassociation_ep_asconf(struct mbuf *, int, int, struct sctphdr *, struct sctp_inpcb **, struct sctp_nets **); +void sctp_inpcb_set_flags(struct sctp_inpcb *, int); + int sctp_inpcb_alloc(struct socket *); int sctp_is_address_on_local_host(struct sockaddr *addr, uint32_t vrf_id); Index: sctp_usrreq.c =================================================================== RCS file: /data/cvs/src/sys/netinet/sctp_usrreq.c,v retrieving revision 1.19 diff -u -r1.19 sctp_usrreq.c --- sctp_usrreq.c 22 Apr 2007 11:06:27 -0000 1.19 +++ sctp_usrreq.c 2 May 2007 04:44:54 -0000 @@ -3672,6 +3672,9 @@ } else { SCTP_INP_RUNLOCK(inp); } + + sctp_inpcb_set_flags(inp, SCTP_PCB_FLAGS_LISTENING); + /* It appears for 7.0 and on, we must always call this. */ solisten_proto(so, backlog);