Date: Wed, 16 Oct 2019 13:14:40 -0400 From: Mark Johnston <markj@freebsd.org> To: Dheeraj Kandula <dkandula@gmail.com> Cc: freebsd-net@freebsd.org Subject: Re: sol_upcall in FreeBSD 12 Message-ID: <20191016171440.GE82455@raichu> In-Reply-To: <CA%2BqNgxQo0941OsNUZdq7mBjPQcVXW6nPF6ztQEnJAJv9ahAh5A@mail.gmail.com> References: <CA%2BqNgxQo0941OsNUZdq7mBjPQcVXW6nPF6ztQEnJAJv9ahAh5A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Aug 01, 2019 at 04:06:34PM -0400, Dheeraj Kandula wrote: > When going through the code of FreeBSD12, I see that the socket code has > undergone significant change. > > The socket is now either a regular socket or a listen socket. > The listen socket has two new fields besides others: > > sol_upcall and sol_upcallarg > > My understanding is that this callback will be used to notify the accept > socket's consumers when the 3 way handshake is completed and the socket is > ready to be accepted. Right, it is called from solisten_wakeup() when a new connection is established. > However in soisconnected function, when the accept filter is set, the code > still sets the receive socket buffer's upcall. Right. The accept filter is supposed to process incoming data on that socket until it accepts or rejects the connection. To do this, we must set the socket buffer upcall. When the accept filter returns SU_ISCONNECTED, the receive socket transitions to the connected state, and the listen socket upcall, if any, is invoked. > Shouldn't we set the > sol_upcall in line 3773 below instead. If not, when should the sol_upcall > be set. An example will help clarify the usage. I don't really follow: line 3773 is setting an upcall for the new socket, not the listening socket. If the listening socket has set sol_upcall, and an accept filter is configured, sol_upcall will be invoked once the accept filter has accepted the connection.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20191016171440.GE82455>