CVS commit: src/sys/dev/pci

2023-10-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Oct 19 23:43:40 UTC 2023

Modified Files:
src/sys/dev/pci: if_rge.c

Log Message:
rge: properly handle mbuf allocation failures in rx interrupts

several changes that should fix crashes seen after an mbuf
allocation failure:

- create RX ring dma maps with BUS_DMA_ALLOCNOW, so that any
  future bus_dmamap_load*() call will succeed.  this avoids one
  error case in rge_newbuf(), that similar cases in eg wm(4)
  actually call panic for now (i think this idea can be copied
  into wm(4) as well.)

- extract the RX descriptor set into a common function that
  both rge_newbuf() and rge_rxeof() can both use.  it's almost
  identical to the old rge_discard_rxbuf() except it also sets
  the rge_addr (this is needed for the newbuf case.)

- move the bus_dmamap_unload() into rge_newbuf(), so that the
  existing mbuf will remain mapped until a new mbuf is allocated.
  (this part is what should fix crashes seen by wiz and Chavdar,
  as the unload follow by sync is what triggers the assert in
  x86 bus_dma.  without the assert, it will would have shortly
  triggered a page fault.)  remove the assignment to NULL for
  the rxq mbuf pointer, it is required for reload.

- add a couple of missing if_statinc() calls.

tested on amd64 and arm64.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/if_rge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.27 src/sys/dev/pci/if_rge.c:1.28
--- src/sys/dev/pci/if_rge.c:1.27	Mon Oct  9 11:55:22 2023
+++ src/sys/dev/pci/if_rge.c	Thu Oct 19 23:43:40 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.27 2023/10/09 11:55:22 riastradh Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.28 2023/10/19 23:43:40 mrg Exp $	*/
 /*	$OpenBSD: if_rge.c,v 1.9 2020/12/12 11:48:53 jan Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.27 2023/10/09 11:55:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.28 2023/10/19 23:43:40 mrg Exp $");
 
 #include 
 
@@ -106,7 +106,6 @@ int		rge_ifmedia_upd(struct ifnet *);
 void		rge_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 int		rge_allocmem(struct rge_softc *);
 int		rge_newbuf(struct rge_softc *, int);
-void		rge_discard_rxbuf(struct rge_softc *, int);
 static int	rge_rx_list_init(struct rge_softc *);
 static void	rge_rx_list_fini(struct rge_softc *);
 static void	rge_tx_list_init(struct rge_softc *);
@@ -976,6 +975,9 @@ rge_ifmedia_sts(struct ifnet *ifp, struc
 
 /*
  * Allocate memory for RX/TX rings.
+ *
+ * XXX There is no tear-down for this if it any part fails, so everything
+ * remains allocated.
  */
 int
 rge_allocmem(struct rge_softc *sc)
@@ -1071,10 +1073,13 @@ rge_allocmem(struct rge_softc *sc)
 		return (error);
 	}
 
-	/* Create DMA maps for RX buffers. */
+	/*
+	 * Create DMA maps for RX buffers.  Use BUS_DMA_ALLOCNOW to avoid any
+	 * potential failure in bus_dmamap_load_mbuf() in the RX path.
+	 */
 	for (i = 0; i < RGE_RX_LIST_CNT; i++) {
 		error = bus_dmamap_create(sc->sc_dmat, RGE_JUMBO_FRAMELEN, 1,
-		RGE_JUMBO_FRAMELEN, 0, 0,
+		RGE_JUMBO_FRAMELEN, 0, BUS_DMA_ALLOCNOW,
 		>rge_ldata.rge_rxq[i].rxq_dmamap);
 		if (error) {
 			aprint_error_dev(sc->sc_dev, "can't create DMA map for RX\n");
@@ -1086,15 +1091,39 @@ rge_allocmem(struct rge_softc *sc)
 }
 
 /*
+ * Set an RX descriptor and sync it.
+ */
+static void
+rge_load_rxbuf(struct rge_softc *sc, int idx)
+{
+	struct rge_rx_desc *r = >rge_ldata.rge_rx_list[idx];
+	struct rge_rxq *rxq = >rge_ldata.rge_rxq[idx];
+	bus_dmamap_t rxmap = rxq->rxq_dmamap;
+	uint32_t cmdsts;
+
+	cmdsts = rxmap->dm_segs[0].ds_len | RGE_RDCMDSTS_OWN;
+	if (idx == RGE_RX_LIST_CNT - 1)
+		cmdsts |= RGE_RDCMDSTS_EOR;
+
+	r->hi_qword0.rge_addr = htole64(rxmap->dm_segs[0].ds_addr);
+	r->hi_qword1.rx_qword4.rge_extsts = 0;
+	r->hi_qword1.rx_qword4.rge_cmdsts = htole32(cmdsts);
+
+	bus_dmamap_sync(sc->sc_dmat, sc->rge_ldata.rge_rx_list_map,
+	idx * sizeof(struct rge_rx_desc), sizeof(struct rge_rx_desc),
+	BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+}
+
+/*
  * Initialize the RX descriptor and attach an mbuf cluster.
  */
 int
 rge_newbuf(struct rge_softc *sc, int idx)
 {
 	struct mbuf *m;
-	struct rge_rx_desc *r;
 	struct rge_rxq *rxq;
 	bus_dmamap_t rxmap;
+	int error __diagused;
 
 	m = MCLGETL(NULL, M_DONTWAIT, RGE_JUMBO_FRAMELEN);
 	if (m == NULL)
@@ -1105,53 +1134,22 @@ rge_newbuf(struct rge_softc *sc, int idx
 	rxq = >rge_ldata.rge_rxq[idx];
 	rxmap = rxq->rxq_dmamap;
 
-	if (bus_dmamap_load_mbuf(sc->sc_dmat, rxmap, m, BUS_DMA_NOWAIT))
-		goto out;
+	if (rxq->rxq_mbuf != NULL)
+		bus_dmamap_unload(sc->sc_dmat, rxq->rxq_dmamap);
+
+	/* This map was created with BUS_DMA_ALLOCNOW so should never fail. */
+	error = bus_dmamap_load_mbuf(sc->sc_dmat, rxmap, m, BUS_DMA_NOWAIT);
+	KASSERTMSG(error == 0, "error=%d", 

CVS commit: src/sys/dev/pci

2023-10-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Oct 19 23:43:40 UTC 2023

Modified Files:
src/sys/dev/pci: if_rge.c

Log Message:
rge: properly handle mbuf allocation failures in rx interrupts

several changes that should fix crashes seen after an mbuf
allocation failure:

- create RX ring dma maps with BUS_DMA_ALLOCNOW, so that any
  future bus_dmamap_load*() call will succeed.  this avoids one
  error case in rge_newbuf(), that similar cases in eg wm(4)
  actually call panic for now (i think this idea can be copied
  into wm(4) as well.)

- extract the RX descriptor set into a common function that
  both rge_newbuf() and rge_rxeof() can both use.  it's almost
  identical to the old rge_discard_rxbuf() except it also sets
  the rge_addr (this is needed for the newbuf case.)

- move the bus_dmamap_unload() into rge_newbuf(), so that the
  existing mbuf will remain mapped until a new mbuf is allocated.
  (this part is what should fix crashes seen by wiz and Chavdar,
  as the unload follow by sync is what triggers the assert in
  x86 bus_dma.  without the assert, it will would have shortly
  triggered a page fault.)  remove the assignment to NULL for
  the rxq mbuf pointer, it is required for reload.

- add a couple of missing if_statinc() calls.

tested on amd64 and arm64.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/if_rge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/next68k/next68k

2023-10-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Oct 19 22:07:13 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: rtc.c

Log Message:
Fix printf specifier for tvp->tv_sec from 0x%08x to 0x%08llx.
Remove printf secs argument for "Regs after:" printout, none expected.
Remove "Setting RTC to 0x%08x." and non existing secs arg from settime_old().
Code was changed with rev. 1.14 without fully adjusting DEBUG code.

Fixes RTC_DEBUG build for next68k.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/next68k/rtc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/next68k/next68k/rtc.c
diff -u src/sys/arch/next68k/next68k/rtc.c:1.19 src/sys/arch/next68k/next68k/rtc.c:1.20
--- src/sys/arch/next68k/next68k/rtc.c:1.19	Fri Feb  3 23:13:01 2023
+++ src/sys/arch/next68k/next68k/rtc.c	Thu Oct 19 22:07:13 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: rtc.c,v 1.19 2023/02/03 23:13:01 tsutsui Exp $*/
+/*  $NetBSD: rtc.c,v 1.20 2023/10/19 22:07:13 andvar Exp $*/
 /*
  * Copyright (c) 1998 Darrin Jewell
  * Copyright (c) 1997 Rolf Grossmann
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.19 2023/02/03 23:13:01 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.20 2023/10/19 22:07:13 andvar Exp $");
 
 #include 
 #include   /* for panic */
@@ -321,7 +321,7 @@ settime_old(todr_chip_handle_t tcr, stru
 	rtc_write(RTC_CONTROL, rtc_read(RTC_CONTROL) & ~RTC_START);
 
 #ifdef RTC_DEBUG
-	printf("Setting RTC to 0x%08x.  Regs before:\n", secs);
+	printf("Regs before:\n");
 	rtc_print();
 #endif
 
@@ -352,7 +352,7 @@ settime_old(todr_chip_handle_t tcr, stru
 	rtc_write(RTC_YR, bintobcd(dt->dt_year % 100));
 
 #ifdef RTC_DEBUG
-	printf("Regs after:\n", secs);
+	printf("Regs after:\n");
 	rtc_print();
 #endif
 
@@ -380,7 +380,7 @@ settime_new(todr_chip_handle_t tch, stru
 	rtc_write(RTC_CONTROL, rtc_read(RTC_CONTROL) & ~RTC_START);
 
 #ifdef RTC_DEBUG
-	printf("Setting RTC to 0x%08x.  Regs before:\n", tvp->tv_sec);
+	printf("Setting RTC to 0x%08llx.  Regs before:\n", tvp->tv_sec);
 	rtc_print();
 #endif
 
@@ -390,7 +390,7 @@ settime_new(todr_chip_handle_t tch, stru
 	rtc_write(RTC_CNTR3, (tvp->tv_sec) & 0xff);
 
 #ifdef RTC_DEBUG
-	printf("Regs after:\n", secs);
+	printf("Regs after:\n");
 	rtc_print();
 #endif
 



CVS commit: src/sys/arch/next68k/next68k

2023-10-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Oct 19 22:07:13 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: rtc.c

Log Message:
Fix printf specifier for tvp->tv_sec from 0x%08x to 0x%08llx.
Remove printf secs argument for "Regs after:" printout, none expected.
Remove "Setting RTC to 0x%08x." and non existing secs arg from settime_old().
Code was changed with rev. 1.14 without fully adjusting DEBUG code.

Fixes RTC_DEBUG build for next68k.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/next68k/rtc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/make/unit-tests

2023-10-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Oct 19 18:24:33 UTC 2023

Modified Files:
src/usr.bin/make/unit-tests: cond-short.exp cond-short.mk
directive-for.exp directive-for.mk directive-ifndef.mk
directive-include-guard.exp directive-include-guard.mk escape.exp
escape.mk hanoi-include.mk recursive.exp recursive.mk unexport.mk
var-eval-short.mk varmisc.exp varmisc.mk varmod-gmtime.mk

Log Message:
tests/make: clean up, explain and reorganize several tests


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-short.exp \
src/usr.bin/make/unit-tests/directive-include-guard.mk
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/cond-short.mk
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/directive-for.exp \
src/usr.bin/make/unit-tests/varmod-gmtime.mk
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/directive-for.mk
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/directive-ifndef.mk
cvs rdiff -u -r1.11 -r1.12 \
src/usr.bin/make/unit-tests/directive-include-guard.exp
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/escape.exp
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/escape.mk
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/hanoi-include.mk \
src/usr.bin/make/unit-tests/recursive.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/recursive.mk
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/unexport.mk
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/var-eval-short.mk
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varmisc.exp
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/make/unit-tests/varmisc.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/cond-short.exp
diff -u src/usr.bin/make/unit-tests/cond-short.exp:1.12 src/usr.bin/make/unit-tests/cond-short.exp:1.13
--- src/usr.bin/make/unit-tests/cond-short.exp:1.12	Sat Mar  4 13:42:36 2023
+++ src/usr.bin/make/unit-tests/cond-short.exp	Thu Oct 19 18:24:33 2023
@@ -7,7 +7,7 @@ expected M pattern
 expected or
 expected or exists
 expected or empty
-make: "cond-short.mk" line 214: Comparison with '<' requires both operands '' and '42' to be numeric
+make: "cond-short.mk" line 231: Comparison with '<' requires both operands '' and '42' to be numeric
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
Index: src/usr.bin/make/unit-tests/directive-include-guard.mk
diff -u src/usr.bin/make/unit-tests/directive-include-guard.mk:1.12 src/usr.bin/make/unit-tests/directive-include-guard.mk:1.13
--- src/usr.bin/make/unit-tests/directive-include-guard.mk:1.12	Fri Aug 11 04:56:31 2023
+++ src/usr.bin/make/unit-tests/directive-include-guard.mk	Thu Oct 19 18:24:33 2023
@@ -1,4 +1,4 @@
-# $NetBSD: directive-include-guard.mk,v 1.12 2023/08/11 04:56:31 rillig Exp $
+# $NetBSD: directive-include-guard.mk,v 1.13 2023/10/19 18:24:33 rillig Exp $
 #
 # Tests for multiple-inclusion guards in makefiles.
 #
@@ -15,8 +15,9 @@
 #	.endif
 #
 # When such a file is included for the second or later time, and the guard
-# variable or the guard target is defined, including the file has no effect,
-# as all its content is skipped.
+# variable or the guard target is defined, the file is skipped completely, as
+# including it would not have any effect, not even on the special variable
+# '.MAKE.MAKEFILES', as that variable skips duplicate pathnames.
 #
 # See also:
 #	https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
@@ -46,6 +47,25 @@ LINES.variable-ifndef-reuse= \
 # expect: Parse_PushInput: file variable-ifndef-reuse.tmp, line 1
 # expect: Skipping 'variable-ifndef-reuse.tmp' because 'VARIABLE_IFNDEF' is defined
 
+# The guard variable cannot be a number, as numbers are interpreted
+# differently from bare words.
+INCS+=	variable-ifndef-zero
+LINES.variable-ifndef-zero= \
+	'.ifndef 0e0' \
+	'syntax error' \
+	'.endif'
+# expect: Parse_PushInput: file variable-ifndef-zero.tmp, line 1
+# expect: Parse_PushInput: file variable-ifndef-zero.tmp, line 1
+
+# The guard variable cannot be a number, as numbers are interpreted
+# differently from bare words.
+INCS+=	variable-ifndef-one
+LINES.variable-ifndef-one= \
+	'.ifndef 1' \
+	'.endif'
+# expect: Parse_PushInput: file variable-ifndef-one.tmp, line 1
+# expect: Parse_PushInput: file variable-ifndef-one.tmp, line 1
+
 # Comments and empty lines do not affect the multiple-inclusion guard.
 INCS+=	comments
 LINES.comments= \
@@ -124,10 +144,10 @@ LINES.variable-name-exclamation= \
 # expect: Parse_PushInput: file variable-name-exclamation.tmp, line 1
 # expect: Parse_PushInput: file variable-name-exclamation.tmp, line 1
 
-# A variable name can contain a '!' in the middle, as that character is
-# interpreted as an ordinary character in conditions as well as on the left
-# side of a variable 

CVS commit: src/usr.bin/make/unit-tests

2023-10-19 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Oct 19 18:24:33 UTC 2023

Modified Files:
src/usr.bin/make/unit-tests: cond-short.exp cond-short.mk
directive-for.exp directive-for.mk directive-ifndef.mk
directive-include-guard.exp directive-include-guard.mk escape.exp
escape.mk hanoi-include.mk recursive.exp recursive.mk unexport.mk
var-eval-short.mk varmisc.exp varmisc.mk varmod-gmtime.mk

Log Message:
tests/make: clean up, explain and reorganize several tests


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/cond-short.exp \
src/usr.bin/make/unit-tests/directive-include-guard.mk
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/make/unit-tests/cond-short.mk
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/directive-for.exp \
src/usr.bin/make/unit-tests/varmod-gmtime.mk
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/directive-for.mk
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/directive-ifndef.mk
cvs rdiff -u -r1.11 -r1.12 \
src/usr.bin/make/unit-tests/directive-include-guard.exp
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/escape.exp
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/escape.mk
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/hanoi-include.mk \
src/usr.bin/make/unit-tests/recursive.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/recursive.mk
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/unexport.mk
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/var-eval-short.mk
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varmisc.exp
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/make/unit-tests/varmisc.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/x86

2023-10-19 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Oct 19 14:59:46 UTC 2023

Modified Files:
src/sys/arch/x86/acpi: acpi_wakeup.c
src/sys/arch/x86/x86: genfb_machdep.c

Log Message:
Move definition of acpi_md_vesa_modenum to acpi_wakeup.c; allows building
kernels without framebuffer devices.
Problem reported by John D. Baker on current-users@


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/x86/acpi/acpi_wakeup.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/x86/x86/genfb_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/acpi/acpi_wakeup.c
diff -u src/sys/arch/x86/acpi/acpi_wakeup.c:1.56 src/sys/arch/x86/acpi/acpi_wakeup.c:1.57
--- src/sys/arch/x86/acpi/acpi_wakeup.c:1.56	Mon Oct 16 17:27:02 2023
+++ src/sys/arch/x86/acpi/acpi_wakeup.c	Thu Oct 19 14:59:46 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_wakeup.c,v 1.56 2023/10/16 17:27:02 bouyer Exp $	*/
+/*	$NetBSD: acpi_wakeup.c,v 1.57 2023/10/19 14:59:46 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.56 2023/10/16 17:27:02 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.57 2023/10/19 14:59:46 bouyer Exp $");
 
 #include 
 #include 
@@ -106,6 +106,8 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.
 
 #ifdef XENPV
 #error acpi_wakeup.c (acpi_md_vesa_modenum) users must be adapted for Xen
+#else
+int acpi_md_vesa_modenum = 0;
 #endif
 
 /* Address is also hard-coded in acpi_wakecode.S */

Index: src/sys/arch/x86/x86/genfb_machdep.c
diff -u src/sys/arch/x86/x86/genfb_machdep.c:1.22 src/sys/arch/x86/x86/genfb_machdep.c:1.23
--- src/sys/arch/x86/x86/genfb_machdep.c:1.22	Tue Oct 17 12:07:42 2023
+++ src/sys/arch/x86/x86/genfb_machdep.c	Thu Oct 19 14:59:46 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_machdep.c,v 1.22 2023/10/17 12:07:42 bouyer Exp $ */
+/* $NetBSD: genfb_machdep.c,v 1.23 2023/10/19 14:59:46 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.22 2023/10/17 12:07:42 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.23 2023/10/19 14:59:46 bouyer Exp $");
 
 #include 
 #include 
@@ -64,10 +64,6 @@ __KERNEL_RCSID(0, "$NetBSD: genfb_machde
 struct vcons_screen x86_genfb_console_screen;
 bool x86_genfb_use_shadowfb = true;
 
-#if NACPICA > 0 && !defined(XENPV)
-int acpi_md_vesa_modenum = 0;
-#endif
-
 static device_t x86_genfb_console_dev = NULL;
 
 static struct wsscreen_descr x86_genfb_stdscreen = {



CVS commit: src/sys/arch/x86

2023-10-19 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Oct 19 14:59:46 UTC 2023

Modified Files:
src/sys/arch/x86/acpi: acpi_wakeup.c
src/sys/arch/x86/x86: genfb_machdep.c

Log Message:
Move definition of acpi_md_vesa_modenum to acpi_wakeup.c; allows building
kernels without framebuffer devices.
Problem reported by John D. Baker on current-users@


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/x86/acpi/acpi_wakeup.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/x86/x86/genfb_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/doc

2023-10-19 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Oct 19 12:32:14 UTC 2023

Modified Files:
src/doc: 3RDPARTY

Log Message:
doc: openssh 9.5p1 out


To generate a diff of this commit:
cvs rdiff -u -r1.1958 -r1.1959 src/doc/3RDPARTY

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/doc

2023-10-19 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Oct 19 12:32:14 UTC 2023

Modified Files:
src/doc: 3RDPARTY

Log Message:
doc: openssh 9.5p1 out


To generate a diff of this commit:
cvs rdiff -u -r1.1958 -r1.1959 src/doc/3RDPARTY

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1958 src/doc/3RDPARTY:1.1959
--- src/doc/3RDPARTY:1.1958	Thu Oct 19 11:27:57 2023
+++ src/doc/3RDPARTY	Thu Oct 19 12:32:13 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1958 2023/10/19 11:27:57 roy Exp $
+#	$NetBSD: 3RDPARTY,v 1.1959 2023/10/19 12:32:13 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1077,7 +1077,7 @@ Patch applied after OpenSSH import.
 
 Package:	OpenSSH
 Version:	9.3
-Current Vers:	9.3 / portable 9.3p2
+Current Vers:	9.5 / portable 9.5p1
 Maintainer:	OpenSSH
 Archive Site:	http://www.openssh.com/ftp.html
 Home Page:	http://www.openssh.com/portable.html



CVS commit: src/doc

2023-10-19 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Oct 19 11:27:57 UTC 2023

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note import of dhcpcd-10.0.4


To generate a diff of this commit:
cvs rdiff -u -r1.1957 -r1.1958 src/doc/3RDPARTY
cvs rdiff -u -r1.3006 -r1.3007 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1957 src/doc/3RDPARTY:1.1958
--- src/doc/3RDPARTY:1.1957	Sun Oct  8 21:08:05 2023
+++ src/doc/3RDPARTY	Thu Oct 19 11:27:57 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1957 2023/10/08 21:08:05 gutteridge Exp $
+#	$NetBSD: 3RDPARTY,v 1.1958 2023/10/19 11:27:57 roy Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -352,13 +352,13 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	10.0.3
-Current Vers:	10.0.3
+Version:	10.0.4
+Current Vers:	10.0.4
 Maintainer:	roy
 Archive Site:	https://github.com/NetworkConfiguration/dhcpcd/releases
 Home Page:	https://roy.marples.name/projects/dhcpcd/
 Home Page:	https://github.com/NetworkConfiguration/dhcpcd
-Date:		2023-10-06
+Date:		2023-10-19
 License:	BSD (2-clause)
 Location:	external/bsd/dhcpcd/dist
 Notes:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.3006 src/doc/CHANGES:1.3007
--- src/doc/CHANGES:1.3006	Sat Oct  7 12:42:03 2023
+++ src/doc/CHANGES	Thu Oct 19 11:27:57 2023
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3006 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.3007 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -226,7 +226,7 @@ Changes from NetBSD 10.0 to NetBSD 11.0:
 	igc(4): Add initial support to Intel I225/I226 series Ethernet devices.
 		[knakahara, rin, msaitoh 20231006]
 	less: Updated to version 643.  [simonb 20231006]
-	dhcpcd: Import version 10.0.3. [roy 20231006]
 	gcc.old: Initial import of major vax toolchain fix by Kalvis Duckmanton.
 		[rin 20231007]
+	dhcpcd: Import version 10.0.4. [roy 20231019]
 



CVS commit: src/doc

2023-10-19 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Oct 19 11:27:57 UTC 2023

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note import of dhcpcd-10.0.4


To generate a diff of this commit:
cvs rdiff -u -r1.1957 -r1.1958 src/doc/3RDPARTY
cvs rdiff -u -r1.3006 -r1.3007 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/dhcpcd/dist/src

2023-10-19 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Oct 19 11:26:52 UTC 2023

Modified Files:
src/external/bsd/dhcpcd/dist/src: dhcpcd.c privsep.c script.c

Log Message:
Sync with dhcpcd-10.0.4


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.16 -r1.17 src/external/bsd/dhcpcd/dist/src/privsep.c \
src/external/bsd/dhcpcd/dist/src/script.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.52 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.53
--- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.52	Fri Oct  6 08:49:42 2023
+++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c	Thu Oct 19 11:26:52 2023
@@ -329,6 +329,36 @@ dhcpcd_ipwaited(struct dhcpcd_ctx *ctx)
 	return 1;
 }
 
+#ifndef THERE_IS_NO_FORK
+void
+dhcpcd_daemonised(struct dhcpcd_ctx *ctx)
+{
+	unsigned int logopts = loggetopts();
+
+	/*
+	 * Stop writing to stderr.
+	 * On the happy path, only the manager process writes to stderr,
+	 * so this just stops wasting fprintf calls to nowhere.
+	 * All other calls - ie errors in privsep processes or script output,
+	 * will error when printing.
+	 * If we *really* want to fix that, then we need to suck
+	 * stderr/stdout in the manager process and either discard it or pass
+	 * it to the launcher process and then to stderr.
+	 */
+	logopts &= ~LOGERR_ERR;
+	logsetopts(logopts);
+
+	/*
+	 * We need to do something with stdout/stderr to avoid SIGPIPE
+	 * We know that stdin is already mapped to /dev/null
+	 */
+	dup2(STDIN_FILENO, STDOUT_FILENO);
+	dup2(STDIN_FILENO, STDERR_FILENO);
+
+	ctx->options |= DHCPCD_DAEMONISED;
+}
+#endif
+
 /* Returns the pid of the child, otherwise 0. */
 void
 dhcpcd_daemonise(struct dhcpcd_ctx *ctx)
@@ -363,6 +393,13 @@ dhcpcd_daemonise(struct dhcpcd_ctx *ctx)
 	if (!(logopts & LOGERR_QUIET) && ctx->stderr_valid)
 		(void)fprintf(stderr,
 		"forked to background, child pid %d\n", getpid());
+
+#ifdef PRIVSEP
+	ps_daemonised(ctx);
+#else
+	dhcpcd_daemonised(ctx);
+#endif
+
 	i = EXIT_SUCCESS;
 	if (write(ctx->fork_fd, , sizeof(i)) == -1)
 		logerr("write");
@@ -370,19 +407,6 @@ dhcpcd_daemonise(struct dhcpcd_ctx *ctx)
 	eloop_event_delete(ctx->eloop, ctx->fork_fd);
 	close(ctx->fork_fd);
 	ctx->fork_fd = -1;
-
-	/*
-	 * Stop writing to stderr.
-	 * On the happy path, only the manager process writes to stderr,
-	 * so this just stops wasting fprintf calls to nowhere.
-	 * All other calls - ie errors in privsep processes or script output,
-	 * will error when printing.
-	 * If we *really* want to fix that, then we need to suck
-	 * stderr/stdout in the manager process and either disacrd it or pass
-	 * it to the launcher process and then to stderr.
-	 */
-	logopts &= ~LOGERR_ERR;
-	logsetopts(logopts);
 #endif
 }
 
@@ -1869,6 +1893,22 @@ dhcpcd_pidfile_timeout(void *arg)
 		dhcpcd_pidfile_timeout, ctx);
 }
 
+static int dup_null(int fd)
+{
+	int fd_null = open(_PATH_DEVNULL, O_WRONLY);
+	int err;
+
+	if (fd_null == -1) {
+		logwarn("open %s", _PATH_DEVNULL);
+		return -1;
+	}
+
+	if ((err = dup2(fd_null, fd)) == -1)
+		logwarn("dup2 %d", fd);
+	close(fd_null);
+	return err;
+}
+
 int
 main(int argc, char **argv, char **envp)
 {
@@ -1972,6 +2012,15 @@ main(int argc, char **argv, char **envp)
 	ctx.stdout_valid = fcntl(STDOUT_FILENO, F_GETFD) != -1;
 	ctx.stderr_valid = fcntl(STDERR_FILENO, F_GETFD) != -1;
 
+	/* Even we if we don't have input/outputs, we need to
+	 * ensure they are setup for shells. */
+	if (!ctx.stdin_valid)
+		dup_null(STDIN_FILENO);
+	if (!ctx.stdout_valid)
+		dup_null(STDOUT_FILENO);
+	if (!ctx.stderr_valid)
+		dup_null(STDERR_FILENO);
+
 	logopts = LOGERR_LOG | LOGERR_LOG_DATE | LOGERR_LOG_PID;
 	if (ctx.stderr_valid)
 		logopts |= LOGERR_ERR;
@@ -2341,8 +2390,10 @@ printpidfile:
 	}
 
 	loginfox(PACKAGE "-" VERSION " starting");
-	if (ctx.stdin_valid && freopen(_PATH_DEVNULL, "w", stdin) == NULL)
-		logwarn("freopen stdin");
+
+	// We don't need stdin past this point
+	if (ctx.stdin_valid)
+		dup_null(STDIN_FILENO);
 
 #if defined(USE_SIGNALS) && !defined(THERE_IS_NO_FORK)
 	if (!(ctx.options & DHCPCD_DAEMONISE))
@@ -2385,10 +2436,9 @@ printpidfile:
 logerr("dup2");
 			close(stderr_fd[0]);
 			close(stderr_fd[1]);
-		} else if (ctx.stdout_valid) {
-			if (freopen(_PATH_DEVNULL, "w", stdout) == NULL)
-logerr("freopen stdout");
-		}
+		} else if (ctx.stdout_valid)
+			dup_null(STDOUT_FILENO);
+
 		if (setsid() == -1) {
 			logerr("%s: setsid", __func__);
 			goto exit_failure;

Index: src/external/bsd/dhcpcd/dist/src/privsep.c
diff -u src/external/bsd/dhcpcd/dist/src/privsep.c:1.16 src/external/bsd/dhcpcd/dist/src/privsep.c:1.17
--- src/external/bsd/dhcpcd/dist/src/privsep.c:1.16	Fri Oct  6 08:49:42 2023
+++ src/external/bsd/dhcpcd/dist/src/privsep.c	Thu Oct 19 11:26:52 2023
@@ -1100,6 

CVS commit: src/external/bsd/dhcpcd/dist/src

2023-10-19 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Oct 19 11:26:52 UTC 2023

Modified Files:
src/external/bsd/dhcpcd/dist/src: dhcpcd.c privsep.c script.c

Log Message:
Sync with dhcpcd-10.0.4


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.16 -r1.17 src/external/bsd/dhcpcd/dist/src/privsep.c \
src/external/bsd/dhcpcd/dist/src/script.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS import: src/external/bsd/dhcpcd/dist

2023-10-19 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Oct 19 11:25:19 UTC 2023

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv5255

Log Message:
Import dhcpcd-10.0.4 with the following change:

privsep: Notify processes that dhcpcd has daemonised so they dup
 stdout and stderr to /dev/null.
 This avoids scripts failing with SIGPIPE if they try and write
 to these streams.

Status:

Vendor Tag: ROY
Release Tags:   dhcpcd-10_0_4

U src/external/bsd/dhcpcd/dist/LICENSE
U src/external/bsd/dhcpcd/dist/README.md
U src/external/bsd/dhcpcd/dist/src/defs.h
U src/external/bsd/dhcpcd/dist/src/common.c
U src/external/bsd/dhcpcd/dist/src/control.c
C src/external/bsd/dhcpcd/dist/src/dhcpcd.c
U src/external/bsd/dhcpcd/dist/src/duid.c
U src/external/bsd/dhcpcd/dist/src/eloop.c
U src/external/bsd/dhcpcd/dist/src/logerr.c
U src/external/bsd/dhcpcd/dist/src/if.c
U src/external/bsd/dhcpcd/dist/src/if-options.c
U src/external/bsd/dhcpcd/dist/src/sa.c
U src/external/bsd/dhcpcd/dist/src/route.c
U src/external/bsd/dhcpcd/dist/src/dhcp-common.c
C src/external/bsd/dhcpcd/dist/src/script.c
U src/external/bsd/dhcpcd/dist/src/auth.c
U src/external/bsd/dhcpcd/dist/src/if-bsd.c
U src/external/bsd/dhcpcd/dist/src/dhcp.c
U src/external/bsd/dhcpcd/dist/src/ipv4.c
U src/external/bsd/dhcpcd/dist/src/bpf.c
U src/external/bsd/dhcpcd/dist/src/arp.c
U src/external/bsd/dhcpcd/dist/src/ipv4ll.c
U src/external/bsd/dhcpcd/dist/src/ipv6.c
U src/external/bsd/dhcpcd/dist/src/ipv6nd.c
U src/external/bsd/dhcpcd/dist/src/dhcp6.c
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c
C src/external/bsd/dhcpcd/dist/src/privsep.c
U src/external/bsd/dhcpcd/dist/src/privsep-root.c
U src/external/bsd/dhcpcd/dist/src/privsep-control.c
U src/external/bsd/dhcpcd/dist/src/privsep-inet.c
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.c
U src/external/bsd/dhcpcd/dist/src/privsep-bsd.c
U src/external/bsd/dhcpcd/dist/src/common.h
U src/external/bsd/dhcpcd/dist/src/control.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.h
U src/external/bsd/dhcpcd/dist/src/duid.h
U src/external/bsd/dhcpcd/dist/src/eloop.h
U src/external/bsd/dhcpcd/dist/src/logerr.h
U src/external/bsd/dhcpcd/dist/src/if.h
U src/external/bsd/dhcpcd/dist/src/if-options.h
U src/external/bsd/dhcpcd/dist/src/sa.h
U src/external/bsd/dhcpcd/dist/src/route.h
U src/external/bsd/dhcpcd/dist/src/dhcp-common.h
U src/external/bsd/dhcpcd/dist/src/script.h
U src/external/bsd/dhcpcd/dist/src/auth.h
U src/external/bsd/dhcpcd/dist/src/dhcp.h
U src/external/bsd/dhcpcd/dist/src/ipv4.h
U src/external/bsd/dhcpcd/dist/src/bpf.h
U src/external/bsd/dhcpcd/dist/src/arp.h
U src/external/bsd/dhcpcd/dist/src/ipv4ll.h
U src/external/bsd/dhcpcd/dist/src/ipv6.h
U src/external/bsd/dhcpcd/dist/src/ipv6nd.h
U src/external/bsd/dhcpcd/dist/src/dhcp6.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h
U src/external/bsd/dhcpcd/dist/src/privsep.h
U src/external/bsd/dhcpcd/dist/src/privsep-root.h
U src/external/bsd/dhcpcd/dist/src/privsep-control.h
U src/external/bsd/dhcpcd/dist/src/privsep-inet.h
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.h
U src/external/bsd/dhcpcd/dist/src/dev.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5
U src/external/bsd/dhcpcd/dist/src/dhcpcd.8
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8
U src/external/bsd/dhcpcd/dist/hooks/01-test
U src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf
U src/external/bsd/dhcpcd/dist/hooks/30-hostname
U src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf
U src/external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant
U src/external/bsd/dhcpcd/dist/hooks/15-timezone
U src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname
U src/external/bsd/dhcpcd/dist/hooks/50-ypbind

3 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jROY:yesterday -jROY src/external/bsd/dhcpcd/dist



CVS import: src/external/bsd/dhcpcd/dist

2023-10-19 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Oct 19 11:25:19 UTC 2023

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv5255

Log Message:
Import dhcpcd-10.0.4 with the following change:

privsep: Notify processes that dhcpcd has daemonised so they dup
 stdout and stderr to /dev/null.
 This avoids scripts failing with SIGPIPE if they try and write
 to these streams.

Status:

Vendor Tag: ROY
Release Tags:   dhcpcd-10_0_4

U src/external/bsd/dhcpcd/dist/LICENSE
U src/external/bsd/dhcpcd/dist/README.md
U src/external/bsd/dhcpcd/dist/src/defs.h
U src/external/bsd/dhcpcd/dist/src/common.c
U src/external/bsd/dhcpcd/dist/src/control.c
C src/external/bsd/dhcpcd/dist/src/dhcpcd.c
U src/external/bsd/dhcpcd/dist/src/duid.c
U src/external/bsd/dhcpcd/dist/src/eloop.c
U src/external/bsd/dhcpcd/dist/src/logerr.c
U src/external/bsd/dhcpcd/dist/src/if.c
U src/external/bsd/dhcpcd/dist/src/if-options.c
U src/external/bsd/dhcpcd/dist/src/sa.c
U src/external/bsd/dhcpcd/dist/src/route.c
U src/external/bsd/dhcpcd/dist/src/dhcp-common.c
C src/external/bsd/dhcpcd/dist/src/script.c
U src/external/bsd/dhcpcd/dist/src/auth.c
U src/external/bsd/dhcpcd/dist/src/if-bsd.c
U src/external/bsd/dhcpcd/dist/src/dhcp.c
U src/external/bsd/dhcpcd/dist/src/ipv4.c
U src/external/bsd/dhcpcd/dist/src/bpf.c
U src/external/bsd/dhcpcd/dist/src/arp.c
U src/external/bsd/dhcpcd/dist/src/ipv4ll.c
U src/external/bsd/dhcpcd/dist/src/ipv6.c
U src/external/bsd/dhcpcd/dist/src/ipv6nd.c
U src/external/bsd/dhcpcd/dist/src/dhcp6.c
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c
C src/external/bsd/dhcpcd/dist/src/privsep.c
U src/external/bsd/dhcpcd/dist/src/privsep-root.c
U src/external/bsd/dhcpcd/dist/src/privsep-control.c
U src/external/bsd/dhcpcd/dist/src/privsep-inet.c
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.c
U src/external/bsd/dhcpcd/dist/src/privsep-bsd.c
U src/external/bsd/dhcpcd/dist/src/common.h
U src/external/bsd/dhcpcd/dist/src/control.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.h
U src/external/bsd/dhcpcd/dist/src/duid.h
U src/external/bsd/dhcpcd/dist/src/eloop.h
U src/external/bsd/dhcpcd/dist/src/logerr.h
U src/external/bsd/dhcpcd/dist/src/if.h
U src/external/bsd/dhcpcd/dist/src/if-options.h
U src/external/bsd/dhcpcd/dist/src/sa.h
U src/external/bsd/dhcpcd/dist/src/route.h
U src/external/bsd/dhcpcd/dist/src/dhcp-common.h
U src/external/bsd/dhcpcd/dist/src/script.h
U src/external/bsd/dhcpcd/dist/src/auth.h
U src/external/bsd/dhcpcd/dist/src/dhcp.h
U src/external/bsd/dhcpcd/dist/src/ipv4.h
U src/external/bsd/dhcpcd/dist/src/bpf.h
U src/external/bsd/dhcpcd/dist/src/arp.h
U src/external/bsd/dhcpcd/dist/src/ipv4ll.h
U src/external/bsd/dhcpcd/dist/src/ipv6.h
U src/external/bsd/dhcpcd/dist/src/ipv6nd.h
U src/external/bsd/dhcpcd/dist/src/dhcp6.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h
U src/external/bsd/dhcpcd/dist/src/privsep.h
U src/external/bsd/dhcpcd/dist/src/privsep-root.h
U src/external/bsd/dhcpcd/dist/src/privsep-control.h
U src/external/bsd/dhcpcd/dist/src/privsep-inet.h
U src/external/bsd/dhcpcd/dist/src/privsep-bpf.h
U src/external/bsd/dhcpcd/dist/src/dev.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5
U src/external/bsd/dhcpcd/dist/src/dhcpcd.8
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks
U src/external/bsd/dhcpcd/dist/hooks/dhcpcd-run-hooks.8
U src/external/bsd/dhcpcd/dist/hooks/01-test
U src/external/bsd/dhcpcd/dist/hooks/20-resolv.conf
U src/external/bsd/dhcpcd/dist/hooks/30-hostname
U src/external/bsd/dhcpcd/dist/hooks/50-ntp.conf
U src/external/bsd/dhcpcd/dist/hooks/10-wpa_supplicant
U src/external/bsd/dhcpcd/dist/hooks/15-timezone
U src/external/bsd/dhcpcd/dist/hooks/29-lookup-hostname
U src/external/bsd/dhcpcd/dist/hooks/50-ypbind

3 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jROY:yesterday -jROY src/external/bsd/dhcpcd/dist



CVS commit: [netbsd-10] src/doc

2023-10-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 19 07:24:46 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Ticket #429


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.140 -r1.1.2.141 src/doc/CHANGES-10.0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-10.0
diff -u src/doc/CHANGES-10.0:1.1.2.140 src/doc/CHANGES-10.0:1.1.2.141
--- src/doc/CHANGES-10.0:1.1.2.140	Wed Oct 18 15:31:09 2023
+++ src/doc/CHANGES-10.0	Thu Oct 19 07:24:45 2023
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-10.0,v 1.1.2.140 2023/10/18 15:31:09 martin Exp $
+# $NetBSD: CHANGES-10.0,v 1.1.2.141 2023/10/19 07:24:45 martin Exp $
 
 A complete list of changes from the initial NetBSD 10.0 branch on 2022-12-16
 until the 10.0 release:
@@ -12612,3 +12612,10 @@ sys/external/mit/xen-include-public/dist
 	Xen: add genfb(4) support.
 	[bouyer, ticket #428]
 
+share/man/man4/lagg.41.5
+sys/net/lagg/if_lagg.c1.49-1.51
+tests/net/if_lagg/t_lagg.sh			1.9,1.10
+
+	lagg(4): PR 57650: locking fixes and documentation updates.
+	[yamaguchi, ticket #429]
+



CVS commit: [netbsd-10] src/doc

2023-10-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 19 07:24:46 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Ticket #429


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.140 -r1.1.2.141 src/doc/CHANGES-10.0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-10] src

2023-10-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 19 07:23:51 UTC 2023

Modified Files:
src/share/man/man4 [netbsd-10]: lagg.4
src/sys/net/lagg [netbsd-10]: if_lagg.c
src/tests/net/if_lagg [netbsd-10]: t_lagg.sh

Log Message:
Pull up following revision(s) (requested by yamaguchi in ticket #429):

sys/net/lagg/if_lagg.c: revision 1.50
sys/net/lagg/if_lagg.c: revision 1.51
tests/net/if_lagg/t_lagg.sh: revision 1.10
sys/net/lagg/if_lagg.c: revision 1.49
tests/net/if_lagg/t_lagg.sh: revision 1.9
share/man/man4/lagg.4: revision 1.5

lagg(4): release LAGG_LOCK before mtu changing
PR kern/57650

Make the lagg interface up before change its MTU
This change is related to PR kern/57650

Fix missing IFNET_LOCK holding while destroy the lagg interface
copy MTU of lagg to a interface added to lagg
even if the interface is the first member of the lagg

This change breaks ATF test case for lagg MTU

Update the test case for MTU of lag to adapt new behavior

Update lagg(4) manual
1. corrected the wrong example
   - lagg(4) can not add multiple port and set its priority at once
  - This is the restriction of ifconfig(8)
2. adapted to changed behavior related to MTU
   - Changed not to copy MTU of the 1st physical interface
 to lagg(4) to prevent locking against myself


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.2.1 src/share/man/man4/lagg.4
cvs rdiff -u -r1.48 -r1.48.4.1 src/sys/net/lagg/if_lagg.c
cvs rdiff -u -r1.8 -r1.8.2.1 src/tests/net/if_lagg/t_lagg.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/lagg.4
diff -u src/share/man/man4/lagg.4:1.4 src/share/man/man4/lagg.4:1.4.2.1
--- src/share/man/man4/lagg.4:1.4	Tue May 24 20:50:18 2022
+++ src/share/man/man4/lagg.4	Thu Oct 19 07:23:51 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: lagg.4,v 1.4 2022/05/24 20:50:18 andvar Exp $
+.\"	$NetBSD: lagg.4,v 1.4.2.1 2023/10/19 07:23:51 martin Exp $
 .\"
 .\" Copyright (c) 2005, 2006 Reyk Floeter 
 .\"
@@ -150,8 +150,10 @@ most easily done with the
 .Cm create
 command.
 .Pp
-The MTU of the first interface to be added is used as the lagg MTU.
-All additional interfaces are required to have exactly the same value.
+The MTU of the
+.Xr lagg 4
+is applied to each physical interfaces.
+And the physical interfaces can not change its MTU directly.
 .Sh EXAMPLES
 Create a link aggregation using LACP with two
 .Xr wm 4
@@ -171,9 +173,10 @@ Gigabit Ethernet interfaces and set each
 # ifconfig wm0 up
 # ifconfig wm1 up
 # ifconfig lagg0 create
-# ifconfig lagg0 laggproto failover \e
-	laggport wm0 pri 1000 laggport wm1 pri 2000 \e
-	192.168.1.1 netmask 255.255.255.0
+# ifconfig lagg0 laggproto failover
+# ifconfig lagg0 laggport wm0 pri 1000
+# ifconfig lagg0 laggport wm1 pri 2000
+# ifconfig lagg0 inet 192.168.1.1 netmask 255.255.255.0
 .Ed
 .Sh SEE ALSO
 .Xr ifconfig 8

Index: src/sys/net/lagg/if_lagg.c
diff -u src/sys/net/lagg/if_lagg.c:1.48 src/sys/net/lagg/if_lagg.c:1.48.4.1
--- src/sys/net/lagg/if_lagg.c:1.48	Sun Jun 26 17:55:24 2022
+++ src/sys/net/lagg/if_lagg.c	Thu Oct 19 07:23:50 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lagg.c,v 1.48 2022/06/26 17:55:24 riastradh Exp $	*/
+/*	$NetBSD: if_lagg.c,v 1.48.4.1 2023/10/19 07:23:50 martin Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006 Reyk Floeter 
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.48 2022/06/26 17:55:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.48.4.1 2023/10/19 07:23:50 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -444,11 +444,13 @@ lagg_clone_destroy(struct ifnet *ifp)
 
 	lagg_stop(ifp, 1);
 
+	IFNET_LOCK(ifp);
 	LAGG_LOCK(sc);
 	while ((lp = LAGG_PORTS_FIRST(sc)) != NULL) {
 		lagg_port_teardown(sc, lp, false);
 	}
 	LAGG_UNLOCK(sc);
+	IFNET_UNLOCK(ifp);
 
 	switch (ifp->if_type) {
 	case IFT_ETHER:
@@ -727,8 +729,8 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
 		LAGG_UNLOCK(sc);
 		break;
 	case SIOCSIFMTU:
-		LAGG_LOCK(sc);
 		/* set the MTU to each port */
+		LAGG_LOCK(sc);
 		LAGG_PORTS_FOREACH(sc, lp) {
 			error = lagg_lp_ioctl(lp, cmd, (void *)ifr);
 
@@ -742,6 +744,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
 break;
 			}
 		}
+		LAGG_UNLOCK(sc);
 
 		/* set the MTU to the lagg interface */
 		if (error == 0)
@@ -750,12 +753,14 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
 		if (error != 0) {
 			/* undo the changed MTU */
 			ifr->ifr_mtu = ifp->if_mtu;
+
+			LAGG_LOCK(sc);
 			LAGG_PORTS_FOREACH(sc, lp) {
 if (lp->lp_ioctl != NULL)
 	lagg_lp_ioctl(lp, cmd, (void *)ifr);
 			}
+			LAGG_UNLOCK(sc);
 		}
-		LAGG_UNLOCK(sc);
 		break;
 	case SIOCADDMULTI:
 		if (sc->sc_if.if_type == IFT_ETHER) {
@@ -2238,11 +2243,12 @@ lagg_port_setup(struct lagg_softc *sc,
 			lagg_port_setsadl(lp, NULL);
 	} else {
 		lagg_port_setsadl(lp, CLLADDR(ifp->if_sadl));
-		error = lagg_setmtu(ifp_port, 

CVS commit: [netbsd-10] src

2023-10-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 19 07:23:51 UTC 2023

Modified Files:
src/share/man/man4 [netbsd-10]: lagg.4
src/sys/net/lagg [netbsd-10]: if_lagg.c
src/tests/net/if_lagg [netbsd-10]: t_lagg.sh

Log Message:
Pull up following revision(s) (requested by yamaguchi in ticket #429):

sys/net/lagg/if_lagg.c: revision 1.50
sys/net/lagg/if_lagg.c: revision 1.51
tests/net/if_lagg/t_lagg.sh: revision 1.10
sys/net/lagg/if_lagg.c: revision 1.49
tests/net/if_lagg/t_lagg.sh: revision 1.9
share/man/man4/lagg.4: revision 1.5

lagg(4): release LAGG_LOCK before mtu changing
PR kern/57650

Make the lagg interface up before change its MTU
This change is related to PR kern/57650

Fix missing IFNET_LOCK holding while destroy the lagg interface
copy MTU of lagg to a interface added to lagg
even if the interface is the first member of the lagg

This change breaks ATF test case for lagg MTU

Update the test case for MTU of lag to adapt new behavior

Update lagg(4) manual
1. corrected the wrong example
   - lagg(4) can not add multiple port and set its priority at once
  - This is the restriction of ifconfig(8)
2. adapted to changed behavior related to MTU
   - Changed not to copy MTU of the 1st physical interface
 to lagg(4) to prevent locking against myself


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.2.1 src/share/man/man4/lagg.4
cvs rdiff -u -r1.48 -r1.48.4.1 src/sys/net/lagg/if_lagg.c
cvs rdiff -u -r1.8 -r1.8.2.1 src/tests/net/if_lagg/t_lagg.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.