summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2022-12-30 18:53:51 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2022-12-30 18:53:51 +0000
commit5281dce92f37ab268bfa781e384d64dc5947203f (patch)
treeaf3d5ee915eb64b8d1773421390387e03507db72
parent712684792801868efbc821d21ce5c38feeec2e05 (diff)
FreeBSD: fix listener-socket backlog monitoring
-rw-r--r--src/src/daemon.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/src/daemon.c b/src/src/daemon.c
index d3fec42ee..05d94b188 100644
--- a/src/src/daemon.c
+++ b/src/src/daemon.c
@@ -2553,7 +2553,19 @@ for (;;)
if (p->revents & POLLIN)
{
EXIM_SOCKLEN_T alen = sizeof(accepted);
-#ifdef TCP_INFO
+#if defined(__FreeBSD__) && defined(SO_LISTENQLEN)
+ int backlog;
+ socklen_t blen = sizeof(backlog);
+
+ if ( smtp_backlog_monitor > 0
+ && getsockopt(p->fd, SOL_SOCKET, SO_LISTENQLEN, &backlog, &blen) == 0)
+ {
+ DEBUG(D_interface)
+ debug_printf("listen fd %d queue curr %d\n", p->fd, backlog);
+ smtp_listen_backlog = backlog;
+ }
+
+#elif defined(TCP_INFO) && defined(EXIM_HAVE_TCPI_UNACKED)
struct tcp_info ti;
socklen_t tlen = sizeof(ti);
@@ -2563,15 +2575,9 @@ for (;;)
if ( smtp_backlog_monitor > 0
&& getsockopt(p->fd, IPPROTO_TCP, TCP_INFO, &ti, &tlen) == 0)
{
-# ifdef EXIM_HAVE_TCPI_UNACKED
DEBUG(D_interface) debug_printf("listen fd %d queue max %u curr %u\n",
p->fd, ti.tcpi_sacked, ti.tcpi_unacked);
smtp_listen_backlog = ti.tcpi_unacked;
-# elif defined(__FreeBSD__) /* This does not work. Investigate kernel sourcecode. */
- DEBUG(D_interface) debug_printf("listen fd %d queue max %u curr %u\n",
- p->fd, ti.__tcpi_sacked, ti.__tcpi_unacked);
- smtp_listen_backlog = ti.__tcpi_unacked;
-# endif
}
#endif
p->revents = 0;