From b306c5cbf152da9d8cbd81ba1ea8c8813af197a9 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Fri, 30 Oct 2026 15:23:55 +0100 Subject: Use accept filter dataready instead of httpready on FreeBSD --- man4/opentracker.conf.4 | 11 +++++++++++ ot_socket.c | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/man4/opentracker.conf.4 b/man4/opentracker.conf.4 index b28879f..aa82e1d 100644 --- a/man4/opentracker.conf.4 +++ b/man4/opentracker.conf.4 @@ -100,6 +100,17 @@ group only where the answer is yes. .Pa tests/udp_scaling.py in the source distribution sweeps the setting against a running tracker. Measure on the machine that will carry the traffic. +.Pp +On FreeBSD the +.Xr accf_data 9 +filter has the kernel hold a new connection until data arrives on it, so the +tracker is woken once with the request already there. opentracker uses it +wherever it is available; enable it with +.Cm options ACCEPT_FILTER_DATA +in the kernel or +.Va kld_list Ns = Ns Qq accf_data +in +.Xr rc.conf 5 . .Sh EXAMPLES To specify the address opentracker will listen on for both TCP and UDP connections: .Dl listen.tcp_udp 0.0.0.0:6969 diff --git a/ot_socket.c b/ot_socket.c index 78a16d2..48ffc27 100644 --- a/ot_socket.c +++ b/ot_socket.c @@ -130,9 +130,10 @@ int socket_defer_accept(int s) { return setsockopt(s, IPPROTO_TCP, TCP_DEFER_ACCEPT, &patience, sizeof(patience)); #elif defined(SO_ACCEPTFILTER) struct accept_filter_arg filter; + const char name[sizeof(filter.af_name)] = "dataready"; memset(&filter, 0, sizeof(filter)); - strcpy(filter.af_name, "httpready"); + memcpy(filter.af_name, name, sizeof(name)); return setsockopt(s, SOL_SOCKET, SO_ACCEPTFILTER, &filter, sizeof(filter)); #else (void)s; -- cgit v1.3