svn commit: r208852 - head/sys/netinet
Randall Stewart
rrs at FreeBSD.org
Sat Jun 5 21:17:25 UTC 2010
Author: rrs
Date: Sat Jun 5 21:17:23 2010
New Revision: 208852
URL: http://svn.freebsd.org/changeset/base/208852
Log:
This fixes a bug in the close up of a socket that
had un-accepted assoc's. Basically the assoc (and inp)
would get stuck and never get cleaned up.
MFC after: 1 week
Modified:
head/sys/netinet/sctp_pcb.c
Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c Sat Jun 5 20:51:56 2010 (r208851)
+++ head/sys/netinet/sctp_pcb.c Sat Jun 5 21:17:23 2010 (r208852)
@@ -3164,8 +3164,17 @@ sctp_inpcb_free(struct sctp_inpcb *inp,
nasoc = LIST_NEXT(asoc, sctp_tcblist);
if (asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
/* Skip guys being freed */
- /* asoc->sctp_socket = NULL; FIXME MT */
cnt_in_sd++;
+ if (asoc->asoc.state & SCTP_STATE_IN_ACCEPT_QUEUE) {
+ /*
+ * Special case - we did not start a
+ * kill timer on the asoc due to it
+ * was not closed. So go ahead and
+ * start it now.
+ */
+ asoc->asoc.state &= ~SCTP_STATE_IN_ACCEPT_QUEUE;
+ sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, asoc, NULL);
+ }
SCTP_TCB_UNLOCK(asoc);
continue;
}
@@ -4590,8 +4599,12 @@ sctp_free_assoc(struct sctp_inpcb *inp,
* Someone holds a reference OR the socket is unaccepted
* yet.
*/
- if (stcb->asoc.refcnt)
+ if ((stcb->asoc.refcnt) ||
+ (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
+ (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
+ stcb->asoc.state &= ~SCTP_STATE_IN_ACCEPT_QUEUE;
sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL);
+ }
SCTP_TCB_UNLOCK(stcb);
if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
(inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE))
More information about the svn-src-all
mailing list