git: a8acc2bf5699 - main - sockets: inherit SO_ACCEPTFILTER from listener to child
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 24 Apr 2024 00:19:05 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=a8acc2bf5699556946dda2a37589d3c3bd9762c6 commit a8acc2bf5699556946dda2a37589d3c3bd9762c6 Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2024-04-24 00:17:14 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2024-04-24 00:17:14 +0000 sockets: inherit SO_ACCEPTFILTER from listener to child This is crucial for operation of accept_filter(9). See added comment. Fixes: d29b95ecc0d049406d27a6c11939d40a46658733 --- sys/kern/uipc_socket.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index c040bdf4d3eb..f0b36fc5595e 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -761,9 +761,13 @@ solisten_clone(struct socket *head) * including those completely irrelevant to a new born socket. For * compatibility with older versions we will inherit a list of * meaningful options. + * The crucial bit to inherit is SO_ACCEPTFILTER. We need it present + * in the child socket for soisconnected() promoting socket from the + * incomplete queue to complete. It will be cleared before the child + * gets available to accept(2). */ - so->so_options = head->so_options & (SO_KEEPALIVE | SO_DONTROUTE | - SO_LINGER | SO_OOBINLINE | SO_NOSIGPIPE); + so->so_options = head->so_options & (SO_ACCEPTFILTER | SO_KEEPALIVE | + SO_DONTROUTE | SO_LINGER | SO_OOBINLINE | SO_NOSIGPIPE); so->so_linger = head->so_linger; so->so_state = head->so_state; so->so_fibnum = head->so_fibnum;