[SCTP][patch] socket does not wake up

Martin Kulas coolaz at web.de
Wed Oct 3 07:40:47 PDT 2007


Hello!

I patched netcat to support 1to1-SCTP sockets.
Netcat uses the poll() system call to wait for new data
in the socket buffer.  The problem is that poll() does not
return when the kernel has closed the SCTP association.
Select() has the same problem.

I digged around in the SCTP sources and created a patched to remove 
that bug.   The patch is a one-liner:

<patch>
--- sctp_pcb.c.orig	2007-10-03 13:27:12.000000000 +0200
+++ sctp_pcb.c	2007-10-03 15:51:55.286987000 +0200
@@ -4234,6 +4234,7 @@
 					    SS_ISCONFIRMING |
 					    SS_ISCONNECTED);
 				}
+				socantrcvmore(so);
 				SOCK_UNLOCK(so);
 				sctp_sowwakeup(inp, so);
 				sctp_sorwakeup(inp, so);
</patch>

Now I have no problems with the system calls select()/poll() anymore.
Is this patch OK or have I missed anything?


Regards,
Martin

-- 
PGP Key: http://www.stud.uni-hamburg.de/~kulas/mkulas_pubkey.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20071003/a248de76/attachment.pgp


More information about the freebsd-current mailing list