Module Name: src Committed By: martin Date: Tue Oct 8 11:16:19 UTC 2024
Modified Files: src/crypto/external/bsd/openssh/dist [netbsd-10]: pfilter.c src/distrib/sets/lists/base [netbsd-10]: shl.mi src/distrib/sets/lists/comp [netbsd-10]: mi src/distrib/sets/lists/debug [netbsd-10]: shl.mi src/external/bsd/blocklist [netbsd-10]: README src/external/bsd/blocklist/bin [netbsd-10]: blocklistd.8 blocklistd.c support.c support.h src/external/bsd/blocklist/include [netbsd-10]: bl.h blocklist.h src/external/bsd/blocklist/lib [netbsd-10]: bl.c blocklist.c libblocklist.3 shlib_version src/external/bsd/blocklist/libexec [netbsd-10]: blocklistd-helper src/lib/libc/gen [netbsd-10]: Makefile.inc syslog.3 syslog_ss.c src/lib/libc/include [netbsd-10]: extern.h src/sys/sys [netbsd-10]: syslog.h Log Message: Pull up following revision(s) (requested by rin in ticket #930): lib/libc/include/extern.h: revision 1.30 distrib/sets/lists/base/shl.mi: revision 1.987 (patch) external/bsd/blocklist/bin/support.c: revision 1.2 external/bsd/blocklist/bin/blocklistd.c: revision 1.5 external/bsd/blocklist/bin/blocklistd.8: revision 1.3 sys/sys/syslog.h: revision 1.42 external/bsd/blocklist/bin/support.h: revision 1.2 external/bsd/blocklist/include/blocklist.h: revision 1.3 crypto/external/bsd/openssh/dist/pfilter.c: revision 1.9 external/bsd/blocklist/lib/shlib_version: revision 1.2 lib/libc/gen/syslog_ss.c: revision 1.4 lib/libc/gen/Makefile.inc: revision 1.218 external/bsd/blocklist/lib/bl.c: revision 1.3 external/bsd/blocklist/README: revision 1.3 external/bsd/blocklist/include/bl.h: revision 1.2 distrib/sets/lists/debug/shl.mi: revision 1.347 (patch) distrib/sets/lists/comp/mi: revision 1.2462 lib/libc/gen/syslog.3: revision 1.34 lib/libc/gen/syslog.3: revision 1.35 external/bsd/blocklist/libexec/blocklistd-helper: revision 1.8 external/bsd/blocklist/lib/libblocklist.3: revision 1.4 external/bsd/blocklist/lib/libblocklist.3: revision 1.5 external/bsd/blocklist/lib/libblocklist.3: revision 1.6 external/bsd/blocklist/lib/blocklist.c: revision 1.3 Spelling fixes PR/58391: Noriyuki Soda: re-adding syslog_ss() to syslog.h and syslog.3 syslog(3): Nix trailing whitespace in man page. No functional change intended. reference sockpath instead of sockspath Add blocklist_open2() that can pass a custom logger or NULL for no logging. Switch internally to use syslog_r. Add compatibility for systems that don't have syslog_r. Switch blocklist to use syslog_ss since we are being called from a signal handler. bump libblocklist remove trailing space Silence a bogus warning when starting up: NetBSD pf: No ALTQ support in kernel ALTQ related functions disabled FreeBSD pf: Anchor 'blacklistd' not found. The anchor is indeed found and working correctly. This patch just discards stderr's output, like in other places. (jlduran@github) update markup (Ed Maste) To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.8.6.1 src/crypto/external/bsd/openssh/dist/pfilter.c cvs rdiff -u -r1.942.2.15 -r1.942.2.16 src/distrib/sets/lists/base/shl.mi cvs rdiff -u -r1.2425.2.8 -r1.2425.2.9 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.298.2.17 -r1.298.2.18 src/distrib/sets/lists/debug/shl.mi cvs rdiff -u -r1.2 -r1.2.6.1 src/external/bsd/blocklist/README cvs rdiff -u -r1.2 -r1.2.6.1 src/external/bsd/blocklist/bin/blocklistd.8 cvs rdiff -u -r1.3.2.1 -r1.3.2.2 src/external/bsd/blocklist/bin/blocklistd.c cvs rdiff -u -r1.1.1.1 -r1.1.1.1.6.1 src/external/bsd/blocklist/bin/support.c \ src/external/bsd/blocklist/bin/support.h cvs rdiff -u -r1.1.1.1 -r1.1.1.1.6.1 src/external/bsd/blocklist/include/bl.h cvs rdiff -u -r1.2 -r1.2.6.1 src/external/bsd/blocklist/include/blocklist.h cvs rdiff -u -r1.2 -r1.2.2.1 src/external/bsd/blocklist/lib/bl.c cvs rdiff -u -r1.2 -r1.2.6.1 src/external/bsd/blocklist/lib/blocklist.c cvs rdiff -u -r1.3 -r1.3.6.1 src/external/bsd/blocklist/lib/libblocklist.3 cvs rdiff -u -r1.1.1.1 -r1.1.1.1.6.1 \ src/external/bsd/blocklist/lib/shlib_version cvs rdiff -u -r1.7 -r1.7.2.1 \ src/external/bsd/blocklist/libexec/blocklistd-helper cvs rdiff -u -r1.216 -r1.216.2.1 src/lib/libc/gen/Makefile.inc cvs rdiff -u -r1.33 -r1.33.16.1 src/lib/libc/gen/syslog.3 cvs rdiff -u -r1.3 -r1.3.26.1 src/lib/libc/gen/syslog_ss.c cvs rdiff -u -r1.26.6.1 -r1.26.6.2 src/lib/libc/include/extern.h cvs rdiff -u -r1.41 -r1.41.44.1 src/sys/sys/syslog.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/crypto/external/bsd/openssh/dist/pfilter.c diff -u src/crypto/external/bsd/openssh/dist/pfilter.c:1.8 src/crypto/external/bsd/openssh/dist/pfilter.c:1.8.6.1 --- src/crypto/external/bsd/openssh/dist/pfilter.c:1.8 Mon Jun 15 01:57:29 2020 +++ src/crypto/external/bsd/openssh/dist/pfilter.c Tue Oct 8 11:16:17 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: pfilter.c,v 1.8 2020/06/15 01:57:29 christos Exp $ */ +/* $NetBSD: pfilter.c,v 1.8.6.1 2024/10/08 11:16:17 martin Exp $ */ #include "namespace.h" #include "includes.h" #include "ssh.h" @@ -6,19 +6,20 @@ #include "log.h" #include "pfilter.h" #include <blocklist.h> +#include <syslog.h> #ifndef SMALL static struct blocklist *blstate; #endif #include "includes.h" -__RCSID("$NetBSD: pfilter.c,v 1.8 2020/06/15 01:57:29 christos Exp $"); +__RCSID("$NetBSD: pfilter.c,v 1.8.6.1 2024/10/08 11:16:17 martin Exp $"); void pfilter_init() { #ifndef SMALL - blstate = blocklist_open(); + blstate = blocklist_open2(vsyslog_ss); #endif } Index: src/distrib/sets/lists/base/shl.mi diff -u src/distrib/sets/lists/base/shl.mi:1.942.2.15 src/distrib/sets/lists/base/shl.mi:1.942.2.16 --- src/distrib/sets/lists/base/shl.mi:1.942.2.15 Sun Feb 25 15:47:58 2024 +++ src/distrib/sets/lists/base/shl.mi Tue Oct 8 11:16:16 2024 @@ -1,4 +1,4 @@ -# $NetBSD: shl.mi,v 1.942.2.15 2024/02/25 15:47:58 martin Exp $ +# $NetBSD: shl.mi,v 1.942.2.16 2024/10/08 11:16:16 martin Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -19,7 +19,7 @@ ./lib/libblacklist.so base-obsolete obsolete,compatfile ./lib/libblocklist.so base-sys-shlib dynamicroot ./lib/libblocklist.so.0 base-sys-shlib dynamicroot -./lib/libblocklist.so.0.0 base-sys-shlib dynamicroot +./lib/libblocklist.so.0.1 base-sys-shlib dynamicroot ./lib/libc.so base-sys-shlib dynamicroot ./lib/libc.so.12 base-sys-shlib dynamicroot ./lib/libc.so.12.220 base-sys-shlib dynamicroot @@ -235,7 +235,7 @@ ./usr/lib/libblacklist.so base-obsolete obsolete,compatfile ./usr/lib/libblocklist.so base-sys-shlib compatfile ./usr/lib/libblocklist.so.0 base-sys-shlib compatfile -./usr/lib/libblocklist.so.0.0 base-sys-shlib compatfile +./usr/lib/libblocklist.so.0.1 base-sys-shlib compatfile ./usr/lib/libbluetooth.so base-sys-shlib compatfile ./usr/lib/libbluetooth.so.4 base-sys-shlib compatfile ./usr/lib/libbluetooth.so.4.2 base-sys-shlib compatfile Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.2425.2.8 src/distrib/sets/lists/comp/mi:1.2425.2.9 --- src/distrib/sets/lists/comp/mi:1.2425.2.8 Fri Sep 20 11:00:20 2024 +++ src/distrib/sets/lists/comp/mi Tue Oct 8 11:16:18 2024 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.2425.2.8 2024/09/20 11:00:20 martin Exp $ +# $NetBSD: mi,v 1.2425.2.9 2024/10/08 11:16:18 martin Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. ./etc/mtree/set.comp comp-sys-root @@ -10816,9 +10816,10 @@ ./usr/share/man/cat3/sysexits.0 comp-c-catman .cat ./usr/share/man/cat3/syslog.0 comp-c-catman .cat ./usr/share/man/cat3/syslog_r.0 comp-c-catman .cat -./usr/share/man/cat3/syslog_ss.0 comp-obsolete obsolete +./usr/share/man/cat3/syslog_ss.0 comp-c-catman .cat ./usr/share/man/cat3/syslogp.0 comp-c-catman .cat ./usr/share/man/cat3/syslogp_r.0 comp-c-catman .cat +./usr/share/man/cat3/syslogp_ss.0 comp-c-catman .cat ./usr/share/man/cat3/system.0 comp-c-catman .cat ./usr/share/man/cat3/t_freent.0 comp-obsolete obsolete ./usr/share/man/cat3/t_getent.0 comp-obsolete obsolete @@ -11055,9 +11056,10 @@ ./usr/share/man/cat3/vswscanf.0 comp-c-catman .cat ./usr/share/man/cat3/vsyslog.0 comp-c-catman .cat ./usr/share/man/cat3/vsyslog_r.0 comp-c-catman .cat -./usr/share/man/cat3/vsyslog_ss.0 comp-obsolete obsolete +./usr/share/man/cat3/vsyslog_ss.0 comp-c-catman .cat ./usr/share/man/cat3/vsyslogp.0 comp-c-catman .cat ./usr/share/man/cat3/vsyslogp_r.0 comp-c-catman .cat +./usr/share/man/cat3/vsyslogp_ss.0 comp-c-catman .cat ./usr/share/man/cat3/vtimes.0 comp-obsolete obsolete ./usr/share/man/cat3/vwarn.0 comp-c-catman .cat ./usr/share/man/cat3/vwarnc.0 comp-c-catman .cat @@ -19228,8 +19230,10 @@ ./usr/share/man/html3/sysexits.html comp-c-htmlman html ./usr/share/man/html3/syslog.html comp-c-htmlman html ./usr/share/man/html3/syslog_r.html comp-c-htmlman html +./usr/share/man/html3/syslog_ss.html comp-c-htmlman html ./usr/share/man/html3/syslogp.html comp-c-htmlman html ./usr/share/man/html3/syslogp_r.html comp-c-htmlman html +./usr/share/man/html3/syslogp_ss.html comp-c-htmlman html ./usr/share/man/html3/system.html comp-c-htmlman html ./usr/share/man/html3/t_freent.html comp-obsolete obsolete ./usr/share/man/html3/t_getent.html comp-obsolete obsolete @@ -19452,8 +19456,10 @@ ./usr/share/man/html3/vswscanf.html comp-c-htmlman html ./usr/share/man/html3/vsyslog.html comp-c-htmlman html ./usr/share/man/html3/vsyslog_r.html comp-c-htmlman html +./usr/share/man/html3/vsyslog_ss.html comp-c-htmlman html ./usr/share/man/html3/vsyslogp.html comp-c-htmlman html ./usr/share/man/html3/vsyslogp_r.html comp-c-htmlman html +./usr/share/man/html3/vsyslogp_ss.html comp-c-htmlman html ./usr/share/man/html3/vwarn.html comp-c-htmlman html ./usr/share/man/html3/vwarnc.html comp-c-htmlman html ./usr/share/man/html3/vwarnx.html comp-c-htmlman html @@ -27678,9 +27684,10 @@ ./usr/share/man/man3/sysexits.3 comp-c-man .man ./usr/share/man/man3/syslog.3 comp-c-man .man ./usr/share/man/man3/syslog_r.3 comp-c-man .man -./usr/share/man/man3/syslog_ss.3 comp-obsolete obsolete +./usr/share/man/man3/syslog_ss.3 comp-c-man .man ./usr/share/man/man3/syslogp.3 comp-c-man .man ./usr/share/man/man3/syslogp_r.3 comp-c-man .man +./usr/share/man/man3/syslogp_ss.3 comp-c-man .man ./usr/share/man/man3/system.3 comp-c-man .man ./usr/share/man/man3/t_freent.3 comp-obsolete obsolete ./usr/share/man/man3/t_getent.3 comp-obsolete obsolete @@ -27917,9 +27924,10 @@ ./usr/share/man/man3/vswscanf.3 comp-c-man .man ./usr/share/man/man3/vsyslog.3 comp-c-man .man ./usr/share/man/man3/vsyslog_r.3 comp-c-man .man -./usr/share/man/man3/vsyslog_ss.3 comp-obsolete obsolete +./usr/share/man/man3/vsyslog_ss.3 comp-c-man .man ./usr/share/man/man3/vsyslogp.3 comp-c-man .man ./usr/share/man/man3/vsyslogp_r.3 comp-c-man .man +./usr/share/man/man3/vsyslogp_ss.3 comp-c-man .man ./usr/share/man/man3/vtimes.3 comp-obsolete obsolete ./usr/share/man/man3/vwarn.3 comp-c-man .man ./usr/share/man/man3/vwarnc.3 comp-c-man .man Index: src/distrib/sets/lists/debug/shl.mi diff -u src/distrib/sets/lists/debug/shl.mi:1.298.2.17 src/distrib/sets/lists/debug/shl.mi:1.298.2.18 --- src/distrib/sets/lists/debug/shl.mi:1.298.2.17 Sun Feb 25 17:19:15 2024 +++ src/distrib/sets/lists/debug/shl.mi Tue Oct 8 11:16:18 2024 @@ -1,10 +1,11 @@ -# $NetBSD: shl.mi,v 1.298.2.17 2024/02/25 17:19:15 martin Exp $ +# $NetBSD: shl.mi,v 1.298.2.18 2024/10/08 11:16:18 martin Exp $ +# ./usr/lib/libbfd_g.a comp-c-debuglib debuglib,compatfile,binutils ./usr/lib/libgcc_eh_g.a comp-c-debuglib debuglib,compatfile,gcc ./usr/lib/libgcc_s_g.a comp-c-debuglib debuglib,compatfile,gcc ./usr/libdata/debug/lib base-sys-usr debug,dynamicroot,compatdir ./usr/libdata/debug/lib/libavl.so.0.0.debug comp-zfs-debug debug,dynamicroot,zfs -./usr/libdata/debug/lib/libblocklist.so.0.0.debug comp-sys-debug debug,dynamicroot +./usr/libdata/debug/lib/libblocklist.so.0.1.debug comp-sys-debug debug,dynamicroot ./usr/libdata/debug/lib/libc.so.12.220.debug comp-sys-debug debug,dynamicroot ./usr/libdata/debug/lib/libcrypt.so.1.0.debug comp-sys-debug debug,dynamicroot ./usr/libdata/debug/lib/libcrypto.so.12.0.debug comp-sys-debug debug,dynamicroot,openssl=10 @@ -77,7 +78,7 @@ ./usr/libdata/debug/usr/lib/libbfd.so.16.0.debug comp-sys-debug debug,compatfile,binutils=231 ./usr/libdata/debug/usr/lib/libbfd.so.17.0.debug comp-sys-debug debug,compatfile,binutils=234 ./usr/libdata/debug/usr/lib/libbind9.so.21.0.debug comp-bind-debug debug,compatfile -./usr/libdata/debug/usr/lib/libblocklist.so.0.0.debug comp-sys-debug debug,compatfile +./usr/libdata/debug/usr/lib/libblocklist.so.0.1.debug comp-sys-debug debug,compatfile ./usr/libdata/debug/usr/lib/libbluetooth.so.4.2.debug comp-sys-debug debug,compatfile ./usr/libdata/debug/usr/lib/libbozohttpd.so.1.0.debug comp-sys-debug debug,compatfile ./usr/libdata/debug/usr/lib/libbsdmalloc.so.0.0.debug comp-sys-debug debug,compatfile Index: src/external/bsd/blocklist/README diff -u src/external/bsd/blocklist/README:1.2 src/external/bsd/blocklist/README:1.2.6.1 --- src/external/bsd/blocklist/README:1.2 Mon Jun 15 21:27:57 2020 +++ src/external/bsd/blocklist/README Tue Oct 8 11:16:18 2024 @@ -1,4 +1,4 @@ -# $NetBSD: README,v 1.2 2020/06/15 21:27:57 christos Exp $ +# $NetBSD: README,v 1.2.6.1 2024/10/08 11:16:18 martin Exp $ This package contains library that can be used by network daemons to communicate with a packet filter via a daemon to enforce opening and @@ -15,7 +15,7 @@ blocklistd=YES in /etc/rc.conf, start it There is also a startup file in etc/rc.d/blocklistd -Patches to various daemons to add blocklisting capabilitiers are in the +Patches to various daemons to add blocklisting capabilities are in the "diff" directory: - OpenSSH: diff/ssh.diff [tcp socket example] - Bind: diff/named.diff [both tcp and udp] @@ -24,7 +24,7 @@ Patches to various daemons to add blockl These patches have been applied to NetBSD-current. The network daemon (for example sshd) communicates to blocklistd, via -a unix socket like syslog. The library calls are simple and everything +a Unix socket like syslog. The library calls are simple and everything is handled by the library. In the simplest form the only thing the daemon needs to do is to call: @@ -60,11 +60,11 @@ ssh stream tcp6 * * 6 60m http stream tcp * * 6 60m Here note that owner is * because the connection is done from the -child ssh socket which runs with user privs. We treat ipv4 connections +child ssh socket which runs with user privs. We treat IPv4 connections differently by maintaining two different rules one for the external interface and one from the internal We also register for both tcp and tcp6 since those are different listening sockets and addresses; -we don't bother with ipv6 and separate rules. We use nfail = 6, +we don't bother with IPv6 and separate rules. We use nfail = 6, because ssh allows 3 password attempts per connection, and this will let us have 2 connections before blocking. Finally we block for an hour; we could block forever too by specifying * in the @@ -100,7 +100,7 @@ group "internal" on $int_if { You can use 'blocklistctl dump -a' to list all the current entries in the database; the ones that have nfail <c>/<t> where <c>urrent ->= <t>otal, should have an id assosiated with them; this means that +>= <t>otal, should have an id associated with them; this means that there is a packet filter rule added for that entry. For npf, you can examine the packet filter dynamic rule entries using 'npfctl rule <rulename> list'. The number of current entries can exceed Index: src/external/bsd/blocklist/bin/blocklistd.8 diff -u src/external/bsd/blocklist/bin/blocklistd.8:1.2 src/external/bsd/blocklist/bin/blocklistd.8:1.2.6.1 --- src/external/bsd/blocklist/bin/blocklistd.8:1.2 Mon Jun 15 02:29:44 2020 +++ src/external/bsd/blocklist/bin/blocklistd.8 Tue Oct 8 11:16:17 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: blocklistd.8,v 1.2 2020/06/15 02:29:44 christos Exp $ +.\" $NetBSD: blocklistd.8,v 1.2.6.1 2024/10/08 11:16:17 martin Exp $ .\" .\" Copyright (c) 2015 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -53,7 +53,7 @@ for notifications from other daemons abo attempts. If no such file is specified, then it only listens to the socket path specified by -.Ar sockspath +.Ar sockpath or if that is not specified to .Pa /var/run/blocklistd.sock . Each notification contains an (action, port, protocol, address, owner) tuple Index: src/external/bsd/blocklist/bin/blocklistd.c diff -u src/external/bsd/blocklist/bin/blocklistd.c:1.3.2.1 src/external/bsd/blocklist/bin/blocklistd.c:1.3.2.2 --- src/external/bsd/blocklist/bin/blocklistd.c:1.3.2.1 Mon Dec 25 18:59:46 2023 +++ src/external/bsd/blocklist/bin/blocklistd.c Tue Oct 8 11:16:17 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: blocklistd.c,v 1.3.2.1 2023/12/25 18:59:46 martin Exp $ */ +/* $NetBSD: blocklistd.c,v 1.3.2.2 2024/10/08 11:16:17 martin Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "config.h" #endif #include <sys/cdefs.h> -__RCSID("$NetBSD: blocklistd.c,v 1.3.2.1 2023/12/25 18:59:46 martin Exp $"); +__RCSID("$NetBSD: blocklistd.c,v 1.3.2.2 2024/10/08 11:16:17 martin Exp $"); #include <sys/types.h> #include <sys/socket.h> @@ -334,7 +334,7 @@ static void addfd(struct pollfd **pfdp, bl_t **blp, size_t *nfd, size_t *maxfd, const char *path) { - bl_t bl = bl_create(true, path, vflag ? vdlog : vsyslog); + bl_t bl = bl_create(true, path, vflag ? vdlog : vsyslog_r); if (bl == NULL || !bl_isconnected(bl)) exit(EXIT_FAILURE); if (*nfd >= *maxfd) { Index: src/external/bsd/blocklist/bin/support.c diff -u src/external/bsd/blocklist/bin/support.c:1.1.1.1 src/external/bsd/blocklist/bin/support.c:1.1.1.1.6.1 --- src/external/bsd/blocklist/bin/support.c:1.1.1.1 Mon Jun 15 01:52:53 2020 +++ src/external/bsd/blocklist/bin/support.c Tue Oct 8 11:16:17 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: support.c,v 1.1.1.1 2020/06/15 01:52:53 christos Exp $ */ +/* $NetBSD: support.c,v 1.1.1.1.6.1 2024/10/08 11:16:17 martin Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #endif #include <sys/cdefs.h> -__RCSID("$NetBSD: support.c,v 1.1.1.1 2020/06/15 01:52:53 christos Exp $"); +__RCSID("$NetBSD: support.c,v 1.1.1.1.6.1 2024/10/08 11:16:17 martin Exp $"); #include <time.h> #include <string.h> @@ -66,7 +66,8 @@ expandm(char *buf, size_t len, const cha } void -vdlog(int level __unused, const char *fmt, va_list ap) +vdlog(int level __unused, struct syslog_data *sd __unused, + const char *fmt, va_list ap) { char buf[BUFSIZ]; @@ -81,7 +82,7 @@ dlog(int level, const char *fmt, ...) va_list ap; va_start(ap, fmt); - vdlog(level, fmt, ap); + vdlog(level, NULL, fmt, ap); va_end(ap); } Index: src/external/bsd/blocklist/bin/support.h diff -u src/external/bsd/blocklist/bin/support.h:1.1.1.1 src/external/bsd/blocklist/bin/support.h:1.1.1.1.6.1 --- src/external/bsd/blocklist/bin/support.h:1.1.1.1 Mon Jun 15 01:52:53 2020 +++ src/external/bsd/blocklist/bin/support.h Tue Oct 8 11:16:17 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: support.h,v 1.1.1.1 2020/06/15 01:52:53 christos Exp $ */ +/* $NetBSD: support.h,v 1.1.1.1.6.1 2024/10/08 11:16:17 martin Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -34,8 +34,9 @@ __BEGIN_DECLS const char *fmttime(char *, size_t, time_t); const char *fmtydhms(char *, size_t, time_t); -void vdlog(int, const char *, va_list) - __attribute__((__format__(__printf__, 2, 0))); +struct syslog_data; +void vdlog(int, struct syslog_data *, const char *, va_list) + __attribute__((__format__(__printf__, 3, 0))); void dlog(int, const char *, ...) __attribute__((__format__(__printf__, 2, 3))); ssize_t blhexdump(char *, size_t, const char *, const void *, size_t); Index: src/external/bsd/blocklist/include/bl.h diff -u src/external/bsd/blocklist/include/bl.h:1.1.1.1 src/external/bsd/blocklist/include/bl.h:1.1.1.1.6.1 --- src/external/bsd/blocklist/include/bl.h:1.1.1.1 Mon Jun 15 01:52:53 2020 +++ src/external/bsd/blocklist/include/bl.h Tue Oct 8 11:16:17 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: bl.h,v 1.1.1.1 2020/06/15 01:52:53 christos Exp $ */ +/* $NetBSD: bl.h,v 1.1.1.1.6.1 2024/10/08 11:16:17 martin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -65,7 +65,8 @@ __BEGIN_DECLS typedef struct blocklist *bl_t; -bl_t bl_create(bool, const char *, void (*)(int, const char *, va_list)); +bl_t bl_create(bool, const char *, + void (*)(int, struct syslog_data *, const char *, va_list)); void bl_destroy(bl_t); int bl_send(bl_t, bl_type_t, int, const struct sockaddr *, socklen_t, const char *); Index: src/external/bsd/blocklist/include/blocklist.h diff -u src/external/bsd/blocklist/include/blocklist.h:1.2 src/external/bsd/blocklist/include/blocklist.h:1.2.6.1 --- src/external/bsd/blocklist/include/blocklist.h:1.2 Mon Jun 15 02:29:45 2020 +++ src/external/bsd/blocklist/include/blocklist.h Tue Oct 8 11:16:17 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: blocklist.h,v 1.2 2020/06/15 02:29:45 christos Exp $ */ +/* $NetBSD: blocklist.h,v 1.2.6.1 2024/10/08 11:16:17 martin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -32,9 +32,13 @@ #define _BLOCKLIST_H #include <sys/socket.h> +#include <syslog.h> __BEGIN_DECLS +struct syslog_data; struct blocklist *blocklist_open(void); +struct blocklist *blocklist_open2( + void (*)(int, struct syslog_data *, const char *, va_list)); void blocklist_close(struct blocklist *); int blocklist(int, int, const char *); int blocklist_r(struct blocklist *, int, int, const char *); Index: src/external/bsd/blocklist/lib/bl.c diff -u src/external/bsd/blocklist/lib/bl.c:1.2 src/external/bsd/blocklist/lib/bl.c:1.2.2.1 --- src/external/bsd/blocklist/lib/bl.c:1.2 Sun Jun 12 17:54:15 2022 +++ src/external/bsd/blocklist/lib/bl.c Tue Oct 8 11:16:17 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: bl.c,v 1.2 2022/06/12 17:54:15 christos Exp $ */ +/* $NetBSD: bl.c,v 1.2.2.1 2024/10/08 11:16:17 martin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #endif #include <sys/cdefs.h> -__RCSID("$NetBSD: bl.c,v 1.2 2022/06/12 17:54:15 christos Exp $"); +__RCSID("$NetBSD: bl.c,v 1.2.2.1 2024/10/08 11:16:17 martin Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -59,6 +59,19 @@ __RCSID("$NetBSD: bl.c,v 1.2 2022/06/12 #include "bl.h" +#ifndef SYSLOG_DATA_INIT +struct syslog_data { + int dummy; +}; +#define SYSLOG_DATA_INIT { 0 } + +static void +vsyslog_r(int priority, struct syslog_data *sd, const char *fmt, va_list ap) +{ + vsyslog(priority, fmt, ap); +} +#endif + typedef struct { uint32_t bl_len; uint32_t bl_version; @@ -82,7 +95,8 @@ struct blocklist { int b_fd; int b_connected; struct sockaddr_un b_sun; - void (*b_fun)(int, const char *, va_list); + struct syslog_data b_syslog_data; + void (*b_fun)(int, struct syslog_data *, const char *, va_list); bl_info_t b_info; }; @@ -115,14 +129,16 @@ bl_reset(bl_t b, bool locked) } static void -bl_log(void (*fun)(int, const char *, va_list), int level, - const char *fmt, ...) +bl_log(bl_t b, int level, const char *fmt, ...) { va_list ap; int serrno = errno; + if (b->b_fun == NULL) + return; + va_start(ap, fmt); - (*fun)(level, fmt, ap); + (*b->b_fun)(level, &b->b_syslog_data, fmt, ap); va_end(ap); errno = serrno; } @@ -152,7 +168,7 @@ bl_init(bl_t b, bool srv) b->b_fd = socket(PF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK|SOCK_NOSIGPIPE, 0); if (b->b_fd == -1) { - bl_log(b->b_fun, LOG_ERR, "%s: socket failed (%s)", + bl_log(b, LOG_ERR, "%s: socket failed (%s)", __func__, strerror(errno)); BL_UNLOCK(b); return -1; @@ -186,7 +202,7 @@ bl_init(bl_t b, bool srv) rv = connect(b->b_fd, (const void *)sun, (socklen_t)sizeof(*sun)); if (rv == 0) { if (srv) { - bl_log(b->b_fun, LOG_ERR, + bl_log(b, LOG_ERR, "%s: another daemon is handling `%s'", __func__, sun->sun_path); goto out; @@ -199,7 +215,7 @@ bl_init(bl_t b, bool srv) * and only log once. */ if (b->b_connected != 1) { - bl_log(b->b_fun, LOG_DEBUG, + bl_log(b, LOG_DEBUG, "%s: connect failed for `%s' (%s)", __func__, sun->sun_path, strerror(errno)); b->b_connected = 1; @@ -207,8 +223,7 @@ bl_init(bl_t b, bool srv) BL_UNLOCK(b); return -1; } - bl_log(b->b_fun, LOG_DEBUG, "Connected to blocklist server", - __func__); + bl_log(b, LOG_DEBUG, "Connected to blocklist server", __func__); } if (srv) { @@ -219,8 +234,7 @@ bl_init(bl_t b, bool srv) (void)umask(om); errno = serrno; if (rv == -1) { - bl_log(b->b_fun, LOG_ERR, - "%s: bind failed for `%s' (%s)", + bl_log(b, LOG_ERR, "%s: bind failed for `%s' (%s)", __func__, sun->sun_path, strerror(errno)); goto out; } @@ -259,7 +273,7 @@ bl_init(bl_t b, bool srv) #ifdef CRED_LEVEL if (setsockopt(b->b_fd, CRED_LEVEL, CRED_NAME, &one, (socklen_t)sizeof(one)) == -1) { - bl_log(b->b_fun, LOG_ERR, "%s: setsockopt %s " + bl_log(b, LOG_ERR, "%s: setsockopt %s " "failed (%s)", __func__, __STRING(CRED_NAME), strerror(errno)); goto out; @@ -275,12 +289,15 @@ out: } bl_t -bl_create(bool srv, const char *path, void (*fun)(int, const char *, va_list)) +bl_create(bool srv, const char *path, + void (*fun)(int, struct syslog_data *, const char *, va_list)) { + static struct syslog_data sd = SYSLOG_DATA_INIT; bl_t b = calloc(1, sizeof(*b)); if (b == NULL) - goto out; - b->b_fun = fun == NULL ? vsyslog : fun; + return NULL; + b->b_fun = fun; + b->b_syslog_data = sd; b->b_fd = -1; b->b_connected = -1; BL_INIT(b); @@ -295,11 +312,6 @@ bl_create(bool srv, const char *path, vo bl_init(b, srv); return b; -out: - free(b); - bl_log(fun, LOG_ERR, "%s: malloc failed (%s)", __func__, - strerror(errno)); - return NULL; } void @@ -327,7 +339,7 @@ bl_getsock(bl_t b, struct sockaddr_stora family = AF_INET6; break; default: - bl_log(b->b_fun, LOG_ERR, "%s: invalid socket len %u (%s)", + bl_log(b, LOG_ERR, "%s: invalid socket len %u (%s)", __func__, (unsigned)slen, ctx); errno = EINVAL; return -1; @@ -336,7 +348,7 @@ bl_getsock(bl_t b, struct sockaddr_stora memcpy(ss, sa, slen); if (ss->ss_family != family) { - bl_log(b->b_fun, LOG_INFO, + bl_log(b, LOG_INFO, "%s: correcting socket family %d to %d (%s)", __func__, ss->ss_family, family, ctx); ss->ss_family = family; @@ -344,7 +356,7 @@ bl_getsock(bl_t b, struct sockaddr_stora #ifdef HAVE_STRUCT_SOCKADDR_SA_LEN if (ss->ss_len != slen) { - bl_log(b->b_fun, LOG_INFO, + bl_log(b, LOG_INFO, "%s: correcting socket len %u to %u (%s)", __func__, ss->ss_len, (unsigned)slen, ctx); ss->ss_len = (uint8_t)slen; @@ -454,14 +466,14 @@ bl_recv(bl_t b) rlen = recvmsg(b->b_fd, &msg, 0); if (rlen == -1) { - bl_log(b->b_fun, LOG_ERR, "%s: recvmsg failed (%s)", __func__, + bl_log(b, LOG_ERR, "%s: recvmsg failed (%s)", __func__, strerror(errno)); return NULL; } for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) { if (cmsg->cmsg_level != SOL_SOCKET) { - bl_log(b->b_fun, LOG_ERR, + bl_log(b, LOG_ERR, "%s: unexpected cmsg_level %d", __func__, cmsg->cmsg_level); continue; @@ -469,7 +481,7 @@ bl_recv(bl_t b) switch (cmsg->cmsg_type) { case SCM_RIGHTS: if (cmsg->cmsg_len != CMSG_LEN(sizeof(int))) { - bl_log(b->b_fun, LOG_ERR, + bl_log(b, LOG_ERR, "%s: unexpected cmsg_len %d != %zu", __func__, cmsg->cmsg_len, CMSG_LEN(2 * sizeof(int))); @@ -487,7 +499,7 @@ bl_recv(bl_t b) break; #endif default: - bl_log(b->b_fun, LOG_ERR, + bl_log(b, LOG_ERR, "%s: unexpected cmsg_type %d", __func__, cmsg->cmsg_type); continue; @@ -496,7 +508,7 @@ bl_recv(bl_t b) } if (got != (GOT_CRED|GOT_FD)) { - bl_log(b->b_fun, LOG_ERR, "message missing %s %s", + bl_log(b, LOG_ERR, "message missing %s %s", #if GOT_CRED != 0 (got & GOT_CRED) == 0 ? "cred" : #endif @@ -506,13 +518,13 @@ bl_recv(bl_t b) rem = (size_t)rlen; if (rem < sizeof(ub.bl)) { - bl_log(b->b_fun, LOG_ERR, "message too short %zd", rlen); + bl_log(b, LOG_ERR, "message too short %zd", rlen); return NULL; } rem -= sizeof(ub.bl); if (ub.bl.bl_version != BL_VERSION) { - bl_log(b->b_fun, LOG_ERR, "bad version %d", ub.bl.bl_version); + bl_log(b, LOG_ERR, "bad version %d", ub.bl.bl_version); return NULL; } Index: src/external/bsd/blocklist/lib/blocklist.c diff -u src/external/bsd/blocklist/lib/blocklist.c:1.2 src/external/bsd/blocklist/lib/blocklist.c:1.2.6.1 --- src/external/bsd/blocklist/lib/blocklist.c:1.2 Mon Jun 15 02:29:45 2020 +++ src/external/bsd/blocklist/lib/blocklist.c Tue Oct 8 11:16:17 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: blocklist.c,v 1.2 2020/06/15 02:29:45 christos Exp $ */ +/* $NetBSD: blocklist.c,v 1.2.6.1 2024/10/08 11:16:17 martin Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #endif #include <sys/cdefs.h> -__RCSID("$NetBSD: blocklist.c,v 1.2 2020/06/15 02:29:45 christos Exp $"); +__RCSID("$NetBSD: blocklist.c,v 1.2.6.1 2024/10/08 11:16:17 martin Exp $"); #include <stdio.h> #include <bl.h> @@ -98,7 +98,14 @@ blocklist_r(struct blocklist *bl, int ac struct blocklist * blocklist_open(void) { - return bl_create(false, NULL, vsyslog); + return bl_create(false, NULL, vsyslog_r); +} + +struct blocklist * +blocklist_open2( + void (*logger)(int, struct syslog_data *, const char *, va_list)) +{ + return bl_create(false, NULL, logger); } void Index: src/external/bsd/blocklist/lib/libblocklist.3 diff -u src/external/bsd/blocklist/lib/libblocklist.3:1.3 src/external/bsd/blocklist/lib/libblocklist.3:1.3.6.1 --- src/external/bsd/blocklist/lib/libblocklist.3:1.3 Mon Jun 15 21:27:57 2020 +++ src/external/bsd/blocklist/lib/libblocklist.3 Tue Oct 8 11:16:17 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: libblocklist.3,v 1.3 2020/06/15 21:27:57 christos Exp $ +.\" $NetBSD: libblocklist.3,v 1.3.6.1 2024/10/08 11:16:17 martin Exp $ .\" .\" Copyright (c) 2015 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,11 +27,12 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd March 30, 2020 +.Dd August 2, 2024 .Dt LIBBLOCKLIST 3 .Os .Sh NAME .Nm blocklist_open , +.Nm blocklist_open2 , .Nm blocklist_close , .Nm blocklist_r , .Nm blocklist , @@ -44,6 +45,8 @@ .In blocklist.h .Ft struct blocklist * .Fn blocklist_open "void" +.Ft struct blocklist * +.Fn blocklist_open2 "void (*logger)(int, struct syslog_data *, va_list)" .Ft void .Fn blocklist_close "struct blocklist *cookie" .Ft int @@ -68,6 +71,19 @@ and returns a pointer to it, or .Dv NULL on failure. .Pp +The function +.Fn blocklist_open2 +is similar to +.Fn blocklist_open +but allows a +.Fa logger +to be specified. +If the +.Fa logger +is +.Dv NULL , +then no logging is performed. +.Pp The .Fn blocklist_close function frees all memory and resources used. @@ -89,17 +105,17 @@ argument. The .Ar action parameter can take these values: -.Bl -tag -width ".Va BLOCKLIST_ABUSIVE_BEHAVIOR" -.It Va BLOCKLIST_AUTH_FAIL +.Bl -tag -width ".Dv BLOCKLIST_ABUSIVE_BEHAVIOR" +.It Dv BLOCKLIST_AUTH_FAIL There was an unsuccessful authentication attempt. -.It Va BLOCKLIST_AUTH_OK +.It Dv BLOCKLIST_AUTH_OK A user successfully authenticated. -.It Va BLOCKLIST_ABUSIVE_BEHAVIOR +.It Dv BLOCKLIST_ABUSIVE_BEHAVIOR The sending daemon has detected abusive behavior from the remote system. The remote address should be blocked as soon as possible. -.It Va BLOCKLIST_BAD_USER +.It Dv BLOCKLIST_BAD_USER The sending daemon has determined the username presented for authentication is invalid. The @@ -108,7 +124,7 @@ daemon compares the username to a config usernames and blocks the address immediately if a forbidden username matches. (The -.Ar BLOCKLIST_BAD_USER +.Dv BLOCKLIST_BAD_USER support is not currently available.) .El .Pp Index: src/external/bsd/blocklist/lib/shlib_version diff -u src/external/bsd/blocklist/lib/shlib_version:1.1.1.1 src/external/bsd/blocklist/lib/shlib_version:1.1.1.1.6.1 --- src/external/bsd/blocklist/lib/shlib_version:1.1.1.1 Mon Jun 15 01:52:53 2020 +++ src/external/bsd/blocklist/lib/shlib_version Tue Oct 8 11:16:17 2024 @@ -1,2 +1,2 @@ major=0 -minor=0 +minor=1 Index: src/external/bsd/blocklist/libexec/blocklistd-helper diff -u src/external/bsd/blocklist/libexec/blocklistd-helper:1.7 src/external/bsd/blocklist/libexec/blocklistd-helper:1.7.2.1 --- src/external/bsd/blocklist/libexec/blocklistd-helper:1.7 Tue Nov 15 21:05:00 2022 +++ src/external/bsd/blocklist/libexec/blocklistd-helper Tue Oct 8 11:16:19 2024 @@ -233,7 +233,7 @@ flush) pf) # dynamically determine which anchors exist - for anchor in $(/sbin/pfctl -a "$2" -s Anchors); do + for anchor in $(/sbin/pfctl -a "$2" -s Anchors 2> /dev/null); do /sbin/pfctl -a "$anchor" -t "port${anchor##*/}" -T flush /sbin/pfctl -a "$anchor" -F rules done Index: src/lib/libc/gen/Makefile.inc diff -u src/lib/libc/gen/Makefile.inc:1.216 src/lib/libc/gen/Makefile.inc:1.216.2.1 --- src/lib/libc/gen/Makefile.inc:1.216 Tue May 31 13:42:59 2022 +++ src/lib/libc/gen/Makefile.inc Tue Oct 8 11:16:17 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.216 2022/05/31 13:42:59 riastradh Exp $ +# $NetBSD: Makefile.inc,v 1.216.2.1 2024/10/08 11:16:17 martin Exp $ # from: @(#)Makefile.inc 8.6 (Berkeley) 5/4/95 # gen sources @@ -191,9 +191,11 @@ MLINKS+=sysctl.3 sysctlbyname.3 \ MLINKS+=syslog.3 closelog.3 syslog.3 openlog.3 syslog.3 setlogmask.3 \ syslog.3 vsyslog.3 MLINKS+=syslog.3 closelog_r.3 syslog.3 openlog_r.3 syslog.3 setlogmask_r.3 \ - syslog.3 syslog_r.3 syslog.3 vsyslog_r.3 + syslog.3 syslog_r.3 syslog.3 vsyslog_r.3 \ + syslog.3 syslog_ss.3 syslog.3 vsyslog_ss.3 MLINKS+=syslog.3 syslogp.3 syslog.3 syslogp_r.3 \ - syslog.3 vsyslogp.3 syslog.3 vsyslogp_r.3 + syslog.3 vsyslogp.3 syslog.3 vsyslogp_r.3 \ + syslog.3 syslogp_ss.3 syslog.3 vsyslogp_ss.3 MLINKS+=ttyname.3 isatty.3 ttyname.3 ttyslot.3 ttyname.3 ttyname_r.3 MLINKS+=unvis.3 strunvis.3 unvis.3 strunvisx.3 MLINKS+=unvis.3 strnunvis.3 unvis.3 strnunvisx.3 Index: src/lib/libc/gen/syslog.3 diff -u src/lib/libc/gen/syslog.3:1.33 src/lib/libc/gen/syslog.3:1.33.16.1 --- src/lib/libc/gen/syslog.3:1.33 Mon Jul 3 21:32:49 2017 +++ src/lib/libc/gen/syslog.3 Tue Oct 8 11:16:17 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: syslog.3,v 1.33 2017/07/03 21:32:49 wiz Exp $ +.\" $NetBSD: syslog.3,v 1.33.16.1 2024/10/08 11:16:17 martin Exp $ .\" $OpenBSD: syslog.3,v 1.25 2005/07/22 03:16:58 jaredy Exp $ .\" .\" Copyright (c) 1985, 1991, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)syslog.3 8.1 (Berkeley) 6/4/93 .\" -.Dd March 22, 2017 +.Dd July 2, 2024 .Dt SYSLOG 3 .Os .Sh NAME @@ -40,8 +40,12 @@ .Nm vsyslog_r , .Nm syslogp , .Nm syslogp_r , +.Nm syslog_ss , +.Nm syslogp_ss , .Nm vsyslogp , .Nm vsyslogp_r , +.Nm vsyslog_ss , +.Nm vsyslogp_ss , .Nm openlog , .Nm openlog_r , .Nm closelog , @@ -61,8 +65,10 @@ .Fn syslogp "int priority" "const char *msgid" "const char *sdfmt" "const char *message" "..." .Ft void .Fn syslogp_r "int priority" "struct syslog_data *data" "const char *msgid" "const char *sdfmt" "const char *message" "..." -.\" .Ft void -.\" .Fn syslog_ss "int priority" "struct syslog_data *data" "const char *message" "..." +.Ft void +.Fn syslog_ss "int priority" "struct syslog_data *data" "const char *message" "..." +.Ft void +.Fn syslogp_ss "int priority" "struct syslog_data *data" "const char *msgid" "const char *sdfmt" "const char *message" "..." .Ft void .Fn openlog "const char *ident" "int logopt" "int facility" .Ft void @@ -84,8 +90,10 @@ .Fn vsyslogp "int priority" "const char *msgid" "const char *sdfmt" "const char *message" "va_list args" .Ft void .Fn vsyslogp_r "int priority" "struct syslog_data *data" "const char *msgid" "const char *sdfmt" "const char *message" "va_list args" -.\" .Ft void -.\" .Fn vsyslog_ss "int priority" "struct syslog_data *data" "const char *message" "va_list args" +.Ft void +.Fn vsyslog_ss "int priority" "struct syslog_data *data" "const char *message" "va_list args" +.Ft void +.Fn vsyslogp_ss "int priority" "struct syslog_data *data" "const char *msgid" "const char *sdfmt" "const char *message" "va_list args" .Sh DESCRIPTION The .Fn syslog @@ -170,29 +178,46 @@ facility code .It Va log_mask mask of priorities to be logged .El -.\" .Pp -.\" The -.\" .Fn syslog_ss -.\" is the async-signal-safe version of -.\" .Fn syslog_r -.\" and is also multithread-safe. -.\" It has the following limitations: -.\" .Bl -enum -offset indent -.\" .It -.\" The format string cannot contain multi-byte character sequences. -.\" .It -.\" Floating point formats are not supported and print -.\" .Dq UNK . -.\" .It -.\" The time of the event is not sent to -.\" .Xr syslogd 8 . -.\" .It -.\" The error string in the %m format is not printed symbolically but as -.\" .Dq Error %d . -.\" .El -.\" .Pp -.\" For more information about async-signal-safe functions and signal handlers, see -.\" .Xr signal 7 . +.Pp +The +.Fn syslog_ss +is the async-signal-safe version of +.Fn syslog_r +and is also multithread-safe. +It has the following limitations: +.Bl -enum -offset indent +.It +The format string cannot contain multi-byte character sequences. +.It +Positional +.Xr printf 3 +arguments are not supported. +.It +Floating point formats are not supported and print +.Dq UNK . +.It +The time of the event is not sent to +.Xr syslogd 8 . +.It +The error string in the %m format is not printed symbolically but as +.Dq Error %d . +.El +.Pp +For more information about async-signal-safe functions and signal handlers, see +.Xr signal 7 . +.Pp +Similarly +.Fn vsyslog_ss +is the async-signal-safe version of +.Fn vsyslog_r . +Same for +.Fn syslogp_ss +and +.Fn syslogp_r , +and finally +.Fn vsyslogp_ss +and +.Fn vsyslogp_r . .Pp The .Fn vsyslog Index: src/lib/libc/gen/syslog_ss.c diff -u src/lib/libc/gen/syslog_ss.c:1.3 src/lib/libc/gen/syslog_ss.c:1.3.26.1 --- src/lib/libc/gen/syslog_ss.c:1.3 Sun Jan 15 16:41:39 2017 +++ src/lib/libc/gen/syslog_ss.c Tue Oct 8 11:16:17 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: syslog_ss.c,v 1.3 2017/01/15 16:41:39 christos Exp $ */ +/* $NetBSD: syslog_ss.c,v 1.3.26.1 2024/10/08 11:16:17 martin Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -30,11 +30,12 @@ */ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: syslog_ss.c,v 1.3 2017/01/15 16:41:39 christos Exp $"); +__RCSID("$NetBSD: syslog_ss.c,v 1.3.26.1 2024/10/08 11:16:17 martin Exp $"); #endif /* LIBC_SCCS and not lint */ #include "namespace.h" #include <stdio.h> +#include <sys/syslog.h> #include "extern.h" #include "syslog_private.h" Index: src/lib/libc/include/extern.h diff -u src/lib/libc/include/extern.h:1.26.6.1 src/lib/libc/include/extern.h:1.26.6.2 --- src/lib/libc/include/extern.h:1.26.6.1 Mon Apr 17 18:22:20 2023 +++ src/lib/libc/include/extern.h Tue Oct 8 11:16:16 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.26.6.1 2023/04/17 18:22:20 martin Exp $ */ +/* $NetBSD: extern.h,v 1.26.6.2 2024/10/08 11:16:16 martin Exp $ */ /* * Copyright (c) 1997 Christos Zoulas. All rights reserved. @@ -61,18 +61,6 @@ char *__ldtoa(long double *, int, int, i #endif char *__hdtoa(double, const char *, int, int *, int *, char **); -#ifndef __LIBC12_SOURCE__ -struct syslog_data; -void syslog_ss(int, struct syslog_data *, const char *, ...) - __RENAME(__syslog_ss60) __printflike(3, 4); -void vsyslog_ss(int, struct syslog_data *, const char *, va_list) - __RENAME(__vsyslog_ss60) __printflike(3, 0); -void syslogp_ss(int, struct syslog_data *, const char *, const char *, - const char *, ...) __RENAME(__syslogp_ss60) __printflike(5, 0); -void vsyslogp_ss(int, struct syslog_data *, const char *, const char *, - const char *, va_list) __RENAME(__vsyslogp_ss60) __printflike(5, 0); -#endif - void _malloc_prefork(void); void _malloc_postfork(void); void _malloc_postfork_child(void); Index: src/sys/sys/syslog.h diff -u src/sys/sys/syslog.h:1.41 src/sys/sys/syslog.h:1.41.44.1 --- src/sys/sys/syslog.h:1.41 Wed Mar 22 17:52:36 2017 +++ src/sys/sys/syslog.h Tue Oct 8 11:16:17 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: syslog.h,v 1.41 2017/03/22 17:52:36 roy Exp $ */ +/* $NetBSD: syslog.h,v 1.41.44.1 2024/10/08 11:16:17 martin Exp $ */ /* * Copyright (c) 1982, 1986, 1988, 1993 @@ -37,6 +37,7 @@ #include <sys/cdefs.h> #include <sys/featuretest.h> #include <sys/ansi.h> +#include <sys/stdarg.h> #define _PATH_LOG "/var/run/log" @@ -219,6 +220,14 @@ void syslogp_r(int, struct syslog_data * const char *, ...) __RENAME(__syslogp_r60) __sysloglike(5, 6); void vsyslogp_r(int, struct syslog_data *, const char *, const char *, const char *, __va_list) __RENAME(__vsyslogp_r60) __sysloglike(5, 0); +void syslog_ss(int, struct syslog_data *, const char *, ...) + __RENAME(__syslog_ss60) __sysloglike(3, 4); +void vsyslog_ss(int, struct syslog_data *, const char *, va_list) + __RENAME(__vsyslog_ss60) __sysloglike(3, 0); +void syslogp_ss(int, struct syslog_data *, const char *, const char *, + const char *, ...) __RENAME(__syslogp_ss60) __sysloglike(5, 0); +void vsyslogp_ss(int, struct syslog_data *, const char *, const char *, + const char *, va_list) __RENAME(__vsyslogp_ss60) __sysloglike(5, 0); #endif void syslogp(int, const char *, const char *, const char *, ...) __sysloglike(4, 5);