git: e56cb0b4cc3c - stable/14 - sockets: inherit SO_ACCEPTFILTER from listener to child
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 14 Jul 2026 23:08:25 UTC
The branch stable/14 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=e56cb0b4cc3c48bbf287fc5eba427c66b228acbb
commit e56cb0b4cc3c48bbf287fc5eba427c66b228acbb
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2024-04-24 00:17:14 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-07-14 23:08:13 +0000
sockets: inherit SO_ACCEPTFILTER from listener to child
This is crucial for operation of accept_filter(9). See added comment.
Fixes: d29b95ecc0d049406d27a6c11939d40a46658733
(cherry picked from commit a8acc2bf5699556946dda2a37589d3c3bd9762c6)
---
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 515f038b78fa..c9691d351a58 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1166,9 +1166,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;