diff --git a/bin/md5/cksum.1 b/bin/md5/cksum.1 index fa11401da..75fc56cb2 100644 --- a/bin/md5/cksum.1 +++ b/bin/md5/cksum.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cksum.1,v 1.40 2022/08/04 06:20:24 jsg Exp $ +.\" $OpenBSD: cksum.1,v 1.41 2023/08/18 14:10:33 kn Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\" .\" @(#)cksum.1 8.2 (Berkeley) 4/28/95 .\" -.Dd $Mdocdate: August 4 2022 $ +.Dd $Mdocdate: August 18 2023 $ .Dt CKSUM 1 .Os .Sh NAME @@ -131,7 +131,7 @@ Place the checksum into .Ar hashfile instead of stdout. .It Fl p -Echoes stdin to stdout and appends the +Echo stdin to stdout and append the checksum to stdout. .It Fl q Only print the checksum (quiet mode) or if used in conjunction with the @@ -141,16 +141,16 @@ flag, only print the failed cases. Reverse the format of the hash algorithm output, making it match the checksum output format. .It Fl s Ar string -Prints a checksum of the given +Print a checksum of the given .Ar string . .It Fl t -Runs a built-in time trial. +Run a built-in time trial. Specifying .Fl t multiple times results in the number of rounds being multiplied by 10 for each additional flag. .It Fl x -Runs a built-in test script. +Run a built-in test script. .El .Pp The default CRC used is based on the polynomial used for CRC error checking diff --git a/bin/md5/md5.1 b/bin/md5/md5.1 index fa860eb97..e92828c96 100644 --- a/bin/md5/md5.1 +++ b/bin/md5/md5.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: md5.1,v 1.48 2019/01/25 00:19:25 millert Exp $ +.\" $OpenBSD: md5.1,v 1.49 2023/08/18 14:10:33 kn Exp $ .\" .\" Copyright (c) 2003, 2004, 2006 Todd C. Miller .\" @@ -18,7 +18,7 @@ .\" Agency (DARPA) and Air Force Research Laboratory, Air Force .\" Materiel Command, USAF, under agreement number F39502-99-1-0512. .\" -.Dd $Mdocdate: January 25 2019 $ +.Dd $Mdocdate: August 18 2023 $ .Dt MD5 1 .Os .Sh NAME @@ -89,7 +89,7 @@ Place the checksum into .Ar hashfile instead of stdout. .It Fl p -Echoes stdin to stdout and appends the +Echo stdin to stdout and append the checksum to stdout. .It Fl q Only print the checksum (quiet mode) or if used in conjunction with the @@ -100,16 +100,16 @@ Reverse the format of the hash algorithm output, making it match the output format used by .Xr cksum 1 . .It Fl s Ar string -Prints a checksum of the given +Print a checksum of the given .Ar string . .It Fl t -Runs a built-in time trial. +Run a built-in time trial. Specifying .Fl t multiple times results in the number of rounds being multiplied by 10 for each additional flag. .It Fl x -Runs a built-in test script. +Run a built-in test script. .El .Sh EXIT STATUS These utilities exit 0 on success, diff --git a/etc/examples/radiusd.conf b/etc/examples/radiusd.conf index 47f4064c7..62e0e7f37 100644 --- a/etc/examples/radiusd.conf +++ b/etc/examples/radiusd.conf @@ -1,18 +1,20 @@ -# $OpenBSD: radiusd.conf,v 1.2 2019/04/01 09:40:16 yasuoka Exp $ +# $OpenBSD: radiusd.conf,v 1.3 2023/08/18 06:45:15 yasuoka Exp $ listen on 0.0.0.0 #listen on :: client 127.0.0.1/32 { secret "secret" + # "msgauth-required no" to disable message authentication check for + # some implementations (e.g. login_radius(8)) don't support msgauth + msgauth-required no } client 192.168.0.0/24 { secret "secret" - msgauth-required yes } module load "bsdauth" "/usr/libexec/radiusd/radiusd_bsdauth" -module set "bsdauth" "restrict-group" "operator" +#module set "bsdauth" "restrict-group" "users" module load "radius" "/usr/libexec/radiusd/radiusd_radius" module set "radius" "secret" "testing123" diff --git a/gnu/usr.bin/binutils-2.17/Makefile.def b/gnu/usr.bin/binutils-2.17/Makefile.def index 4c58ab5a7..dfc957877 100644 --- a/gnu/usr.bin/binutils-2.17/Makefile.def +++ b/gnu/usr.bin/binutils-2.17/Makefile.def @@ -10,12 +10,12 @@ AutoGen definitions Makefile.tpl; // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -59,7 +59,7 @@ host_modules= { module= fixincludes; missing= installcheck; }; host_modules= { module= flex; no_check_cross= true; }; host_modules= { module= gas; bootstrap=true; }; -host_modules= { module= gcc; bootstrap=true; +host_modules= { module= gcc; bootstrap=true; target="`if [ -f stage_last ]; then echo quickstrap ; else echo all; fi`"; extra_make_flags="$(EXTRA_GCC_FLAGS)"; }; host_modules= { module= gawk; }; @@ -106,7 +106,7 @@ host_modules= { module= gdb; extra_make_flags="$(X11_FLAGS_TO_PASS)"; }; host_modules= { module= expect; extra_make_flags="$(X11_FLAGS_TO_PASS)"; }; host_modules= { module= guile; extra_make_flags="$(X11_FLAGS_TO_PASS)"; }; host_modules= { module= tk; extra_make_flags="$(X11_FLAGS_TO_PASS)"; }; -host_modules= { module= libtermcap; no_check=true; +host_modules= { module= libtermcap; no_check=true; missing=mostlyclean; missing=clean; missing=distclean; @@ -144,21 +144,21 @@ target_modules = { module= libgomp; lib_path=.libs; }; // Not all; these are the ones which don't have special options. // "depend" indicates that a target depends on another target uniformly // for each subdirectory. There can be several such lines per target. -recursive_targets = { make_target= info; +recursive_targets = { make_target= info; depend=configure; }; -recursive_targets = { make_target= dvi; +recursive_targets = { make_target= dvi; depend=configure; }; -recursive_targets = { make_target= html; +recursive_targets = { make_target= html; depend=configure; }; -recursive_targets = { make_target= TAGS; +recursive_targets = { make_target= TAGS; depend=configure; }; -recursive_targets = { make_target= install-info; +recursive_targets = { make_target= install-info; depend=configure; depend=info; }; -recursive_targets = { make_target= install-html; +recursive_targets = { make_target= install-html; depend=configure; depend=html; }; -recursive_targets = { make_target= installcheck; +recursive_targets = { make_target= installcheck; depend=configure; }; recursive_targets = { make_target= mostlyclean; }; recursive_targets = { make_target= clean; }; diff --git a/gnu/usr.bin/cc/libgcc/Makefile b/gnu/usr.bin/cc/libgcc/Makefile index d83f6ac80..9eec01dc2 100644 --- a/gnu/usr.bin/cc/libgcc/Makefile +++ b/gnu/usr.bin/cc/libgcc/Makefile @@ -129,7 +129,7 @@ LIB1ASMFUNCS+= _cmpsf2 _fixunssfsi _negsf2 LIB1ASMFUNCS+= _cmpdf2 _fixunsdfsi _negdf2 LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c LIB2ADDEH = unwind-arm.c libunwind.S pr-support.c unwind-c.c -SWFLOATFUNCS = +SWFLOATFUNCS = DWFLOATFUNCS = _floatundisf _floatundidf # Not now diff --git a/lib/libcrypto/objects/obj_dat.c b/lib/libcrypto/objects/obj_dat.c index ff0617745..9c4c3179f 100644 --- a/lib/libcrypto/objects/obj_dat.c +++ b/lib/libcrypto/objects/obj_dat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_dat.c,v 1.54 2023/07/08 12:27:51 beck Exp $ */ +/* $OpenBSD: obj_dat.c,v 1.60 2023/08/17 09:28:43 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -166,7 +166,6 @@ added_obj_hash(const ADDED_OBJ *ca) ret = a->nid; break; default: - /* abort(); */ return 0; } ret &= 0x3fffffffL; @@ -178,38 +177,32 @@ static IMPLEMENT_LHASH_HASH_FN(added_obj, ADDED_OBJ) static int added_obj_cmp(const ADDED_OBJ *ca, const ADDED_OBJ *cb) { - ASN1_OBJECT *a, *b; - int i; + const ASN1_OBJECT *a, *b; + int cmp; + + if ((cmp = ca->type - cb->type) != 0) + return cmp; - i = ca->type - cb->type; - if (i) - return (i); a = ca->obj; b = cb->obj; switch (ca->type) { case ADDED_DATA: - i = (a->length - b->length); - if (i) - return (i); - return (memcmp(a->data, b->data, (size_t)a->length)); + return OBJ_cmp(a, b); case ADDED_SNAME: if (a->sn == NULL) - return (-1); - else if (b->sn == NULL) - return (1); - else - return (strcmp(a->sn, b->sn)); + return -1; + if (b->sn == NULL) + return 1; + return strcmp(a->sn, b->sn); case ADDED_LNAME: if (a->ln == NULL) - return (-1); - else if (b->ln == NULL) - return (1); - else - return (strcmp(a->ln, b->ln)); + return -1; + if (b->ln == NULL) + return 1; + return strcmp(a->ln, b->ln); case ADDED_NID: - return (a->nid - b->nid); + return a->nid - b->nid; default: - /* abort(); */ return 0; } } @@ -432,17 +425,12 @@ LCRYPTO_ALIAS(OBJ_nid2ln); static int obj_cmp(const ASN1_OBJECT * const *ap, const unsigned int *bp) { - int j; - const ASN1_OBJECT *a= *ap; + const ASN1_OBJECT *a = *ap; const ASN1_OBJECT *b = &nid_objs[*bp]; - j = (a->length - b->length); - if (j) - return (j); - return (memcmp(a->data, b->data, a->length)); + return OBJ_cmp(a, b); } - static int obj_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) { diff --git a/lib/libcrypto/objects/obj_lib.c b/lib/libcrypto/objects/obj_lib.c index 83575c16c..45062dbd4 100644 --- a/lib/libcrypto/objects/obj_lib.c +++ b/lib/libcrypto/objects/obj_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: obj_lib.c,v 1.18 2023/07/08 12:27:51 beck Exp $ */ +/* $OpenBSD: obj_lib.c,v 1.19 2023/08/17 09:13:01 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -124,11 +124,12 @@ LCRYPTO_ALIAS(OBJ_dup); int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b) { - int ret; + int cmp; - ret = (a->length - b->length); - if (ret) - return (ret); - return (memcmp(a->data, b->data, a->length)); + if ((cmp = a->length - b->length) != 0) + return cmp; + if (a->length == 0) + return 0; + return memcmp(a->data, b->data, a->length); } LCRYPTO_ALIAS(OBJ_cmp); diff --git a/lib/libcrypto/x509/x509_purp.c b/lib/libcrypto/x509/x509_purp.c index f2c4f1dd5..0c92dfb19 100644 --- a/lib/libcrypto/x509/x509_purp.c +++ b/lib/libcrypto/x509/x509_purp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_purp.c,v 1.28 2023/07/02 17:12:17 tb Exp $ */ +/* $OpenBSD: x509_purp.c,v 1.29 2023/08/18 08:42:41 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2001. */ @@ -550,7 +550,8 @@ x509v3_cache_extensions_internal(X509 *x) if (x->ex_flags & EXFLAG_SET) return; - X509_digest(x, X509_CERT_HASH_EVP, x->hash, NULL); + if (!X509_digest(x, X509_CERT_HASH_EVP, x->hash, NULL)) + x->ex_flags |= EXFLAG_INVALID; version = X509_get_version(x); if (version < 0 || version > 2) diff --git a/lib/libz/compress.3 b/lib/libz/compress.3 index 7650a945e..eb25a9dc8 100644 --- a/lib/libz/compress.3 +++ b/lib/libz/compress.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: compress.3,v 1.24 2023/07/30 16:43:28 tb Exp $ +.\" $OpenBSD: compress.3,v 1.25 2023/08/18 06:08:19 tb Exp $ .\" .\" Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler .\" @@ -23,7 +23,7 @@ .\" .\" This page corresponds to zlib version 1.2.3 .\" -.Dd $Mdocdate: July 30 2023 $ +.Dd $Mdocdate: August 18 2023 $ .Dt COMPRESS 3 .Os .Sh NAME @@ -551,8 +551,10 @@ or a .Dv Z_SYNC_FLUSH , make sure that .Fa avail_out -is greater than six to avoid repeated flush markers due to avail_out == 0 -on return. +is greater than six when the flush marker begins, +in order to avoid repeated flush markers upon calling +.Fn deflate +again when avail_out == 0. .Pp If the parameter .Fa flush diff --git a/lib/libz/zlib.h b/lib/libz/zlib.h index 929eb0f85..13d835738 100644 --- a/lib/libz/zlib.h +++ b/lib/libz/zlib.h @@ -320,8 +320,8 @@ ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush); with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. + avail_out is greater than six when the flush marker begins, in order to avoid + repeated flush markers upon calling deflate() again when avail_out == 0. If the parameter flush is set to Z_FINISH, pending input is processed, pending output is flushed and deflate returns with Z_STREAM_END if there was diff --git a/sbin/bioctl/bioctl.8 b/sbin/bioctl/bioctl.8 index d6617b145..e8c6bcbce 100644 --- a/sbin/bioctl/bioctl.8 +++ b/sbin/bioctl/bioctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bioctl.8,v 1.111 2023/07/06 21:08:50 kn Exp $ +.\" $OpenBSD: bioctl.8,v 1.112 2023/08/18 14:09:19 kn Exp $ .\" .\" Copyright (c) 2004, 2005 Marco Peereboom .\" @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: July 6 2023 $ +.Dd $Mdocdate: August 18 2023 $ .Dt BIOCTL 8 .Os .Sh NAME @@ -288,7 +288,7 @@ is specified as "auto", the number of rounds will be automatically determined based on system performance. Otherwise the minimum is 4 rounds and the default is 16. .It Fl s -Read the passphrase for the selected crypto volume from +Omit prompts and read passphrases without confirmation from .Pa /dev/stdin rather than .Pa /dev/tty . diff --git a/sbin/bioctl/bioctl.c b/sbin/bioctl/bioctl.c index d8b901c13..644cddee2 100644 --- a/sbin/bioctl/bioctl.c +++ b/sbin/bioctl/bioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bioctl.c,v 1.151 2022/10/18 07:04:20 kn Exp $ */ +/* $OpenBSD: bioctl.c,v 1.152 2023/08/18 14:09:19 kn Exp $ */ /* * Copyright (c) 2004, 2005 Marco Peereboom @@ -94,7 +94,7 @@ char *password; void *bio_cookie; -int rpp_flag = RPP_REQUIRE_TTY; +int interactive = 1; int main(int argc, char *argv[]) @@ -200,7 +200,7 @@ main(int argc, char *argv[]) al_arg = optarg; break; case 's': - rpp_flag = RPP_STDIN; + interactive = 0; break; case 't': /* patrol */ func |= BIOC_PATROL; @@ -989,7 +989,7 @@ bio_kdf_generate(struct sr_crypto_kdfinfo *kdfinfo) derive_key(kdfinfo->pbkdf.generic.type, kdfinfo->pbkdf.rounds, kdfinfo->maskkey, sizeof(kdfinfo->maskkey), kdfinfo->pbkdf.salt, sizeof(kdfinfo->pbkdf.salt), - "New passphrase: ", 1); + "New passphrase: ", interactive); } int @@ -1316,6 +1316,7 @@ derive_key(u_int32_t type, int rounds, u_int8_t *key, size_t keysz, size_t pl; struct stat sb; char passphrase[1024], verifybuf[1024]; + int rpp_flag = RPP_ECHO_OFF; if (!key) errx(1, "Invalid key"); @@ -1351,6 +1352,8 @@ derive_key(u_int32_t type, int rounds, u_int8_t *key, size_t keysz, fclose(f); } else { + rpp_flag |= interactive ? RPP_REQUIRE_TTY : RPP_STDIN; + if (readpassphrase(prompt, passphrase, sizeof(passphrase), rpp_flag) == NULL) err(1, "unable to read passphrase"); diff --git a/share/man/man5/cargo-module.5 b/share/man/man5/cargo-module.5 index 3538714b0..c01507406 100644 --- a/share/man/man5/cargo-module.5 +++ b/share/man/man5/cargo-module.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cargo-module.5,v 1.5 2023/08/17 05:43:09 tb Exp $ +.\" $OpenBSD: cargo-module.5,v 1.7 2023/08/18 08:22:29 tb Exp $ .\" .\" Copyright (c) 2008 Marc Espie .\" Copyright (c) 2017 Daniel Jakots @@ -25,7 +25,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: August 17 2023 $ +.Dd $Mdocdate: August 18 2023 $ .Dt CARGO-MODULE 5 .Os .Sh NAME @@ -86,26 +86,35 @@ is used to download the crates. .Pp This module defines: .Bl -tag -width MODCARGO_INSTALL_TARGET_PATH -.It MODCARGO_CARGOTOML +.It Ev MODCARGO_CARGOTOML Path to cargo manifest. Defaults to .Pa ${WRKSRC}/Cargo.toml . -.It MODCARGO_CRATES +.It Ev MODCARGO_CRATES Crates that will be downloaded by the module. -.It MODCARGO_CRATES_UPDATE +.It Ev MODCARGO_CRATES_UPDATE List of crates to update, overriding the version listed in Cargo.lock. -.It MODCARGO_FEATURES +.It Ev MODCARGO_FEATURES List of features to be used when building. -.It MODCARGO_INSTALL_TARGET_PATH +.It Ev MODCARGO_INSTALL_TARGET_PATH Path to pass to .Cm cargo install instead of .Pa \&. . Needs to be set for some virtual manifests. -.It MODCARGO_VENDOR_DIR +.It Ev MODCARGO_VENDOR_DIR Name of the local directory for vendoring crates. Defaults to .Pa ${WRKSRC}/modcargo-crates . +.It Ev MODCARGO_WANTLIB +Architecture-specific +.Ev WANTLIB +entries required by all Rust code. +Should be used instead of explicit entries for +.Dq c , +.Dq pthread , +and +.Dq c++abi . .El .Pp This module adds three diff --git a/share/man/man5/port-modules.5 b/share/man/man5/port-modules.5 index 6d62a5e47..5fbb2c185 100644 --- a/share/man/man5/port-modules.5 +++ b/share/man/man5/port-modules.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: port-modules.5,v 1.264 2023/05/09 19:44:06 jmc Exp $ +.\" $OpenBSD: port-modules.5,v 1.265 2023/08/17 10:51:54 sthen Exp $ .\" .\" Copyright (c) 2008 Marc Espie .\" @@ -24,7 +24,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: May 9 2023 $ +.Dd $Mdocdate: August 17 2023 $ .Dt PORT-MODULES 5 .Os .Sh NAME @@ -789,7 +789,7 @@ target (if not already defined). It heeds .Ev NO_BUILD . .It lang/clang -Similar to gcc3 and gcc4 modules. +Similar to gcc4 module. If architecture is in MODCLANG_ARCHS, the Clang compilers will be put at the front of the path. By default, only C language support is included by this module. diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c index ae38ac60a..e06aa801d 100644 --- a/sys/kern/sched_bsd.c +++ b/sys/kern/sched_bsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sched_bsd.c,v 1.81 2023/08/14 08:33:24 mpi Exp $ */ +/* $OpenBSD: sched_bsd.c,v 1.82 2023/08/18 09:18:52 claudio Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /*- @@ -61,9 +61,24 @@ int lbolt; /* once a second sleep address */ struct __mp_lock sched_lock; #endif +void update_loadavg(void *); void schedcpu(void *); uint32_t decay_aftersleep(uint32_t, uint32_t); +extern struct cpuset sched_idle_cpus; + +/* + * constants for averages over 1, 5, and 15 minutes when sampling at + * 5 second intervals. + */ +static const fixpt_t cexp[3] = { + 0.9200444146293232 * FSCALE, /* exp(-1/12) */ + 0.9834714538216174 * FSCALE, /* exp(-1/60) */ + 0.9944598480048967 * FSCALE, /* exp(-1/180) */ +}; + +struct loadavg averunnable; + /* * Force switch among equal priority processes every 100ms. */ @@ -95,6 +110,34 @@ roundrobin(struct clockintr *cl, void *cf) need_resched(ci); } + + +/* + * update_loadav: compute a tenex style load average of a quantity on + * 1, 5, and 15 minute intervals. + */ +void +update_loadavg(void *arg) +{ + struct timeout *to = (struct timeout *)arg; + CPU_INFO_ITERATOR cii; + struct cpu_info *ci; + u_int i, nrun = 0; + + CPU_INFO_FOREACH(cii, ci) { + if (!cpuset_isset(&sched_idle_cpus, ci)) + nrun++; + nrun += ci->ci_schedstate.spc_nrun; + } + + for (i = 0; i < 3; i++) { + averunnable.ldavg[i] = (cexp[i] * averunnable.ldavg[i] + + nrun * FSCALE * (FSCALE - cexp[i])) >> FSHIFT; + } + + timeout_add_sec(to, 5); +} + /* * Constants for digital decay and forget: * 90% of (p_estcpu) usage in 5 * loadav time @@ -236,7 +279,6 @@ schedcpu(void *arg) } SCHED_UNLOCK(s); } - uvm_meter(); wakeup(&lbolt); timeout_add_sec(to, 1); } @@ -691,6 +733,7 @@ void scheduler_start(void) { static struct timeout schedcpu_to; + static struct timeout loadavg_to; /* * We avoid polluting the global namespace by keeping the scheduler @@ -699,7 +742,10 @@ scheduler_start(void) * its job. */ timeout_set(&schedcpu_to, schedcpu, &schedcpu_to); + timeout_set(&loadavg_to, update_loadavg, &loadavg_to); + schedcpu(&schedcpu_to); + update_loadavg(&loadavg_to); #ifndef SMALL_KERNEL if (perfpolicy == PERFPOL_AUTO) diff --git a/sys/lib/libz/zlib.h b/sys/lib/libz/zlib.h index f836fec89..d8b290096 100644 --- a/sys/lib/libz/zlib.h +++ b/sys/lib/libz/zlib.h @@ -320,8 +320,8 @@ ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush); with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. + avail_out is greater than six when the flush marker begins, in order to avoid + repeated flush markers upon calling deflate() again when avail_out == 0. If the parameter flush is set to Z_FINISH, pending input is processed, pending output is flushed and deflate returns with Z_STREAM_END if there was diff --git a/sys/net/if.c b/sys/net/if.c index 8dc61bfcd..48ec3bb47 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.706 2023/07/07 19:45:26 bluhm Exp $ */ +/* $OpenBSD: if.c,v 1.707 2023/08/18 08:10:16 jsg Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -910,7 +910,7 @@ if_output_tso(struct ifnet *ifp, struct mbuf **mp, struct sockaddr *dst, /* * Try to send with TSO first. When forwarding LRO may set - * maximium segment size in mbuf header. Chop TCP segment + * maximum segment size in mbuf header. Chop TCP segment * even if it would fit interface MTU to preserve maximum * path MTU. */ diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c index 1d1ed200f..6d7f29f45 100644 --- a/sys/net/if_pfsync.c +++ b/sys/net/if_pfsync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pfsync.c,v 1.319 2023/07/31 11:13:09 dlg Exp $ */ +/* $OpenBSD: if_pfsync.c,v 1.320 2023/08/18 08:03:57 jsg Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff @@ -1528,7 +1528,7 @@ pfsync_sendout(struct pfsync_softc *sc, struct mbuf *m) { struct ip_moptions imo; unsigned int len = m->m_pkthdr.len; -#if NBPF > 0 +#if NBPFILTER > 0 caddr_t if_bpf = sc->sc_if.if_bpf; if (if_bpf) bpf_mtap(if_bpf, m, BPF_DIRECTION_OUT); @@ -2628,9 +2628,6 @@ pfsync_input(struct mbuf *m, uint8_t ttl, unsigned int hlen) unsigned int len; void (*in)(struct pfsync_softc *, const caddr_t, unsigned int, unsigned int); -#if NBPF > 0 - caddr_t if_bpf; -#endif pfsyncstat_inc(pfsyncs_ipackets); @@ -2650,9 +2647,6 @@ pfsync_input(struct mbuf *m, uint8_t ttl, unsigned int hlen) goto leave; } -#if NBPF > 0 -#endif - /* verify that the IP TTL is 255. */ if (ttl != PFSYNC_DFLTTL) { pfsyncstat_inc(pfsyncs_badttl); diff --git a/sys/net/wg_cookie.c b/sys/net/wg_cookie.c index 47eb37874..a34a3a37e 100644 --- a/sys/net/wg_cookie.c +++ b/sys/net/wg_cookie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wg_cookie.c,v 1.4 2022/03/17 18:51:56 tb Exp $ */ +/* $OpenBSD: wg_cookie.c,v 1.5 2023/08/18 08:11:47 jsg Exp $ */ /* * Copyright (C) 2015-2020 Jason A. Donenfeld . All Rights Reserved. * Copyright (C) 2019-2020 Matt Dunwoodie @@ -385,7 +385,7 @@ ratelimit_allow(struct ratelimit *rl, struct sockaddr *sa) * lapsed since our last_time, adding that, ensuring that we * cap the tokens at TOKEN_MAX. If the endpoint has no tokens * left (that is tokens <= INITIATION_COST) then we block the - * request, otherwise we subtract the INITITIATION_COST and + * request, otherwise we subtract the INITIATION_COST and * return OK. */ diff = r->r_last_time; getnanouptime(&r->r_last_time); diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h index 42e5ed806..60f3e1e01 100644 --- a/sys/uvm/uvm_extern.h +++ b/sys/uvm/uvm_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_extern.h,v 1.170 2023/06/21 21:16:21 cheloha Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.171 2023/08/18 09:18:52 claudio Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* @@ -414,7 +414,6 @@ void uvmspace_free(struct vmspace *); struct vmspace *uvmspace_share(struct process *); int uvm_share(vm_map_t, vaddr_t, vm_prot_t, vm_map_t, vaddr_t, vsize_t); -void uvm_meter(void); int uvm_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *); struct vm_page *uvm_pagealloc(struct uvm_object *, diff --git a/sys/uvm/uvm_meter.c b/sys/uvm/uvm_meter.c index e0c5d41ae..25bc9126d 100644 --- a/sys/uvm/uvm_meter.c +++ b/sys/uvm/uvm_meter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_meter.c,v 1.48 2023/08/03 16:12:08 claudio Exp $ */ +/* $OpenBSD: uvm_meter.c,v 1.49 2023/08/18 09:18:52 claudio Exp $ */ /* $NetBSD: uvm_meter.c,v 1.21 2001/07/14 06:36:03 matt Exp $ */ /* @@ -63,58 +63,12 @@ #define MAXSLP 20 int maxslp = MAXSLP; /* patchable ... */ -struct loadavg averunnable; -/* - * constants for averages over 1, 5, and 15 minutes when sampling at - * 5 second intervals. - */ +extern struct loadavg averunnable; -static const fixpt_t cexp[3] = { - 0.9200444146293232 * FSCALE, /* exp(-1/12) */ - 0.9834714538216174 * FSCALE, /* exp(-1/60) */ - 0.9944598480048967 * FSCALE, /* exp(-1/180) */ -}; - - -static void uvm_loadav(struct loadavg *); void uvm_total(struct vmtotal *); void uvmexp_read(struct uvmexp *); -/* - * uvm_meter: calculate load average - */ -void -uvm_meter(void) -{ - if ((gettime() % 5) == 0) - uvm_loadav(&averunnable); -} - -/* - * uvm_loadav: compute a tenex style load average of a quantity on - * 1, 5, and 15 minute intervals. - */ -static void -uvm_loadav(struct loadavg *avg) -{ - extern struct cpuset sched_idle_cpus; - CPU_INFO_ITERATOR cii; - struct cpu_info *ci; - u_int i, nrun = 0; - - CPU_INFO_FOREACH(cii, ci) { - if (!cpuset_isset(&sched_idle_cpus, ci)) - nrun++; - nrun += ci->ci_schedstate.spc_nrun; - } - - for (i = 0; i < 3; i++) { - avg->ldavg[i] = (cexp[i] * avg->ldavg[i] + - nrun * FSCALE * (FSCALE - cexp[i])) >> FSHIFT; - } -} - char malloc_conf[16]; /* diff --git a/usr.bin/ssh/kex.c b/usr.bin/ssh/kex.c index 3b08e3461..cdd5c2500 100644 --- a/usr.bin/ssh/kex.c +++ b/usr.bin/ssh/kex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kex.c,v 1.178 2023/03/12 10:40:39 dtucker Exp $ */ +/* $OpenBSD: kex.c,v 1.179 2023/08/18 01:37:41 djm Exp $ */ /* * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. * @@ -1317,7 +1317,7 @@ kex_exchange_identification(struct ssh *ssh, int timeout_ms, for (;;) { if (timeout_ms > 0) { r = waitrfd(ssh_packet_get_connection_in(ssh), - &timeout_ms); + &timeout_ms, NULL); if (r == -1 && errno == ETIMEDOUT) { send_error(ssh, "Timed out waiting " "for SSH identification string."); diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c index c49aa6065..52d79e748 100644 --- a/usr.bin/ssh/misc.c +++ b/usr.bin/ssh/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.185 2023/08/04 06:32:40 dtucker Exp $ */ +/* $OpenBSD: misc.c,v 1.186 2023/08/18 01:37:41 djm Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2005-2020 Damien Miller. All rights reserved. @@ -269,20 +269,38 @@ set_sock_tos(int fd, int tos) * Returns 0 if fd ready or -1 on timeout or error (see errno). */ static int -waitfd(int fd, int *timeoutp, short events) +waitfd(int fd, int *timeoutp, short events, volatile sig_atomic_t *stop) { struct pollfd pfd; - struct timeval t_start; - int oerrno, r, have_timeout = (*timeoutp >= 0); + struct timespec timeout; + int oerrno, r; + sigset_t nsigset, osigset; + if (timeoutp && *timeoutp == -1) + timeoutp = NULL; pfd.fd = fd; pfd.events = events; - for (; !have_timeout || *timeoutp >= 0;) { - monotime_tv(&t_start); - r = poll(&pfd, 1, *timeoutp); + ptimeout_init(&timeout); + if (timeoutp != NULL) + ptimeout_deadline_ms(&timeout, *timeoutp); + if (stop != NULL) + sigfillset(&nsigset); + for (; timeoutp == NULL || *timeoutp >= 0;) { + if (stop != NULL) { + sigprocmask(SIG_BLOCK, &nsigset, &osigset); + if (*stop) { + sigprocmask(SIG_SETMASK, &osigset, NULL); + errno = EINTR; + return -1; + } + } + r = ppoll(&pfd, 1, ptimeout_get_tsp(&timeout), + stop != NULL ? &osigset : NULL); oerrno = errno; - if (have_timeout) - ms_subtract_diff(&t_start, timeoutp); + if (stop != NULL) + sigprocmask(SIG_SETMASK, &osigset, NULL); + if (timeoutp) + *timeoutp = ptimeout_get_ms(&timeout); errno = oerrno; if (r > 0) return 0; @@ -302,8 +320,8 @@ waitfd(int fd, int *timeoutp, short events) * Returns 0 if fd ready or -1 on timeout or error (see errno). */ int -waitrfd(int fd, int *timeoutp) { - return waitfd(fd, timeoutp, POLLIN); +waitrfd(int fd, int *timeoutp, volatile sig_atomic_t *stop) { + return waitfd(fd, timeoutp, POLLIN, stop); } /* @@ -337,7 +355,7 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr, break; } - if (waitfd(sockfd, timeoutp, POLLIN | POLLOUT) == -1) + if (waitfd(sockfd, timeoutp, POLLIN | POLLOUT, NULL) == -1) return -1; /* Completed or failed */ diff --git a/usr.bin/ssh/misc.h b/usr.bin/ssh/misc.h index 94082238d..0221ce24e 100644 --- a/usr.bin/ssh/misc.h +++ b/usr.bin/ssh/misc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.h,v 1.103 2023/07/19 14:02:27 djm Exp $ */ +/* $OpenBSD: misc.h,v 1.104 2023/08/18 01:37:41 djm Exp $ */ /* * Author: Tatu Ylonen @@ -19,6 +19,7 @@ #include #include #include +#include /* Data structure for representing a forwarding request. */ struct Forward { @@ -57,7 +58,7 @@ char *get_rdomain(int); int set_rdomain(int, const char *); int get_sock_af(int); void set_sock_tos(int, int); -int waitrfd(int, int *); +int waitrfd(int, int *, volatile sig_atomic_t *); int timeout_connect(int, const struct sockaddr *, socklen_t, int *); int a2port(const char *); int a2tun(const char *, int *); diff --git a/usr.bin/ssh/mux.c b/usr.bin/ssh/mux.c index 20ec1b024..df9be75b3 100644 --- a/usr.bin/ssh/mux.c +++ b/usr.bin/ssh/mux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mux.c,v 1.99 2023/08/04 06:32:40 dtucker Exp $ */ +/* $OpenBSD: mux.c,v 1.100 2023/08/18 01:37:41 djm Exp $ */ /* * Copyright (c) 2002-2008 Damien Miller * @@ -1464,7 +1464,9 @@ mux_client_read(int fd, struct sshbuf *b, size_t need, int timeout_ms) if (len == -1) { switch (errno) { case EAGAIN: - if (waitrfd(fd, &timeout_ms) == -1) + if (waitrfd(fd, &timeout_ms, + &muxclient_terminate) == -1 && + errno != EINTR) return -1; /* timeout */ /* FALLTHROUGH */ case EINTR: diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index bd6a09075..f5c71fbdd 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.174 2022/05/30 12:48:57 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.175 2023/08/17 14:10:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -813,10 +813,14 @@ cmd_mouse_pane(struct mouse_event *m, struct session **sp, if ((wl = cmd_mouse_window(m, sp)) == NULL) return (NULL); - if ((wp = window_pane_find_by_id(m->wp)) == NULL) - return (NULL); - if (!window_has_pane(wl->window, wp)) - return (NULL); + if (m->wp == -1) + wp = wl->window->active; + else { + if ((wp = window_pane_find_by_id(m->wp)) == NULL) + return (NULL); + if (!window_has_pane(wl->window, wp)) + return (NULL); + } if (wlp != NULL) *wlp = wl; diff --git a/usr.bin/tmux/format-draw.c b/usr.bin/tmux/format-draw.c index ba3a01145..f05cdb071 100644 --- a/usr.bin/tmux/format-draw.c +++ b/usr.bin/tmux/format-draw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format-draw.c,v 1.27 2023/08/07 10:04:29 nicm Exp $ */ +/* $OpenBSD: format-draw.c,v 1.28 2023/08/17 14:10:28 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott @@ -33,6 +33,7 @@ struct format_range { enum style_range_type type; u_int argument; + char string[16]; TAILQ_ENTRY(format_range) entry; }; @@ -44,9 +45,18 @@ format_is_type(struct format_range *fr, struct style *sy) { if (fr->type != sy->range_type) return (0); - if (fr->type == STYLE_RANGE_WINDOW && - fr->argument != sy->range_argument) - return (0); + switch (fr->type) { + case STYLE_RANGE_NONE: + case STYLE_RANGE_LEFT: + case STYLE_RANGE_RIGHT: + return (1); + case STYLE_RANGE_PANE: + case STYLE_RANGE_WINDOW: + case STYLE_RANGE_SESSION: + return (fr->argument == sy->range_argument); + case STYLE_RANGE_USER: + return (strcmp(fr->string, sy->range_string) == 0); + } return (1); } @@ -942,6 +952,8 @@ format_draw(struct screen_write_ctx *octx, const struct grid_cell *base, fr->type = sy.range_type; fr->argument = sy.range_argument; + strlcpy(fr->string, sy.range_string, + sizeof fr->string); } } @@ -1013,13 +1025,39 @@ format_draw(struct screen_write_ctx *octx, const struct grid_cell *base, sr = xcalloc(1, sizeof *sr); sr->type = fr->type; sr->argument = fr->argument; + strlcpy(sr->string, fr->string, sizeof sr->string); sr->start = fr->start; sr->end = fr->end; TAILQ_INSERT_TAIL(srs, sr, entry); - log_debug("%s: range %d|%u at %u-%u", __func__, sr->type, - sr->argument, sr->start, sr->end); - + switch (sr->type) { + case STYLE_RANGE_NONE: + break; + case STYLE_RANGE_LEFT: + log_debug("%s: range left at %u-%u", __func__, + sr->start, sr->end); + break; + case STYLE_RANGE_RIGHT: + log_debug("%s: range right at %u-%u", __func__, + sr->start, sr->end); + break; + case STYLE_RANGE_PANE: + log_debug("%s: range pane|%%%u at %u-%u", __func__, + sr->argument, sr->start, sr->end); + break; + case STYLE_RANGE_WINDOW: + log_debug("%s: range window|%u at %u-%u", __func__, + sr->argument, sr->start, sr->end); + break; + case STYLE_RANGE_SESSION: + log_debug("%s: range session|$%u at %u-%u", __func__, + sr->argument, sr->start, sr->end); + break; + case STYLE_RANGE_USER: + log_debug("%s: range user|%u at %u-%u", __func__, + sr->argument, sr->start, sr->end); + break; + } format_free_range(&frs, fr); } diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index ff1293ed2..430bb3565 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.316 2023/07/10 09:24:53 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.317 2023/08/17 14:10:28 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -1191,6 +1191,72 @@ format_cb_mouse_line(struct format_tree *ft) return (format_grid_line(gd, gd->hsize + y)); } +/* Callback for mouse_status_line. */ +static void * +format_cb_mouse_status_line(struct format_tree *ft) +{ + char *value; + u_int y; + + if (!ft->m.valid) + return (NULL); + if (ft->c == NULL || (~ft->c->tty.flags & TTY_STARTED)) + return (NULL); + + if (ft->m.statusat == 0 && ft->m.y < ft->m.statuslines) { + y = ft->m.y; + } else if (ft->m.statusat > 0 && ft->m.y >= (u_int)ft->m.statusat) { + y = ft->m.y - ft->m.statusat; + } else + return (NULL); + xasprintf(&value, "%u", y); + return (value); + +} + +/* Callback for mouse_status_range. */ +static void * +format_cb_mouse_status_range(struct format_tree *ft) +{ + struct style_range *sr; + u_int x, y; + + if (!ft->m.valid) + return (NULL); + if (ft->c == NULL || (~ft->c->tty.flags & TTY_STARTED)) + return (NULL); + + if (ft->m.statusat == 0 && ft->m.y < ft->m.statuslines) { + x = ft->m.x; + y = ft->m.y; + } else if (ft->m.statusat > 0 && ft->m.y >= (u_int)ft->m.statusat) { + x = ft->m.x; + y = ft->m.y - ft->m.statusat; + } else + return (NULL); + + sr = status_get_range(ft->c, x, y); + if (sr == NULL) + return (NULL); + switch (sr->type) { + case STYLE_RANGE_NONE: + return (NULL); + case STYLE_RANGE_LEFT: + return (xstrdup("left")); + case STYLE_RANGE_RIGHT: + return (xstrdup("right")); + case STYLE_RANGE_PANE: + return (xstrdup("pane")); + case STYLE_RANGE_WINDOW: + return (xstrdup("window")); + case STYLE_RANGE_SESSION: + return (xstrdup("session")); + case STYLE_RANGE_USER: + return (xstrdup(sr->string)); + } + return (NULL); +} + /* Callback for alternate_on. */ static void * format_cb_alternate_on(struct format_tree *ft) @@ -2848,6 +2914,12 @@ static const struct format_table_entry format_table[] = { { "mouse_standard_flag", FORMAT_TABLE_STRING, format_cb_mouse_standard_flag }, + { "mouse_status_line", FORMAT_TABLE_STRING, + format_cb_mouse_status_line + }, + { "mouse_status_range", FORMAT_TABLE_STRING, + format_cb_mouse_status_range + }, { "mouse_utf8_flag", FORMAT_TABLE_STRING, format_cb_mouse_utf8_flag }, diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index a28cf5a70..c57e57ecf 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.400 2023/02/05 21:15:32 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.401 2023/08/17 14:10:28 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -564,9 +564,9 @@ static key_code server_client_check_mouse(struct client *c, struct key_event *event) { struct mouse_event *m = &event->m; - struct session *s = c->session; - struct winlink *wl; - struct window_pane *wp; + struct session *s = c->session, *fs; + struct winlink *fwl; + struct window_pane *wp, *fwp; u_int x, y, b, sx, sy, px, py; int ignore = 0; key_code key; @@ -672,6 +672,7 @@ have_event: /* Save the session. */ m->s = s->id; m->w = -1; + m->wp = -1; m->ignore = ignore; /* Is this on the status line? */ @@ -688,18 +689,42 @@ have_event: case STYLE_RANGE_NONE: return (KEYC_UNKNOWN); case STYLE_RANGE_LEFT: + log_debug("mouse range: left"); where = STATUS_LEFT; break; case STYLE_RANGE_RIGHT: + log_debug("mouse range: right"); where = STATUS_RIGHT; break; - case STYLE_RANGE_WINDOW: - wl = winlink_find_by_index(&s->windows, - sr->argument); - if (wl == NULL) + case STYLE_RANGE_PANE: + fwp = window_pane_find_by_id(sr->argument); + if (fwp == NULL) return (KEYC_UNKNOWN); - m->w = wl->window->id; + m->wp = sr->argument; + log_debug("mouse range: pane %%%u", m->wp); + where = STATUS; + break; + case STYLE_RANGE_WINDOW: + fwl = winlink_find_by_index(&s->windows, + sr->argument); + if (fwl == NULL) + return (KEYC_UNKNOWN); + m->w = fwl->window->id; + + log_debug("mouse range: window @%u", m->w); + where = STATUS; + break; + case STYLE_RANGE_SESSION: + fs = session_find_by_id(sr->argument); + if (fs == NULL) + return (KEYC_UNKNOWN); + m->s = sr->argument; + + log_debug("mouse range: session $%u", m->s); + where = STATUS; + break; + case STYLE_RANGE_USER: where = STATUS; break; } diff --git a/usr.bin/tmux/style.c b/usr.bin/tmux/style.c index 7fec0b3b9..cb507c253 100644 --- a/usr.bin/tmux/style.c +++ b/usr.bin/tmux/style.c @@ -1,4 +1,4 @@ -/* $OpenBSD: style.c,v 1.32 2023/06/26 07:17:40 nicm Exp $ */ +/* $OpenBSD: style.c,v 1.33 2023/08/17 14:10:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -37,11 +37,18 @@ static struct style style_default = { STYLE_ALIGN_DEFAULT, STYLE_LIST_OFF, - STYLE_RANGE_NONE, 0, + STYLE_RANGE_NONE, 0, "", STYLE_DEFAULT_BASE }; +/* Set range string. */ +static void +style_set_range_string(struct style *sy, const char *s) +{ + strlcpy(sy->range_string, s, sizeof sy->range_string); +} + /* * Parse an embedded style of the form "fg=colour,bg=colour,bright,...". Note * that this adds onto the given style, so it must have been initialized @@ -104,32 +111,67 @@ style_parse(struct style *sy, const struct grid_cell *base, const char *in) } else if (strcasecmp(tmp, "norange") == 0) { sy->range_type = style_default.range_type; sy->range_argument = style_default.range_type; + strlcpy(sy->range_string, style_default.range_string, + sizeof sy->range_string); } else if (end > 6 && strncasecmp(tmp, "range=", 6) == 0) { found = strchr(tmp + 6, '|'); if (found != NULL) { *found++ = '\0'; if (*found == '\0') goto error; - for (cp = found; *cp != '\0'; cp++) { - if (!isdigit((u_char)*cp)) - goto error; - } } if (strcasecmp(tmp + 6, "left") == 0) { if (found != NULL) goto error; sy->range_type = STYLE_RANGE_LEFT; sy->range_argument = 0; + style_set_range_string(sy, ""); } else if (strcasecmp(tmp + 6, "right") == 0) { if (found != NULL) goto error; sy->range_type = STYLE_RANGE_RIGHT; sy->range_argument = 0; + style_set_range_string(sy, ""); + } else if (strcasecmp(tmp + 6, "pane") == 0) { + if (found == NULL) + goto error; + if (*found != '%' || found[1] == '\0') + goto error; + for (cp = found + 1; *cp != '\0'; cp++) { + if (!isdigit((u_char)*cp)) + goto error; + } + sy->range_type = STYLE_RANGE_PANE; + sy->range_argument = atoi(found + 1); + style_set_range_string(sy, ""); } else if (strcasecmp(tmp + 6, "window") == 0) { if (found == NULL) goto error; + for (cp = found; *cp != '\0'; cp++) { + if (!isdigit((u_char)*cp)) + goto error; + } sy->range_type = STYLE_RANGE_WINDOW; sy->range_argument = atoi(found); + style_set_range_string(sy, ""); + } else if (strcasecmp(tmp + 6, "session") == 0) { + if (found == NULL) + goto error; + if (*found != '$' || found[1] == '\0') + goto error; + for (cp = found + 1; *cp != '\0'; cp++) { + if (!isdigit((u_char)*cp)) + goto error; + } + sy->range_type = STYLE_RANGE_SESSION; + sy->range_argument = atoi(found + 1); + style_set_range_string(sy, ""); + } else if (strcasecmp(tmp + 6, "user") == 0) { + if (found == NULL) + goto error; + sy->range_type = STYLE_RANGE_USER; + sy->range_argument = 0; + style_set_range_string(sy, found); } } else if (strcasecmp(tmp, "noalign") == 0) sy->align = style_default.align; @@ -222,9 +264,19 @@ style_tostring(struct style *sy) tmp = "left"; else if (sy->range_type == STYLE_RANGE_RIGHT) tmp = "right"; - else if (sy->range_type == STYLE_RANGE_WINDOW) { + else if (sy->range_type == STYLE_RANGE_PANE) { + snprintf(b, sizeof b, "pane|%%%u", sy->range_argument); + tmp = b; + } else if (sy->range_type == STYLE_RANGE_WINDOW) { snprintf(b, sizeof b, "window|%u", sy->range_argument); tmp = b; + } else if (sy->range_type == STYLE_RANGE_SESSION) { + snprintf(b, sizeof b, "session|$%u", + sy->range_argument); + tmp = b; + } else if (sy->range_type == STYLE_RANGE_USER) { + snprintf(b, sizeof b, "user|%s", sy->range_string); + tmp = b; } off += xsnprintf(s + off, sizeof s - off, "%srange=%s", comma, tmp); diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 1e43c29a1..34ee4037b 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.927 2023/08/15 07:01:47 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.928 2023/08/17 14:10:28 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: August 15 2023 $ +.Dd $Mdocdate: August 17 2023 $ .Dt TMUX 1 .Os .Sh NAME @@ -5443,6 +5443,8 @@ The following variables are available, where appropriate: .It Li "mouse_line" Ta "" Ta "Line under mouse, if any" .It Li "mouse_sgr_flag" Ta "" Ta "Pane mouse SGR flag" .It Li "mouse_standard_flag" Ta "" Ta "Pane mouse standard flag" +.It Li "mouse_status_line" Ta "" Ta "Status line on which mouse event took place" +.It Li "mouse_status_range" Ta "" Ta "Range type or argument of mouse event on status line" .It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag" .It Li "mouse_word" Ta "" Ta "Word under mouse, if any" .It Li "mouse_x" Ta "" Ta "Mouse X position, if any" @@ -5681,26 +5683,56 @@ Only one default may be pushed (each replaces the previous saved default). .It Xo Ic range=left , .Ic range=right , +.Ic range=session|X , .Ic range=window|X , +.Ic range=pane|X , +.Ic range=user|X , .Ic norange .Xc -Mark a range in the +Mark a range for mouse events in the .Ic status-format option. +When a mouse event occurs in the .Ic range=left -and +or .Ic range=right -are the text used for the +range, the .Ql StatusLeft and .Ql StatusRight -mouse keys. +key bindings are triggered. +.Pp +.Ic range=session|X , .Ic range=window|X -is the range for a window passed to the +and +.Ic range=pane|X +are ranges for a session, window or pane. +These trigger the .Ql Status -mouse key, where +mouse key with the target session, window or pane given by the .Ql X -is a window index. +argument. +.Ql X +is a session ID, window index in the current session or a pane ID. +For these, the +.Ic mouse_status_range +format variable will be set to +.Ql session , +.Ql window +or +.Ql pane . +.Pp +.Ic range=user|X +is a user-defined range; it triggers the +.Ql Status +mouse key. +The argument +.Ql X +will be available in the +.Ic mouse_status_range +format variable. +.Ql X +must be at most 15 bytes in length. .El .Pp Examples are: diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 0ee5813e0..8a63e8b76 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1205 2023/08/15 07:01:47 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1206 2023/08/17 14:10:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -795,11 +795,15 @@ enum style_range_type { STYLE_RANGE_NONE, STYLE_RANGE_LEFT, STYLE_RANGE_RIGHT, - STYLE_RANGE_WINDOW + STYLE_RANGE_PANE, + STYLE_RANGE_WINDOW, + STYLE_RANGE_SESSION, + STYLE_RANGE_USER }; struct style_range { enum style_range_type type; u_int argument; + char string[16]; u_int start; u_int end; /* not included */ @@ -826,6 +830,7 @@ struct style { enum style_range_type range_type; u_int range_argument; + char range_string[16]; enum style_default_type default_type; }; diff --git a/usr.sbin/httpd/httpd.conf.5 b/usr.sbin/httpd/httpd.conf.5 index 16b086a9e..90ea5e750 100644 --- a/usr.sbin/httpd/httpd.conf.5 +++ b/usr.sbin/httpd/httpd.conf.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: httpd.conf.5,v 1.122 2022/09/02 07:38:14 benno Exp $ +.\" $OpenBSD: httpd.conf.5,v 1.123 2023/08/17 07:25:57 op Exp $ .\" .\" Copyright (c) 2014, 2015 Reyk Floeter .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: September 2 2022 $ +.Dd $Mdocdate: August 17 2023 $ .Dt HTTPD.CONF 5 .Os .Sh NAME @@ -98,7 +98,7 @@ Macros are not expanded inside quotes. For example: .Bd -literal -offset indent ext_ip="10.0.0.1" -server "default" { +server "example.com" { listen on $ext_ip port 80 } .Ed @@ -179,7 +179,11 @@ The configured web servers. Each .Ic server section starts with a declaration of the server -.Ar name : +.Ar name . +If a request does not match any server name, it is handled by the +first defined +.Ic server +section that matches the listening port. .Bl -tag -width Ds .It Ic server Ar name Brq ... Match the server name using shell globbing rules. @@ -779,7 +783,7 @@ It additionally defines some media types overriding the defaults. .Bd -literal -offset indent prefork 2 -server "default" { +server "example.com" { listen on * port 80 } @@ -800,7 +804,7 @@ address of the network interface that is a member of the .Qq egress group. .Bd -literal -offset indent -server "default" { +server "example.com" { listen on egress port 80 } .Ed diff --git a/usr.sbin/radiusd/parse.y b/usr.sbin/radiusd/parse.y index a85add90e..619345550 100644 --- a/usr.sbin/radiusd/parse.y +++ b/usr.sbin/radiusd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.13 2021/10/15 15:01:28 naddy Exp $ */ +/* $OpenBSD: parse.y,v 1.14 2023/08/18 06:37:20 yasuoka Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -167,7 +167,9 @@ listen_addr : STRING optport { optport : { $$ = 0; } | PORT NUMBER { $$ = $2; } ; -client : CLIENT prefix optnl clientopts_b { +client : CLIENT { + radiusd_client_init(&client); + } prefix optnl '{' clientopts '}' { struct radiusd_client *client0; if (client.secret[0] == '\0') { @@ -181,31 +183,33 @@ client : CLIENT prefix optnl clientopts_b { strlcpy(client0->secret, client.secret, sizeof(client0->secret)); client0->msgauth_required = client.msgauth_required; - client0->af = $2.af; - client0->addr = $2.addr; - client0->mask = $2.mask; + client0->af = $3.af; + client0->addr = $3.addr; + client0->mask = $3.mask; TAILQ_INSERT_TAIL(&conf->client, client0, next); - radiusd_client_init(&client); } -clientopts_b : '{' optnl_l clientopts_l optnl_l '}' - | '{' optnl_l '}' /* allow empty block */ +clientopts : clientopts '\n' clientopt + | clientopt ; -clientopts_l : clientopts_l nl clientopts - | clientopts - ; - -clientopts : SECRET STRING { - if (strlcpy(client.secret, $2, sizeof(client.secret)) - >= sizeof(client.secret)) { +clientopt : SECRET STRING { + if (client.secret[0] != '\0') { + free($2); + yyerror("secret is specified already"); + YYERROR; + } else if (strlcpy(client.secret, $2, + sizeof(client.secret)) >= sizeof(client.secret)) { + free($2); yyerror("secret is too long"); YYERROR; } + free($2); } | MSGAUTH_REQUIRED yesno { client.msgauth_required = $2; } + | ; prefix : STRING '/' NUMBER { @@ -297,34 +301,37 @@ setstrerr: free_str_l(&$5); } ; -authenticate : AUTHENTICATE str_l optnl authopts_b { +authenticate : AUTHENTICATE { + radiusd_authentication_init(&authen); + } str_l optnl '{' authopts '}' { struct radiusd_authentication *a; if ((a = calloc(1, sizeof(struct radiusd_authentication))) == NULL) { - free_str_l(&$2); + free_str_l(&$3); goto outofmemory; } a->auth = authen.auth; + authen.auth = NULL; a->deco = authen.deco; - a->username = $2.v; + a->username = $3.v; TAILQ_INSERT_TAIL(&conf->authen, a, next); - radiusd_authentication_init(&authen); } ; -authopts_b : '{' optnl_l authopts_l optnl_l '}' - | '{' optnl_l '}' /* empty options */ +authopts : authopts '\n' authopt + | authopt ; -authopts_l : authopts_l nl authopts - | authopts - ; - -authopts : AUTHENTICATE_BY STRING { +authopt : AUTHENTICATE_BY STRING { struct radiusd_module_ref *modref; + if (authen.auth != NULL) { + free($2); + yyerror("authenticate is specified already"); + YYERROR; + } modref = create_module_ref($2); free($2); if (modref == NULL) @@ -346,6 +353,7 @@ authopts : AUTHENTICATE_BY STRING { } free_str_l(&$2); } + | ; str_l : str_l strnum { int i; @@ -379,11 +387,6 @@ strnum : STRING { $$ = $1; } optnl : | '\n' ; -nl : '\n' optnl /* one new line or more */ - ; -optnl_l : - | '\n' optnl_l - ; yesno : YES { $$ = true; } | NO { $$ = false; } ; @@ -717,7 +720,6 @@ parse_config(const char *filename, struct radiusd *radiusd) radiusd_conf_init(conf); radiusd_authentication_init(&authen); radiusd_client_init(&client); - authen.auth = NULL; if ((file = pushfile(filename)) == NULL) { errors++; @@ -745,8 +747,7 @@ parse_config(const char *filename, struct radiusd *radiusd) TAILQ_FOREACH(l, &conf->listen, next) { l->sock = -1; } - if (authen.auth != NULL) - free(authen.auth); + radiusd_authentication_init(&authen); TAILQ_FOREACH_SAFE(m, &authen.deco, next, mt) { TAILQ_REMOVE(&authen.deco, m, next); free(m); @@ -805,6 +806,7 @@ create_module_ref(const char *modulename) static void radiusd_authentication_init(struct radiusd_authentication *auth) { + free(auth->auth); memset(auth, 0, sizeof(struct radiusd_authentication)); TAILQ_INIT(&auth->deco); } diff --git a/usr.sbin/radiusd/radiusd_bsdauth.c b/usr.sbin/radiusd/radiusd_bsdauth.c index 8df5badd6..69907bf9a 100644 --- a/usr.sbin/radiusd/radiusd_bsdauth.c +++ b/usr.sbin/radiusd/radiusd_bsdauth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radiusd_bsdauth.c,v 1.14 2019/12/14 15:56:20 millert Exp $ */ +/* $OpenBSD: radiusd_bsdauth.c,v 1.15 2023/08/18 06:12:27 yasuoka Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko @@ -418,6 +418,7 @@ start_child(char *argv0, int fd) argv[argc++] = argv0; argv[argc++] = "-M"; /* main proc */ + argv[argc++] = NULL; execvp(argv0, argv); fatal("execvp"); }