From nobody Wed Mar 4 14:45:12 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4fQwSS6Q7hz6TbpY for ; Wed, 04 Mar 2026 14:45:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fQwSS3C8Mz3bP7 for ; Wed, 04 Mar 2026 14:45:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772635512; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AiD4f0Juacjd4IoizTLagwj5J8vwFV2nJ+9QG+POsnA=; b=hVG+SRen/KkrWIWhZSQAzVvEMWtP/1r7+GzW/NTjob17fPujwddRGNdC1HTLM7NumMijcV 6Y1dU+EMqpy1AY0s/08J9UBDD5/ulydD2UCziHsXONdIco3AOlD6Lyvy/zxmXEZi7bqBX3 GelpW4CWfjkcZROL4bwj4SPGfbiTOyYgRGSZ3tgCcDmUI696m0SuUQsqxyRR2CYUP/VZFh rP/dJj3F9go8E2e40tcHiw436aRkfw5LiQgR6VczGfAxCIuKch6ZeNVNyj9yq2KYJQU1SN fjSp8bWJs19Mm3YmYpaZ8hCE3+PBkiv27cY6EzBohxO1zu5bHwIc4k9nl/8cng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772635512; a=rsa-sha256; cv=none; b=HZifjo9z4WRSIJH2z818wwfuB0JRdUUiu/gduPxkBn+yoRnS7e8GxfuNT6Fl7cEecydRYN MRhlRjQkqN6DCm9v9ZxSWYRlLl91ojSU8KtpCHhSTBRuQ/H+mRx/TDlm6hZx2hNK+GzU7G 2Kfk1Nsoi0ahrcrWwxefe4vmKRtIhAcao5iz55G2zyK2pUKq+MAH7lt0DpXCwRKaCXGO2s D/AVJQY2UaM7UzM5Am4WmLLU0bHoeBbIMgfzmHmRVL4MlV6oO7PKZ758aJoYqLxJhb5P0i 4/PAQ5KU/cH/Yh0RrqezFEl7gRT0VZechTKuwZVFfGuU+DWoGO8ETxIAYpyWxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772635512; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AiD4f0Juacjd4IoizTLagwj5J8vwFV2nJ+9QG+POsnA=; b=D6nj7AAeYD6TX5YQh8ohsJse53MQUPo9yyclC9aa0sB04dsOkBRhNuKMLSMn/QBj1DMIv5 AXYh0A0DoeZ9ZwctWVarqQ592zDKAHn/XMaP58yt8cvN1160GjS4xOqz+0H8ZpOKFAyV9g HeCs0C2oL/aCAY3d+h+feKkUTgFsducekNSDp+5hOUt5CAukwB6BoZgH5T6y1QSfD+uC/e SZor9NSOmHh8yElNGQPCOrWKivPb3rR1T2YV2FdRL986I6GHzSMO8pHPCCuPSr2H6B6sil EX0NKXyHQgV3Nu6vzfCSRGmNePUwjkhFNgvg/mJpgnSDLqTXDvF2dj1Cti+LuA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fQwSS2Rpxzw4K for ; Wed, 04 Mar 2026 14:45:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26a09 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 04 Mar 2026 14:45:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: f413ebdf126d - stable/15 - lpd: Add timeout option List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: f413ebdf126db12500d636c7eabee6a219c88721 Auto-Submitted: auto-generated Date: Wed, 04 Mar 2026 14:45:12 +0000 Message-Id: <69a84578.26a09.634bb86@gitrepo.freebsd.org> The branch stable/15 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=f413ebdf126db12500d636c7eabee6a219c88721 commit f413ebdf126db12500d636c7eabee6a219c88721 Author: Dag-Erling Smørgrav AuthorDate: 2026-02-26 06:15:14 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-03-04 14:45:00 +0000 lpd: Add timeout option Set a 120-second receive timeout on all client connections, and add a command-line option to change that value. MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D55400 (cherry picked from commit 56fbfd1ecdc78fc99b3a2e381c355ce8980de39d) --- usr.sbin/lpr/lpd/lpd.8 | 8 +++++++- usr.sbin/lpr/lpd/lpd.c | 30 +++++++++++++++++++----------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/usr.sbin/lpr/lpd/lpd.8 b/usr.sbin/lpr/lpd/lpd.8 index 9a4e46996811..9d24a450ba0e 100644 --- a/usr.sbin/lpr/lpd/lpd.8 +++ b/usr.sbin/lpr/lpd/lpd.8 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 15, 2021 +.Dd February 19, 2026 .Dt LPD 8 .Os .Sh NAME @@ -34,6 +34,7 @@ .Sh SYNOPSIS .Nm .Op Fl cdlpsFW46 +.Op Fl t Ar timeout .Op Ar port# .Sh DEPRECATION NOTICE This facility is scheduled for removal prior to the release of @@ -108,6 +109,11 @@ This means that will not accept any connections from any remote hosts, although it will still accept print requests from all local users. +.It Fl t Ar timeout +Set the network receive timeout for client connections to +.Ar timeout +seconds. +The default is 120. .It Fl F By default, .Nm diff --git a/usr.sbin/lpr/lpd/lpd.c b/usr.sbin/lpr/lpd/lpd.c index 089b8fedc2d5..d1dcd0766a77 100644 --- a/usr.sbin/lpr/lpd/lpd.c +++ b/usr.sbin/lpr/lpd/lpd.c @@ -61,28 +61,28 @@ */ #include -#include -#include +#include #include -#include #include -#include +#include +#include + #include #include -#include -#include -#include -#include +#include +#include #include #include #include -#include +#include +#include #include #include #include #include -#include +#include +#include #include "lp.h" #include "lp.local.h" #include "pathnames.h" @@ -117,6 +117,7 @@ uid_t uid, euid; int main(int argc, char **argv) { + struct timeval tv = { .tv_sec = 120 }; int ch_options, errs, f, funix, *finet, i, lfd, socket_debug; fd_set defreadfds; struct sockaddr_un un, fromunix; @@ -139,7 +140,7 @@ main(int argc, char **argv) errx(EX_NOPERM,"must run as root"); errs = 0; - while ((i = getopt(argc, argv, "cdlpswFW46")) != -1) + while ((i = getopt(argc, argv, "cdlpst:wFW46")) != -1) switch (i) { case 'c': /* log all kinds of connection-errors to syslog */ @@ -159,6 +160,9 @@ main(int argc, char **argv) case 's': /* secure (no inet) */ sflag++; break; + case 't': + tv.tv_sec = atol(optarg); + break; case 'w': /* netbsd uses -w for maxwait */ /* * This will be removed after the release of 4.4, as @@ -386,6 +390,10 @@ main(int argc, char **argv) syslog(LOG_WARNING, "accept: %m"); continue; } + if (tv.tv_sec > 0) { + (void) setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, + sizeof(tv)); + } if (fork() == 0) { /* * Note that printjob() also plays around with