[SCTP][patch] socket does not wake up

Previous thread: none

Next thread: kill hangs with csh by Nathan Lay on Wednesday, October 3, 2007 - 10:50 am. (1 message)
From: Martin Kulas
Date: Wednesday, October 3, 2007 - 7:14 am

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=20
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

--=20
PGP Key: http://www.stud.uni-hamburg.de/~kulas/mkulas_pubkey.asc
From: Randall Stewart
Date: Wednesday, October 3, 2007 - 3:51 pm

Martin:

Thanks for the patch.. note that I will submit it to
re for approval after a minor fix.

socantrcvmore(so);

assumes you do NOT hold a lock.  This code holds
the socket lock.. which is the recv sockbuf lock..

So if you turn witness on your kernel and run with this
you will have a double lock.. panic.

Note to fix this right you should have it be:
  				SOCK_UNLOCK(so);
+				socantrcvmore(so);

Which is what I will submit to release ops.. you may want
to change this in what you are working with so you don;t
have some other side-effect issue from the double lock.. like
leaking sockets.

R



-- 
Randall Stewart
NSSTG - Cisco Systems Inc.
803-345-0369 <or> 803-317-4952 (cell)
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Aryeh Friedman
Date: Wednesday, October 3, 2007 - 4:33 pm

Does this solve the many issues with warning messages and syn/ack
being received after close and such?  Also I think this might also be
related to the re(3) patch I mentioned in an other thread
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Randall Stewart
Date: Wednesday, October 3, 2007 - 4:41 pm

This is SCTP not TCP... so no I don't think it will help any
syn-ack problems.

R

-- 
Randall Stewart
NSSTG - Cisco Systems Inc.
803-345-0369 <or> 803-317-4952 (cell)
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Martin Kulas
Date: Thursday, October 4, 2007 - 1:51 pm

Oops, of course, that is the right fix.

Regards,
Martin

--=20
PGP Key: http://sosend.de/mk/coolaz_web_de.pub.asc
Previous thread: none

Next thread: kill hangs with csh by Nathan Lay on Wednesday, October 3, 2007 - 10:50 am. (1 message)