diff --git a/lib/libcrypto/camellia/cmll_ecb.c b/lib/libcrypto/camellia/cmll_ecb.c index b47ece737..0575d29e2 100644 --- a/lib/libcrypto/camellia/cmll_ecb.c +++ b/lib/libcrypto/camellia/cmll_ecb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmll_ecb.c,v 1.5 2022/11/26 16:08:51 tb Exp $ */ +/* $OpenBSD: cmll_ecb.c,v 1.7 2023/09/04 08:43:41 tb Exp $ */ /* ==================================================================== * Copyright (c) 2006 The OpenSSL Project. All rights reserved. * @@ -50,6 +50,7 @@ */ #include + #include "cmll_local.h" void diff --git a/lib/libcrypto/camellia/cmll_local.h b/lib/libcrypto/camellia/cmll_local.h index ed9807c06..831625e77 100644 --- a/lib/libcrypto/camellia/cmll_local.h +++ b/lib/libcrypto/camellia/cmll_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cmll_local.h,v 1.2 2022/11/26 17:23:17 tb Exp $ */ +/* $OpenBSD: cmll_local.h,v 1.3 2023/09/04 08:43:41 tb Exp $ */ /* ==================================================================== * Copyright 2006 NTT (Nippon Telegraph and Telephone Corporation) . * ALL RIGHTS RESERVED. @@ -68,6 +68,8 @@ #ifndef HEADER_CAMELLIA_LOCAL_H #define HEADER_CAMELLIA_LOCAL_H +#include + __BEGIN_HIDDEN_DECLS typedef unsigned int u32; diff --git a/lib/libcrypto/whrlpool/wp_dgst.c b/lib/libcrypto/whrlpool/wp_dgst.c index fd074c181..71fd79c84 100644 --- a/lib/libcrypto/whrlpool/wp_dgst.c +++ b/lib/libcrypto/whrlpool/wp_dgst.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wp_dgst.c,v 1.5 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: wp_dgst.c,v 1.7 2023/09/04 08:43:41 tb Exp $ */ /** * The Whirlpool hashing function. * @@ -52,10 +52,12 @@ * input. This is done for performance. */ -#include "wp_local.h" -#include #include +#include + +#include "wp_local.h" + int WHIRLPOOL_Init(WHIRLPOOL_CTX *c) { memset (c,0,sizeof(*c)); diff --git a/lib/libcrypto/whrlpool/wp_local.h b/lib/libcrypto/whrlpool/wp_local.h index 2d3bc9c6e..892dce23b 100644 --- a/lib/libcrypto/whrlpool/wp_local.h +++ b/lib/libcrypto/whrlpool/wp_local.h @@ -1,4 +1,6 @@ -/* $OpenBSD: wp_local.h,v 1.1 2022/11/26 16:08:54 tb Exp $ */ +/* $OpenBSD: wp_local.h,v 1.2 2023/09/04 08:43:41 tb Exp $ */ + +#include #include diff --git a/share/man/man5/bsd.port.mk.5 b/share/man/man5/bsd.port.mk.5 index cdd2ae271..366c90fc5 100644 --- a/share/man/man5/bsd.port.mk.5 +++ b/share/man/man5/bsd.port.mk.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bsd.port.mk.5,v 1.585 2023/09/03 12:24:16 espie Exp $ +.\" $OpenBSD: bsd.port.mk.5,v 1.586 2023/09/04 12:40:44 espie Exp $ .\" .\" Copyright (c) 2000-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: September 3 2023 $ +.Dd $Mdocdate: September 4 2023 $ .Dt BSD.PORT.MK 5 .Os .Sh NAME @@ -302,7 +302,7 @@ ${FETCH_CMD} retrieve from .Ev MASTER_SITES0 to .Ev MASTER_SITES9 -instead. +instead (deprecated). .Pp Preferably, adding a suffix to .Ev DISTFILES , @@ -327,6 +327,14 @@ Transfers in progress are stored as .Ar filenamesufx.part and moved after completion. .Pp +The actual filesystem paths to all distfiles (resp. patchfiles) after +url/filename substitution, including suffixed sources, is conveniently +stored as +.Ev ALL_DISTFILES +.Po +resp. +.Ev ALL_PATCHFILES +.Pc . The ports framework uses .Pa ${DISTDIR}/${DIST_SUBDIR} (aliased to @@ -343,6 +351,8 @@ Use of hooks is forbidden, as this would make mirroring of distfiles very complicated. .Pp See +.Ev ALL_DISTFILES , +.Ev ALL_PATCHFILES , .Ev CHECKSUMFILES , .Ev DISTDIR , .Ev DISTFILES* , @@ -926,6 +936,7 @@ setting, after applying the conversion, occasionally useful for setting .Ev EXTRACT_ONLY manually. +Read-only. .It Ev ALL_FAKE_FLAGS Flags passed to ${MAKE} invocations during the fake process. Equals @@ -937,6 +948,7 @@ List of all actual files coming from every setting, after applying the .Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx conversion. +Read-only. .It Ev ALL_TEST_ENV Environment passed to test. Equals @@ -4382,6 +4394,10 @@ somewhere, or it runs strips during fake anyway. It can also occur if .Ev DEBUG_PACKAGES includes subpackages with no files holding debug info. +.It "Warning: old style distfiles ... found" +See +.Cm fetch +for the newer way. .It "Warning: symlink(s) point to non existent file." Warning message comes from .Xr pkg_create 1 . diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 2863d1806..7dbb63dac 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.212 2023/08/29 16:19:34 claudio Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.213 2023/09/04 13:18:41 claudio Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -119,7 +119,7 @@ exit1(struct proc *p, int xexit, int xsig, int flags) struct process *pr, *qr, *nqr; struct rusage *rup; struct timespec ts; - int s; + int s, wake; atomic_setbits_int(&p->p_flag, P_WEXIT); @@ -161,9 +161,17 @@ exit1(struct proc *p, int xexit, int xsig, int flags) TAILQ_REMOVE(&pr->ps_threads, p, p_thr_link); SCHED_UNLOCK(s); + mtx_enter(&pr->ps_mtx); + pr->ps_threadcnt--; + wake = (pr->ps_single && pr->ps_singlecnt == pr->ps_threadcnt); + mtx_leave(&pr->ps_mtx); + if (wake) + wakeup(&pr->ps_singlecnt); + if ((p->p_flag & P_THREAD) == 0) { /* main thread gotta wait because it has the pid, et al */ - while (pr->ps_threadcnt > 1) + /* XXX locking depends on kernel lock here. */ + while (pr->ps_threadcnt > 0) tsleep_nsec(&pr->ps_threads, PWAIT, "thrdeath", INFSLP); if (pr->ps_flags & PS_PROFIL) stopprofclock(pr); @@ -337,9 +345,8 @@ exit1(struct proc *p, int xexit, int xsig, int flags) /* just a thread? detach it from its process */ if (p->p_flag & P_THREAD) { /* scheduler_wait_hook(pr->ps_mainproc, p); XXX */ - if (--pr->ps_threadcnt == 1) + if (pr->ps_threadcnt == 0) wakeup(&pr->ps_threads); - KASSERT(pr->ps_threadcnt > 0); } /* Release the thread's read reference of resource limit structure. */ @@ -823,7 +830,7 @@ process_zap(struct process *pr) if (otvp) vrele(otvp); - KASSERT(pr->ps_threadcnt == 1); + KASSERT(pr->ps_threadcnt == 0); if (pr->ps_ptstat != NULL) free(pr->ps_ptstat, M_SUBPROC, sizeof(*pr->ps_ptstat)); pool_put(&rusage_pool, pr->ps_ru); diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 9c2f1b038..c37dd2fea 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.249 2023/08/14 08:33:24 mpi Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.250 2023/09/04 13:18:41 claudio Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -543,7 +543,6 @@ thread_fork(struct proc *curp, void *stack, void *tcb, pid_t *tidptr, /* other links */ p->p_p = pr; - pr->ps_threadcnt++; /* local copies */ p->p_fd = pr->ps_fd; @@ -564,16 +563,18 @@ thread_fork(struct proc *curp, void *stack, void *tcb, pid_t *tidptr, SCHED_LOCK(s); TAILQ_INSERT_TAIL(&pr->ps_threads, p, p_thr_link); + SCHED_UNLOCK(s); + + mtx_enter(&pr->ps_mtx); + pr->ps_threadcnt++; /* * if somebody else wants to take us to single threaded mode, * count ourselves in. */ - if (pr->ps_single) { - atomic_inc_int(&pr->ps_singlecount); + if (pr->ps_single) atomic_setbits_int(&p->p_flag, P_SUSPSINGLE); - } - SCHED_UNLOCK(s); + mtx_leave(&pr->ps_mtx); /* * Return tid to parent thread and copy it out to userspace diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index b6a6ee1a8..a003797c0 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.313 2023/08/16 07:55:52 claudio Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.314 2023/09/04 13:18:41 claudio Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -2008,11 +2008,12 @@ userret(struct proc *p) } int -single_thread_check_locked(struct proc *p, int deep, int s) +single_thread_check_locked(struct proc *p, int deep) { struct process *pr = p->p_p; + int s, wake; - SCHED_ASSERT_LOCKED(); + MUTEX_ASSERT_LOCKED(&pr->ps_mtx); if (pr->ps_single == NULL || pr->ps_single == p) return (0); @@ -2026,19 +2027,24 @@ single_thread_check_locked(struct proc *p, int deep, int s) return (EINTR); } - if (atomic_dec_int_nv(&pr->ps_singlecount) == 0) - wakeup(&pr->ps_singlecount); - if (pr->ps_flags & PS_SINGLEEXIT) { - SCHED_UNLOCK(s); + mtx_leave(&pr->ps_mtx); KERNEL_LOCK(); exit1(p, 0, 0, EXIT_THREAD_NOCHECK); /* NOTREACHED */ } /* not exiting and don't need to unwind, so suspend */ + wake = (++pr->ps_singlecnt == pr->ps_threadcnt); + mtx_leave(&pr->ps_mtx); + if (wake) + wakeup(&pr->ps_singlecnt); + + SCHED_LOCK(s); p->p_stat = SSTOP; mi_switch(); + SCHED_UNLOCK(s); + mtx_enter(&pr->ps_mtx); } while (pr->ps_single != NULL); return (0); @@ -2047,11 +2053,11 @@ single_thread_check_locked(struct proc *p, int deep, int s) int single_thread_check(struct proc *p, int deep) { - int s, error; + int error; - SCHED_LOCK(s); - error = single_thread_check_locked(p, deep, s); - SCHED_UNLOCK(s); + mtx_enter(&p->p_p->ps_mtx); + error = single_thread_check_locked(p, deep); + mtx_leave(&p->p_p->ps_mtx); return error; } @@ -2071,13 +2077,14 @@ single_thread_set(struct proc *p, enum single_thread_mode mode, int wait) struct process *pr = p->p_p; struct proc *q; int error, s; + u_int count = 0; KASSERT(curproc == p); - SCHED_LOCK(s); - error = single_thread_check_locked(p, (mode == SINGLE_UNWIND), s); + mtx_enter(&pr->ps_mtx); + error = single_thread_check_locked(p, (mode == SINGLE_UNWIND)); if (error) { - SCHED_UNLOCK(s); + mtx_leave(&pr->ps_mtx); return error; } @@ -2096,26 +2103,24 @@ single_thread_set(struct proc *p, enum single_thread_mode mode, int wait) panic("single_thread_mode = %d", mode); #endif } - pr->ps_singlecount = 0; - membar_producer(); + pr->ps_singlecnt = 1; /* count ourselfs in already */ pr->ps_single = p; + mtx_leave(&pr->ps_mtx); + + SCHED_LOCK(s); TAILQ_FOREACH(q, &pr->ps_threads, p_thr_link) { if (q == p) continue; if (q->p_flag & P_WEXIT) { - if (mode == SINGLE_EXIT) { - if (q->p_stat == SSTOP) { - setrunnable(q); - atomic_inc_int(&pr->ps_singlecount); - } - } + if (mode == SINGLE_EXIT && q->p_stat == SSTOP) + setrunnable(q); continue; } atomic_setbits_int(&q->p_flag, P_SUSPSINGLE); switch (q->p_stat) { case SIDL: + case SDEAD: case SRUN: - atomic_inc_int(&pr->ps_singlecount); break; case SSLEEP: /* if it's not interruptible, then just have to wait */ @@ -2123,29 +2128,31 @@ single_thread_set(struct proc *p, enum single_thread_mode mode, int wait) /* merely need to suspend? just stop it */ if (mode == SINGLE_SUSPEND) { q->p_stat = SSTOP; + count++; break; } /* need to unwind or exit, so wake it */ setrunnable(q); } - atomic_inc_int(&pr->ps_singlecount); break; case SSTOP: if (mode == SINGLE_EXIT) { setrunnable(q); - atomic_inc_int(&pr->ps_singlecount); + break; } - break; - case SDEAD: + count++; break; case SONPROC: - atomic_inc_int(&pr->ps_singlecount); signotify(q); break; } } SCHED_UNLOCK(s); + mtx_enter(&pr->ps_mtx); + pr->ps_singlecnt += count; + mtx_leave(&pr->ps_mtx); + if (wait) single_thread_wait(pr, 1); @@ -2163,14 +2170,16 @@ single_thread_wait(struct process *pr, int recheck) int wait; /* wait until they're all suspended */ - wait = pr->ps_singlecount > 0; + mtx_enter(&pr->ps_mtx); + wait = pr->ps_singlecnt < pr->ps_threadcnt; while (wait) { - sleep_setup(&pr->ps_singlecount, PWAIT, "suspend"); - wait = pr->ps_singlecount > 0; - sleep_finish(0, wait); + msleep_nsec(&pr->ps_singlecnt, &pr->ps_mtx, PWAIT, "suspend", + INFSLP); if (!recheck) break; + wait = pr->ps_singlecnt < pr->ps_threadcnt; } + mtx_leave(&pr->ps_mtx); return wait; } @@ -2185,9 +2194,11 @@ single_thread_clear(struct proc *p, int flag) KASSERT(pr->ps_single == p); KASSERT(curproc == p); - SCHED_LOCK(s); + /* can do this without holding pr->ps_mtx since no concurrency */ pr->ps_single = NULL; atomic_clearbits_int(&pr->ps_flags, PS_SINGLEUNWIND | PS_SINGLEEXIT); + + SCHED_LOCK(s); TAILQ_FOREACH(q, &pr->ps_threads, p_thr_link) { if (q == p || (q->p_flag & P_SUSPSINGLE) == 0) continue; diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 41e5a3b8d..6cdef43ff 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.348 2023/08/29 16:19:34 claudio Exp $ */ +/* $OpenBSD: proc.h,v 1.349 2023/09/04 13:18:41 claudio Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -173,8 +173,8 @@ struct process { u_int ps_flags; /* [a] PS_* flags. */ int ps_siglist; /* Signals pending for the process. */ - struct proc *ps_single; /* [S] Thread for single-threading. */ - u_int ps_singlecount; /* [a] Not yet suspended threads. */ + struct proc *ps_single; /* [m] Thread for single-threading. */ + u_int ps_singlecnt; /* [m] Number of suspended threads. */ int ps_traceflag; /* Kernel trace points. */ struct vnode *ps_tracevp; /* Trace to vnode. */ @@ -242,7 +242,7 @@ struct process { /* End area that is copied on creation. */ #define ps_endcopy ps_threadcnt - u_int ps_threadcnt; /* Number of threads. */ + u_int ps_threadcnt; /* [m] Number of threads. */ struct timespec ps_start; /* starting uptime. */ struct timeout ps_realit_to; /* [m] ITIMER_REAL timeout */ diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile index f5ef2dd5e..7682ba326 100644 --- a/usr.bin/make/Makefile +++ b/usr.bin/make/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.64 2020/01/13 15:41:53 espie Exp $ +# $OpenBSD: Makefile,v 1.65 2023/09/04 11:35:11 espie Exp $ PROG= make CFLAGS+= -I${.OBJDIR} -I${.CURDIR} @@ -6,8 +6,7 @@ HOSTCFLAGS+= -I${.OBJDIR} -I${.CURDIR} CDIAGFLAGS=-Wall -W -Wno-char-subscripts -Wstrict-prototypes -pedantic \ -Wmissing-prototypes -Wdeclaration-after-statement -std=c99 -CDEFS+=-DHAS_PATHS_H -CDEFS+=-DHAS_EXTENDED_GETCWD +CDEFS+=-DMAKE_BSIZE=256 -DDEFMAXJOBS=4 #CDEFS+=-DHAS_STATS DPADD += ${LIBUTIL} diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c index ef7cdee62..278574a2d 100644 --- a/usr.bin/make/arch.c +++ b/usr.bin/make/arch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arch.c,v 1.93 2023/02/17 17:59:36 miod Exp $ */ +/* $OpenBSD: arch.c,v 1.94 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */ /* @@ -82,7 +82,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "buf.h" #include "dir.h" diff --git a/usr.bin/make/buf.c b/usr.bin/make/buf.c index 6d8feb8ee..0a3d80609 100644 --- a/usr.bin/make/buf.c +++ b/usr.bin/make/buf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.c,v 1.29 2020/01/13 13:54:44 espie Exp $ */ +/* $OpenBSD: buf.c,v 1.30 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: buf.c,v 1.9 1996/12/31 17:53:21 christos Exp $ */ /* @@ -75,7 +75,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "buf.h" #include "stats.h" diff --git a/usr.bin/make/cmd_exec.c b/usr.bin/make/cmd_exec.c index 70e28f93f..701ad39fb 100644 --- a/usr.bin/make/cmd_exec.c +++ b/usr.bin/make/cmd_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd_exec.c,v 1.12 2023/08/31 06:53:28 espie Exp $ */ +/* $OpenBSD: cmd_exec.c,v 1.13 2023/09/04 11:35:11 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. * @@ -30,7 +30,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "cmd_exec.h" #include "buf.h" diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c index e45ace199..bef1e8789 100644 --- a/usr.bin/make/compat.c +++ b/usr.bin/make/compat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: compat.c,v 1.93 2020/01/26 12:41:21 espie Exp $ */ +/* $OpenBSD: compat.c,v 1.94 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */ /* @@ -40,7 +40,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "dir.h" #include "engine.h" diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c index ae5a29cb4..e3b7c230f 100644 --- a/usr.bin/make/cond.c +++ b/usr.bin/make/cond.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cond.c,v 1.54 2019/12/21 15:29:25 espie Exp $ */ +/* $OpenBSD: cond.c,v 1.55 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: cond.c,v 1.7 1996/11/06 17:59:02 christos Exp $ */ /* @@ -42,7 +42,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "dir.h" #include "buf.h" diff --git a/usr.bin/make/config.h b/usr.bin/make/config.h deleted file mode 100644 index f077d9681..000000000 --- a/usr.bin/make/config.h +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef CONFIG_H -#define CONFIG_H - -/* $OpenBSD: config.h,v 1.21 2022/01/05 02:00:55 jsg Exp $ */ -/* $NetBSD: config.h,v 1.7 1996/11/06 17:59:03 christos Exp $ */ - -/* - * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. - * Copyright (c) 1988, 1989 by Adam de Boor - * Copyright (c) 1989 by Berkeley Softworks - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Adam de Boor. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)config.h 8.1 (Berkeley) 6/6/93 - */ - -#define DEFSHELL 1 /* Bourne shell */ - -/* - * DEFMAXJOBS - * This controls the default concurrency. On no occasion will more - * than DEFMAXJOBS targets be created at once. - */ -#define DEFMAXJOBS 4 - -/* - * SYSVINCLUDE - * Recognize system V like include directives [include "filename"] - * SYSVVARSUB - * Recognize system V like ${VAR:x=y} variable substitutions - */ -#define SYSVINCLUDE -#define SYSVVARSUB - -/* - * SUNSHCMD - * Recognize SunOS and Solaris: - * VAR :sh= CMD # Assign VAR to the command substitution of CMD - * ${VAR:sh} # Return the command substitution of the value - * # of ${VAR} - */ -#define SUNSHCMD - -#ifdef HAS_EXTENDED_GETCWD -#define dogetcwd() getcwd(NULL, 0) -#else -#define dogetcwd() getcwd(emalloc(PATH_MAX), PATH_MAX) -#endif - -#ifdef SYSVINCLUDE -#define DOFEATURE_SYSVINCLUDE FEATURE_SYSVINCLUDE -#else -#define DOFEATURE_SYSVINCLUDE 0 -#endif -#ifdef SYSVVARSUB -#define DOFEATURE_SYSVVARSUB FEATURE_SYSVVARSUB -#else -#define DOFEATURE_SYSVVARSUB 0 -#endif -#ifdef SUNSHCMD -#define DOFEATURE_SUNSHCMD FEATURE_SUNSHCMD -#else -#define DOFEATURE_SUNSHCMD 0 -#endif - -#ifndef DEFAULT_FEATURES -#define DEFAULT_FEATURES (FEATURE_UPPERLOWER | DOFEATURE_SYSVVARSUB | DOFEATURE_SYSVINCLUDE | DOFEATURE_SUNSHCMD | FEATURE_RECVARS | FEATURE_CONDINCLUDE) -#endif - -#define FEATURES(x) ((DEFAULT_FEATURES & (x)) != 0) -#define FEATURE_ODE 1 -#define FEATURE_UNIQ 2 -#define FEATURE_SORT 4 -#define FEATURE_UPPERLOWER 8 -#define FEATURE_SYSVVARSUB 16 -#define FEATURE_SYSVINCLUDE 32 -#define FEATURE_SUNSHCMD 64 -#define FEATURE_RECVARS 128 -#define FEATURE_CONDINCLUDE 256 -#define FEATURE_ASSIGN 512 -#define FEATURE_EXECMOD 1024 - -/* - * There are several places where expandable buffers are used (parse.c and - * var.c). This constant is merely the starting point for those buffers. If - * lines tend to be much shorter than this, it would be best to reduce BSIZE. - * If longer, it should be increased. Reducing it will cause more copying to - * be done for longer lines, but will save space for shorter ones. In any - * case, it ought to be a power of two simply because most storage allocation - * schemes allocate in powers of two. - */ -#define MAKE_BSIZE 256 /* starting size for expandable buffers */ - -#endif diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c index 70b686dff..6463519d5 100644 --- a/usr.bin/make/dir.c +++ b/usr.bin/make/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.68 2016/10/21 16:12:38 espie Exp $ */ +/* $OpenBSD: dir.c,v 1.69 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $ */ /* @@ -70,7 +70,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "dir.h" #include "lst.h" diff --git a/usr.bin/make/direxpand.c b/usr.bin/make/direxpand.c index 3335e8cfe..115bb2847 100644 --- a/usr.bin/make/direxpand.c +++ b/usr.bin/make/direxpand.c @@ -1,4 +1,4 @@ -/* $OpenBSD: direxpand.c,v 1.8 2016/10/21 16:12:38 espie Exp $ */ +/* $OpenBSD: direxpand.c,v 1.9 2023/09/04 11:35:11 espie Exp $ */ /* * Copyright (c) 1999,2007 Marc Espie. * @@ -62,7 +62,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "lst.h" #include "dir.h" diff --git a/usr.bin/make/engine.c b/usr.bin/make/engine.c index cc9ee3e6a..b57301044 100644 --- a/usr.bin/make/engine.c +++ b/usr.bin/make/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.72 2023/08/31 06:53:28 espie Exp $ */ +/* $OpenBSD: engine.c,v 1.73 2023/09/04 11:35:11 espie Exp $ */ /* * Copyright (c) 2012 Marc Espie. * @@ -73,7 +73,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "cmd_exec.h" #include "dir.h" diff --git a/usr.bin/make/enginechoice.c b/usr.bin/make/enginechoice.c index a6ecb6f7f..9d28c8ffa 100644 --- a/usr.bin/make/enginechoice.c +++ b/usr.bin/make/enginechoice.c @@ -1,4 +1,4 @@ -/* $OpenBSD: enginechoice.c,v 1.3 2021/03/04 09:34:30 espie Exp $ */ +/* $OpenBSD: enginechoice.c,v 1.4 2023/09/04 11:35:11 espie Exp $ */ /* * Copyright (c) 2020 Marc Espie. * @@ -23,7 +23,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" #include "defines.h" #include "compat.h" #include "make.h" diff --git a/usr.bin/make/error.c b/usr.bin/make/error.c index 8e66db64b..6fe193a2b 100644 --- a/usr.bin/make/error.c +++ b/usr.bin/make/error.c @@ -1,4 +1,4 @@ -/* $OpenBSD: error.c,v 1.25 2015/09/27 16:58:16 guenther Exp $ */ +/* $OpenBSD: error.c,v 1.26 2023/09/04 11:35:11 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -31,7 +31,6 @@ #include #include -#include "config.h" #include "defines.h" #include "error.h" #include "job.h" diff --git a/usr.bin/make/expandchildren.c b/usr.bin/make/expandchildren.c index 3fc45547d..22fb3f395 100644 --- a/usr.bin/make/expandchildren.c +++ b/usr.bin/make/expandchildren.c @@ -1,4 +1,4 @@ -/* $OpenBSD: expandchildren.c,v 1.2 2020/01/26 12:41:21 espie Exp $ */ +/* $OpenBSD: expandchildren.c,v 1.3 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */ /* @@ -44,7 +44,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "direxpand.h" #include "engine.h" diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c index e9c41eb59..b743ceebc 100644 --- a/usr.bin/make/for.c +++ b/usr.bin/make/for.c @@ -1,4 +1,4 @@ -/* $OpenBSD: for.c,v 1.47 2017/12/05 17:47:09 millert Exp $ */ +/* $OpenBSD: for.c,v 1.48 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: for.c,v 1.4 1996/11/06 17:59:05 christos Exp $ */ /* @@ -63,7 +63,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "buf.h" #include "for.h" diff --git a/usr.bin/make/init.c b/usr.bin/make/init.c index ae8d68971..8c85c61e0 100644 --- a/usr.bin/make/init.c +++ b/usr.bin/make/init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init.c,v 1.9 2023/08/31 06:53:28 espie Exp $ */ +/* $OpenBSD: init.c,v 1.10 2023/09/04 11:35:11 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -26,7 +26,6 @@ */ #include #include "defines.h" -#include "config.h" #include "init.h" #include "timestamp.h" #include "stats.h" diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 37502ebdb..9b43637c0 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.164 2023/03/08 04:43:11 guenther Exp $ */ +/* $OpenBSD: job.c,v 1.165 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */ /* @@ -93,7 +93,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "job.h" #include "engine.h" diff --git a/usr.bin/make/lowparse.c b/usr.bin/make/lowparse.c index 044e7ead2..820ca64e2 100644 --- a/usr.bin/make/lowparse.c +++ b/usr.bin/make/lowparse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lowparse.c,v 1.35 2016/10/21 16:12:38 espie Exp $ */ +/* $OpenBSD: lowparse.c,v 1.36 2023/09/04 11:35:11 espie Exp $ */ /* low-level parsing functions. */ @@ -35,7 +35,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "buf.h" #include "lowparse.h" diff --git a/usr.bin/make/lst.lib/lstInt.h b/usr.bin/make/lst.lib/lstInt.h index f88a8ba87..4b6d28457 100644 --- a/usr.bin/make/lst.lib/lstInt.h +++ b/usr.bin/make/lst.lib/lstInt.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lstInt.h,v 1.15 2010/07/19 19:46:44 espie Exp $ */ +/* $OpenBSD: lstInt.h,v 1.16 2023/09/04 11:35:12 espie Exp $ */ /* $NetBSD: lstInt.h,v 1.7 1996/11/06 17:59:44 christos Exp $ */ /* @@ -42,7 +42,6 @@ #ifndef _LSTINT_H_ #define _LSTINT_H_ -#include "config.h" #include "defines.h" #include "lst.h" diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index ee8a79c44..cf238d7bc 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.131 2023/07/08 21:51:45 jmc Exp $ */ +/* $OpenBSD: main.c,v 1.132 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: main.c,v 1.34 1997/03/24 20:56:36 gwr Exp $ */ /* @@ -45,7 +45,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "var.h" #include "lowparse.h" @@ -517,7 +516,7 @@ figure_out_CURDIR() struct stat sa, sb; /* curdir is cwd... */ - cwd = dogetcwd(); + cwd = getcwd(NULL, 0); if (cwd == NULL) err(2, "getcwd"); diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c index 039bd4aa5..7577b15f8 100644 --- a/usr.bin/make/make.c +++ b/usr.bin/make/make.c @@ -1,4 +1,4 @@ -/* $OpenBSD: make.c,v 1.83 2023/07/08 18:42:27 espie Exp $ */ +/* $OpenBSD: make.c,v 1.84 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */ /* @@ -64,7 +64,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "dir.h" #include "job.h" diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c index 04a915c9f..2a2f2b6ad 100644 --- a/usr.bin/make/parse.c +++ b/usr.bin/make/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.135 2023/05/30 04:42:21 espie Exp $ */ +/* $OpenBSD: parse.c,v 1.136 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* @@ -68,7 +68,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "dir.h" #include "direxpand.h" @@ -1555,23 +1554,20 @@ parse_as_special_line(Buffer buf, Buffer copy, const char *line) { if (*line == '.' && handle_bsd_command(buf, copy, line+1)) return true; - if (FEATURES(FEATURE_SYSVINCLUDE) && - strncmp(line, "include", 7) == 0 && + if (strncmp(line, "include", 7) == 0 && ISSPACE(line[7]) && strchr(line, ':') == NULL) { /* It's an S3/S5-style "include". */ lookup_sysv_include(line + 7, "include"); return true; } - if (FEATURES(FEATURE_CONDINCLUDE) && - strncmp(line, "sinclude", 8) == 0 && + if (strncmp(line, "sinclude", 8) == 0 && ISSPACE(line[8]) && strchr(line, ':') == NULL) { lookup_conditional_include(line+8, "sinclude"); return true; } - if (FEATURES(FEATURE_CONDINCLUDE) && - strncmp(line, "-include", 8) == 0 && + if (strncmp(line, "-include", 8) == 0 && ISSPACE(line[8]) && strchr(line, ':') == NULL) { lookup_conditional_include(line+8, "-include"); diff --git a/usr.bin/make/parsevar.c b/usr.bin/make/parsevar.c index 807912727..c90ed89e0 100644 --- a/usr.bin/make/parsevar.c +++ b/usr.bin/make/parsevar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parsevar.c,v 1.16 2016/10/23 14:54:14 espie Exp $ */ +/* $OpenBSD: parsevar.c,v 1.17 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */ /* @@ -30,7 +30,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "var.h" #include "varname.h" @@ -84,8 +83,7 @@ parse_variable_assignment(const char *line, int ctxt) int type; struct Name name; - arg = VarName_Get(line, &name, NULL, true, - FEATURES(FEATURE_SUNSHCMD) ? find_op1 : find_op2); + arg = VarName_Get(line, &name, NULL, true, find_op1); while (ISSPACE(*arg)) arg++; @@ -113,8 +111,7 @@ parse_variable_assignment(const char *line, int ctxt) break; case ':': - if (FEATURES(FEATURE_SUNSHCMD) && - strncmp(arg, "sh", 2) == 0) { + if (strncmp(arg, "sh", 2) == 0) { type = VAR_SUNSHELL; arg += 2; while (*arg != '=' && *arg != '\0') diff --git a/usr.bin/make/stats.c b/usr.bin/make/stats.c index e20cf1fe9..b02ed64cd 100644 --- a/usr.bin/make/stats.c +++ b/usr.bin/make/stats.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stats.c,v 1.11 2014/04/22 12:21:17 espie Exp $ */ +/* $OpenBSD: stats.c,v 1.12 2023/09/04 11:35:11 espie Exp $ */ /* * Copyright (c) 1999 Marc Espie. @@ -34,7 +34,6 @@ to allow for concurrent adjustment to variables. */ -#include "config.h" #include "defines.h" #include "stats.h" diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c index 8e92350ed..ce25b172d 100644 --- a/usr.bin/make/str.c +++ b/usr.bin/make/str.c @@ -1,4 +1,4 @@ -/* $OpenBSD: str.c,v 1.32 2019/05/21 17:21:02 espie Exp $ */ +/* $OpenBSD: str.c,v 1.33 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: str.c,v 1.13 1996/11/06 17:59:23 christos Exp $ */ /*- @@ -37,7 +37,6 @@ #include #include -#include "config.h" #include "defines.h" #include "str.h" #include "memory.h" diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c index 842dbcc4c..4eba326b9 100644 --- a/usr.bin/make/suff.c +++ b/usr.bin/make/suff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: suff.c,v 1.102 2020/01/13 15:41:53 espie Exp $ */ +/* $OpenBSD: suff.c,v 1.103 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */ /* @@ -48,7 +48,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "dir.h" #include "engine.h" diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c index 981179d0b..a6dc2f9df 100644 --- a/usr.bin/make/targ.c +++ b/usr.bin/make/targ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: targ.c,v 1.85 2020/01/26 12:41:21 espie Exp $ */ +/* $OpenBSD: targ.c,v 1.86 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */ /* @@ -102,7 +102,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "stats.h" #include "suff.h" diff --git a/usr.bin/make/targequiv.c b/usr.bin/make/targequiv.c index 290e82429..53bdca26f 100644 --- a/usr.bin/make/targequiv.c +++ b/usr.bin/make/targequiv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: targequiv.c,v 1.9 2019/12/21 15:29:25 espie Exp $ */ +/* $OpenBSD: targequiv.c,v 1.10 2023/09/04 11:35:11 espie Exp $ */ /* * Copyright (c) 2007-2008 Marc Espie. * @@ -37,7 +37,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "memory.h" #include "gnode.h" diff --git a/usr.bin/make/timestamp.c b/usr.bin/make/timestamp.c index ad1a28288..2029d6b62 100644 --- a/usr.bin/make/timestamp.c +++ b/usr.bin/make/timestamp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: timestamp.c,v 1.10 2013/05/22 12:14:08 espie Exp $ */ +/* $OpenBSD: timestamp.c,v 1.11 2023/09/04 11:35:11 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -27,7 +27,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "timestamp.h" diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index 1e0cbfe4f..09ae6d9ef 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -1,4 +1,4 @@ -/* $OpenBSD: var.c,v 1.105 2023/08/10 10:52:43 espie Exp $ */ +/* $OpenBSD: var.c,v 1.106 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */ /* @@ -69,7 +69,6 @@ #include #include -#include "config.h" #include "defines.h" #include "buf.h" #include "cmd_exec.h" diff --git a/usr.bin/make/varmodifiers.c b/usr.bin/make/varmodifiers.c index 2fe655947..ea457a3a0 100644 --- a/usr.bin/make/varmodifiers.c +++ b/usr.bin/make/varmodifiers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: varmodifiers.c,v 1.48 2020/08/30 12:16:04 tb Exp $ */ +/* $OpenBSD: varmodifiers.c,v 1.49 2023/09/04 11:35:11 espie Exp $ */ /* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */ /* @@ -65,6 +65,7 @@ * is also called directly by Var_SubstVar. */ +#include #include #include #include @@ -72,7 +73,6 @@ #include #include #include -#include "config.h" #include "defines.h" #include "buf.h" #include "var.h" @@ -100,7 +100,7 @@ #define VAR_BANG_EQUAL 0x100 typedef struct { - char *lbuffer; /* left string to free */ + char *lbuffer; /* Left string to free */ char *lhs; /* String to match */ size_t leftLen; /* Length of string */ char *rhs; /* Replacement string (w/ &'s removed) */ @@ -108,12 +108,6 @@ typedef struct { int flags; } VarPattern; -struct LoopStuff { - struct LoopVar *var; - char *expand; - bool err; -}; - static bool VarHead(struct Name *, bool, Buffer, void *); static bool VarTail(struct Name *, bool, Buffer, void *); static bool VarSuffix(struct Name *, bool, Buffer, void *); @@ -121,8 +115,6 @@ static bool VarRoot(struct Name *, bool, Buffer, void *); static bool VarMatch(struct Name *, bool, Buffer, void *); static bool VarSYSVMatch(struct Name *, bool, Buffer, void *); static bool VarNoMatch(struct Name *, bool, Buffer, void *); -static bool VarUniq(struct Name *, bool, Buffer, void *); -static bool VarLoop(struct Name *, bool, Buffer, void *); static void VarREError(int, regex_t *, const char *); @@ -149,62 +141,36 @@ static char *do_upper(const char *, const struct Name *, void *); static char *do_lower(const char *, const struct Name *, void *); static void *check_shcmd(const char **, SymTable *, bool, int); static char *do_shcmd(const char *, const struct Name *, void *); -static char *do_sort(const char *, const struct Name *, void *); -static char *finish_loop(const char *, const struct Name *, void *); -static int NameCompare(const void *, const void *); -static char *do_label(const char *, const struct Name *, void *); -static char *do_path(const char *, const struct Name *, void *); -static char *do_def(const char *, const struct Name *, void *); -static char *do_undef(const char *, const struct Name *, void *); -static char *do_assign(const char *, const struct Name *, void *); -static char *do_exec(const char *, const struct Name *, void *); - -static void *assign_get_value(const char **, SymTable *, bool, int); -static void *get_cmd(const char **, SymTable *, bool, int); -static void *get_value(const char **, SymTable *, bool, int); static void *get_stringarg(const char **, SymTable *, bool, int); static void free_stringarg(void *); static void *get_patternarg(const char **, SymTable *, bool, int); static void *get_spatternarg(const char **, SymTable *, bool, int); static void *common_get_patternarg(const char **, SymTable *, bool, int, bool); static void free_patternarg(void *); -static void free_looparg(void *); static void *get_sysvpattern(const char **, SymTable *, bool, int); -static void *get_loop(const char **, SymTable *, bool, int); -static char *LoopGrab(const char **); static struct Name dummy; static struct Name *dummy_arg = &dummy; static struct modifier { - bool atstart; void * (*getarg)(const char **, SymTable *, bool, int); char * (*apply)(const char *, const struct Name *, void *); bool (*word_apply)(struct Name *, bool, Buffer, void *); void (*freearg)(void *); } *choose_mod[256], - match_mod = {false, get_stringarg, NULL, VarMatch, free_stringarg}, - nomatch_mod = {false, get_stringarg, NULL, VarNoMatch, free_stringarg}, - subst_mod = {false, get_spatternarg, NULL, VarSubstitute, free_patternarg}, - resubst_mod = {false, get_patternarg, do_regex, NULL, free_patternarg}, - quote_mod = {false, check_quote, VarQuote, NULL , free}, - tail_mod = {false, check_empty, NULL, VarTail, NULL}, - head_mod = {false, check_empty, NULL, VarHead, NULL}, - suffix_mod = {false, check_empty, NULL, VarSuffix, NULL}, - root_mod = {false, check_empty, NULL, VarRoot, NULL}, - upper_mod = {false, check_empty, do_upper, NULL, NULL}, - lower_mod = {false, check_empty, do_lower, NULL, NULL}, - shcmd_mod = {false, check_shcmd, do_shcmd, NULL, NULL}, - sysv_mod = {false, get_sysvpattern, NULL, VarSYSVMatch, free_patternarg}, - uniq_mod = {false, check_empty, NULL, VarUniq, NULL}, - sort_mod = {false, check_empty, do_sort, NULL, NULL}, - loop_mod = {false, get_loop, finish_loop, VarLoop, free_looparg}, - undef_mod = {true, get_value, do_undef, NULL, NULL}, - def_mod = {true, get_value, do_def, NULL, NULL}, - label_mod = {true, check_empty, do_label, NULL, NULL}, - path_mod = {true, check_empty, do_path, NULL, NULL}, - assign_mod = {true, assign_get_value, do_assign, NULL, free_patternarg}, - exec_mod = {true, get_cmd, do_exec, NULL, free_patternarg} + match_mod = {get_stringarg, NULL, VarMatch, free_stringarg}, + nomatch_mod = {get_stringarg, NULL, VarNoMatch, free_stringarg}, + subst_mod = {get_spatternarg, NULL, VarSubstitute, free_patternarg}, + resubst_mod = {get_patternarg, do_regex, NULL, free_patternarg}, + quote_mod = {check_quote, VarQuote, NULL , free}, + tail_mod = {check_empty, NULL, VarTail, NULL}, + head_mod = {check_empty, NULL, VarHead, NULL}, + suffix_mod = {check_empty, NULL, VarSuffix, NULL}, + root_mod = {check_empty, NULL, VarRoot, NULL}, + upper_mod = {check_empty, do_upper, NULL, NULL}, + lower_mod = {check_empty, do_lower, NULL, NULL}, + shcmd_mod = {check_shcmd, do_shcmd, NULL, NULL}, + sysv_mod = {get_sysvpattern, NULL, VarSYSVMatch, free_patternarg} ; void @@ -219,27 +185,9 @@ VarModifiers_Init() choose_mod['H'] = &head_mod; choose_mod['E'] = &suffix_mod; choose_mod['R'] = &root_mod; - if (FEATURES(FEATURE_UPPERLOWER)) { - choose_mod['U'] = &upper_mod; - choose_mod['L'] = &lower_mod; - } - if (FEATURES(FEATURE_SUNSHCMD)) - choose_mod['s'] = &shcmd_mod; - if (FEATURES(FEATURE_UNIQ)) - choose_mod['u'] = &uniq_mod; - if (FEATURES(FEATURE_SORT)) - choose_mod['O'] = &sort_mod; - if (FEATURES(FEATURE_ODE)) { - choose_mod['@'] = &loop_mod; - choose_mod['D'] = &def_mod; - choose_mod['U'] = &undef_mod; - choose_mod['L'] = &label_mod; - choose_mod['P'] = &path_mod; - } - if (FEATURES(FEATURE_ASSIGN)) - choose_mod[':'] = &assign_mod; - if (FEATURES(FEATURE_EXECMOD)) - choose_mod['!'] = &exec_mod; + choose_mod['U'] = &upper_mod; + choose_mod['L'] = &lower_mod; + choose_mod['s'] = &shcmd_mod; } /* All modifiers handle addSpace (need to add a space before placing the @@ -345,8 +293,7 @@ VarRoot(struct Name *word, bool addSpace, Buffer buf, void *dummy UNUSED) *----------------------------------------------------------------------- */ static bool -VarMatch(struct Name *word, bool addSpace, Buffer buf, - void *pattern) /* Pattern the word must match */ +VarMatch(struct Name *word, bool addSpace, Buffer buf, void *pattern) { const char *pat = pattern; @@ -366,8 +313,7 @@ VarMatch(struct Name *word, bool addSpace, Buffer buf, *----------------------------------------------------------------------- */ static bool -VarNoMatch(struct Name *word, bool addSpace, Buffer buf, - void *pattern) /* Pattern the word must not match */ +VarNoMatch(struct Name *word, bool addSpace, Buffer buf, void *pattern) { const char *pat = pattern; @@ -380,198 +326,6 @@ VarNoMatch(struct Name *word, bool addSpace, Buffer buf, return addSpace; } -static bool -VarUniq(struct Name *word, bool addSpace, Buffer buf, void *lastp) -{ - struct Name *last = lastp; - - /* does not match */ - if (last->s == NULL || last->e - last->s != word->e - word->s || - strncmp(word->s, last->s, word->e - word->s) != 0) { - if (addSpace) - Buf_AddSpace(buf); - Buf_Addi(buf, word->s, word->e); - addSpace = true; - } - last->s = word->s; - last->e = word->e; - return addSpace; -} - -static bool -VarLoop(struct Name *word, bool addSpace, Buffer buf, void *vp) -{ - struct LoopStuff *v = vp; - - if (addSpace) - Buf_AddSpace(buf); - Var_SubstVar(buf, v->expand, v->var, word->s); - return true; -} - -static char * -finish_loop(const char *s, const struct Name *n UNUSED , void *p) -{ - struct LoopStuff *l = p; - - return Var_Subst(s, NULL, l->err); -} - -static int -NameCompare(const void *ap, const void *bp) -{ - const struct Name *a, *b; - size_t n, m; - int c; - - a = ap; - b = bp; - n = a->e - a->s; - m = b->e - b->s; - if (n < m) { - c = strncmp(a->s, b->s, n); - if (c != 0) - return c; - else - return -1; - } else if (m < n) { - c = strncmp(a->s, b->s, m); - if (c != 0) - return c; - else - return 1; - } else - return strncmp(a->s, b->s, n); -} - -static char * -do_sort(const char *s, const struct Name *dummy UNUSED, void *arg UNUSED) -{ - struct Name *t; - unsigned long n, i, j; - const char *start, *end; - - n = 1024; /* start at 1024 words */ - t = ereallocarray(NULL, n, sizeof(struct Name)); - start = s; - end = start; - - for (i = 0;; i++) { - if (i == n) { - n *= 2; - t = ereallocarray(t, n, sizeof(struct Name)); - } - start = iterate_words(&end); - if (start == NULL) - break; - t[i].s = start; - t[i].e = end; - } - if (i > 0) { - BUFFER buf; - - Buf_Init(&buf, end - s); - qsort(t, i, sizeof(struct Name), NameCompare); - Buf_Addi(&buf, t[0].s, t[0].e); - for (j = 1; j < i; j++) { - Buf_AddSpace(&buf); - Buf_Addi(&buf, t[j].s, t[j].e); - } - free(t); - return Buf_Retrieve(&buf); - } else { - free(t); - return ""; - } -} - -static char * -do_label(const char *s UNUSED, const struct Name *n, void *arg UNUSED) -{ - return Str_dupi(n->s, n->e); -} - -static char * -do_path(const char *s UNUSED, const struct Name *n, void *arg UNUSED) -{ - GNode *gn; - - gn = Targ_FindNodei(n->s, n->e, TARG_NOCREATE); - if (gn == NULL) - return Str_dupi(n->s, n->e); - else - return strdup(gn->path); -} - -static char * -do_def(const char *s, const struct Name *n UNUSED, void *arg) -{ - VarPattern *v = arg; - if (s == NULL) { - free_patternarg(v); - return NULL; - } else - return v->lbuffer; -} - -static char * -do_undef(const char *s, const struct Name *n UNUSED, void *arg) -{ - VarPattern *v = arg; - if (s != NULL) { - free_patternarg(v); - return NULL; - } else - return v->lbuffer; -} - -static char * -do_assign(const char *s, const struct Name *n, void *arg) -{ - VarPattern *v = arg; - char *msg; - char *result; - - switch (v->flags) { - case VAR_EQUAL: - Var_Seti(n->s, n->e, v->lbuffer); - break; - case VAR_MAY_EQUAL: - if (s == NULL) - Var_Seti(n->s, n->e, v->lbuffer); - break; - case VAR_ADD_EQUAL: - if (s == NULL) - Var_Seti(n->s, n->e, v->lbuffer); - else - Var_Appendi(n->s, n->e, v->lbuffer); - break; - case VAR_BANG_EQUAL: - result = Cmd_Exec(v->lbuffer, &msg); - if (result != NULL) { - Var_Seti(n->s, n->e, result); - free(result); - } else - Error(msg, v->lbuffer); - break; - - } - return NULL; -} - -static char * -do_exec(const char *s UNUSED, const struct Name *n UNUSED, void *arg) -{ - VarPattern *v = arg; - char *msg; - char *result; - - result = Cmd_Exec(v->lbuffer, &msg); - if (result == NULL) - Error(msg, v->lbuffer); - return result; -} - /*- *----------------------------------------------------------------------- * VarSYSVMatch -- @@ -958,7 +712,7 @@ VarRESubstitute(struct Name *word, bool addSpace, Buffer buf, void *patternp) *----------------------------------------------------------------------- * VarModify -- * Modify each of the words of the passed string using the given - * function. Used to implement all modifiers. + * function. Used to implement most modifiers. * * Results: * A string of all the words modified appropriately. @@ -1218,56 +972,6 @@ get_spatternarg(const char **p, SymTable *ctxt, bool err, int endc) return common_get_patternarg(p, ctxt, err, endc, true); } -static void -free_looparg(void *arg) -{ - struct LoopStuff *l = arg; - - Var_DeleteLoopVar(l->var); - free(l->expand); -} - -static char * -LoopGrab(const char **s) -{ - const char *p, *start; - - start = *s; - for (p = start; *p != '@'; p++) { - if (*p == '\\') - p++; - if (*p == 0) - return NULL; - } - *s = p+1; - return escape_dupi(start, p, "@\\"); -} - -static void * -get_loop(const char **p, SymTable *ctxt UNUSED, bool err, int endc) -{ - static struct LoopStuff loop; - const char *s; - const char *var; - - s = *p +1; - - loop.var = NULL; - loop.expand = NULL; - loop.err = err; - var = LoopGrab(&s); - if (var != NULL) { - loop.expand = LoopGrab(&s); - if (*s == endc || *s == ':') { - *p = s; - loop.var = Var_NewLoopVar(var, NULL); - return &loop; - } - } - free_looparg(&loop); - return NULL; -} - static void * common_get_patternarg(const char **p, SymTable *ctxt, bool err, int endc, bool dosubst) @@ -1328,71 +1032,6 @@ common_get_patternarg(const char **p, SymTable *ctxt, bool err, int endc, return NULL; } -static void * -assign_get_value(const char **p, SymTable *ctxt, bool err, int endc) -{ - const char *s; - int flags; - VarPattern *arg; - - s = *p + 1; - if (s[0] == '=') - flags = VAR_EQUAL; - else if (s[0] == '?' && s[1] == '=') - flags = VAR_MAY_EQUAL; - else if (s[0] == '+' && s[1] == '=') - flags = VAR_ADD_EQUAL; - else if (s[0] == '!' && s[1] == '=') - flags = VAR_BANG_EQUAL; - else - return NULL; - - arg = get_value(&s, ctxt, err, endc); - if (arg != NULL) { - *p = s; - arg->flags = flags; - } - return arg; -} - -static void * -get_value(const char **p, SymTable *ctxt, bool err, int endc) -{ - VarPattern *pattern; - const char *s; - - pattern = emalloc(sizeof(VarPattern)); - s = *p + 1; - pattern->rhs = NULL; - pattern->lbuffer = VarGetPattern(ctxt, err, &s, ':', endc, - &pattern->leftLen, NULL); - if (s[-1] == endc || s[-1] == ':') { - *p = s-1; - return pattern; - } - free_patternarg(pattern); - return NULL; -} - -static void * -get_cmd(const char **p, SymTable *ctxt, bool err, int endc UNUSED) -{ - VarPattern *pattern; - const char *s; - - pattern = emalloc(sizeof(VarPattern)); - s = *p + 1; - pattern->rhs = NULL; - pattern->lbuffer = VarGetPattern(ctxt, err, &s, '!', '!', - &pattern->leftLen, NULL); - if (s[-1] == '!') { - *p = s-1; - return pattern; - } - free_patternarg(pattern); - return NULL; -} - static void free_patternarg(void *p) { @@ -1435,7 +1074,6 @@ VarModifiers_Apply(char *str, const struct Name *name, SymTable *ctxt, bool err, bool *freePtr, const char **pscan, int paren) { const char *tstr; - bool atstart; /* Some ODE modifiers only make sense at start */ char endc = paren == '(' ? ')' : '}'; const char *start = *pscan; @@ -1462,7 +1100,6 @@ VarModifiers_Apply(char *str, const struct Name *name, SymTable *ctxt, * the invocation. */ - atstart = true; while (*tstr != endc && *tstr != '\0') { struct modifier *mod; void *arg; @@ -1479,26 +1116,18 @@ VarModifiers_Apply(char *str, const struct Name *name, SymTable *ctxt, mod = choose_mod[(unsigned char)*tstr]; arg = NULL; - if (mod != NULL && (!mod->atstart || atstart)) + if (mod != NULL) arg = mod->getarg(&tstr, ctxt, err, endc); - if (FEATURES(FEATURE_SYSVVARSUB) && arg == NULL) { + if (arg == NULL) { mod = &sysv_mod; arg = mod->getarg(&tstr, ctxt, err, endc); } - atstart = false; if (arg != NULL) { - if (str != NULL || (mod->atstart && name != NULL)) { + if (str != NULL) { if (mod->word_apply != NULL) { newStr = VarModify(str, mod->word_apply, arg); - if (mod->apply != NULL) { - char *newStr2; - - newStr2 = mod->apply(newStr, - name, arg); - free(newStr); - newStr = newStr2; - } + assert(mod->apply == NULL); } else newStr = mod->apply(str, name, arg); if (*freePtr) diff --git a/usr.bin/make/varname.c b/usr.bin/make/varname.c index 23c73790a..6053e8946 100644 --- a/usr.bin/make/varname.c +++ b/usr.bin/make/varname.c @@ -1,4 +1,4 @@ -/* $OpenBSD: varname.c,v 1.6 2012/08/25 08:12:56 espie Exp $ */ +/* $OpenBSD: varname.c,v 1.7 2023/09/04 11:35:11 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. * @@ -25,7 +25,6 @@ */ #include -#include "config.h" #include "defines.h" #include "var.h" #include "buf.h" @@ -39,11 +38,6 @@ VarName_Get(const char *start, struct Name *name, SymTable *ctxt, bool err, size_t len; p = cont(start); - /* If we don't want recursive variables, we skip over '$' */ - if (!FEATURES(FEATURE_RECVARS)) { - while (*p == '$') - p = cont(p+1); - } if (*p != '$') { name->s = start; name->e = p; diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index 280f36539..fe8e5a2b1 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.262 2021/10/04 21:28:50 schwarze Exp $ */ +/* $OpenBSD: main.c,v 1.263 2023/09/04 13:08:11 schwarze Exp $ */ /* * Copyright (c) 2010-2012, 2014-2021 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons @@ -504,7 +504,8 @@ main(int argc, char *argv[]) best_prio = 40; for (ib = i = 0; i < resnsz; i++) { - sec = resn[i].file; + sec = resn[i].file + + strlen(conf.manpath.paths[resn[i].ipath]); sec += strcspn(sec, "123456789"); if (sec[0] == '\0') continue; /* No section at all. */ diff --git a/usr.bin/ssh/ssh-keygen.1 b/usr.bin/ssh/ssh-keygen.1 index c760f91be..c392141ea 100644 --- a/usr.bin/ssh/ssh-keygen.1 +++ b/usr.bin/ssh/ssh-keygen.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ssh-keygen.1,v 1.229 2023/07/23 20:04:45 naddy Exp $ +.\" $OpenBSD: ssh-keygen.1,v 1.230 2023/09/04 10:29:58 job Exp $ .\" .\" Author: Tatu Ylonen .\" Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -35,7 +35,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: July 23 2023 $ +.Dd $Mdocdate: September 4 2023 $ .Dt SSH-KEYGEN 1 .Os .Sh NAME @@ -185,7 +185,7 @@ The type of key to be generated is specified with the option. If invoked without any arguments, .Nm -will generate an RSA key. +will generate an Ed25519 key. .Pp .Nm is also used to generate groups for use in Diffie-Hellman group diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c index 7d7a78c54..56a11a6dd 100644 --- a/usr.bin/ssh/ssh-keygen.c +++ b/usr.bin/ssh/ssh-keygen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-keygen.c,v 1.470 2023/07/17 04:01:10 djm Exp $ */ +/* $OpenBSD: ssh-keygen.c,v 1.471 2023/09/04 10:29:58 job Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1994 Tatu Ylonen , Espoo, Finland @@ -61,11 +61,7 @@ #include "ssh-pkcs11.h" #endif -#ifdef WITH_OPENSSL -# define DEFAULT_KEY_TYPE_NAME "rsa" -#else -# define DEFAULT_KEY_TYPE_NAME "ed25519" -#endif +#define DEFAULT_KEY_TYPE_NAME "ed25519" /* * Default number of bits in the RSA, DSA and ECDSA keys. These value can be @@ -252,7 +248,7 @@ ask_filename(struct passwd *pw, const char *prompt) char *name = NULL; if (key_type_name == NULL) - name = _PATH_SSH_CLIENT_ID_RSA; + name = _PATH_SSH_CLIENT_ID_ED25519; else { switch (sshkey_type_from_name(key_type_name)) { case KEY_DSA_CERT: diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 58454d519..741dfd3e1 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.343 2023/09/01 14:29:11 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.344 2023/09/04 08:01:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -295,6 +295,7 @@ struct window_copy_mode_data { int timeout; /* search has timed out */ #define WINDOW_COPY_SEARCH_TIMEOUT 10000 #define WINDOW_COPY_SEARCH_ALL_TIMEOUT 200 +#define WINDOW_COPY_SEARCH_MAX_LINE 2000 int jumptype; struct utf8_data *jumpchar; @@ -3205,7 +3206,9 @@ window_copy_search_lr_regex(struct grid *gd, u_int *ppx, u_int *psx, u_int py, len = gd->sx - first; endline = gd->hsize + gd->sy - 1; pywrap = py; - while (buf != NULL && pywrap <= endline) { + while (buf != NULL && + pywrap <= endline && + len < WINDOW_COPY_SEARCH_MAX_LINE) { gl = grid_get_line(gd, pywrap); if (~gl->flags & GRID_LINE_WRAPPED) break; @@ -3262,7 +3265,9 @@ window_copy_search_rl_regex(struct grid *gd, u_int *ppx, u_int *psx, u_int py, len = gd->sx - first; endline = gd->hsize + gd->sy - 1; pywrap = py; - while (buf != NULL && (pywrap <= endline)) { + while (buf != NULL && + pywrap <= endline && + len < WINDOW_COPY_SEARCH_MAX_LINE) { gl = grid_get_line(gd, pywrap); if (~gl->flags & GRID_LINE_WRAPPED) break; @@ -3601,10 +3606,11 @@ window_copy_search_jump(struct window_mode_entry *wme, struct grid *gd, struct grid *sgd, u_int fx, u_int fy, u_int endline, int cis, int wrap, int direction, int regex) { - u_int i, px, sx, ssize = 1; - int found = 0, cflags = REG_EXTENDED; - char *sbuf; - regex_t reg; + u_int i, px, sx, ssize = 1; + int found = 0, cflags = REG_EXTENDED; + char *sbuf; + regex_t reg; + struct grid_line *gl; if (regex) { sbuf = xmalloc(ssize); @@ -3621,6 +3627,9 @@ window_copy_search_jump(struct window_mode_entry *wme, struct grid *gd, if (direction) { for (i = fy; i <= endline; i++) { + gl = grid_get_line(gd, i); + if (i != endline && gl->flags & GRID_LINE_WRAPPED) + continue; if (regex) { found = window_copy_search_lr_regex(gd, &px, &sx, i, fx, gd->sx, ®); @@ -3634,6 +3643,9 @@ window_copy_search_jump(struct window_mode_entry *wme, struct grid *gd, } } else { for (i = fy + 1; endline < i; i--) { + gl = grid_get_line(gd, i - 1); + if (i != endline && gl->flags & GRID_LINE_WRAPPED) + continue; if (regex) { found = window_copy_search_rl_regex(gd, &px, &sx, i - 1, 0, fx + 1, ®); diff --git a/usr.sbin/dhcpd/dhcpd.8 b/usr.sbin/dhcpd/dhcpd.8 index 858535043..d40e3feaf 100644 --- a/usr.sbin/dhcpd/dhcpd.8 +++ b/usr.sbin/dhcpd/dhcpd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: dhcpd.8,v 1.32 2023/09/03 20:19:13 stsp Exp $ +.\" $OpenBSD: dhcpd.8,v 1.33 2023/09/04 16:11:00 jmc Exp $ .\" .\" Copyright (c) 1995, 1996 The Internet Software Consortium. .\" All rights reserved. @@ -36,7 +36,7 @@ .\" see ``http://www.isc.org/''. To learn more about Vixie .\" Enterprises, see ``http://www.vix.com''. .\" -.Dd $Mdocdate: September 3 2023 $ +.Dd $Mdocdate: September 4 2023 $ .Dt DHCPD 8 .Os .Sh NAME @@ -92,6 +92,12 @@ to renew them in order to continue to use the addresses. Once a lease has expired, the client to which that lease was assigned is no longer permitted to use the leased IP address. .Pp +Whenever changes are made to the +.Pa dhcpd.conf +file, +.Nm +must be restarted. +.Pp In order to keep track of leases across system reboots and server restarts, .Nm keeps a list of leases it has assigned in the @@ -112,60 +118,34 @@ reads the .Pa dhcpd.leases file to refresh its memory about what leases have been assigned. .Pp -BOOTP support is also provided by this server. -Unlike DHCP, the BOOTP protocol does not provide a protocol for recovering -dynamically-assigned addresses once they are no longer needed. -It is still possible to dynamically assign addresses to BOOTP clients, but -some administrative process for reclaiming addresses is required. -By default, leases are granted to BOOTP clients in perpetuity, although -the network administrator may set an earlier cutoff date or a shorter -lease length for BOOTP leases if that makes sense. -.Pp -BOOTP clients may also be served in the old standard way, which is -simply to provide a declaration in the -.Pa dhcpd.conf -file for each BOOTP client, permanently assigning an address to each client. -.Pp -Whenever changes are made to the -.Pa dhcpd.conf -file, +When .Nm -must be restarted. -Because the DHCP server database is not as lightweight as a BOOTP database, +starts up, it +identifies all network interfaces in all routing domains, +eliminating non-broadcast interfaces if possible, +and listens for DHCP broadcasts on each interface. +The names of the network interfaces on which .Nm -does not automatically restart itself when it sees a change to the -.Pa dhcpd.conf -file. +should listen for broadcasts may also be specified on the command line +on systems where +.Nm +is unable to identify non-broadcast interfaces. +.Pp +.Nm +normally runs in routing domain 0. +In order to run in another +.Xr rdomain 4 , +.Nm +needs to be started with a list of interfaces +which share the same routing domain, +which allows +.Nm +to set its own routing domain accordingly. .Pp DHCP traffic always bypasses IPsec. Otherwise there could be situations when a server has an IPsec SA for the client and sends replies over that, which a newly booted client would not be able to grasp. -.Sh COMMAND LINE -The names of the network interfaces on which -.Nm -should listen for broadcasts may be specified on the command line. -Listing interfaces on the command line is usually optional but is required -for running -.Nm -in an -.Xr rdomain 4 -other than 0, or on systems where -.Nm -is unable to identify non-broadcast interfaces. -All specified interfaces must share the same routing domain and -.Nm -will set its own routing domain accordingly. -.Pp -If no interface names are specified on the command line, -.Nm -will run in routing domain 0, and if the -.Fl u -option is not given -.Nm -will identify all network interfaces in all routing domains, -eliminating non-broadcast interfaces if possible, -and listen for DHCP broadcasts on each interface. .Pp The options are as follows: .Bl -tag -width Ds @@ -286,6 +266,21 @@ See also .Sx SYNCHRONISATION below. .El +.Sh BOOTP +.Nm +also provides BOOTP support. +Unlike DHCP, the BOOTP protocol does not provide a protocol for recovering +dynamically-assigned addresses once they are no longer needed. +It is still possible to dynamically assign addresses to BOOTP clients, but +some administrative process for reclaiming addresses is required. +By default, leases are granted to BOOTP clients in perpetuity, although +the network administrator may set an earlier cutoff date or a shorter +lease length for BOOTP leases if that makes sense. +.Pp +BOOTP clients may also be served in the old standard way, which is +simply to provide a declaration in the +.Pa dhcpd.conf +file for each BOOTP client, permanently assigning an address to each client. .Sh CONFIGURATION The syntax of the .Xr dhcpd.conf 5 diff --git a/usr.sbin/radiusd/parse.y b/usr.sbin/radiusd/parse.y index 619345550..ba3399fbf 100644 --- a/usr.sbin/radiusd/parse.y +++ b/usr.sbin/radiusd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.14 2023/08/18 06:37:20 yasuoka Exp $ */ +/* $OpenBSD: parse.y,v 1.15 2023/09/04 12:28:18 yasuoka Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -99,6 +99,7 @@ typedef struct { %type prefix %type yesno %type strnum +%type key %% grammar : /* empty */ @@ -276,7 +277,7 @@ module : MODULE LOAD STRING STRING { free($4); TAILQ_INSERT_TAIL(&conf->module, module, next); } - | MODULE SET STRING STRING str_l { + | MODULE SET STRING key str_l { struct radiusd_module *module; module = find_module($3); @@ -301,6 +302,11 @@ setstrerr: free_str_l(&$5); } ; + +key : STRING + | SECRET { $$ = strdup("secret"); } + ; + authenticate : AUTHENTICATE { radiusd_authentication_init(&authen); } str_l optnl '{' authopts '}' { diff --git a/usr.sbin/radiusd/radiusd.c b/usr.sbin/radiusd/radiusd.c index 717022308..143cd0d1a 100644 --- a/usr.sbin/radiusd/radiusd.c +++ b/usr.sbin/radiusd/radiusd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radiusd.c,v 1.28 2022/12/28 21:30:18 jmc Exp $ */ +/* $OpenBSD: radiusd.c,v 1.29 2023/09/04 10:50:52 yasuoka Exp $ */ /* * Copyright (c) 2013 Internet Initiative Japan Inc. @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -919,7 +918,7 @@ radiusd_module_load(struct radiusd *radiusd, const char *path, const char *name) { struct radiusd_module *module = NULL; pid_t pid; - int ival, pairsock[] = { -1, -1 }; + int pairsock[] = { -1, -1 }; const char *av[3]; ssize_t n; struct imsg imsg; @@ -929,7 +928,8 @@ radiusd_module_load(struct radiusd *radiusd, const char *path, const char *name) fatal("Out of memory"); module->radiusd = radiusd; - if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pairsock) == -1) { + if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, PF_UNSPEC, + pairsock) == -1) { log_warn("Could not load module `%s'(%s): pipe()", name, path); goto on_error; } @@ -956,16 +956,6 @@ radiusd_module_load(struct radiusd *radiusd, const char *path, const char *name) close(pairsock[1]); module->fd = pairsock[0]; - if ((ival = fcntl(module->fd, F_GETFL)) == -1) { - log_warn("Could not load module `%s': fcntl(F_GETFL)", - name); - goto on_error; - } - if (fcntl(module->fd, F_SETFL, ival | O_NONBLOCK) == -1) { - log_warn("Could not load module `%s': fcntl(F_SETFL,O_NONBLOCK)", - name); - goto on_error; - } strlcpy(module->name, name, sizeof(module->name)); module->pid = pid; imsg_init(&module->ibuf, module->fd); diff --git a/usr.sbin/radiusd/radiusd.conf.5 b/usr.sbin/radiusd/radiusd.conf.5 index 7da28773c..b2bd3f9d0 100644 --- a/usr.sbin/radiusd/radiusd.conf.5 +++ b/usr.sbin/radiusd/radiusd.conf.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: radiusd.conf.5,v 1.15 2022/12/13 00:59:53 yasuoka Exp $ +.\" $OpenBSD: radiusd.conf.5,v 1.16 2023/09/04 12:28:18 yasuoka Exp $ .\" .\" Copyright (c) 2014 Esdenera Networks GmbH .\" Copyright (c) 2014 Internet Initiative Japan Inc. @@ -15,7 +15,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: December 13 2022 $ +.Dd $Mdocdate: September 4 2023 $ .Dt RADIUSD.CONF 5 .Os .Sh NAME @@ -192,18 +192,18 @@ client 192.168.0.0/24 { msgauth-required yes } -module load "bsdauth" "/usr/libexec/radiusd/radiusd_bsdauth" -module set "bsdauth" "restrict-group" "operator" +module load bsdauth "/usr/libexec/radiusd/radiusd_bsdauth" +module set bsdauth restrict-group "operator" -module load "radius" "/usr/libexec/radiusd/radiusd_radius" -module set "radius" "secret" "testing123" -module set "radius" "server" "127.0.0.1" +module load radius "/usr/libexec/radiusd/radiusd_radius" +module set radius secret "testing123" +module set radius server "127.0.0.1" authenticate *@example.com { - authenticate-by "radius" + authenticate-by radius } authenticate * { - authenticate-by "bsdauth" + authenticate-by bsdauth } .Ed .Sh SEE ALSO diff --git a/usr.sbin/radiusd/radiusd_radius.c b/usr.sbin/radiusd/radiusd_radius.c index cbd44e93e..3b3b67ea5 100644 --- a/usr.sbin/radiusd/radiusd_radius.c +++ b/usr.sbin/radiusd/radiusd_radius.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radiusd_radius.c,v 1.18 2022/12/28 21:30:18 jmc Exp $ */ +/* $OpenBSD: radiusd_radius.c,v 1.19 2023/09/04 10:49:20 yasuoka Exp $ */ /* * Copyright (c) 2013 Internet Initiative Japan Inc. @@ -138,6 +138,8 @@ main(int argc, char *argv[]) module_start(module_radius.base); event_loop(0); + module_destroy(module_radius.base); + exit(EXIT_SUCCESS); } @@ -219,8 +221,7 @@ module_radius_config_set(void *ctx, const char *paramname, int paramvalc, } else if (strcmp(paramname, "_debug") == 0) log_init(1); else if (strncmp(paramname, "_", 1) == 0) - /* ignore all internal messages */ - module_send_message(module->base, IMSG_OK, NULL); + /* nothing */; /* ignore all internal messages */ else { module_send_message(module->base, IMSG_NG, "Unknown config parameter name `%s'", paramname);