reDTYNNuSfvtME9lWJ56g5G1D RDWT/KuJO1IdtU4UAoHmT74GYD/uFH8hNqyGVt+0r9lC4LFdrNJ6eK4A7EKG+BJTn4pPdU xS1qIL5S3rbKX35jxeBnUHqCvNOTNcsuIw3XN1TocseM6KIBtgLAApoFuz3y0p4MYNte4T Tf0Jawbo+es/INb9yYjxGExuFYXWKO1j3pSb8c/mbDtyGwDHSrXCFsnyaAVOvUDhc4/O3p GB1ld+GGUjOVcK0ph0LFLDOCRrSHMdxyuwXS+pl+gxFk90+WVFl5Yt4cenF0yQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dVqTm5Hg3zyFY for ; Tue, 16 Dec 2025 08:14:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 37bb0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 16 Dec 2025 08:14:36 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jose Luis Duran Subject: git: 9c844b6110b3 - main - blocklist: blacklist: Chase recent upstream changes List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jlduran X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9c844b6110b3768a4fc3ce47cd9d1b30915213ec Auto-Submitted: auto-generated Date: Tue, 16 Dec 2025 08:14:36 +0000 Message-Id: <694114ec.37bb0.4c55429@gitrepo.freebsd.org> The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/src/commit/?id=9c844b6110b3768a4fc3ce47cd9d1b30915213ec commit 9c844b6110b3768a4fc3ce47cd9d1b30915213ec Author: Jose Luis Duran AuthorDate: 2025-12-16 07:57:07 +0000 Commit: Jose Luis Duran CommitDate: 2025-12-16 08:13:39 +0000 blocklist: blacklist: Chase recent upstream changes Upstream fixed a couple of bugs: 1. Only attempt to restore the blocking rules if the database file exists. Otherwise, when the service starts for the first time, it fails (PR 258411). 2. Revert a commit that removed a call to close(bi->bi_fd), preventing the descriptor from being deleted. PR: 258411 PR: 291680 MFC after: 1 week --- contrib/blocklist/bin/blacklistd.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/contrib/blocklist/bin/blacklistd.c b/contrib/blocklist/bin/blacklistd.c index cb6ce6578d9c..7dec62cfa58b 100644 --- a/contrib/blocklist/bin/blacklistd.c +++ b/contrib/blocklist/bin/blacklistd.c @@ -1,4 +1,4 @@ -/* $NetBSD: blocklistd.c,v 1.12 2025/10/25 18:43:51 christos Exp $ */ +/* $NetBSD: blocklistd.c,v 1.14 2025/12/15 15:51:37 christos Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #ifdef HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: blocklistd.c,v 1.12 2025/10/25 18:43:51 christos Exp $"); +__RCSID("$NetBSD: blocklistd.c,v 1.14 2025/12/15 15:51:37 christos Exp $"); #include #include @@ -191,12 +191,13 @@ process(bl_t bl) } if (getremoteaddress(bi, &rss, &rsl) == -1) - return; + goto out; if (debug || bi->bi_msg[0]) { sockaddr_snprintf(rbuf, sizeof(rbuf), "%a:%p", (void *)&rss); (*lfun)(bi->bi_msg[0] ? LOG_INFO : LOG_DEBUG, - "processing type=%d fd=%d remote=%s msg=\"%s\" uid=%lu gid=%lu", + "processing type=%d fd=%d remote=%s msg=\"%s\" " + "uid=%lu gid=%lu", bi->bi_type, bi->bi_fd, rbuf, bi->bi_msg, (unsigned long)bi->bi_uid, (unsigned long)bi->bi_gid); @@ -204,12 +205,12 @@ process(bl_t bl) if (conf_find(bi->bi_fd, bi->bi_uid, &rss, &c) == NULL) { (*lfun)(LOG_DEBUG, "no rule matched"); - return; + goto out; } if (state_get(state, &c, &dbi) == -1) - return; + goto out; if (debug) { char b1[128], b2[128]; @@ -269,6 +270,8 @@ process(bl_t bl) state_put(state, &c, &dbi); out: + close(bi->bi_fd); + if (debug) { char b1[128], b2[128]; (*lfun)(LOG_DEBUG, "%s: final db state for %s: count=%d/%d " @@ -541,15 +544,16 @@ main(int argc, char *argv[]) state = state_open(dbfile, flags, 0600); if (state == NULL) state = state_open(dbfile, flags | O_CREAT, 0600); + else { + if (restore) { + if (!flush) + rules_flush(); + rules_restore(); + } + } if (state == NULL) return EXIT_FAILURE; - if (restore) { - if (!flush) - rules_flush(); - rules_restore(); - } - if (!debug) { if (daemon(0, 0) == -1) err(EXIT_FAILURE, "daemon failed"); @@ -563,7 +567,7 @@ main(int argc, char *argv[]) conf_parse(configfile); } ret = poll(pfd, (nfds_t)nfd, tout); - if (debug && ret != 0) + if (debug) (*lfun)(LOG_DEBUG, "received %d from poll()", ret); switch (ret) { case -1: