Socket related stuff - patch available for testing

Antonio Huete Jimenez ahuete.devel at
Thu Nov 12 01:40:16 PST 2009

Hi Matt,

It seems that a hammer fix has slipped into your tcp patch. See the
end of the tcp01.patch:

diff --git a/sys/vfs/hammer/hammer_btree.c b/sys/vfs/hammer/hammer_btree.c
index 6ee1e1a..050d4a2 100644
--- a/sys/vfs/hammer/hammer_btree.c
+++ b/sys/vfs/hammer/hammer_btree.c
@@ -2226,9 +2226,10 @@ btree_remove(hammer_cursor_t cursor)
. ..

Antonio Huete

2009/11/12 Matthew Dillon <dillon at>:
>    Here's a patch, it needs some serious testing:
>        fetch
>    The patch:
>        * Moves the socket pointer into the netmsg base structure, even
>          though some things don't use it, I know
>        * Adds a lwkt_port pointer to the socket structure and initializes
>          it to cpu0_soport()
>        * Expects network protocols to set so->so_port in their attach
>          functions, plus I do that for tcp and udp.
>        * Performs message chasing when the protocol port changes due to
>          e.g.  a connect() or an implied connect or (I think) also an
>          implied binding to INADDR_ANY.
>          If a number of messages for a socket have built up on a protocol
>          thread and some operation in the protocol changes the socket's
>          protocol thread (aka implied connect), then any other messages
>          queued to that protocol thread, or new messages which race the
>          change, will automatically be forwarded to the correct protocol
>          thread when they are encountered.
>        * Fixes implied connects for TCP.  This is when you use sendmsg()
>          with an address to imply a connect along with data, so data can
>          be sent along with the SYN.
>          Implied connects were completely broken and would crash the kernel.
>          Example:  finger user at target  (instant crash).  finger uses the
>          implied connect feature.
>        * Cleans up a bunch of stuff.  I was almost able to remove
>          the proto->pr_mport field entirely but sendmsg() still needs
>          to use it in the case where the passed address is non-NULL (aka
>          sendto() style).  All other code that used to call proto->pr_mport()
>          now simply snarf the port out of so->so_port.
>          The mport functions themselves now basically just return so_port.
>          I left the sendmsg code intact just in case we wanted to optimize
>          it later on for UDP.
>    I found a few other bugs in the code but haven't fixed them yet.  UDP
>    is not MPSAFE due to the global inpcbinfo (udbinfo) structure it uses.
>    This patch does need testing.  I don't know what I might have blown up.
>    It's fairly straight forward so I would also appreciate a code review.
>                                                -Matt

More information about the Kernel mailing list