tcpdrop(8) for DragonFly

Andre Nathan andre at digirati.com.br
Sat Nov 13 19:31:36 PST 2004


Matthew Dillon said:
>     Heh, documentation is fairly lacking considering how new the code
>     is.

When I mentioned documentation I was actually expecting pointers to
comments in the code or something :)

>     BUT, I don't think you have to do that.  I think all you need to
>     do to disconnect a TCP connection is to call soshutdown() on the
>     socket, which you can do directly.  soshutdown() calls
so_pru_shutdown()
>     which does all the messaging.

OK, I updated the patch but I used soabort(). I tried both soshutdown()
and sodisconnect(), but they leave the connection in one of the *_WAIT TCP
states.

soabort() will call so_pru_abort(), which sends a message containing a
pointer to tcp_usr_abort(), which finally calls tcp_drop(), so it seems to
be the correct way to do it.

>     There is one more issue, and that is how to safely operating on sockets
>     owned by other processes.  The socket structure is not ref-counted so
>     there's a race between finding and operating on the socket via the
>     sysctl, and the program that owns the socket trying to close it at the
>     same time.

I still need to think about this one... so far, no ideas :\


Andre





More information about the Submit mailing list