DragonFly BSD
DragonFly submit List (threaded) for 2004-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: tcpdrop(8) for DragonFly


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 13 Nov 2004 15:58:11 -0800 (PST)

:Would you mind pointing me to some documentation on this, or maybe to some
:example code? Would it be something like the messages sent in tcp_drain()
:or in tcp_close(), ie,
:
:msg = malloc(...);
:lwkt_initmsg(...);
:/* fill message */
:lwkt_send(...);
:
:?
:
:Thanks,
:Andre

    Heh, documentation is fairly lacking considering how new the code
    is.

    Ok, I have researched it.  The nominal way of injecting a message
    into the protocol stack is to follow how the so_pru_*() functions
    do it.  For example, so_pru_disconnect() (see kern/uipc_msg.c).

    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.

    So I think it may be easier then you thought.

    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.

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]