CVS commit: src/sys/dev/pckbport

2024-04-18 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Apr 18 17:35:53 UTC 2024

Modified Files:
src/sys/dev/pckbport: synaptics.c

Log Message:
Renamed border/boundary variables to better describe their use.
Fix edge default values, factor out percentage calculation for more consistent
values. Use device_printf/DPRINTF to show errors instead of aprint variants.
Print raw input for debugging.

Correct capability parsing. Old devices were probed with nonexistent
commands and then used undefined boundary values that made them unusuable.

Fixes PR 57874.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/pckbport/synaptics.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/pckbport/synaptics.c
diff -u src/sys/dev/pckbport/synaptics.c:1.82 src/sys/dev/pckbport/synaptics.c:1.83
--- src/sys/dev/pckbport/synaptics.c:1.82	Tue Sep  5 05:55:12 2023
+++ src/sys/dev/pckbport/synaptics.c	Thu Apr 18 17:35:53 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: synaptics.c,v 1.82 2023/09/05 05:55:12 mrg Exp $	*/
+/*	$NetBSD: synaptics.c,v 1.83 2024/04/18 17:35:53 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2005, Steve C. Woodford
@@ -48,7 +48,7 @@
 #include "opt_pms.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.82 2023/09/05 05:55:12 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.83 2024/04/18 17:35:53 mlelstv Exp $");
 
 #include 
 #include 
@@ -112,10 +112,10 @@ static int synaptics_edge_bottom = SYNAP
 static int synaptics_edge_motion_delta = 32;
 static u_int synaptics_finger_high = SYNAPTICS_FINGER_LIGHT + 5;
 static u_int synaptics_finger_low = SYNAPTICS_FINGER_LIGHT - 10;
-static int synaptics_horiz_pct = 0;
-static int synaptics_vert_pct = 0;
-static int synaptics_button_pct = 30;
-static int synaptics_button_boundary;
+static int synaptics_hscroll_pct = 0;
+static int synaptics_vscroll_pct = 0;
+static int synaptics_button_pct = 0;
+static int synaptics_button_boundary = SYNAPTICS_EDGE_BOTTOM;
 static int synaptics_button2;
 static int synaptics_button3;
 static int synaptics_two_fingers_emul = 0;
@@ -166,23 +166,26 @@ static int synaptics_movement_threshold_
 static int synaptics_movement_enable_nodenum;
 static int synaptics_button_region_movement_nodenum;
 static int synaptics_aux_mid_button_scroll_nodenum;
-static int synaptics_horiz_pct_nodenum;
-static int synaptics_vert_pct_nodenum;
+static int synaptics_hscroll_pct_nodenum;
+static int synaptics_vscroll_pct_nodenum;
 static int synaptics_button_pct_nodenum;
 
 /*
  * copy of edges so we can recalculate edge limit if there is 
  * vertical scroll region
  */
-static int synaptics_actual_edge_right;
-static int synaptics_actual_edge_bottom;
+static int synaptics_true_edge_right;
+static int synaptics_true_edge_bottom;
 
-static int synaptics_old_vert_pct = 0;
-static int synaptics_old_horiz_pct = 0;
-static int synaptics_old_button_pct = 0;
-static int synaptics_old_button_boundary = SYNAPTICS_EDGE_BOTTOM;
-static int synaptics_old_horiz_edge = SYNAPTICS_EDGE_BOTTOM;
-static int synaptics_old_vert_edge = SYNAPTICS_EDGE_RIGHT;
+/*
+ * invalid old values, recalculate everything
+ */
+static int synaptics_old_vscroll_pct = -1;
+static int synaptics_old_hscroll_pct = -1;
+static int synaptics_old_button_pct = -1;
+static int synaptics_old_button_boundary = -1;
+static int synaptics_old_edge_right = -1;
+static int synaptics_old_edge_bottom = -1;
 
 /*
  * This holds the processed packet data, it is global because multiple
@@ -208,7 +211,7 @@ synaptics_poll_cmd(struct pms_softc *psc
 	int res = pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot, cmd, i, 0,
 	NULL, 0);
 	if (res)
-		aprint_error_dev(psc->sc_dev, "command error %#x\n", cmd[0]);
+		device_printf(psc->sc_dev, "command error %#x\n", cmd[0]);
 	return res;
 }
 
@@ -221,7 +224,7 @@ synaptics_poll_reset(struct pms_softc *p
 	u_char cmd[1] = { PMS_RESET };
 	res = pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot, cmd, 1, 2,
 	resp, 1);
-	aprint_debug_dev(psc->sc_dev, "reset %d 0x%02x 0x%02x\n",
+	DPRINTF(10, >u.synaptics, "reset %d 0x%02x 0x%02x\n",
 	res, resp[0], resp[1]);
 	return res;
 }
@@ -251,80 +254,90 @@ synaptics_special_write(struct pms_softc
 	return res;
 }
 
+static int
+synaptics_value(int pct, int low, int high)
+{
+	return low + pct * (high - low) / 100UL;
+}
+
+static int
+synaptics_percentage(int val, int low, int high)
+{
+	return ((val - low) * 100UL + high - low - 1) / (high - low);
+}
+
 static void
 pms_synaptics_set_boundaries(void)
 {
-	if (synaptics_vert_pct != synaptics_old_vert_pct ) {
-		synaptics_edge_right = synaptics_actual_edge_right -
-		((unsigned long) synaptics_vert_pct *
-		(synaptics_actual_edge_right - synaptics_edge_left)) / 100;
-		synaptics_old_vert_pct = synaptics_vert_pct;
-		synaptics_old_vert_edge = synaptics_edge_right;
+	if (synaptics_vscroll_pct != synaptics_old_vscroll_pct ) {
+		

CVS commit: src/sys/dev/pckbport

2024-04-18 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Apr 18 17:35:53 UTC 2024

Modified Files:
src/sys/dev/pckbport: synaptics.c

Log Message:
Renamed border/boundary variables to better describe their use.
Fix edge default values, factor out percentage calculation for more consistent
values. Use device_printf/DPRINTF to show errors instead of aprint variants.
Print raw input for debugging.

Correct capability parsing. Old devices were probed with nonexistent
commands and then used undefined boundary values that made them unusuable.

Fixes PR 57874.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/pckbport/synaptics.c

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



CVS commit: xsrc/external/mit/xf86-input-ws/dist/src

2024-04-14 Thread Michael van Elst
Module Name:xsrc
Committed By:   mlelstv
Date:   Sun Apr 14 20:10:29 UTC 2024

Modified Files:
xsrc/external/mit/xf86-input-ws/dist/src: ws.c

Log Message:
Only limit the scroll warning, but continue to send the scroll events.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 xsrc/external/mit/xf86-input-ws/dist/src/ws.c

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

Modified files:

Index: xsrc/external/mit/xf86-input-ws/dist/src/ws.c
diff -u xsrc/external/mit/xf86-input-ws/dist/src/ws.c:1.17 xsrc/external/mit/xf86-input-ws/dist/src/ws.c:1.18
--- xsrc/external/mit/xf86-input-ws/dist/src/ws.c:1.17	Wed Feb  7 18:01:48 2024
+++ xsrc/external/mit/xf86-input-ws/dist/src/ws.c	Sun Apr 14 20:10:29 2024
@@ -747,11 +747,13 @@ wsReadInput(InputInfoPtr pInfo)
 			dw = 0;
 		}
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 14
-		static int warned = 0;
-		if ((hscroll || vscroll) && !warned) {
-			warned = 1;
-			xf86Msg(X_WARNING, "%s: hscroll=%d, vscroll=%d\n",
-			pInfo->name, hscroll, vscroll);
+		if (hscroll || vscroll) {
+			static int warned = 0;
+			if (!warned) {
+warned = 1;
+xf86Msg(X_WARNING, "%s: hscroll=%d, vscroll=%d\n",
+pInfo->name, hscroll, vscroll);
+			}
 			valuator_mask_zero(priv->scroll_mask);
 			valuator_mask_set_double(priv->scroll_mask,
 			HSCROLL_AXIS, (double) hscroll);



CVS commit: xsrc/external/mit/xf86-input-ws/dist/src

2024-04-14 Thread Michael van Elst
Module Name:xsrc
Committed By:   mlelstv
Date:   Sun Apr 14 20:10:29 UTC 2024

Modified Files:
xsrc/external/mit/xf86-input-ws/dist/src: ws.c

Log Message:
Only limit the scroll warning, but continue to send the scroll events.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 xsrc/external/mit/xf86-input-ws/dist/src/ws.c

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



CVS commit: src/lib/libcrypt

2024-03-09 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Mar  9 13:48:50 UTC 2024

Modified Files:
src/lib/libcrypt: crypt-argon2.c

Log Message:
Don't use uninitialized variable.
Fixes PR 57895.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libcrypt/crypt-argon2.c

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

Modified files:

Index: src/lib/libcrypt/crypt-argon2.c
diff -u src/lib/libcrypt/crypt-argon2.c:1.19 src/lib/libcrypt/crypt-argon2.c:1.20
--- src/lib/libcrypt/crypt-argon2.c:1.19	Sun May 29 12:15:00 2022
+++ src/lib/libcrypt/crypt-argon2.c	Sat Mar  9 13:48:50 2024
@@ -207,7 +207,7 @@ estimate_argon2_params(argon2_type atype
 
 		if (clock_gettime(CLOCK_MONOTONIC, ) == -1)
 			goto error;
-		for (; delta.tv_sec < 1 && time < ARGON2_MAX_TIME; ++time) {
+		for (; time < ARGON2_MAX_TIME; ++time) {
 			if (argon2_hash(time, memory, threads,
 			tmp_pwd, sizeof(tmp_pwd), 
 			tmp_salt, sizeof(tmp_salt), 
@@ -221,6 +221,8 @@ estimate_argon2_params(argon2_type atype
 			if (timespeccmp(, , >))
 break; /* broken system... */
 			timespecsub(, , );
+			if (delta.tv_sec >= 1)
+break;
 		}
 	} else {
 		time = *etime;



CVS commit: src/lib/libcrypt

2024-03-09 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Mar  9 13:48:50 UTC 2024

Modified Files:
src/lib/libcrypt: crypt-argon2.c

Log Message:
Don't use uninitialized variable.
Fixes PR 57895.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libcrypt/crypt-argon2.c

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



CVS commit: src/sys/kern

2024-03-02 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Mar  2 08:59:47 UTC 2024

Modified Files:
src/sys/kern: sysv_shm.c

Log Message:
Avoid overflow when computing kern.ipc.shmmax. Keep shmmax (bytes) and
shmall (pages) values aligned and use arithmetic everywhere instead
of shifts.
Should fix PR 57979


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/kern/sysv_shm.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/kern/sysv_shm.c
diff -u src/sys/kern/sysv_shm.c:1.141 src/sys/kern/sysv_shm.c:1.142
--- src/sys/kern/sysv_shm.c:1.141	Wed Oct  9 17:47:13 2019
+++ src/sys/kern/sysv_shm.c	Sat Mar  2 08:59:47 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_shm.c,v 1.141 2019/10/09 17:47:13 chs Exp $	*/
+/*	$NetBSD: sysv_shm.c,v 1.142 2024/03/02 08:59:47 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2007 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysv_shm.c,v 1.141 2019/10/09 17:47:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_shm.c,v 1.142 2024/03/02 08:59:47 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -961,10 +961,10 @@ shminit(void)
 	ALIGN(shminfo.shmmni * sizeof(struct shmid_ds)));
 
 	if (shminfo.shmmax == 0)
-		shminfo.shmmax = uimax(physmem / 4, 1024) * PAGE_SIZE;
+		shminfo.shmall = uimax(physmem / 4, 1024);
 	else
-		shminfo.shmmax *= PAGE_SIZE;
-	shminfo.shmall = shminfo.shmmax / PAGE_SIZE;
+		shminfo.shmall = shminfo.shmmax / PAGE_SIZE;
+	shminfo.shmmax = (uint64_t)shminfo.shmall * PAGE_SIZE;
 
 	for (i = 0; i < shminfo.shmmni; i++) {
 		cv_init(_cv[i], "shmwait");
@@ -1083,7 +1083,7 @@ sysctl_ipc_shmmax(SYSCTLFN_ARGS)
 		return EINVAL;
 
 	shminfo.shmmax = round_page(newsize);
-	shminfo.shmall = shminfo.shmmax >> PAGE_SHIFT;
+	shminfo.shmall = shminfo.shmmax / PAGE_SIZE;
 
 	return 0;
 }



CVS commit: src/sys/kern

2024-03-02 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Mar  2 08:59:47 UTC 2024

Modified Files:
src/sys/kern: sysv_shm.c

Log Message:
Avoid overflow when computing kern.ipc.shmmax. Keep shmmax (bytes) and
shmall (pages) values aligned and use arithmetic everywhere instead
of shifts.
Should fix PR 57979


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/kern/sysv_shm.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/virt68k/virt68k

2024-02-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Feb 25 14:35:31 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: trap.c

Log Message:
Don't crash in copyin/copyout when a NULL pointer is passed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/trap.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/virt68k/virt68k

2024-02-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Feb 25 14:35:31 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: trap.c

Log Message:
Don't crash in copyin/copyout when a NULL pointer is passed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/trap.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/virt68k/virt68k/trap.c
diff -u src/sys/arch/virt68k/virt68k/trap.c:1.2 src/sys/arch/virt68k/virt68k/trap.c:1.3
--- src/sys/arch/virt68k/virt68k/trap.c:1.2	Sat Jan 20 00:15:33 2024
+++ src/sys/arch/virt68k/virt68k/trap.c	Sun Feb 25 14:35:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.2 2024/01/20 00:15:33 thorpej Exp $	*/
+/*	$NetBSD: trap.c,v 1.3 2024/02/25 14:35:31 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.2 2024/01/20 00:15:33 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.3 2024/02/25 14:35:31 mlelstv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_execfmt.h"
@@ -554,7 +554,7 @@ trap(struct frame *fp, int type, unsigne
 
 		va = trunc_page((vaddr_t)v);
 
-		if (map == kernel_map && va == 0) {
+		if (map == kernel_map && va == 0 && onfault == 0) {
 			printf("trap: bad kernel %s access at 0x%x\n",
 			(ftype & VM_PROT_WRITE) ? "read/write" :
 			"read", v);



CVS commit: src/sys/dev/scsipi

2024-02-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 24 22:06:50 UTC 2024

Modified Files:
src/sys/dev/scsipi: sd.c

Log Message:
Don't try to discover wedges when the unit isn't online.


To generate a diff of this commit:
cvs rdiff -u -r1.335 -r1.336 src/sys/dev/scsipi/sd.c

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



CVS commit: src/sys/dev/scsipi

2024-02-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 24 22:06:50 UTC 2024

Modified Files:
src/sys/dev/scsipi: sd.c

Log Message:
Don't try to discover wedges when the unit isn't online.


To generate a diff of this commit:
cvs rdiff -u -r1.335 -r1.336 src/sys/dev/scsipi/sd.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/scsipi/sd.c
diff -u src/sys/dev/scsipi/sd.c:1.335 src/sys/dev/scsipi/sd.c:1.336
--- src/sys/dev/scsipi/sd.c:1.335	Sun Aug 28 10:26:37 2022
+++ src/sys/dev/scsipi/sd.c	Sat Feb 24 22:06:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sd.c,v 1.335 2022/08/28 10:26:37 mlelstv Exp $	*/
+/*	$NetBSD: sd.c,v 1.336 2024/02/24 22:06:49 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.335 2022/08/28 10:26:37 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.336 2024/02/24 22:06:49 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_scsi.h"
@@ -351,8 +351,9 @@ sdattach(device_t parent, device_t self,
 	}
 	aprint_normal("\n");
 
-	/* Discover wedges on this disk. */
-	dkwedge_discover(>sc_dkdev);
+	/* Discover wedges on this disk if it is online */
+	if (result == SDGP_RESULT_OK)
+		dkwedge_discover(>sc_dkdev);
 
 	/*
 	 * Establish a shutdown hook so that we can ensure that



CVS commit: src/sys/netinet6

2024-02-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 24 21:41:13 UTC 2024

Modified Files:
src/sys/netinet6: icmp6.c raw_ip6.c

Log Message:
Deliver timestamps also to raw sockets.
Fixes PR 57955


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.183 -r1.184 src/sys/netinet6/raw_ip6.c

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



CVS commit: src/sys/netinet6

2024-02-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 24 21:41:13 UTC 2024

Modified Files:
src/sys/netinet6: icmp6.c raw_ip6.c

Log Message:
Deliver timestamps also to raw sockets.
Fixes PR 57955


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.183 -r1.184 src/sys/netinet6/raw_ip6.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/netinet6/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.255 src/sys/netinet6/icmp6.c:1.256
--- src/sys/netinet6/icmp6.c:1.255	Sat Dec  9 15:21:02 2023
+++ src/sys/netinet6/icmp6.c	Sat Feb 24 21:41:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: icmp6.c,v 1.255 2023/12/09 15:21:02 pgoyette Exp $	*/
+/*	$NetBSD: icmp6.c,v 1.256 2024/02/24 21:41:13 mlelstv Exp $	*/
 /*	$KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.255 2023/12/09 15:21:02 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.256 2024/02/24 21:41:13 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1987,7 +1987,8 @@ icmp6_rip6_input(struct mbuf **mp, int o
 		}
 #endif
 		else if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) {
-			if (last->inp_flags & IN6P_CONTROLOPTS)
+			if (last->inp_flags & IN6P_CONTROLOPTS ||
+			SOOPT_TIMESTAMP(last->inp_socket->so_options))
 ip6_savecontrol(last, , ip6, n);
 			/* strip intermediate headers */
 			m_adj(n, off);
@@ -2014,7 +2015,8 @@ icmp6_rip6_input(struct mbuf **mp, int o
 	} else
 #endif
 	if (last) {
-		if (last->inp_flags & IN6P_CONTROLOPTS)
+		if (last->inp_flags & IN6P_CONTROLOPTS ||
+		SOOPT_TIMESTAMP(last->inp_socket->so_options))
 			ip6_savecontrol(last, , ip6, m);
 		/* strip intermediate headers */
 		m_adj(m, off);

Index: src/sys/netinet6/raw_ip6.c
diff -u src/sys/netinet6/raw_ip6.c:1.183 src/sys/netinet6/raw_ip6.c:1.184
--- src/sys/netinet6/raw_ip6.c:1.183	Wed Mar 22 03:17:18 2023
+++ src/sys/netinet6/raw_ip6.c	Sat Feb 24 21:41:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: raw_ip6.c,v 1.183 2023/03/22 03:17:18 ozaki-r Exp $	*/
+/*	$NetBSD: raw_ip6.c,v 1.184 2024/02/24 21:41:13 mlelstv Exp $	*/
 /*	$KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.183 2023/03/22 03:17:18 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.184 2024/02/24 21:41:13 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -140,7 +140,8 @@ rip6_sbappendaddr(struct inpcb *last, st
 {
 	struct mbuf *opts = NULL;
 
-	if (last->inp_flags & IN6P_CONTROLOPTS)
+	if (last->inp_flags & IN6P_CONTROLOPTS ||
+	SOOPT_TIMESTAMP(last->inp_socket->so_options))
 		ip6_savecontrol(last, , ip6, n);
 
 	m_adj(n, hlen);



CVS commit: src/sys/netinet

2024-02-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 24 21:39:05 UTC 2024

Modified Files:
src/sys/netinet: if_arp.c

Log Message:
Attribute debug message.
Fixes PR 57959


To generate a diff of this commit:
cvs rdiff -u -r1.311 -r1.312 src/sys/netinet/if_arp.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/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.311 src/sys/netinet/if_arp.c:1.312
--- src/sys/netinet/if_arp.c:1.311	Tue Nov 15 10:47:39 2022
+++ src/sys/netinet/if_arp.c	Sat Feb 24 21:39:05 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.311 2022/11/15 10:47:39 roy Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.312 2024/02/24 21:39:05 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.311 2022/11/15 10:47:39 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.312 2024/02/24 21:39:05 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1355,8 +1355,8 @@ arp_llinfo_output(struct ifnet *ifp, __u
 		if (sip.s_addr == INADDR_ANY) {
 			char ipbuf[INET_ADDRSTRLEN];
 
-			log(LOG_DEBUG, "source can't be "
-			"determined: dst=%s\n",
+			log(LOG_DEBUG, "%s: source can't be "
+			"determined: dst=%s\n", __func__,
 			IN_PRINT(ipbuf, ));
 			return;
 		}



CVS commit: src/sys/netinet

2024-02-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 24 21:39:05 UTC 2024

Modified Files:
src/sys/netinet: if_arp.c

Log Message:
Attribute debug message.
Fixes PR 57959


To generate a diff of this commit:
cvs rdiff -u -r1.311 -r1.312 src/sys/netinet/if_arp.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/seq

2024-02-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 24 10:10:05 UTC 2024

Modified Files:
src/usr.bin/seq: seq.c

Log Message:
Chose better number format.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/seq/seq.c

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/seq/seq.c
diff -u src/usr.bin/seq/seq.c:1.12 src/usr.bin/seq/seq.c:1.13
--- src/usr.bin/seq/seq.c:1.12	Sat Mar 20 22:10:17 2021
+++ src/usr.bin/seq/seq.c	Sat Feb 24 10:10:04 2024
@@ -31,7 +31,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 2005\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: seq.c,v 1.12 2021/03/20 22:10:17 cheusov Exp $");
+__RCSID("$NetBSD: seq.c,v 1.13 2024/02/24 10:10:04 mlelstv Exp $");
 #endif /* not lint */
 
 #include 
@@ -56,6 +56,8 @@ __RCSID("$NetBSD: seq.c,v 1.12 2021/03/2
 
 const char *decimal_point = ".";	/* default */
 char default_format[] = { "%g" };	/* default */
+char default_format_fmt[] = { "%%.%uf" };
+#define MAXPRECISION 40
 
 /* Prototypes */
 
@@ -65,9 +67,29 @@ int decimal_places(const char *);
 int numeric(const char *);
 int valid_format(const char *);
 
-char *generate_format(double, double, double, int, char);
+unsigned get_precision(const char *, unsigned);
+char *generate_format(double, double, double, int, char, char *);
 char *unescape(char *);
 
+unsigned
+get_precision(const char *number, unsigned minprec)
+{
+	const char *p;
+	unsigned prec;
+
+	p = strstr(number, decimal_point);
+	if (p) {
+		prec = strlen(number) - (p - number);
+		if (prec > 0)
+			prec -= 1;
+		if (prec > MAXPRECISION)
+			prec = MAXPRECISION;
+	} else
+		prec = 0;
+
+	return prec < minprec ? minprec : prec;
+}
+
 /*
  * The seq command will print out a numeric sequence from 1, the default,
  * to a user specified upper limit by 1.  The lower bound and increment
@@ -79,6 +101,7 @@ main(int argc, char *argv[])
 {
 	int c = 0, errflg = 0;
 	int equalize = 0;
+	unsigned prec;
 	double first = 1.0;
 	double last = 0.0;
 	double incr = 0.0;
@@ -87,6 +110,8 @@ main(int argc, char *argv[])
 	const char *sep = "\n";
 	const char *term = "\n";
 	char pad = ZERO;
+	char buf[6]; /* %.MAXPRECISIONf */
+
 
 	/* Determine the locale's decimal point. */
 	locale = localeconv();
@@ -136,12 +161,16 @@ main(int argc, char *argv[])
 	}
 
 	last = e_atof(argv[argc - 1]);
+	prec = get_precision(argv[argc - 1], 0);
 
-	if (argc > 1)
+	if (argc > 1) {
 		first = e_atof(argv[0]);
+		prec = get_precision(argv[0], prec);
+	}
 	
 	if (argc > 2) {
 		incr = e_atof(argv[1]);
+		prec = get_precision(argv[1], prec);
 		/* Plan 9/GNU don't do zero */
 		if (incr == 0.0)
 			errx(1, "zero %screment", (first < last)? "in" : "de");
@@ -167,8 +196,15 @@ main(int argc, char *argv[])
 	 * XXX to be bug for bug compatible with Plan 9 add a
 		 * newline if none found at the end of the format string.
 		 */
-	} else
-		fmt = generate_format(first, incr, last, equalize, pad);
+	} else {
+		if (prec == 0)
+			fmt = default_format;
+		else {
+			sprintf(buf, default_format_fmt, prec);
+			fmt = buf;
+		}
+		fmt = generate_format(first, incr, last, equalize, pad, fmt);
+	}
 
 	if (incr > 0) {
 		printf(fmt, first);
@@ -428,14 +464,15 @@ decimal_places(const char *number)
  * when "%g" prints as "%e" (this way no width adjustments are made)
  */
 char *
-generate_format(double first, double incr, double last, int equalize, char pad)
+generate_format(double first, double incr, double last,
+int equalize, char pad, char *deffmt)
 {
 	static char buf[256];
 	char cc = '\0';
 	int precision, width1, width2, places;
 
 	if (equalize == 0)
-		return (default_format);
+		return deffmt;
 
 	/* figure out "last" value printed */
 	if (first > last)
@@ -443,12 +480,12 @@ generate_format(double first, double inc
 	else
 		last = first + incr * floor((last - first) / incr);
 
-	sprintf(buf, "%g", incr);
+	sprintf(buf, deffmt, incr);
 	if (strchr(buf, 'e'))
 		cc = 'e';
 	precision = decimal_places(buf);
 
-	width1 = sprintf(buf, "%g", first);
+	width1 = sprintf(buf, deffmt, first);
 	if (strchr(buf, 'e'))
 		cc = 'e';
 	if ((places = decimal_places(buf)))
@@ -456,7 +493,7 @@ generate_format(double first, double inc
 
 	precision = MAX(places, precision);
 
-	width2 = sprintf(buf, "%g", last);
+	width2 = sprintf(buf, deffmt, last);
 	if (strchr(buf, 'e'))
 		cc = 'e';
 	if ((places = decimal_places(buf)))



CVS commit: src/usr.bin/seq

2024-02-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 24 10:10:05 UTC 2024

Modified Files:
src/usr.bin/seq: seq.c

Log Message:
Chose better number format.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/seq/seq.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/netstat

2024-02-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 24 09:53:26 UTC 2024

Modified Files:
src/usr.bin/netstat: mbuf.c

Log Message:
Don't truncate mo_descr output and protect against missing terminating NUL.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/netstat/mbuf.c

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/netstat/mbuf.c
diff -u src/usr.bin/netstat/mbuf.c:1.35 src/usr.bin/netstat/mbuf.c:1.36
--- src/usr.bin/netstat/mbuf.c:1.35	Thu Sep  1 10:10:20 2022
+++ src/usr.bin/netstat/mbuf.c	Sat Feb 24 09:53:26 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbuf.c,v 1.35 2022/09/01 10:10:20 msaitoh Exp $	*/
+/*	$NetBSD: mbuf.c,v 1.36 2024/02/24 09:53:26 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)mbuf.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: mbuf.c,v 1.35 2022/09/01 10:10:20 msaitoh Exp $");
+__RCSID("$NetBSD: mbuf.c,v 1.36 2024/02/24 09:53:26 mlelstv Exp $");
 #endif
 #endif /* not lint */
 
@@ -225,7 +225,7 @@ dump_drain:
 
 	for (mo = (void *) data, lines = 0; len >= sizeof(*mo);
 	len -= sizeof(*mo), mo++) {
-		char buf[32];
+		char buf[34];
 		if (vflag == 1 &&
 		mo->mo_counter[MOWNER_COUNTER_CLAIMS] == 0 &&
 		mo->mo_counter[MOWNER_COUNTER_EXT_CLAIMS] == 0 &&
@@ -239,7 +239,7 @@ dump_drain:
 		mo->mo_counter[MOWNER_COUNTER_CLUSTER_CLAIMS] ==
 		mo->mo_counter[MOWNER_COUNTER_CLUSTER_RELEASES])
 			continue;
-		snprintf(buf, sizeof(buf), "%16.16s %-13s",
+		snprintf(buf, sizeof(buf), "%16.16s %-13.16s",
 		mo->mo_name, mo->mo_descr);
 		if ((lines % 24) == 0 || lines > 24) {
 			printf("%30s %-8s %10s %10s %10s\n",



CVS commit: src/usr.bin/netstat

2024-02-24 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 24 09:53:26 UTC 2024

Modified Files:
src/usr.bin/netstat: mbuf.c

Log Message:
Don't truncate mo_descr output and protect against missing terminating NUL.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/netstat/mbuf.c

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



CVS commit: src/sys/ufs/lfs

2024-02-17 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 17 09:08:21 UTC 2024

Modified Files:
src/sys/ufs/lfs: ulfs_inode.h

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/ufs/lfs/ulfs_inode.h

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

Modified files:

Index: src/sys/ufs/lfs/ulfs_inode.h
diff -u src/sys/ufs/lfs/ulfs_inode.h:1.24 src/sys/ufs/lfs/ulfs_inode.h:1.25
--- src/sys/ufs/lfs/ulfs_inode.h:1.24	Sat Jun 10 05:29:36 2017
+++ src/sys/ufs/lfs/ulfs_inode.h	Sat Feb 17 09:08:21 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulfs_inode.h,v 1.24 2017/06/10 05:29:36 maya Exp $	*/
+/*	$NetBSD: ulfs_inode.h,v 1.25 2024/02/17 09:08:21 mlelstv Exp $	*/
 /*  from NetBSD: inode.h,v 1.72 2016/06/03 15:36:03 christos Exp  */
 
 /*
@@ -147,7 +147,7 @@ struct ulfs_ufid {
 	uint16_t ufid_len;	/* Length of structure. */
 	uint16_t ufid_pad;	/* Force 32-bit alignment. */
 	uint32_t ufid_ino;	/* File number (ino). XXX should be 64 */
-	int32_t	  ufid_gen;	/* Generation number. */
+	int32_t  ufid_gen;	/* Generation number. */
 };
 /* Filehandle structure for exported LFSes */
 struct lfid {



CVS commit: src/sys/ufs/lfs

2024-02-17 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 17 09:08:21 UTC 2024

Modified Files:
src/sys/ufs/lfs: ulfs_inode.h

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/ufs/lfs/ulfs_inode.h

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



CVS commit: src/distrib/utils/embedded

2024-02-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Feb 12 11:30:33 UTC 2024

Modified Files:
src/distrib/utils/embedded: mkimage

Log Message:
Quote argument to -n as required. [ -n ] is not a syntax error but
evaluates to true.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/distrib/utils/embedded/mkimage

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

Modified files:

Index: src/distrib/utils/embedded/mkimage
diff -u src/distrib/utils/embedded/mkimage:1.80 src/distrib/utils/embedded/mkimage:1.81
--- src/distrib/utils/embedded/mkimage:1.80	Sun Feb 11 17:29:50 2024
+++ src/distrib/utils/embedded/mkimage	Mon Feb 12 11:30:33 2024
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: mkimage,v 1.80 2024/02/11 17:29:50 christos Exp $
+# $NetBSD: mkimage,v 1.81 2024/02/12 11:30:33 mlelstv Exp $
 #
 # Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -190,7 +190,7 @@ do
 	*)	usage;;
 	esac
 done
-if [ -n ${MKREPRO_TIMESTAMP} ]; then
+if [ -n "${MKREPRO_TIMESTAMP}" ]; then
 	timestamp_opt="-T ${MKREPRO_TIMESTAMP}"
 	volume_opt=",volume_id=$((${MKREPRO_TIMESTAMP} & 0x))"
 fi



CVS commit: src/distrib/utils/embedded

2024-02-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Feb 12 11:30:33 UTC 2024

Modified Files:
src/distrib/utils/embedded: mkimage

Log Message:
Quote argument to -n as required. [ -n ] is not a syntax error but
evaluates to true.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/distrib/utils/embedded/mkimage

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



CVS commit: src/sys/dev/pci

2024-02-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb  9 06:01:03 UTC 2024

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

Log Message:
Fix DMA sync sizes.
Don't panic for inconsistent queue counter, just print an error to console.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/pci/if_iwm.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_iwm.c
diff -u src/sys/dev/pci/if_iwm.c:1.88 src/sys/dev/pci/if_iwm.c:1.89
--- src/sys/dev/pci/if_iwm.c:1.88	Thu Sep 21 09:31:50 2023
+++ src/sys/dev/pci/if_iwm.c	Fri Feb  9 06:01:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwm.c,v 1.88 2023/09/21 09:31:50 msaitoh Exp $	*/
+/*	$NetBSD: if_iwm.c,v 1.89 2024/02/09 06:01:03 mlelstv Exp $	*/
 /*	OpenBSD: if_iwm.c,v 1.148 2016/11/19 21:07:08 stsp Exp	*/
 #define IEEE80211_NO_HT
 /*
@@ -106,7 +106,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.88 2023/09/21 09:31:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.89 2024/02/09 06:01:03 mlelstv Exp $");
 
 #include 
 #include 
@@ -1262,8 +1262,9 @@ iwm_free_rx_ring(struct iwm_softc *sc, s
 		struct iwm_rx_data *data = >data[i];
 
 		if (data->m != NULL) {
+			bus_size_t sz = data->m->m_pkthdr.len;
 			bus_dmamap_sync(sc->sc_dmat, data->map, 0,
-			data->map->dm_mapsize, BUS_DMASYNC_POSTREAD);
+			sz, BUS_DMASYNC_POSTREAD);
 			bus_dmamap_unload(sc->sc_dmat, data->map);
 			m_freem(data->m);
 			data->m = NULL;
@@ -1405,8 +1406,9 @@ iwm_reset_tx_ring(struct iwm_softc *sc, 
 		struct iwm_tx_data *data = >data[i];
 
 		if (data->m != NULL) {
+			bus_size_t sz = data->m->m_pkthdr.len;
 			bus_dmamap_sync(sc->sc_dmat, data->map, 0,
-			data->map->dm_mapsize, BUS_DMASYNC_POSTWRITE);
+			sz, BUS_DMASYNC_POSTWRITE);
 			bus_dmamap_unload(sc->sc_dmat, data->map);
 			m_freem(data->m);
 			data->m = NULL;
@@ -1436,8 +1438,9 @@ iwm_free_tx_ring(struct iwm_softc *sc, s
 		struct iwm_tx_data *data = >data[i];
 
 		if (data->m != NULL) {
+			bus_size_t sz = data->m->m_pkthdr.len;
 			bus_dmamap_sync(sc->sc_dmat, data->map, 0,
-			data->map->dm_mapsize, BUS_DMASYNC_POSTWRITE);
+			sz, BUS_DMASYNC_POSTWRITE);
 			bus_dmamap_unload(sc->sc_dmat, data->map);
 			m_freem(data->m);
 			data->m = NULL;
@@ -1517,7 +1520,7 @@ iwm_ict_reset(struct iwm_softc *sc)
 	iwm_disable_interrupts(sc);
 
 	memset(sc->ict_dma.vaddr, 0, IWM_ICT_SIZE);
-	bus_dmamap_sync(sc->sc_dmat, sc->ict_dma.map, 0, IWM_ICT_SIZE,
+	bus_dmamap_sync(sc->sc_dmat, sc->ict_dma.map, 0, sc->ict_dma.size,
 	BUS_DMASYNC_PREWRITE);
 	sc->ict_cur = 0;
 
@@ -3766,7 +3769,7 @@ iwm_rx_addbuf(struct iwm_softc *sc, int 
 	if (size <= MCLBYTES) {
 		MCLGET(m, M_DONTWAIT);
 	} else {
-		MEXTMALLOC(m, IWM_RBUF_SIZE, M_DONTWAIT);
+		MEXTMALLOC(m, size, M_DONTWAIT);
 	}
 	if ((m->m_flags & M_EXT) == 0) {
 		m_freem(m);
@@ -3778,7 +3781,7 @@ iwm_rx_addbuf(struct iwm_softc *sc, int 
 		fatal = 1;
 	}
 
-	m->m_len = m->m_pkthdr.len = m->m_ext.ext_size;
+	m->m_len = m->m_pkthdr.len = size;
 	err = bus_dmamap_load_mbuf(sc->sc_dmat, data->map, m,
 	BUS_DMA_READ|BUS_DMA_NOWAIT);
 	if (err) {
@@ -4452,12 +4455,17 @@ iwm_cmd_done(struct iwm_softc *sc, int q
 	wakeup(>desc[idx]);
 
 	if (((idx + ring->queued) % IWM_TX_RING_COUNT) != ring->cur) {
-		aprint_error_dev(sc->sc_dev,
+		device_printf(sc->sc_dev,
 		"Some HCMDs skipped?: idx=%d queued=%d cur=%d\n",
 		idx, ring->queued, ring->cur);
 	}
 
-	KASSERT(ring->queued > 0);
+	if (ring->queued == 0) {
+		splx(s);
+		device_printf(sc->sc_dev, "cmd_done with empty ring\n");
+		return;
+	}
+
 	if (--ring->queued == 0)
 		iwm_clear_cmd_in_flight(sc);
 
@@ -4785,7 +4793,7 @@ iwm_tx(struct iwm_softc *sc, struct mbuf
 		| ((seg->ds_len) << 4);
 	}
 
-	bus_dmamap_sync(sc->sc_dmat, data->map, 0, data->map->dm_mapsize,
+	bus_dmamap_sync(sc->sc_dmat, data->map, 0, m->m_pkthdr.len,
 	BUS_DMASYNC_PREWRITE);
 	bus_dmamap_sync(sc->sc_dmat, ring->cmd_dma.map,
 	(uint8_t *)cmd - (uint8_t *)ring->cmd, sizeof(*cmd),



CVS commit: src/sys/dev/pci

2024-02-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb  9 06:01:03 UTC 2024

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

Log Message:
Fix DMA sync sizes.
Don't panic for inconsistent queue counter, just print an error to console.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/pci/if_iwm.c

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



CVS commit: src/bin/dd

2024-01-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Jan 26 07:10:04 UTC 2024

Modified Files:
src/bin/dd: args.c

Log Message:
Don't use the signal handler to terminate when nothing is to do (count=0, 
files=0).

The signal handler tries to raise the signal again, so that a parent can 
retrieve
the signal from the exit code. Calling the terminate handler with signal code 0
doesn't raise a signal and dd continues with exit(127) making this case an 
error.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/bin/dd/args.c

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



CVS commit: src/bin/dd

2024-01-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Jan 26 07:10:04 UTC 2024

Modified Files:
src/bin/dd: args.c

Log Message:
Don't use the signal handler to terminate when nothing is to do (count=0, 
files=0).

The signal handler tries to raise the signal again, so that a parent can 
retrieve
the signal from the exit code. Calling the terminate handler with signal code 0
doesn't raise a signal and dd continues with exit(127) making this case an 
error.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/bin/dd/args.c

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

Modified files:

Index: src/bin/dd/args.c
diff -u src/bin/dd/args.c:1.42 src/bin/dd/args.c:1.43
--- src/bin/dd/args.c:1.42	Fri Jan 14 23:55:16 2022
+++ src/bin/dd/args.c	Fri Jan 26 07:10:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.42 2022/01/14 23:55:16 christos Exp $	*/
+/*	$NetBSD: args.c,v 1.43 2024/01/26 07:10:04 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)args.c	8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: args.c,v 1.42 2022/01/14 23:55:16 christos Exp $");
+__RCSID("$NetBSD: args.c,v 1.43 2024/01/26 07:10:04 mlelstv Exp $");
 #endif
 #endif /* not lint */
 
@@ -248,8 +248,10 @@ f_count(char *arg)
 {
 
 	cpy_cnt = strsuftoll("block count", arg, 0, LLONG_MAX);
-	if (!cpy_cnt)
-		terminate(0);
+	if (!cpy_cnt) {
+		summary();
+		exit(0);
+	}
 }
 
 static void
@@ -257,8 +259,10 @@ f_files(char *arg)
 {
 
 	files_cnt = (u_int)strsuftoll("file count", arg, 0, UINT_MAX);
-	if (!files_cnt)
-		terminate(0);
+	if (!files_cnt) {
+		summary();
+		exit(0);
+	}
 }
 
 static void



CVS commit: src/sys/dev/stbi

2024-01-20 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jan 20 13:33:03 UTC 2024

Modified Files:
src/sys/dev/stbi: stb_image.c

Log Message:
Don't put big structures on stack.
Should fix PR 57859.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/stbi/stb_image.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/stbi/stb_image.c
diff -u src/sys/dev/stbi/stb_image.c:1.11 src/sys/dev/stbi/stb_image.c:1.12
--- src/sys/dev/stbi/stb_image.c:1.11	Sat Aug 26 21:03:53 2023
+++ src/sys/dev/stbi/stb_image.c	Sat Jan 20 13:33:03 2024
@@ -430,7 +430,7 @@ extern int  stbi_gif_info_from_file 
 #endif
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: stb_image.c,v 1.11 2023/08/26 21:03:53 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stb_image.c,v 1.12 2024/01/20 13:33:03 mlelstv Exp $");
 #include 
 #include 
 #include 
@@ -2144,16 +2144,28 @@ int stbi_jpeg_info(char const *filename,
 
 int stbi_jpeg_test_memory(stbi_uc const *buffer, int len)
 {
-   jpeg j;
-   start_mem(, buffer,len);
-   return decode_jpeg_header(, SCAN_type);
+jpeg *j;
+int res;
+
+j = MALLOC(sizeof(*j));
+if (j == NULL) return 0;
+start_mem(>s, buffer,len);
+res = decode_jpeg_header(j, SCAN_type);
+FREE(j);
+return res;
 }
 
 int stbi_jpeg_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp)
 {
-jpeg j;
-start_mem(, buffer, len);
-return stbi_jpeg_info_raw(, x, y, comp);
+jpeg *j;
+int res;
+
+j = MALLOC(sizeof(*j));
+if (j == NULL) return 0;
+start_mem(>s, buffer, len);
+res = stbi_jpeg_info_raw(j, x, y, comp);
+FREE(j);
+return res;
 }
 
 #ifndef STBI_NO_STDIO
@@ -2523,18 +2535,25 @@ static int do_zlib(zbuf *a, char *obuf, 
 
 char *stbi_zlib_decode_malloc_guesssize(const char * buffer, int len, int initial_size, int *outlen)
 {
-   zbuf a;
-   char *p = MALLOC(initial_size);
-   if (p == NULL) return NULL;
-   a.zbuffer = (uint8 const *) buffer;
-   a.zbuffer_end = (uint8 const *) buffer + len;
-   if (do_zlib(, p, initial_size, 1, 1)) {
-  if (outlen) *outlen = (int) (a.zout - a.zout_start);
-  return a.zout_start;
+   zbuf *a;
+   char *p;
+   char *res = NULL;
+
+   a = MALLOC(sizeof(*a));
+   if (a == NULL) return NULL;
+   p = MALLOC(initial_size);
+   if (p == NULL) goto fail;
+   a->zbuffer = (uint8 const *) buffer;
+   a->zbuffer_end = (uint8 const *) buffer + len;
+   if (do_zlib(a, p, initial_size, 1, 1)) {
+  if (outlen) *outlen = (int) (a->zout - a->zout_start);
+  res = a->zout_start;
} else {
-  FREE(a.zout_start);
-  return NULL;
+  FREE(a->zout_start);
}
+fail:
+   FREE(a);
+   return res;
 }
 
 char *stbi_zlib_decode_malloc(char const *buffer, int len, int *outlen)
@@ -2544,56 +2563,81 @@ char *stbi_zlib_decode_malloc(char const
 
 char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header)
 {
-   zbuf a;
-   char *p = MALLOC(initial_size);
-   if (p == NULL) return NULL;
-   a.zbuffer = (uint8 const *) buffer;
-   a.zbuffer_end = (uint8 const *) buffer + len;
-   if (do_zlib(, p, initial_size, 1, parse_header)) {
-  if (outlen) *outlen = (int) (a.zout - a.zout_start);
-  return a.zout_start;
+   zbuf *a;
+   char *p;
+   char *res = NULL;
+
+   a = MALLOC(sizeof(*a));
+   if (a == NULL) return NULL;
+   p = MALLOC(initial_size);
+   if (p == NULL) goto fail;
+   a->zbuffer = (uint8 const *) buffer;
+   a->zbuffer_end = (uint8 const *) buffer + len;
+   if (do_zlib(a, p, initial_size, 1, parse_header)) {
+  if (outlen) *outlen = (int) (a->zout - a->zout_start);
+  res = a->zout_start;
} else {
-  FREE(a.zout_start);
-  return NULL;
+  FREE(a->zout_start);
}
+fail:
+   FREE(a);
+   return res;
 }
 
 int stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer, int ilen)
 {
-   zbuf a;
-   a.zbuffer = (uint8 const *) ibuffer;
-   a.zbuffer_end = (uint8 const *) ibuffer + ilen;
-   if (do_zlib(, obuffer, olen, 0, 1))
-  return (int) (a.zout - a.zout_start);
+   zbuf *a;
+   int res;
+
+   a = MALLOC(sizeof(*a));
+   if (a == NULL) return -1;
+   a->zbuffer = (uint8 const *) ibuffer;
+   a->zbuffer_end = (uint8 const *) ibuffer + ilen;
+   if (do_zlib(a, obuffer, olen, 0, 1))
+  res = (int) (a->zout - a->zout_start);
else
-  return -1;
+  res = -1;
+   FREE(a);
+   return res;
 }
 
 char *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen)
 {
-   zbuf a;
-   char *p = MALLOC(16384);
-   if (p == NULL) return NULL;
-   a.zbuffer = (uint8 const *) buffer;
-   a.zbuffer_end = (uint8 const *) buffer+len;
-   if (do_zlib(, p, 16384, 1, 0)) {
-  if (outlen) *outlen = (int) (a.zout - a.zout_start);
-  return a.zout_start;
-   } else {
-  FREE(a.zout_start);
-  return NULL;
-   }
+   

CVS commit: src/sys/dev/stbi

2024-01-20 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jan 20 13:33:03 UTC 2024

Modified Files:
src/sys/dev/stbi: stb_image.c

Log Message:
Don't put big structures on stack.
Should fix PR 57859.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/stbi/stb_image.c

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



CVS commit: src/sys/dev/dm

2024-01-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 14 07:56:53 UTC 2024

Modified Files:
src/sys/dev/dm: dm_ioctl.c

Log Message:
Avoid leaving a configured device without resources.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/dm/dm_ioctl.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/dm/dm_ioctl.c
diff -u src/sys/dev/dm/dm_ioctl.c:1.56 src/sys/dev/dm/dm_ioctl.c:1.57
--- src/sys/dev/dm/dm_ioctl.c:1.56	Thu Oct 13 06:10:48 2022
+++ src/sys/dev/dm/dm_ioctl.c	Sun Jan 14 07:56:53 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_ioctl.c,v 1.56 2022/10/13 06:10:48 andvar Exp $  */
+/* $NetBSD: dm_ioctl.c,v 1.57 2024/01/14 07:56:53 mlelstv Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.56 2022/10/13 06:10:48 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.57 2024/01/14 07:56:53 mlelstv Exp $");
 
 /*
  * Locking is used to synchronise between ioctl calls and between dm_table's
@@ -209,18 +209,21 @@ dm_dev_create_ioctl(prop_dictionary_t dm
 		dm_dev_unbusy(dmv);
 		return EEXIST;
 	}
+
+	if ((dmv = dm_dev_alloc()) == NULL)
+		return ENOMEM;
+
 	cf = kmem_alloc(sizeof(*cf), KM_SLEEP);
 	cf->cf_name = dm_cd.cd_name;
 	cf->cf_atname = dm_ca.ca_name;
 	cf->cf_unit = atomic_inc_32_nv(_minor_num);
 	cf->cf_fstate = FSTATE_NOTFOUND;
 	if ((devt = config_attach_pseudo(cf)) == NULL) {
+		dm_dev_free(dmv);
 		kmem_free(cf, sizeof(*cf));
 		aprint_error("Unable to attach pseudo device dm/%s\n", name);
 		return (ENOMEM);
 	}
-	if ((dmv = dm_dev_alloc()) == NULL)
-		return ENOMEM;
 
 	if (uuid)
 		strncpy(dmv->uuid, uuid, DM_UUID_LEN);
@@ -247,7 +250,7 @@ dm_dev_create_ioctl(prop_dictionary_t dm
 
 	prop_dictionary_set_uint32(dm_dict, DM_IOCTL_MINOR, dmv->minor);
 
-	disk_init(dmv->diskp, dmv->name, );
+	disk_init(dmv->diskp, device_xname(devt), );
 	disk_attach(dmv->diskp);
 
 	dmv->diskp->dk_info = NULL;



CVS commit: src/sys/dev/dm

2024-01-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 14 07:56:53 UTC 2024

Modified Files:
src/sys/dev/dm: dm_ioctl.c

Log Message:
Avoid leaving a configured device without resources.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/dm/dm_ioctl.c

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



CVS commit: src/sys/dev/fdt

2024-01-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 14 07:53:38 UTC 2024

Modified Files:
src/sys/dev/fdt: fdt_memory.c

Log Message:
Handle multiple memory nodes by type, but still allow an untyped
(non-standard) node named /memory.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/fdt/fdt_memory.c

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



CVS commit: src/sys/dev/fdt

2024-01-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan 14 07:53:38 UTC 2024

Modified Files:
src/sys/dev/fdt: fdt_memory.c

Log Message:
Handle multiple memory nodes by type, but still allow an untyped
(non-standard) node named /memory.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/fdt/fdt_memory.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/fdt/fdt_memory.c
diff -u src/sys/dev/fdt/fdt_memory.c:1.9 src/sys/dev/fdt/fdt_memory.c:1.10
--- src/sys/dev/fdt/fdt_memory.c:1.9	Fri Jan 12 18:06:18 2024
+++ src/sys/dev/fdt/fdt_memory.c	Sun Jan 14 07:53:38 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_memory.c,v 1.9 2024/01/12 18:06:18 skrll Exp $ */
+/* $NetBSD: fdt_memory.c,v 1.10 2024/01/14 07:53:38 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "opt_fdt.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.9 2024/01/12 18:06:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.10 2024/01/14 07:53:38 mlelstv Exp $");
 
 #include 
 #include 
@@ -77,26 +77,43 @@ fdt_memory_range_free(struct fdt_memory_
 void
 fdt_memory_get(uint64_t *pstart, uint64_t *pend)
 {
-	const int memory = OF_finddevice("/memory");
+	const void *fdt_data = fdtbus_get_data();
 	uint64_t cur_addr, cur_size;
-	int index, nadd;
+	int index, nadd = 0, off, memory;
 
-	for (index = 0, nadd = 0;
-	 fdtbus_get_reg64(memory, index, _addr, _size) == 0;
-	 index++) {
-		if (cur_size == 0)
-			continue;
-		fdt_memory_add_range(cur_addr, cur_size);
+	off = fdt_node_offset_by_prop_value(fdt_data, -1,
+	"device_type", "memory", sizeof("memory"));
 
-		if (nadd++ == 0) {
-			*pstart = cur_addr;
-			*pend = cur_addr + cur_size;
-			continue;
+	/*
+	 * Device Tree Specification 3.2 says that memory
+	 * nodes are named "memory" and have device_type
+	 * "memory", but if the device_type is missing, try
+	 * to find the (then single) node by name.
+	 */
+	if (off == -FDT_ERR_NOTFOUND)
+		off = fdt_path_offset(fdt_data, "/memory");
+
+	while (off != -FDT_ERR_NOTFOUND) {
+		memory = fdtbus_offset2phandle(off);
+		for (index = 0;
+		 fdtbus_get_reg64(memory, index, _addr, _size) == 0;
+		 index++) {
+			if (cur_size == 0)
+continue;
+			fdt_memory_add_range(cur_addr, cur_size);
+
+			if (nadd++ == 0) {
+*pstart = cur_addr;
+*pend = cur_addr + cur_size;
+continue;
+			}
+			if (cur_addr < *pstart)
+*pstart = cur_addr;
+			if (cur_addr + cur_size > *pend)
+*pend = cur_addr + cur_size;
 		}
-		if (cur_addr < *pstart)
-			*pstart = cur_addr;
-		if (cur_addr + cur_size > *pend)
-			*pend = cur_addr + cur_size;
+		off = fdt_node_offset_by_prop_value(fdt_data, off,
+		"device_type", "memory", sizeof("memory"));
 	}
 	if (nadd == 0)
 		panic("Cannot determine memory size");



CVS commit: src/sys/arch/virt68k/dev

2024-01-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Jan 12 06:23:20 UTC 2024

Modified Files:
src/sys/arch/virt68k/dev: gfrtc_mainbus.c

Log Message:
The interrupt handler needs to clear the interrupt condition
before re-arming the timer. Otherwise the timer could expire
again before clearing the interrupt, the interrupt gets lost
and the clock stops.

On real hardware that could only occur if the timer interval
is extremely short or if there is a higher-than-clock interrupt
that delays processing. In the emulated world however, time
can progress non-continously and this happens often under load.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/dev/gfrtc_mainbus.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/virt68k/dev/gfrtc_mainbus.c
diff -u src/sys/arch/virt68k/dev/gfrtc_mainbus.c:1.1 src/sys/arch/virt68k/dev/gfrtc_mainbus.c:1.2
--- src/sys/arch/virt68k/dev/gfrtc_mainbus.c:1.1	Tue Jan  2 07:40:59 2024
+++ src/sys/arch/virt68k/dev/gfrtc_mainbus.c	Fri Jan 12 06:23:20 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gfrtc_mainbus.c,v 1.1 2024/01/02 07:40:59 thorpej Exp $	*/
+/*	$NetBSD: gfrtc_mainbus.c,v 1.2 2024/01/12 06:23:20 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2023, 2024 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gfrtc_mainbus.c,v 1.1 2024/01/02 07:40:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gfrtc_mainbus.c,v 1.2 2024/01/12 06:23:20 mlelstv Exp $");
 
 #include 
 #include 
@@ -65,12 +65,12 @@ struct gfrtc_mainbus_softc {
 
 #define	CLOCK_HANDLER()			\
 do {	\
-	/* Get the next alarm set ASAP. */\
-	gfrtc_set_alarm(>sc_gfrtc, sc->sc_interval_ns);		\
-	\
 	/* Clear the interrupt condition. */\
 	gfrtc_clear_interrupt(>sc_gfrtc);\
 	\
+	/* Get the next alarm set ASAP. */\
+	gfrtc_set_alarm(>sc_gfrtc, sc->sc_interval_ns);		\
+	\
 	/* Increment the counter and call the handler. */		\
 	sc->sc_evcnt->ev_count++;	\
 	sc->sc_handler((struct clockframe *)v);\



CVS commit: src/sys/arch/virt68k/dev

2024-01-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Jan 12 06:23:20 UTC 2024

Modified Files:
src/sys/arch/virt68k/dev: gfrtc_mainbus.c

Log Message:
The interrupt handler needs to clear the interrupt condition
before re-arming the timer. Otherwise the timer could expire
again before clearing the interrupt, the interrupt gets lost
and the clock stops.

On real hardware that could only occur if the timer interval
is extremely short or if there is a higher-than-clock interrupt
that delays processing. In the emulated world however, time
can progress non-continously and this happens often under load.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/dev/gfrtc_mainbus.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/i386/stand

2024-01-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jan  6 21:26:43 UTC 2024

Modified Files:
src/sys/arch/i386/stand/efiboot: efidisk.c efidisk.h
src/sys/arch/i386/stand/lib: biosdisk.c exec.c

Log Message:
In efiboot
- create bootinfo information only once.
- add fake biosgeom entries so that the kernel can distinguish between
  hard drives (with geom) and CD-ROM (without).


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/efiboot/efidisk.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/efiboot/efidisk.h
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/i386/stand/lib/biosdisk.c
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/i386/stand/lib/exec.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/i386/stand/efiboot/efidisk.c
diff -u src/sys/arch/i386/stand/efiboot/efidisk.c:1.10 src/sys/arch/i386/stand/efiboot/efidisk.c:1.11
--- src/sys/arch/i386/stand/efiboot/efidisk.c:1.10	Sun May 14 09:07:54 2023
+++ src/sys/arch/i386/stand/efiboot/efidisk.c	Sat Jan  6 21:26:43 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: efidisk.c,v 1.10 2023/05/14 09:07:54 riastradh Exp $	*/
+/*	$NetBSD: efidisk.c,v 1.11 2024/01/06 21:26:43 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -38,9 +38,12 @@
 #include "biosdisk_ll.h"
 #include "devopen.h"
 #include "efidisk.h"
+#include "bootinfo.h"
 
 static struct efidiskinfo_lh efi_disklist;
 static int nefidisks;
+static struct btinfo_biosgeom *bibg;
+static size_t bibg_len;
 
 #define MAXDEVNAME 39 /* "NAME=" + 34 char part_name */
 
@@ -158,6 +161,23 @@ next:
 		if (edi->bootdev)
 			boot_biosdev = edi->dev;
 	}
+
+	bibg_len = sizeof(*bibg) + nefidisks * sizeof(struct bi_biosgeom_entry);
+	bibg = alloc(bibg_len);
+	if (bibg == NULL)
+		return;
+
+	bibg->num = nefidisks;
+
+	i = 0;
+	TAILQ_FOREACH(edi, _disklist, list) {
+		if (edi->type == BIOSDISK_TYPE_HD) {
+			memset(>disk[i], 0, sizeof(bibg->disk[i]));
+			bibg->disk[i].dev = edi->dev;
+			bibg->disk[i].flags = BI_GEOM_INVALID;
+		}
+		++i;
+	}
 }
 
 static void
@@ -383,3 +403,10 @@ efidisk_get_efi_system_partition(int dev
 	*partition = i;
 	return 0;
 }
+
+void
+efidisk_getbiosgeom()
+{
+	BI_ADD(bibg, BTINFO_BIOSGEOM, bibg_len);
+}
+

Index: src/sys/arch/i386/stand/efiboot/efidisk.h
diff -u src/sys/arch/i386/stand/efiboot/efidisk.h:1.3 src/sys/arch/i386/stand/efiboot/efidisk.h:1.4
--- src/sys/arch/i386/stand/efiboot/efidisk.h:1.3	Mon Apr  2 09:44:18 2018
+++ src/sys/arch/i386/stand/efiboot/efidisk.h	Sat Jan  6 21:26:43 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: efidisk.h,v 1.3 2018/04/02 09:44:18 nonaka Exp $	*/
+/*	$NetBSD: efidisk.h,v 1.4 2024/01/06 21:26:43 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -41,3 +41,4 @@ TAILQ_HEAD(efidiskinfo_lh, efidiskinfo);
 
 const struct efidiskinfo *efidisk_getinfo(int);
 int efidisk_get_efi_system_partition(int, int *);
+void efidisk_getbiosgeom(void);

Index: src/sys/arch/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.60 src/sys/arch/i386/stand/lib/biosdisk.c:1.61
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.60	Mon Oct  2 00:02:33 2023
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Sat Jan  6 21:26:43 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.60 2023/10/02 00:02:33 manu Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.61 2024/01/06 21:26:43 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -1198,11 +1198,13 @@ out:
 static void
 add_biosdisk_bootinfo(void)
 {
+#ifndef EFIBOOT
 	if (bootinfo == NULL) {
 		return;
 	}
 	BI_ADD(_disk, BTINFO_BOOTDISK, sizeof(bi_disk));
 	BI_ADD(_wedge, BTINFO_BOOTWEDGE, sizeof(bi_wedge));
+#endif
 	return;
 }
 #endif

Index: src/sys/arch/i386/stand/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.79 src/sys/arch/i386/stand/lib/exec.c:1.80
--- src/sys/arch/i386/stand/lib/exec.c:1.79	Thu Apr 20 00:42:24 2023
+++ src/sys/arch/i386/stand/lib/exec.c	Sat Jan  6 21:26:43 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.79 2023/04/20 00:42:24 manu Exp $	 */
+/*	$NetBSD: exec.c,v 1.80 2024/01/06 21:26:43 mlelstv Exp $	 */
 
 /*
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -108,6 +108,8 @@
 #endif
 #ifdef EFIBOOT
 #include "efiboot.h"
+#include "biosdisk.h"
+#include "efidisk.h"
 #undef DEBUG	/* XXX */
 #endif
 
@@ -498,6 +500,10 @@ exec_netbsd(const char *file, physaddr_t
 		goto out;
 	}
 #ifdef EFIBOOT
+	BI_ADD(_disk, BTINFO_BOOTDISK, sizeof(bi_disk));
+	BI_ADD(_wedge, BTINFO_BOOTWEDGE, sizeof(bi_wedge));
+	efidisk_getbiosgeom();
+
 	efi_load_start = marks[MARK_START];
 
 	/* adjust to the real load address */



CVS commit: src/sys/arch/i386/stand

2024-01-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jan  6 21:26:43 UTC 2024

Modified Files:
src/sys/arch/i386/stand/efiboot: efidisk.c efidisk.h
src/sys/arch/i386/stand/lib: biosdisk.c exec.c

Log Message:
In efiboot
- create bootinfo information only once.
- add fake biosgeom entries so that the kernel can distinguish between
  hard drives (with geom) and CD-ROM (without).


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/efiboot/efidisk.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/efiboot/efidisk.h
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/i386/stand/lib/biosdisk.c
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/i386/stand/lib/exec.c

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



CVS commit: src/sys/kern

2024-01-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Jan  4 11:18:20 UTC 2024

Modified Files:
src/sys/kern: subr_cpu.c

Log Message:
dump topology information with aprint_debug instead of requiring to build
a DEBUG kernel.


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

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



CVS commit: src/sys/kern

2024-01-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Jan  4 11:18:20 UTC 2024

Modified Files:
src/sys/kern: subr_cpu.c

Log Message:
dump topology information with aprint_debug instead of requiring to build
a DEBUG kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/kern/subr_cpu.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/kern/subr_cpu.c
diff -u src/sys/kern/subr_cpu.c:1.19 src/sys/kern/subr_cpu.c:1.20
--- src/sys/kern/subr_cpu.c:1.19	Sat Jul  8 13:59:05 2023
+++ src/sys/kern/subr_cpu.c	Thu Jan  4 11:18:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_cpu.c,v 1.19 2023/07/08 13:59:05 riastradh Exp $	*/
+/*	$NetBSD: subr_cpu.c,v 1.20 2024/01/04 11:18:19 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012, 2019, 2020
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.19 2023/07/08 13:59:05 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_cpu.c,v 1.20 2024/01/04 11:18:19 mlelstv Exp $");
 
 #include 
 #include 
@@ -223,7 +223,6 @@ cpu_topology_link(struct cpu_info *ci, s
 static void
 cpu_topology_dump(void)
 {
-#ifdef DEBUG
 	CPU_INFO_ITERATOR cii;
 	struct cpu_info *ci, *ci2;
 	const char *names[] = { "core", "pkg", "1st" };
@@ -237,25 +236,24 @@ cpu_topology_dump(void)
 
 	for (CPU_INFO_FOREACH(cii, ci)) {
 		if (cpu_topology_haveslow)
-			printf("%s ", ci->ci_is_slow ? "slow" : "fast");
+			aprint_debug("%s ", ci->ci_is_slow ? "slow" : "fast");
 		for (rel = 0; rel < __arraycount(ci->ci_sibling); rel++) {
-			printf("%s has %d %s siblings:", cpu_name(ci),
+			aprint_debug("%s has %d %s siblings:", cpu_name(ci),
 			ci->ci_nsibling[rel], names[rel]);
 			ci2 = ci->ci_sibling[rel];
 			i = 0;
 			do {
-printf(" %s", cpu_name(ci2));
+aprint_debug(" %s", cpu_name(ci2));
 ci2 = ci2->ci_sibling[rel];
 			} while (++i < 64 && ci2 != ci->ci_sibling[rel]);
 			if (i == 64) {
-printf(" GAVE UP");
+aprint_debug(" GAVE UP");
 			}
-			printf("\n");
+			aprint_debug("\n");
 		}
-		printf("%s first in package: %s\n", cpu_name(ci),
+		aprint_debug("%s first in package: %s\n", cpu_name(ci),
 		cpu_name(ci->ci_package1st));
 	}
-#endif	/* DEBUG */
 }
 
 /*



CVS commit: src/sys/dev/iscsi

2023-12-28 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Dec 28 15:58:24 UTC 2023

Modified Files:
src/sys/dev/iscsi: iscsi_main.c

Log Message:
Use correct status value SCSI_BUSY (0x08) instead of XS_BUSY (7) when running
out of sessions. The bug had no impact as scsipi was only comparing
against SCSI_CHECK (0x02) and SCSI_QUEUE_FULL (0x28).


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/iscsi/iscsi_main.c

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



CVS commit: src/sys/dev/iscsi

2023-12-28 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Dec 28 15:58:24 UTC 2023

Modified Files:
src/sys/dev/iscsi: iscsi_main.c

Log Message:
Use correct status value SCSI_BUSY (0x08) instead of XS_BUSY (7) when running
out of sessions. The bug had no impact as scsipi was only comparing
against SCSI_CHECK (0x02) and SCSI_QUEUE_FULL (0x28).


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/iscsi/iscsi_main.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/iscsi/iscsi_main.c
diff -u src/sys/dev/iscsi/iscsi_main.c:1.41 src/sys/dev/iscsi/iscsi_main.c:1.42
--- src/sys/dev/iscsi/iscsi_main.c:1.41	Tue Sep 13 13:09:16 2022
+++ src/sys/dev/iscsi/iscsi_main.c	Thu Dec 28 15:58:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_main.c,v 1.41 2022/09/13 13:09:16 mlelstv Exp $	*/
+/*	$NetBSD: iscsi_main.c,v 1.42 2023/12/28 15:58:24 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -490,7 +490,7 @@ iscsi_scsipi_request(struct scsipi_chann
 			DEB(9, ("ISCSI: refcount too high: %d, winsize %d\n",
 sess->s_refcount, sess->s_send_window));
 			xs->error = XS_BUSY;
-			xs->status = XS_BUSY;
+			xs->status = SCSI_BUSY;
 			scsipi_done(xs);
 			return;
 		}



CVS commit: src/sbin/iscsid

2023-12-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Dec 27 18:07:30 UTC 2023

Modified Files:
src/sbin/iscsid: iscsid_driverif.c

Log Message:
Treat port 0 (unset) as ISCSI_DEFAULT_PORT like before.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/iscsid/iscsid_driverif.c

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

Modified files:

Index: src/sbin/iscsid/iscsid_driverif.c
diff -u src/sbin/iscsid/iscsid_driverif.c:1.9 src/sbin/iscsid/iscsid_driverif.c:1.10
--- src/sbin/iscsid/iscsid_driverif.c:1.9	Sat Nov 25 08:06:02 2023
+++ src/sbin/iscsid/iscsid_driverif.c	Wed Dec 27 18:07:30 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsid_driverif.c,v 1.9 2023/11/25 08:06:02 mlelstv Exp $	*/
+/*	$NetBSD: iscsid_driverif.c,v 1.10 2023/12/27 18:07:30 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -285,7 +285,8 @@ make_connection(session_t * sess, iscsid
 	memset(, 0, sizeof(hints));
 	hints.ai_family = AF_UNSPEC;
 	hints.ai_socktype = SOCK_STREAM;
-	snprintf(portnum, sizeof(portnum), "%u", addr->port);
+	snprintf(portnum, sizeof(portnum), "%u", addr->port
+	? addr->port : ISCSI_DEFAULT_PORT);
 	ret = getaddrinfo((char *)addr->address, portnum, , );
 	switch (ret) {
 	case 0:
@@ -553,7 +554,8 @@ event_recover_connection(uint32_t sid, u
 	memset(, 0, sizeof(hints));
 	hints.ai_family = AF_UNSPEC;
 	hints.ai_socktype = SOCK_STREAM;
-	snprintf(portnum, sizeof(portnum), "%u", addr->port);
+	snprintf(portnum, sizeof(portnum), "%u", addr->port
+	? addr->port : ISCSI_DEFAULT_PORT);
 	ret = getaddrinfo((char *)addr->address, portnum, , );
 	if (ret) {
 		DEB(1, ("getaddrinfo failed (%s)", gai_strerror(ret)));



CVS commit: src/sbin/iscsid

2023-12-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Dec 27 18:07:30 UTC 2023

Modified Files:
src/sbin/iscsid: iscsid_driverif.c

Log Message:
Treat port 0 (unset) as ISCSI_DEFAULT_PORT like before.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/iscsid/iscsid_driverif.c

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



CVS commit: src/sys/dev/pci

2023-12-16 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Dec 16 16:35:49 UTC 2023

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

Log Message:
- handle stuck transmitter (descriptor still owned)
- restart send queue after transmit
- count output packets
- use deferred start

Should fix PR 57694


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 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.28 src/sys/dev/pci/if_rge.c:1.29
--- src/sys/dev/pci/if_rge.c:1.28	Thu Oct 19 23:43:40 2023
+++ src/sys/dev/pci/if_rge.c	Sat Dec 16 16:35:49 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.28 2023/10/19 23:43:40 mrg Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.29 2023/12/16 16:35:49 mlelstv 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.28 2023/10/19 23:43:40 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.29 2023/12/16 16:35:49 mlelstv Exp $");
 
 #include 
 
@@ -351,6 +351,7 @@ rge_attach(device_t parent, device_t sel
 	sc->sc_media.ifm_media = sc->sc_media.ifm_cur->ifm_media;
 
 	if_attach(ifp);
+	if_deferred_start_init(ifp, NULL);
 	ether_ifattach(ifp, eaddr);
 
 	if (pmf_device_register(self, NULL, NULL))
@@ -1385,10 +1386,14 @@ rge_txeof(struct rge_softc *sc)
 		m_freem(txq->txq_mbuf);
 		txq->txq_mbuf = NULL;
 
+		net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 		if (txstat & (RGE_TDCMDSTS_EXCESSCOLL | RGE_TDCMDSTS_COLL))
-			if_statinc(ifp, if_collisions);
+			if_statinc_ref(nsr, if_collisions);
 		if (txstat & RGE_TDCMDSTS_TXERR)
-			if_statinc(ifp, if_oerrors);
+			if_statinc_ref(nsr, if_oerrors);
+		else
+			if_statinc_ref(nsr, if_opackets);
+		IF_STAT_PUTREF(ifp);
 
 		bus_dmamap_sync(sc->sc_dmat, sc->rge_ldata.rge_tx_list_map,
 		idx * sizeof(struct rge_tx_desc),
@@ -1404,24 +1409,12 @@ rge_txeof(struct rge_softc *sc)
 
 	sc->rge_ldata.rge_txq_considx = cons;
 
-#if 0
-	if (ifq_is_oactive(>if_snd))
-		ifq_restart(>if_snd);
-	else if (free == 2)
-		ifq_serialize(>if_snd, >sc_task);
-	else
-		ifp->if_timer = 0;
-#else
-#if 0
-	if (!IF_IS_EMPTY(>if_snd))
-		rge_start(ifp);
-	else
 	if (free == 2)
-		if (0) { rge_txstart(>sc_task, sc); }
-	else
-#endif
-		ifp->if_timer = 0;
-#endif
+		rge_txstart(>sc_task, sc);
+
+	CLR(ifp->if_flags, IFF_OACTIVE);
+	ifp->if_timer = 0;
+	if_schedule_deferred_start(ifp);
 
 	return (1);
 }



CVS commit: src/sys/dev/pci

2023-12-16 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Dec 16 16:35:49 UTC 2023

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

Log Message:
- handle stuck transmitter (descriptor still owned)
- restart send queue after transmit
- count output packets
- use deferred start

Should fix PR 57694


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 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/i386/stand/libsa

2023-12-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Dec 14 08:06:23 UTC 2023

Modified Files:
src/sys/arch/i386/stand/libsa: nfs.c

Log Message:
Align again with libsa (NFS_NOSYMLINK fix).


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/stand/libsa/nfs.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/i386/stand/libsa

2023-12-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Dec 14 08:06:23 UTC 2023

Modified Files:
src/sys/arch/i386/stand/libsa: nfs.c

Log Message:
Align again with libsa (NFS_NOSYMLINK fix).


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/stand/libsa/nfs.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/i386/stand/libsa/nfs.c
diff -u src/sys/arch/i386/stand/libsa/nfs.c:1.20 src/sys/arch/i386/stand/libsa/nfs.c:1.21
--- src/sys/arch/i386/stand/libsa/nfs.c:1.20	Tue Dec 12 09:16:17 2023
+++ src/sys/arch/i386/stand/libsa/nfs.c	Thu Dec 14 08:06:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs.c,v 1.20 2023/12/12 09:16:17 mlelstv Exp $	*/
+/*	$NetBSD: nfs.c,v 1.21 2023/12/14 08:06:23 mlelstv Exp $	*/
 
 /*-
  *  Copyright (c) 1993 John Brezak
@@ -597,9 +597,9 @@ nfs_open(const char *path, struct open_f
 	char namebuf[NFS_MAXPATHLEN + 1];
 	char linkbuf[NFS_MAXPATHLEN + 1];
 	int nlinks = 0;
+	n_long fa_type;
 #endif
 	int error = 0;
-	n_long fa_type;
 
 #ifdef NFS_DEBUG
  	if (debug)



CVS commit: src/sys/arch/i386/stand/libsa

2023-12-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Dec 12 09:16:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/libsa: nfs.c

Log Message:
Merge with generic libsa NFS code to minimize differences and to learn NFSv3.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/libsa/nfs.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/i386/stand/libsa

2023-12-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Dec 12 09:16:17 UTC 2023

Modified Files:
src/sys/arch/i386/stand/libsa: nfs.c

Log Message:
Merge with generic libsa NFS code to minimize differences and to learn NFSv3.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/libsa/nfs.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/i386/stand/libsa/nfs.c
diff -u src/sys/arch/i386/stand/libsa/nfs.c:1.19 src/sys/arch/i386/stand/libsa/nfs.c:1.20
--- src/sys/arch/i386/stand/libsa/nfs.c:1.19	Sun Dec 25 06:09:09 2011
+++ src/sys/arch/i386/stand/libsa/nfs.c	Tue Dec 12 09:16:17 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs.c,v 1.19 2011/12/25 06:09:09 tsutsui Exp $	*/
+/*	$NetBSD: nfs.c,v 1.20 2023/12/12 09:16:17 mlelstv Exp $	*/
 
 /*-
  *  Copyright (c) 1993 John Brezak
@@ -28,6 +28,16 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*
+ * XXX Does not currently implement:
+ * XXX
+ * XXX LIBSA_NO_FS_CLOSE
+ * XXX LIBSA_NO_FS_SEEK
+ * XXX LIBSA_NO_FS_WRITE
+ * XXX LIBSA_NO_FS_SYMLINK (does this even make sense?)
+ * XXX LIBSA_FS_SINGLECOMPONENT (does this even make sense?)
+ */
+
 #include 
 #include 
 #include 
@@ -43,6 +53,7 @@
 
 #include "rpcv2.h"
 #include "nfsv2.h"
+#include "nfsv3.h"
 
 #include 
 #include "net.h"
@@ -50,40 +61,11 @@
 #include "nfs.h"
 #include "rpc.h"
 
-/* Define our own NFS attributes. */
-struct nfsv2_fattrs {
-	n_long	fa_type;
-	n_long	fa_mode;
-	n_long	fa_nlink;
-	n_long	fa_uid;
-	n_long	fa_gid;
-	n_long	fa_size;
-	n_long	fa_blocksize;
-	n_long	fa_rdev;
-	n_long	fa_blocks;
-	n_long	fa_fsid;
-	n_long	fa_fileid;
-	struct nfsv2_time fa_atime;
-	struct nfsv2_time fa_mtime;
-	struct nfsv2_time fa_ctime;
-};
-
-
-struct nfs_read_args {
-	u_char	fh[NFS_FHSIZE];
-	n_long	off;
-	n_long	len;
-	n_long	xxx;			/* XXX what's this for? */
-};
+/* Storage for any filehandle (including length for V3) */
+#define NFS_FHSTORE (NFS_FHSIZE < NFS_V3FHSIZE ? NFS_V3FHSIZE + 4: NFS_FHSIZE)
 
 /* Data part of nfs rpc reply (also the largest thing we receive) */
 #define NFSREAD_SIZE 1024
-struct nfs_read_repl {
-	n_long	errno;
-	struct	nfsv2_fattrs fa;
-	n_long	count;
-	u_char	data[NFSREAD_SIZE];
-};
 
 #ifndef NFS_NOSYMLINK
 struct nfs_readlnk_repl {
@@ -93,36 +75,88 @@ struct nfs_readlnk_repl {
 };
 #endif
 
+static inline uint64_t
+getnquad(n_long x[2]) {
+	return (uint64_t)ntohl(x[0]) << 32 | ntohl(x[1]);
+}
+
+static inline void
+setnquad(n_long x[2], uint64_t v)
+{
+	x[0] = htonl((n_long)(v >> 32));
+	x[1] = htonl((n_long)(v & 0x));
+}
+
 struct nfs_iodesc {
 	struct	iodesc	*iodesc;
 	off_t	off;
-	u_char	fh[NFS_FHSIZE];
-	struct nfsv2_fattrs fa;	/* all in network order */
+	int	version;
+	u_char	fh[NFS_FHSTORE];
+	union {
+		/* all in network order */
+		struct nfsv2_fattr v2;
+		struct nfsv3_fattr v3;
+	} u_fa;
 };
 
-int	nfs_getrootfh(struct iodesc *, char *, u_char *);
+static inline size_t
+fhstore(int version, u_char *fh)
+{
+	size_t len;
+
+	switch (version) {
+	case NFS_VER2:
+		len = NFS_FHSIZE;
+		break;
+	case NFS_VER3:
+		len = fh[0] << 24 | fh[1] << 16 | fh[2] << 8 | fh[3];
+		if (len > NFS_V3FHSIZE)
+			len = NFS_V3FHSIZE;
+		len = 4 + roundup(len, 4);
+		break;
+	default:
+		len = 0;
+		break;
+	}
+
+	return len;
+}
+
+static inline size_t
+fhcopy(int version, u_char *src, u_char *dst)
+{
+	size_t len = fhstore(version, src);
+	memcpy(dst, src, len);
+	return len;
+}
+
+#define setfh(d, s) fhcopy((d)->version, (s), (d)->fh)
+#define getfh(d, s) fhcopy((d)->version, (d)->fh, (s))
+
+
+struct nfs_iodesc nfs_root_node;
+
+int	nfs_getrootfh(struct iodesc *, char *, u_char *, int *);
 int	nfs_lookupfh(struct nfs_iodesc *, const char *, int,
 	struct nfs_iodesc *);
-#ifndef NFS_NOSYMLINK
 int	nfs_readlink(struct nfs_iodesc *, char *);
-#endif
 ssize_t	nfs_readdata(struct nfs_iodesc *, off_t, void *, size_t);
 
 /*
  * Fetch the root file handle (call mount daemon)
- * Return zero or error number.
+ * On error, return non-zero and set errno.
  */
 int
-nfs_getrootfh(struct iodesc *d, char *path, u_char *fhp)
+nfs_getrootfh(struct iodesc *d, char *path, u_char *fhp, int *versionp)
 {
-	size_t len;
+	int len;
 	struct args {
 		n_long	len;
 		char	path[FNAME_SIZE];
 	} *args;
 	struct repl {
 		n_long	errno;
-		u_char	fh[NFS_FHSIZE];
+		u_char	fh[NFS_FHSTORE];
 	} *repl;
 	struct {
 		n_long	h[RPC_HEADER_WORDS];
@@ -136,32 +170,42 @@ nfs_getrootfh(struct iodesc *d, char *pa
 
 #ifdef NFS_DEBUG
 	if (debug)
-		printf("nfs_getrootfh: %s\n", path);
+		printf("%s: %s\n", __func__, path);
 #endif
 
 	args = 
 	repl = 
 
-	memset(args, 0, sizeof(*args));
+	(void)memset(args, 0, sizeof(*args));
 	len = strlen(path);
-	if (len > sizeof(args->path))
+	if ((size_t)len > sizeof(args->path))
 		len = sizeof(args->path);
 	args->len = htonl(len);
-	memcpy(args->path, path, len);
+	(void)memcpy(args->path, path, len);
 	len = 4 + roundup(len, 4);
 
-	cc = 

CVS commit: src/sys/lib/libsa

2023-12-12 Thread Michael van Elst
type = currfd->u_fa.v2.fa_type;
+			break;
+		case NFS_VER3:
+			fa_type = currfd->u_fa.v3.fa_type;
+			break;
+		default:
+			fa_type = htonl(NFNON);
+			break;
+		}
+		if (fa_type != htonl(NFDIR)) {
 			error = ENOTDIR;
 			goto out;
 		}
@@ -431,6 +647,7 @@ nfs_open(const char *path, struct open_f
 		newfd = alloc(sizeof(*newfd));
 		newfd->iodesc = currfd->iodesc;
 		newfd->off = 0;
+		newfd->version = currfd->version;
 
 		/*
 		 * Get next component of path name.
@@ -456,7 +673,18 @@ nfs_open(const char *path, struct open_f
 		/*
 		 * Check for symbolic link
 		 */
-		if (newfd->fa.fa_type == htonl(NFLNK)) {
+		switch (newfd->version) {
+		case NFS_VER2:
+			fa_type = newfd->u_fa.v2.fa_type;
+			break;
+		case NFS_VER3:
+			fa_type = newfd->u_fa.v3.fa_type;
+			break;
+		default:
+			fa_type = htonl(NFNON);
+			break;
+		}
+		if (fa_type == htonl(NFLNK)) {
 			int link_len, len;
 
 			error = nfs_readlink(newfd, linkbuf);
@@ -506,6 +734,7 @@ out:
 	currfd = alloc(sizeof(*currfd));
 	currfd->iodesc = nfs_root_node.iodesc;
 	currfd->off = 0;
+	currfd->version = nfs_root_node.version;
 
 	cp = path;
 	/*
@@ -613,7 +842,18 @@ __compactcall off_t
 nfs_seek(struct open_file *f, off_t offset, int where)
 {
 	struct nfs_iodesc *d = (struct nfs_iodesc *)f->f_fsdata;
-	n_long size = ntohl(d->fa.fa_size);
+	off_t size;
+
+	switch (d->version) {
+	case NFS_VER2:
+		size = ntohl(d->u_fa.v2.fa_size);
+		break;
+	case NFS_VER3:
+		size = getnquad(d->u_fa.v3.fa_size);
+		break;
+	default:
+		return -1;
+	}
 
 	switch (where) {
 	case SEEK_SET:
@@ -642,15 +882,29 @@ nfs_stat(struct open_file *f, struct sta
 	struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
 	n_long ftype, mode;
 
-	ftype = ntohl(fp->fa.fa_type);
-	mode  = ntohl(fp->fa.fa_mode);
-	mode |= nfs_stat_types[ftype & 7];
+	switch (fp->version) {
+	case NFS_VER2:
+		ftype = ntohl(fp->u_fa.v2.fa_type);
+		mode  = ntohl(fp->u_fa.v2.fa_mode);
+		sb->st_nlink = ntohl(fp->u_fa.v2.fa_nlink);
+		sb->st_uid   = ntohl(fp->u_fa.v2.fa_uid);
+		sb->st_gid   = ntohl(fp->u_fa.v2.fa_gid);
+		sb->st_size  = ntohl(fp->u_fa.v2.fa_size);
+		break;
+	case NFS_VER3:
+		ftype = ntohl(fp->u_fa.v3.fa_type);
+		mode  = ntohl(fp->u_fa.v3.fa_mode);
+		sb->st_nlink = ntohl(fp->u_fa.v3.fa_nlink);
+		sb->st_uid   = ntohl(fp->u_fa.v3.fa_uid);
+		sb->st_gid   = ntohl(fp->u_fa.v3.fa_gid);
+		sb->st_size  = getnquad(fp->u_fa.v3.fa_size);
+		break;
+	default:
+		return -1;
+	}
 
+	mode |= nfs_stat_types[ftype & 7];
 	sb->st_mode  = mode;
-	sb->st_nlink = ntohl(fp->fa.fa_nlink);
-	sb->st_uid   = ntohl(fp->fa.fa_uid);
-	sb->st_gid   = ntohl(fp->fa.fa_gid);
-	sb->st_size  = ntohl(fp->fa.fa_size);
 
 	return 0;
 }

Index: src/sys/lib/libsa/nfsv2.h
diff -u src/sys/lib/libsa/nfsv2.h:1.4 src/sys/lib/libsa/nfsv2.h:1.5
--- src/sys/lib/libsa/nfsv2.h:1.4	Sun Dec 11 12:24:46 2005
+++ src/sys/lib/libsa/nfsv2.h	Tue Dec 12 09:12:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfsv2.h,v 1.4 2005/12/11 12:24:46 christos Exp $	*/
+/*	$NetBSD: nfsv2.h,v 1.5 2023/12/12 09:12:55 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -144,19 +144,3 @@ struct nfsv2_fattr {
 	struct nfsv2_time fa_ctime;
 };
 
-struct nfsv2_sattr {
-	n_long	sa_mode;
-	n_long	sa_uid;
-	n_long	sa_gid;
-	n_long	sa_size;
-	struct nfsv2_time sa_atime;
-	struct nfsv2_time sa_mtime;
-};
-
-struct nfsv2_statfs {
-	n_long	sf_tsize;
-	n_long	sf_bsize;
-	n_long	sf_blocks;
-	n_long	sf_bfree;
-	n_long	sf_bavail;
-};

Index: src/sys/lib/libsa/rpcv2.h
diff -u src/sys/lib/libsa/rpcv2.h:1.3 src/sys/lib/libsa/rpcv2.h:1.4
--- src/sys/lib/libsa/rpcv2.h:1.3	Sun Dec 11 12:24:46 2005
+++ src/sys/lib/libsa/rpcv2.h	Tue Dec 12 09:12:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcv2.h,v 1.3 2005/12/11 12:24:46 christos Exp $	*/
+/*	$NetBSD: rpcv2.h,v 1.4 2023/12/12 09:12:55 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -75,6 +75,7 @@
 /* RPC Prog definitions */
 #define	RPCPROG_MNT	15
 #define	RPCMNT_VER1	1
+#define	RPCMNT_VER3	3
 #define	RPCMNT_MOUNT	1
 #define	RPCMNT_DUMP	2
 #define	RPCMNT_UMOUNT	3

Added files:

Index: src/sys/lib/libsa/nfsv3.h
diff -u /dev/null src/sys/lib/libsa/nfsv3.h:1.1
--- /dev/null	Tue Dec 12 09:12:55 2023
+++ src/sys/lib/libsa/nfsv3.h	Tue Dec 12 09:12:55 2023
@@ -0,0 +1,73 @@
+/*	$NetBSD: nfsv3.h,v 1.1 2023/12/12 09:12:55 mlelstv Exp $	*/
+
+/*
+ * Copyright (c) 2023 Michael van Elst
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Rick Macklem at The University of Guelph.
+ *
+ * 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
+ *no

CVS commit: src/sys/lib/libsa

2023-12-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Dec 12 09:12:55 UTC 2023

Modified Files:
src/sys/lib/libsa: nfs.c nfsv2.h rpcv2.h
Added Files:
src/sys/lib/libsa: nfsv3.h

Log Message:
Add NFSv3 support. Try NFSv3 and fall back to NFSv2.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/lib/libsa/nfs.c
cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libsa/nfsv2.h
cvs rdiff -u -r0 -r1.1 src/sys/lib/libsa/nfsv3.h
cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libsa/rpcv2.h

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



CVS commit: src/usr.sbin/crash

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 14:00:47 UTC 2023

Modified Files:
src/usr.sbin/crash: crash.c

Log Message:
Implement cngetc, don't abort.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/crash/crash.c

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

Modified files:

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.15 src/usr.sbin/crash/crash.c:1.16
--- src/usr.sbin/crash/crash.c:1.15	Wed Apr 12 17:53:32 2023
+++ src/usr.sbin/crash/crash.c	Mon Dec 11 14:00:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.15 2023/04/12 17:53:32 riastradh Exp $	*/
+/*	$NetBSD: crash.c,v 1.16 2023/12/11 14:00:47 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: crash.c,v 1.15 2023/04/12 17:53:32 riastradh Exp $");
+__RCSID("$NetBSD: crash.c,v 1.16 2023/12/11 14:00:47 mlelstv Exp $");
 #endif /* not lint */
 
 #include 
@@ -94,7 +94,6 @@ void lockdebug_lock_print(void) {
 }
 #endif
 
-
 static void
 cleanup(void)
 {
@@ -309,9 +308,11 @@ db_check_interrupt(void)
 int
 cngetc(void)
 {
+	char ch;
 
-	fprintf(stderr, "cngetc\n");
-	abort();
+	if (el_getc(elptr, ) <= 0)
+		return 0;
+	return (unsigned char)ch;
 }
 
 void



CVS commit: src/usr.sbin/crash

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 14:00:47 UTC 2023

Modified Files:
src/usr.sbin/crash: crash.c

Log Message:
Implement cngetc, don't abort.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/crash/crash.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/rpcinfo

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:56:48 UTC 2023

Modified Files:
src/usr.bin/rpcinfo: rpcinfo.c

Log Message:
Use IANA registerd service name "sunrpc" instead of "rpcbind".


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/rpcinfo/rpcinfo.c

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/rpcinfo/rpcinfo.c
diff -u src/usr.bin/rpcinfo/rpcinfo.c:1.37 src/usr.bin/rpcinfo/rpcinfo.c:1.38
--- src/usr.bin/rpcinfo/rpcinfo.c:1.37	Fri May 24 23:09:45 2013
+++ src/usr.bin/rpcinfo/rpcinfo.c	Mon Dec 11 13:56:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpcinfo.c,v 1.37 2013/05/24 23:09:45 christos Exp $	*/
+/*	$NetBSD: rpcinfo.c,v 1.38 2023/12/11 13:56:47 mlelstv Exp $	*/
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -569,7 +569,7 @@ get_inet_address(struct sockaddr_in *add
 		} else {
 			(void)memset(, 0, sizeof hints);
 			hints.ai_family = AF_INET;
-			if ((error = getaddrinfo(host, "rpcbind", , ))
+			if ((error = getaddrinfo(host, "sunrpc", , ))
 			!= 0) {
 errx(1, "%s: %s", host, gai_strerror(error));
 			} else {
@@ -1628,7 +1628,7 @@ getclnthandle(const char *host, const st
 
 	/* Get the address of the rpcbind */
 	(void)memset(, 0, sizeof hints);
-	if (getaddrinfo(host, "rpcbind", , ) != 0) {
+	if (getaddrinfo(host, "sunrpc", , ) != 0) {
 		rpc_createerr.cf_stat = RPC_N2AXLATEFAILURE;
 		return NULL;
 	}



CVS commit: src/usr.bin/rpcinfo

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:56:48 UTC 2023

Modified Files:
src/usr.bin/rpcinfo: rpcinfo.c

Log Message:
Use IANA registerd service name "sunrpc" instead of "rpcbind".


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/rpcinfo/rpcinfo.c

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



CVS commit: src/sys/dev/wscons

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:38:13 UTC 2023

Modified Files:
src/sys/dev/wscons: wsksymdef.h

Log Message:
Adjust next key value (it's not used anywhere).


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/wscons/wsksymdef.h

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/wscons/wsksymdef.h
diff -u src/sys/dev/wscons/wsksymdef.h:1.77 src/sys/dev/wscons/wsksymdef.h:1.78
--- src/sys/dev/wscons/wsksymdef.h:1.77	Wed Sep 22 17:37:32 2021
+++ src/sys/dev/wscons/wsksymdef.h	Mon Dec 11 13:38:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsksymdef.h,v 1.77 2021/09/22 17:37:32 nia Exp $ */
+/*	$NetBSD: wsksymdef.h,v 1.78 2023/12/11 13:38:13 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -687,7 +687,7 @@ action(KB_UA,	0,	0x1200,	"ua",	,	"Ukrain
 
 /* Define all the KB_xx numeric values using above table */
 #define KBF_ENUM(tag, tagf, value, cc, ccf, country) tag=value,
-enum { KB_ENC_FUN(KBF_ENUM) KB_NEXT=0x1d00 };
+enum { KB_ENC_FUN(KBF_ENUM) KB_NEXT=0x2200 };
 
 /* Define list of KB_xxx and country codes for array initialisation */
 #define KBF_ENCTAB(tag, tagf, value, cc, ccf, country) { tag, cc },



CVS commit: src/sys/dev/wscons

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:38:13 UTC 2023

Modified Files:
src/sys/dev/wscons: wsksymdef.h

Log Message:
Adjust next key value (it's not used anywhere).


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/wscons/wsksymdef.h

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



CVS commit: src/sys/dev/usb

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:35:40 UTC 2023

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.801 -r1.802 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.h

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/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.801 src/sys/dev/usb/usbdevs.h:1.802
--- src/sys/dev/usb/usbdevs.h:1.801	Thu Sep  7 20:04:18 2023
+++ src/sys/dev/usb/usbdevs.h	Mon Dec 11 13:35:40 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.801 2023/09/07 20:04:18 ad Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.802 2023/12/11 13:35:40 mlelstv Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.808 2023/05/14 22:30:13 pgoyette Exp
+ *	NetBSD: usbdevs,v 1.810 2023/12/11 13:33:35 mlelstv Exp
  */
 
 /*-
@@ -2902,6 +2902,7 @@
 #define	USB_PRODUCT_REALTEK_RTL8151	0x8151		/* RTL8151 PNA */
 #define	USB_PRODUCT_REALTEK_RTL8152	0x8152		/* RTL8152 */
 #define	USB_PRODUCT_REALTEK_RTL8153	0x8153		/* RTL8153 */
+#define	USB_PRODUCT_REALTEK_RTL8156	0x8156		/* RTL8156 */
 #define	USB_PRODUCT_REALTEK_RTL8188CE_0	0x8170		/* RTL8188CE */
 #define	USB_PRODUCT_REALTEK_RTL8171	0x8171		/* RTL8171 */
 #define	USB_PRODUCT_REALTEK_RTL8172	0x8172		/* RTL8172 */
Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.801 src/sys/dev/usb/usbdevs_data.h:1.802
--- src/sys/dev/usb/usbdevs_data.h:1.801	Thu Sep  7 20:04:18 2023
+++ src/sys/dev/usb/usbdevs_data.h	Mon Dec 11 13:35:40 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.801 2023/09/07 20:04:18 ad Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.802 2023/12/11 13:35:40 mlelstv Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.808 2023/05/14 22:30:13 pgoyette Exp
+ *	NetBSD: usbdevs,v 1.810 2023/12/11 13:33:35 mlelstv Exp
  */
 
 /*-
@@ -3914,20 +3914,22 @@ static const uint32_t usb_products[] = {
 	17221, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8153, 
 	17229, 0,
+	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8156, 
+	17237, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CE_0, 
 	7357, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8171, 
-	17237, 0,
-	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8172, 
 	17245, 0,
-	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8173, 
+	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8172, 
 	17253, 0,
-	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8174, 
+	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8173, 
 	17261, 0,
+	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8174, 
+	17269, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CU_0, 
 	5293, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8191CU, 
-	17269, 0,
+	17277, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192CU, 
 	5273, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188EU, 
@@ -3937,7 +3939,7 @@ static const uint32_t usb_products[] = {
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CU_2, 
 	5293, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192CE, 
-	17279, 0,
+	17287, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188RU, 
 	17177, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CE_1, 
@@ -3947,181 +3949,181 @@ static const uint32_t usb_products[] = {
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8187, 
 	8936, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8187B_0, 
-	17289, 0,
+	17297, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CUS, 
 	7504, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192EU, 
-	17298, 0,
+	17306, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CU_3, 
 	5293, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8187B_1, 
-	17289, 0,
+	17297, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8187B_2, 
-	17289, 0,
+	17297, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8712, 
-	17308, 0,
-	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8713, 
 	17316, 0,
+	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8713, 
+	17324, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CU_COMBO, 
 	5293, 0,
 	USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192SU, 
 	5431, 0,
 	USB_VENDOR_RIM, USB_PRODUCT_RIM_BLACKBERRY, 
-	17324, 0,
+	17332, 0,
 	USB_VENDOR_RIM, USB_PRODUCT_RIM_BLACKBERRY_PEARL_DUAL, 
-	17324, 17335, 13673, 0,
+	17332, 17343, 13673, 0,
 	USB_VENDOR_RIM, USB_PRODUCT_RIM_BLACKBERRY_PEARL, 
-	17324, 17335, 0,
+	17332, 17343, 0,
 	USB_VENDOR_ROCKFIRE, USB_PRODUCT_ROCKFIRE_GAMEPAD, 
-	12974, 17341, 0,
+	12974, 17349, 0,
 	USB_VENDOR_ROLAND, 

CVS commit: src/sys/dev/usb

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:35:40 UTC 2023

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.801 -r1.802 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.h

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



CVS commit: src/sys/dev/usb

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:33:35 UTC 2023

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add RTL8156


To generate a diff of this commit:
cvs rdiff -u -r1.809 -r1.810 src/sys/dev/usb/usbdevs

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/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.809 src/sys/dev/usb/usbdevs:1.810
--- src/sys/dev/usb/usbdevs:1.809	Thu Sep  7 20:04:18 2023
+++ src/sys/dev/usb/usbdevs	Mon Dec 11 13:33:35 2023
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.809 2023/09/07 20:04:18 ad Exp $
+$NetBSD: usbdevs,v 1.810 2023/12/11 13:33:35 mlelstv Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -2895,6 +2895,7 @@ product REALTEK RTL8150L	0x8150	RTL8150L
 product REALTEK RTL8151		0x8151	RTL8151 PNA
 product REALTEK RTL8152		0x8152	RTL8152
 product REALTEK RTL8153		0x8153	RTL8153
+product REALTEK RTL8156		0x8156	RTL8156
 product REALTEK RTL8188CE_0	0x8170	RTL8188CE
 product REALTEK RTL8171		0x8171	RTL8171
 product REALTEK RTL8172		0x8172	RTL8172



CVS commit: src/sys/dev/usb

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:33:35 UTC 2023

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add RTL8156


To generate a diff of this commit:
cvs rdiff -u -r1.809 -r1.810 src/sys/dev/usb/usbdevs

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



CVS commit: src/sys/dev/onewire

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:30:33 UTC 2023

Modified Files:
src/sys/dev/onewire: owtemp.c

Log Message:
Don't unregister envsys when not registered.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/onewire/owtemp.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/onewire/owtemp.c
diff -u src/sys/dev/onewire/owtemp.c:1.21 src/sys/dev/onewire/owtemp.c:1.22
--- src/sys/dev/onewire/owtemp.c:1.21	Tue Oct 10 19:21:38 2023
+++ src/sys/dev/onewire/owtemp.c	Mon Dec 11 13:30:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: owtemp.c,v 1.21 2023/10/10 19:21:38 kardel Exp $	*/
+/*	$NetBSD: owtemp.c,v 1.22 2023/12/11 13:30:33 mlelstv Exp $	*/
 /*	$OpenBSD: owtemp.c,v 1.1 2006/03/04 16:27:03 grange Exp $	*/
 
 /*-
@@ -51,7 +51,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: owtemp.c,v 1.21 2023/10/10 19:21:38 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: owtemp.c,v 1.22 2023/12/11 13:30:33 mlelstv Exp $");
 
 #include 
 #include 
@@ -161,6 +161,7 @@ owtemp_attach(device_t parent, device_t 
 	"%s S/N %012" PRIx64, sc->sc_chipname, ONEWIRE_ROM_SN(sc->sc_rom));
 	if (sysmon_envsys_sensor_attach(sc->sc_sme, >sc_sensor)) {
 		sysmon_envsys_destroy(sc->sc_sme);
+		sc->sc_sme = NULL;
 		return;
 	}
 
@@ -172,6 +173,7 @@ owtemp_attach(device_t parent, device_t 
 	if (sysmon_envsys_register(sc->sc_sme)) {
 		aprint_error_dev(self, "unable to register with sysmon\n");
 		sysmon_envsys_destroy(sc->sc_sme);
+		sc->sc_sme = NULL;
 		return;
 	}
 
@@ -183,7 +185,8 @@ owtemp_detach(device_t self, int flags)
 {
 	struct owtemp_softc *sc = device_private(self);
 
-	sysmon_envsys_unregister(sc->sc_sme);
+	if (sc->sc_sme != NULL)
+		sysmon_envsys_unregister(sc->sc_sme);
 	evcnt_detach(>sc_ev_rsterr);
 	evcnt_detach(>sc_ev_update);
 	evcnt_detach(>sc_ev_crcerr);



CVS commit: src/sys/dev/onewire

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:30:33 UTC 2023

Modified Files:
src/sys/dev/onewire: owtemp.c

Log Message:
Don't unregister envsys when not registered.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/onewire/owtemp.c

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



CVS commit: src/sys/dev/ic

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:29:03 UTC 2023

Modified Files:
src/sys/dev/ic: dw_hdmi.c

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/dw_hdmi.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/ic/dw_hdmi.c
diff -u src/sys/dev/ic/dw_hdmi.c:1.10 src/sys/dev/ic/dw_hdmi.c:1.11
--- src/sys/dev/ic/dw_hdmi.c:1.10	Fri Mar 25 23:16:04 2022
+++ src/sys/dev/ic/dw_hdmi.c	Mon Dec 11 13:29:03 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dw_hdmi.c,v 1.10 2022/03/25 23:16:04 tnn Exp $ */
+/* $NetBSD: dw_hdmi.c,v 1.11 2023/12/11 13:29:03 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.10 2022/03/25 23:16:04 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.11 2023/12/11 13:29:03 mlelstv Exp $");
 
 #include 
 #include 
@@ -729,7 +729,7 @@ dwhdmi_audio_swvol_codec(audio_filter_ar
 {
 	struct dwhdmi_softc * const sc = arg->context;
 	const aint_t *src;
-	aint_t *dst;
+	int16_t *dst;
 	u_int sample_count;
 	u_int i;
 



CVS commit: src/sys/dev/ic

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:29:03 UTC 2023

Modified Files:
src/sys/dev/ic: dw_hdmi.c

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/dw_hdmi.c

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



CVS commit: src/sys/dev/ic

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:28:15 UTC 2023

Modified Files:
src/sys/dev/ic: anx_dp.c

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/anx_dp.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/ic/anx_dp.c
diff -u src/sys/dev/ic/anx_dp.c:1.5 src/sys/dev/ic/anx_dp.c:1.6
--- src/sys/dev/ic/anx_dp.c:1.5	Sun Dec 19 12:43:37 2021
+++ src/sys/dev/ic/anx_dp.c	Mon Dec 11 13:28:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: anx_dp.c,v 1.5 2021/12/19 12:43:37 riastradh Exp $ */
+/* $NetBSD: anx_dp.c,v 1.6 2023/12/11 13:28:15 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2019 Jonathan A. Kollasch 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: anx_dp.c,v 1.5 2021/12/19 12:43:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: anx_dp.c,v 1.6 2023/12/11 13:28:15 mlelstv Exp $");
 
 #include 
 #include 
@@ -791,7 +791,7 @@ anxdp_audio_swvol_codec(audio_filter_arg
 {
 	struct anxdp_softc * const sc = arg->context;
 	const aint_t *src;
-	aint_t *dst;
+	int16_t *dst;
 	u_int sample_count;
 	u_int i;
 



CVS commit: src/sys/dev/ic

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:28:15 UTC 2023

Modified Files:
src/sys/dev/ic: anx_dp.c

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/anx_dp.c

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



CVS commit: src/sys/dev/i2c

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:27:24 UTC 2023

Modified Files:
src/sys/dev/i2c: es8316ac.c

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/es8316ac.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/i2c/es8316ac.c
diff -u src/sys/dev/i2c/es8316ac.c:1.5 src/sys/dev/i2c/es8316ac.c:1.6
--- src/sys/dev/i2c/es8316ac.c:1.5	Wed Jan 27 02:29:48 2021
+++ src/sys/dev/i2c/es8316ac.c	Mon Dec 11 13:27:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: es8316ac.c,v 1.5 2021/01/27 02:29:48 thorpej Exp $ */
+/* $NetBSD: es8316ac.c,v 1.6 2023/12/11 13:27:24 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: es8316ac.c,v 1.5 2021/01/27 02:29:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: es8316ac.c,v 1.6 2023/12/11 13:27:24 mlelstv Exp $");
 
 #include 
 #include 
@@ -298,7 +298,7 @@ escodec_swvol_codec(audio_filter_arg_t *
 {
 	struct escodec_softc * const sc = arg->context;
 	const aint_t *src;
-	aint_t *dst;
+	int16_t *dst;
 	u_int sample_count;
 	u_int i;
 



CVS commit: src/sys/dev/i2c

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:27:24 UTC 2023

Modified Files:
src/sys/dev/i2c: es8316ac.c

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/es8316ac.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/macppc/dev

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:06:06 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/macppc/dev/snapper.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/macppc/dev/snapper.c
diff -u src/sys/arch/macppc/dev/snapper.c:1.65 src/sys/arch/macppc/dev/snapper.c:1.66
--- src/sys/arch/macppc/dev/snapper.c:1.65	Thu Jun  2 16:22:27 2022
+++ src/sys/arch/macppc/dev/snapper.c	Mon Dec 11 13:06:06 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.65 2022/06/02 16:22:27 macallan Exp $	*/
+/*	$NetBSD: snapper.c,v 1.66 2023/12/11 13:06:06 mlelstv Exp $	*/
 /*	Id: snapper.c,v 1.11 2002/10/31 17:42:13 tsubai Exp	*/
 /*	Id: i2s.c,v 1.12 2005/01/15 14:32:35 tsubai Exp		*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.65 2022/06/02 16:22:27 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.66 2023/12/11 13:06:06 mlelstv Exp $");
 
 #include 
 #include 
@@ -187,7 +187,7 @@ snapper_volume(audio_filter_arg_t *arg)
 {
 	struct snapper_softc *sc;
 	const aint_t *src;
-	aint_t *dst;
+	int16_t *dst;
 	u_int sample_count;
 	u_int i;
 



CVS commit: src/sys/arch/macppc/dev

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 13:06:06 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
Output is always 16bit, the internal audio data type may differ.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/macppc/dev/snapper.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/arm/broadcom

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:53:08 UTC 2023

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_com.c

Log Message:
Report UART clock.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/broadcom/bcm2835_com.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/arm/broadcom/bcm2835_com.c
diff -u src/sys/arch/arm/broadcom/bcm2835_com.c:1.8 src/sys/arch/arm/broadcom/bcm2835_com.c:1.9
--- src/sys/arch/arm/broadcom/bcm2835_com.c:1.8	Fri Jan 29 14:11:14 2021
+++ src/sys/arch/arm/broadcom/bcm2835_com.c	Mon Dec 11 12:53:08 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_com.c,v 1.8 2021/01/29 14:11:14 skrll Exp $ */
+/* $NetBSD: bcm2835_com.c,v 1.9 2023/12/11 12:53:08 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_com.c,v 1.8 2021/01/29 14:11:14 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_com.c,v 1.9 2023/12/11 12:53:08 mlelstv Exp $");
 
 #include 
 #include 
@@ -123,7 +123,8 @@ bcm_com_attach(device_t parent, device_t
 		intrstr);
 		return;
 	}
-	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
+	aprint_normal_dev(self, "interrupting on %s, clock %u Hz\n",
+	   intrstr, sc->sc_frequency);
 }
 
 static int



CVS commit: src/sys/arch/arm/broadcom

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:53:08 UTC 2023

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_com.c

Log Message:
Report UART clock.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/broadcom/bcm2835_com.c

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



CVS commit: src/sbin/swapctl

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:47:24 UTC 2023

Modified Files:
src/sbin/swapctl: swaplist.c

Log Message:
Avoid overflow of totals.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sbin/swapctl/swaplist.c

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

Modified files:

Index: src/sbin/swapctl/swaplist.c
diff -u src/sbin/swapctl/swaplist.c:1.18 src/sbin/swapctl/swaplist.c:1.19
--- src/sbin/swapctl/swaplist.c:1.18	Tue May 31 09:34:25 2016
+++ src/sbin/swapctl/swaplist.c	Mon Dec 11 12:47:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: swaplist.c,v 1.18 2016/05/31 09:34:25 pgoyette Exp $	*/
+/*	$NetBSD: swaplist.c,v 1.19 2023/12/11 12:47:24 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1997 Matthew R. Green
@@ -28,7 +28,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: swaplist.c,v 1.18 2016/05/31 09:34:25 pgoyette Exp $");
+__RCSID("$NetBSD: swaplist.c,v 1.19 2023/12/11 12:47:24 mlelstv Exp $");
 #endif
 
 
@@ -61,8 +61,9 @@ list_swap(int pri, int kflag, int pflag,
 	char	szbuf[5], usbuf[5], avbuf[5]; /* size, used, avail */
 	const	char *header, *suff;
 	size_t	l;
-	int	hlen, totalsize, size, totalinuse, inuse, ncounted, pathmax;
+	int	hlen, size, inuse, ncounted, pathmax;
 	int	rnswap, nswap = swapctl(SWAP_NSWAP, 0, 0), i;
+	int64_t	totalsize, totalinuse;
 
 	if (nswap < 1) {
 		puts("no swap devices configured");



CVS commit: src/sbin/swapctl

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:47:24 UTC 2023

Modified Files:
src/sbin/swapctl: swaplist.c

Log Message:
Avoid overflow of totals.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sbin/swapctl/swaplist.c

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



CVS commit: src/sbin/gpt

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:45:22 UTC 2023

Modified Files:
src/sbin/gpt: gpt.c

Log Message:
Be verbose about errors.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sbin/gpt/gpt.c

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



CVS commit: src/sbin/gpt

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:45:22 UTC 2023

Modified Files:
src/sbin/gpt: gpt.c

Log Message:
Be verbose about errors.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sbin/gpt/gpt.c

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

Modified files:

Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.85 src/sbin/gpt/gpt.c:1.86
--- src/sbin/gpt/gpt.c:1.85	Tue Sep 26 15:55:46 2023
+++ src/sbin/gpt/gpt.c	Mon Dec 11 12:45:22 2023
@@ -35,7 +35,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.85 2023/09/26 15:55:46 kre Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.86 2023/12/11 12:45:22 mlelstv Exp $");
 #endif
 
 #include 
@@ -386,8 +386,10 @@ gpt_gpt(gpt_t gpt, off_t lba, int found)
 	uint32_t crc;
 
 	hdr = gpt_read(gpt, lba, 1);
-	if (hdr == NULL)
+	if (hdr == NULL) {
+		gpt_warn(gpt, "Read failed");
 		return -1;
+	}
 
 	if (memcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)))
 		goto fail_hdr;
@@ -540,6 +542,7 @@ gpt_open(const char *dev, int flags, int
 			gpt->secsz = 512;	/* Fixed size for files. */
 		if (gpt->mediasz == 0) {
 			if (gpt->sb.st_size % gpt->secsz) {
+gpt_warn(gpt, "Media size not a multiple of sector size (%u)\n", gpt->secsz);
 errno = EINVAL;
 goto close;
 			}
@@ -602,6 +605,8 @@ gpt_open(const char *dev, int flags, int
 	if (gpt->fd != -1)
 		close(gpt->fd);
 	free(gpt);
+	if (!(flags & GPT_QUIET))
+		gpt_warn(gpt, "No GPT found");
 	return NULL;
 }
 



CVS commit: src/lib/libpuffs

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:42:18 UTC 2023

Modified Files:
src/lib/libpuffs: dispatcher.c

Log Message:
pathconf needs to return EINVAL when the variable is invalid
or cannot be associated with a file. This also needs to be true
when the node doesn't implement the pathconf function at all.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/lib/libpuffs/dispatcher.c

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



CVS commit: src/lib/libpuffs

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 12:42:18 UTC 2023

Modified Files:
src/lib/libpuffs: dispatcher.c

Log Message:
pathconf needs to return EINVAL when the variable is invalid
or cannot be associated with a file. This also needs to be true
when the node doesn't implement the pathconf function at all.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/lib/libpuffs/dispatcher.c

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

Modified files:

Index: src/lib/libpuffs/dispatcher.c
diff -u src/lib/libpuffs/dispatcher.c:1.49 src/lib/libpuffs/dispatcher.c:1.50
--- src/lib/libpuffs/dispatcher.c:1.49	Mon Mar  8 17:34:10 2021
+++ src/lib/libpuffs/dispatcher.c	Mon Dec 11 12:42:18 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: dispatcher.c,v 1.49 2021/03/08 17:34:10 christos Exp $	*/
+/*	$NetBSD: dispatcher.c,v 1.50 2023/12/11 12:42:18 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2006, 2007, 2008 Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: dispatcher.c,v 1.49 2021/03/08 17:34:10 christos Exp $");
+__RCSID("$NetBSD: dispatcher.c,v 1.50 2023/12/11 12:42:18 mlelstv Exp $");
 #endif /* !lint */
 
 #include 
@@ -893,7 +893,7 @@ dispatch(struct puffs_cc *pcc)
 		{
 			struct puffs_vnmsg_pathconf *auxt = auxbuf;
 			if (pops->puffs_node_pathconf == NULL) {
-error = 0;
+error = EINVAL;
 break;
 			}
 



CVS commit: src/tests/dev/audio

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 09:26:08 UTC 2023

Modified Files:
src/tests/dev/audio: audiotest.c

Log Message:
mmap() fails for size == 0 with EINVAL unless the mapping is anonymous.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/tests/dev/audio/audiotest.c

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

Modified files:

Index: src/tests/dev/audio/audiotest.c
diff -u src/tests/dev/audio/audiotest.c:1.31 src/tests/dev/audio/audiotest.c:1.32
--- src/tests/dev/audio/audiotest.c:1.31	Thu Aug  3 08:36:38 2023
+++ src/tests/dev/audio/audiotest.c	Mon Dec 11 09:26:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiotest.c,v 1.31 2023/08/03 08:36:38 rin Exp $	*/
+/*	$NetBSD: audiotest.c,v 1.32 2023/12/11 09:26:08 mlelstv Exp $	*/
 
 /*
  * Copyright (C) 2019 Tetsuya Isaki. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: audiotest.c,v 1.31 2023/08/03 08:36:38 rin Exp $");
+__RCSID("$NetBSD: audiotest.c,v 1.32 2023/12/11 09:26:08 mlelstv Exp $");
 
 #include 
 #include 
@@ -2773,13 +2773,13 @@ test_mmap_len(size_t len, off_t offset, 
 	reset_after_mmap();
 }
 #define f(l, o, e)	test_mmap_len(l, o, e)
-DEF(mmap_len_0)	{ f(0,   0,   0); }		/* len is 0 */
+DEF(mmap_len_0)	{ f(0,   0,   EINVAL); }	/* len is 0 */
 DEF(mmap_len_1)	{ f(1,   0,   0); }		/* len is smaller than lsize */
 DEF(mmap_len_2)	{ f(LS,  0,   0); }		/* len is the same as lsize */
 DEF(mmap_len_3)	{ f(LS1, 0,   EOVERFLOW); }	/* len is larger */
 DEF(mmap_len_4)	{ f(0,   -1,  EINVAL); }	/* offset is negative */
-DEF(mmap_len_5)	{ f(0,   LS,  0); }		/* pointless param but ok */
-DEF(mmap_len_6)	{ f(0,   LS1, EOVERFLOW); }	/* exceed */
+DEF(mmap_len_5)	{ f(0,   LS,  EINVAL); }	/* len is 0 */
+DEF(mmap_len_6)	{ f(0,   LS1, EINVAL); }	/* len is 0 */
 DEF(mmap_len_7)	{ f(1,   LS,  EOVERFLOW); }	/* exceed */
 /*
  * When you treat the offset as 32bit, offset will be 0 and thus it



CVS commit: src/tests/dev/audio

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 09:26:08 UTC 2023

Modified Files:
src/tests/dev/audio: audiotest.c

Log Message:
mmap() fails for size == 0 with EINVAL unless the mapping is anonymous.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/tests/dev/audio/audiotest.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/x86/x86

2023-11-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Nov 29 11:40:37 UTC 2023

Modified Files:
src/sys/arch/x86/x86: intr.c

Log Message:
Fix use-after-free (source->is_type) when detecting unsharable
interrupts. Doesn't solve the interrupt conflict itself, but
avoids a panic.


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/arch/x86/x86/intr.c

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



CVS commit: src/sys/dev/iscsi

2023-11-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Nov 25 10:08:27 UTC 2023

Modified Files:
src/sys/dev/iscsi: iscsi.h iscsi_globals.h iscsi_ioctl.c iscsi_send.c
iscsi_text.c iscsi_utils.c

Log Message:
Adapt to bignum representation of target.
Fix negotiation for mutual authentication.
Prepare for more CHAP types.
Fix crashes for invalid socket descriptors passed to kernel.
Protect usecount with connection mutex, avoids race on connection close.
Minor cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/iscsi/iscsi.h
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/iscsi/iscsi_globals.h
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/iscsi/iscsi_ioctl.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/iscsi/iscsi_send.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/iscsi/iscsi_text.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/iscsi/iscsi_utils.c

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



CVS commit: src/sys/dev/iscsi

2023-11-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Nov 25 10:08:27 UTC 2023

Modified Files:
src/sys/dev/iscsi: iscsi.h iscsi_globals.h iscsi_ioctl.c iscsi_send.c
iscsi_text.c iscsi_utils.c

Log Message:
Adapt to bignum representation of target.
Fix negotiation for mutual authentication.
Prepare for more CHAP types.
Fix crashes for invalid socket descriptors passed to kernel.
Protect usecount with connection mutex, avoids race on connection close.
Minor cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/iscsi/iscsi.h
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/iscsi/iscsi_globals.h
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/iscsi/iscsi_ioctl.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/iscsi/iscsi_send.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/iscsi/iscsi_text.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/iscsi/iscsi_utils.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/iscsi/iscsi.h
diff -u src/sys/dev/iscsi/iscsi.h:1.4 src/sys/dev/iscsi/iscsi.h:1.5
--- src/sys/dev/iscsi/iscsi.h:1.4	Wed Jun 15 04:30:30 2016
+++ src/sys/dev/iscsi/iscsi.h	Sat Nov 25 10:08:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi.h,v 1.4 2016/06/15 04:30:30 mlelstv Exp $	*/
+/*	$NetBSD: iscsi.h,v 1.5 2023/11/25 10:08:27 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2006,2011 The NetBSD Foundation, Inc.
@@ -54,6 +54,13 @@ typedef enum {
   Indicates SRP authentication (for future use).
 */
 
+typedef enum {
+	ISCSI_CHAP_MD5		= 5,
+	ISCSI_CHAP_SHA1		= 6,
+	ISCSI_CHAP_SHA256	= 7,
+	ISCSI_CHAP_SHA3_256	= 8
+} iscsi_chap_types_t;
+
 typedef struct {
 	unsigned int		mutual_auth:1;
 	unsigned int		is_secure:1;

Index: src/sys/dev/iscsi/iscsi_globals.h
diff -u src/sys/dev/iscsi/iscsi_globals.h:1.27 src/sys/dev/iscsi/iscsi_globals.h:1.28
--- src/sys/dev/iscsi/iscsi_globals.h:1.27	Tue Sep 13 13:09:16 2022
+++ src/sys/dev/iscsi/iscsi_globals.h	Sat Nov 25 10:08:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_globals.h,v 1.27 2022/09/13 13:09:16 mlelstv Exp $	*/
+/*	$NetBSD: iscsi_globals.h,v 1.28 2023/11/25 10:08:27 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -135,11 +135,10 @@
 /* Connection state */
 
 typedef enum {
-	/* first three correspond to CSG/NSG coding */
 	ST_SEC_NEG	= 0,	/* security negotiation phase */
-	ST_OP_NEG	= 1,	/* operational negotiation phase */
+	ST_SEC_FIN  	= 1,	/* switch from SEC after mutual CHAP */
+	ST_OP_NEG	= 2,	/* operational negotiation phase */
 	ST_FULL_FEATURE	= 3,	/* full feature phase */
-	/* rest is internal */
 	ST_WINDING_DOWN	= 4,	/* connection termination initiated, logging out */
 	ST_LOGOUT_SENT	= 5,	/* logout has been sent */
 	ST_SETTLING	= 6,	/* waiting for things to settle down */

Index: src/sys/dev/iscsi/iscsi_ioctl.c
diff -u src/sys/dev/iscsi/iscsi_ioctl.c:1.33 src/sys/dev/iscsi/iscsi_ioctl.c:1.34
--- src/sys/dev/iscsi/iscsi_ioctl.c:1.33	Tue Sep 13 13:09:16 2022
+++ src/sys/dev/iscsi/iscsi_ioctl.c	Sat Nov 25 10:08:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_ioctl.c,v 1.33 2022/09/13 13:09:16 mlelstv Exp $	*/
+/*	$NetBSD: iscsi_ioctl.c,v 1.34 2023/11/25 10:08:27 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -728,18 +728,11 @@ create_connection(iscsi_login_parameters
 	}
 
 	rc = get_socket(par->socket, >c_sock);
-	fd_close(par->socket);
+	if (rc != EBADF)
+		fd_close(par->socket);
 
 	if (rc) {
 		DEBOUT(("Invalid socket %d\n", par->socket));
-
-		callout_destroy(>c_timeout);
-		rw_destroy(>c_sock_rw);
-		cv_destroy(>c_idle_cv);
-		cv_destroy(>c_ccb_cv);
-		cv_destroy(>c_pdu_cv);
-		cv_destroy(>c_conn_cv);
-		mutex_destroy(>c_lock);
 		free(conn, M_DEVBUF);
 		par->status = ISCSI_STATUS_INVALID_SOCKET;
 		return rc;
@@ -901,11 +894,13 @@ recreate_connection(iscsi_login_paramete
 		DEBOUT(("Too many connections (max = %d, curr = %d)\n",
 			sess->s_MaxConnections, sess->s_active_connections));
 
-		/* Always close the desecriptor */
-		fd_close(par->socket);
+		/* Close the desecriptor */
+		rc = EIO;
+		if (fd_getfile(par->socket) != NULL)
+			rc = fd_close(par->socket);
 
 		par->status = ISCSI_STATUS_MAXED_CONNECTIONS;
-		return EIO;
+		return rc;
 	}
 
 	rw_enter(>c_sock_rw, RW_WRITER);
@@ -915,7 +910,8 @@ recreate_connection(iscsi_login_paramete
 	}
 	rc = get_socket(par->socket, >c_sock);
 	rw_exit(>c_sock_rw);
-	fd_close(par->socket);
+	if (rc != EBADF)
+		fd_close(par->socket);
 
 	if (rc) {
 		DEBOUT(("Invalid socket %d\n", par->socket));
@@ -1739,19 +1735,23 @@ iscsi_cleanup_thread(void *par)
 			 * the send/recv threads have been killed
 			 */
 			DEBC(conn, 5, ("Cleanup: Waiting for threads to exit\n"));
+
+			mutex_enter(>c_lock);
 			while (conn->c_sendproc || conn->c_rcvproc)
-kpause("threads", false, hz, NULL);
+kpause("threads", false, hz, >c_lock);
 
 			for (s=1; conn->c_usecount > 0 && s < 3; ++s)
-kpause("usecount", false, 

CVS commit: src/sbin

2023-11-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Nov 25 08:06:02 UTC 2023

Modified Files:
src/sbin/iscsictl: iscsic_parse.c
src/sbin/iscsid: iscsid_driverif.c

Log Message:
Parse IPv6 targets and handle IPv6 addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/iscsictl/iscsic_parse.c
cvs rdiff -u -r1.8 -r1.9 src/sbin/iscsid/iscsid_driverif.c

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



CVS commit: src/sbin

2023-11-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Nov 25 08:06:02 UTC 2023

Modified Files:
src/sbin/iscsictl: iscsic_parse.c
src/sbin/iscsid: iscsid_driverif.c

Log Message:
Parse IPv6 targets and handle IPv6 addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/iscsictl/iscsic_parse.c
cvs rdiff -u -r1.8 -r1.9 src/sbin/iscsid/iscsid_driverif.c

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

Modified files:

Index: src/sbin/iscsictl/iscsic_parse.c
diff -u src/sbin/iscsictl/iscsic_parse.c:1.4 src/sbin/iscsictl/iscsic_parse.c:1.5
--- src/sbin/iscsictl/iscsic_parse.c:1.4	Fri Dec  3 13:27:38 2021
+++ src/sbin/iscsictl/iscsic_parse.c	Sat Nov 25 08:06:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsic_parse.c,v 1.4 2021/12/03 13:27:38 andvar Exp $	*/
+/*	$NetBSD: iscsic_parse.c,v 1.5 2023/11/25 08:06:02 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -48,50 +48,62 @@
 STATIC void
 get_address(iscsi_portal_address_t * portal, char *str, char *arg)
 {
-	char *sp, *sp2;
+	char *sp;
 	int val;
 
 	if (!str || !*str)
 		arg_error(arg, "Address is missing");
 
-	/* is there a port? don't check inside square brackets (IPv6 addr) */
-	for (sp = str + 1, val = 0; *sp && (*sp != ':' || val); sp++) {
-		if (*sp == '[')
-			val = 1;
-		else if (*sp == ']')
-			val = 0;
-	}
-
-	/* */
-	if (*sp) {
-		for (sp2 = sp + 1; *sp2 && *sp2 != ':'; sp2++);
-		/* if there's a second colon, assume it's an unbracketed IPv6 address */
-		if (!*sp2) {
-			/* truncate source, that's the address */
-			*sp++ = '\0';
-			if (sscanf(sp, "%d", ) != 1)
-arg_error(arg, "Bad address format: Expected port number");
-			if (val < 0 || val > 0x)
-arg_error(arg, "Bad address format: Port number out of range");
-			portal->port = (uint16_t) val;
-		}
-		/* is there a group tag? */
-		for (; isdigit((unsigned char)*sp); sp++);
-		if (*sp && *sp != ',')
-			arg_error(arg, "Bad address format: Extra character(s) '%c'", *sp);
-	} else
-		for (sp = str + 1; *sp && *sp != ','; sp++);
-
-	if (*sp) {
+	/* Parse and strip trailing group tag */
+	sp = strrchr(str, ',');
+	if (sp != NULL) {
 		if (sscanf(sp + 1, "%d", ) != 1)
 			arg_error(arg, "Bad address format: Expected group tag");
 		if (val < 0 || val > 0x)
 			arg_error(arg, "Bad address format: Group tag out of range");
 		portal->group_tag = (uint16_t) val;
-		/* truncate source, that's the address */
 		*sp = '\0';
 	}
-	/* only check length, don't verify correct format (too many possibilities) */
+
+	/* Skip over bracketed IPv6 address */
+	sp = strchr(str, ']');
+	if (sp != NULL)
+		sp++;
+	else
+		sp = str;
+
+	/* Parse and strip trailing port number */
+	sp = strchr(sp, ':');
+	if (sp != NULL) {
+		if (strchr(sp + 1, ':') != NULL) {
+			/*
+			 *  If there's a second colon, assume
+			 *  it's an unbracketed IPv6 address
+			 */
+			portal->port = 0;
+		} else {
+			if (sscanf(sp + 1, "%d", ) != 1)
+arg_error(arg, "Bad address format: Expected port number");
+			if (val < 0 || val > 0x)
+arg_error(arg, "Bad address format: Port number ut  of range");
+			portal->port = (uint16_t) val;
+			*sp = '\0';
+		}
+	}
+
+	/* Remove brackets */
+	if (*str == '[') {
+		sp = strchr(str, ']');
+		if (sp != NULL && !*(sp+1)) {
+			str = str + 1;
+			*sp = '\0';
+		}
+	}
+
+	/*
+	 * only check length, don't verify correct format
+	 * (too many possibilities)
+	 */
 	if (strlen(str) >= sizeof(portal->address))
 		arg_error(arg, "Bad address format: Address string too long");
 

Index: src/sbin/iscsid/iscsid_driverif.c
diff -u src/sbin/iscsid/iscsid_driverif.c:1.8 src/sbin/iscsid/iscsid_driverif.c:1.9
--- src/sbin/iscsid/iscsid_driverif.c:1.8	Sun May 29 13:35:45 2016
+++ src/sbin/iscsid/iscsid_driverif.c	Sat Nov 25 08:06:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsid_driverif.c,v 1.8 2016/05/29 13:35:45 mlelstv Exp $	*/
+/*	$NetBSD: iscsid_driverif.c,v 1.9 2023/11/25 08:06:02 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -98,23 +98,29 @@ set_node_name(iscsid_set_node_name_req_t
 static int
 bind_socket(int sock, uint8_t * addr)
 {
-	struct sockaddr_in serverAddress;
-	struct hostent *host;
+	struct addrinfo hints, *ai, *ai0;
+	int ret = FALSE;
 
 	DEB(8, ("Binding to <%s>", addr));
-	(void) memset(, 0x0, sizeof(serverAddress));
-	host = gethostbyname((char *)addr);
-	if (host == NULL)
-		return FALSE;
-	if (host->h_length > (int)sizeof(serverAddress.sin_addr))
-		return FALSE;
-	serverAddress.sin_family = host->h_addrtype;
-	serverAddress.sin_port = 0;
-	serverAddress.sin_len = host->h_length;
-	memcpy(_addr, host->h_addr_list[0], host->h_length);
+	
+	memset(, 0, sizeof(hints));
+	hints.ai_family = AF_UNSPEC;
+	hints.ai_socktype = SOCK_STREAM;
+	hints.ai_flags = AI_PASSIVE;
+	if (getaddrinfo((char *)addr, NULL, , ))
+		return ret;
+
+	for (ai = ai0; ai; ai = ai->ai_next) {
+		if (bind(sock, 

CVS commit: xsrc/external/mit/ctwm/dist

2023-10-20 Thread Michael van Elst
Module Name:xsrc
Committed By:   mlelstv
Date:   Fri Oct 20 10:18:56 UTC 2023

Modified Files:
xsrc/external/mit/ctwm/dist: signals.c

Log Message:
Use a SIGCHLD handler instead of ignoring the signal.

This avoids lockups when child processes were inherited (e.g. from .xsession)
but new children are waited for in system().


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 xsrc/external/mit/ctwm/dist/signals.c

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

Modified files:

Index: xsrc/external/mit/ctwm/dist/signals.c
diff -u xsrc/external/mit/ctwm/dist/signals.c:1.1.1.1 xsrc/external/mit/ctwm/dist/signals.c:1.2
--- xsrc/external/mit/ctwm/dist/signals.c:1.1.1.1	Wed Jul  5 07:36:07 2023
+++ xsrc/external/mit/ctwm/dist/signals.c	Fri Oct 20 10:18:55 2023
@@ -8,6 +8,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "ctwm_shutdown.h"
 #include "signals.h"
@@ -26,6 +28,15 @@ static bool sig_shutdown = false;
 // needs to trigger an action.
 bool SignalFlag = false;
 
+void ChildExit(int signum)
+{
+	int Errno = errno;
+	/* reap dead children, ignore status */
+	while (waitpid(-1, NULL, WNOHANG) > 0)
+		continue;
+	/* restore errno for interrupted sys calls */
+	errno = Errno;
+}
 
 /**
  * Setup signal handlers (run during startup)
@@ -46,9 +57,12 @@ setup_signal_handlers(void)
 	// die...
 	signal(SIGALRM, SIG_IGN);
 
-	// This should be set by default, but just in case; explicitly don't
-	// leave zombies.
-	signal(SIGCHLD, SIG_IGN);
+	/* Setting SIGCHLD to SIG_IGN detaches children from the parent
+	 * immediately, so it need not be waited for.
+	 * In fact, you cannot wait for it, so a function like system()
+	 * breaks.
+	 */
+	signal(SIGCHLD, ChildExit);
 
 	return;
 }



CVS commit: xsrc/external/mit/ctwm/dist

2023-10-20 Thread Michael van Elst
Module Name:xsrc
Committed By:   mlelstv
Date:   Fri Oct 20 10:18:56 UTC 2023

Modified Files:
xsrc/external/mit/ctwm/dist: signals.c

Log Message:
Use a SIGCHLD handler instead of ignoring the signal.

This avoids lockups when child processes were inherited (e.g. from .xsession)
but new children are waited for in system().


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 xsrc/external/mit/ctwm/dist/signals.c

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



CVS commit: src/sys/dev/audio

2023-10-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Oct  1 09:34:29 UTC 2023

Modified Files:
src/sys/dev/audio: audio.c

Log Message:
Fix output for big-endian hardware.
Also optimize the output scaling routine.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/dev/audio/audio.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.144 src/sys/dev/audio/audio.c:1.145
--- src/sys/dev/audio/audio.c:1.144	Mon Jun  5 16:26:05 2023
+++ src/sys/dev/audio/audio.c	Sun Oct  1 09:34:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.144 2023/06/05 16:26:05 mlelstv Exp $	*/
+/*	$NetBSD: audio.c,v 1.145 2023/10/01 09:34:28 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.144 2023/06/05 16:26:05 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.145 2023/10/01 09:34:28 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -9222,7 +9222,6 @@ audio_mixsample_to_linear(audio_filter_a
 	const aint2_t *m;
 	uint8_t *p;
 	u_int sample_count;
-	bool swap;
 	aint2_t v, xor;
 	u_int i, bps;
 	bool little;
@@ -9235,48 +9234,150 @@ audio_mixsample_to_linear(audio_filter_a
 	m = arg->src;
 	p = arg->dst;
 	sample_count = arg->count * fmt->channels;
-	swap = arg->dstfmt->encoding == AUDIO_ENCODING_SLINEAR_OE;
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-	little = !swap;
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
-	little = swap;
-#endif
+	little = arg->dstfmt->encoding == AUDIO_ENCODING_SLINEAR_LE;
 
 	bps = fmt->stride / NBBY;
+	xor = audio_format2_is_signed(fmt) ? 0 : (aint2_t)1 << 31;
 
-	xor = audio_format2_is_signed(fmt)
-	   ? 0 : 1 << (fmt->stride - 1);
-
-	for (i=0; i>= (4 - bps) * NBBY;
-
-		/* signed -> unsigned */
-		v ^= xor;
-
-		if (little) {
-			switch (bps) {
-			case 4: *p++ = v; v >>= 8; /* FALLTHROUGH */
-			case 3: *p++ = v; v >>= 8; /* FALLTHROUGH */
-			case 2: *p++ = v; v >>= 8; /* FALLTHROUGH */
-			case 1: *p++ = v; /* FALLTHROUGH */
+#if AUDIO_INTERNAL_BITS == 16
+	if (little) {
+		switch (bps) {
+		case 4:
+			for (i=0; i> 8;
 			}
-		} else {
-			switch (bps) {
-			case 4: *p++ = v >> 24; v <<= 8; /* FALLTHROUGH */
-			case 3: *p++ = v >> 24; v <<= 8; /* FALLTHROUGH */
-			case 2: *p++ = v >> 24; v <<= 8; /* FALLTHROUGH */
-			case 1: *p++ = v >> 24; /* FALLTHROUGH */
+			break;
+		case 3:
+			for (i=0; i> 8;
+			}
+			break;
+		case 2:
+			for (i=0; i> 8;
+			}
+			break;
+		case 1:
+			for (i=0; i> 8;
+			}
+			break;
+		}
+	} else {
+		switch (bps) {
+		case 4:
+			for (i=0; i> 8;
+*p++ = v;
+*p++ = 0;
+*p++ = 0;
+			}
+			break;
+		case 3:
+			for (i=0; i> 8;
+*p++ = v;
+*p++ = 0;
+			}
+			break;
+		case 2:
+			for (i=0; i> 8;
+*p++ = v;
+			}
+			break;
+		case 1:
+			for (i=0; i> 8;
+			}
+			break;
+		}
+	}
+#elif AUDIO_INTERNAL_BITS == 32
+	if (little) {
+		switch (bps) {
+		case 4:
+			for (i=0; i> 8;
+*p++ = v >> 16;
+*p++ = v >> 24;
+			}
+			break;
+		case 3:
+			for (i=0; i> 8;
+*p++ = v >> 16;
+*p++ = v >> 24;
+			}
+			break;
+		case 2:
+			for (i=0; i> 16;
+*p++ = v >> 24;
+			}
+			break;
+		case 1:
+			for (i=0; i> 24;
+			}
+			break;
+		}
+	} else {
+		switch (bps) {
+		case 4:
+			for (i=0; i> 24;
+*p++ = v >> 16;
+*p++ = v >> 8;
+*p++ = v;
+			}
+			break;
+		case 3:
+			for (i=0; i> 24;
+*p++ = v >> 16;
+*p++ = v >> 8;
+			}
+			break;
+		case 2:
+			for (i=0; i> 24;
+*p++ = v >> 16;
 			}
+			break;
+		case 1:
+			for (i=0; i> 24;
+			}
+			break;
 		}
 	}
-}
+#endif /* AUDIO_INTERNAL_BITS */
 
+}
 
 #endif /* NAUDIO > 0 */
 



CVS commit: src/sys/dev/audio

2023-10-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Oct  1 09:34:29 UTC 2023

Modified Files:
src/sys/dev/audio: audio.c

Log Message:
Fix output for big-endian hardware.
Also optimize the output scaling routine.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/dev/audio/audio.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/ftp

2023-08-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug 12 07:40:13 UTC 2023

Modified Files:
src/usr.bin/ftp: fetch.c

Log Message:
Don't finish downloading an empty file with 'already done' before it is
created locally.


To generate a diff of this commit:
cvs rdiff -u -r1.237 -r1.238 src/usr.bin/ftp/fetch.c

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/ftp/fetch.c
diff -u src/usr.bin/ftp/fetch.c:1.237 src/usr.bin/ftp/fetch.c:1.238
--- src/usr.bin/ftp/fetch.c:1.237	Sun Jul  2 10:02:09 2023
+++ src/usr.bin/ftp/fetch.c	Sat Aug 12 07:40:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fetch.c,v 1.237 2023/07/02 10:02:09 mlelstv Exp $	*/
+/*	$NetBSD: fetch.c,v 1.238 2023/08/12 07:40:13 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1997-2015 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.237 2023/07/02 10:02:09 mlelstv Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.238 2023/08/12 07:40:13 mlelstv Exp $");
 #endif /* not lint */
 
 /*
@@ -1652,9 +1652,10 @@ fetch_url(const char *url, const char *p
 		}
 	}
 	if (fout == NULL) {
-		if ((pi.rangeend != -1 && pi.rangeend <= restart_point) ||
+		if (restart_point && (
+		(pi.rangeend != -1 && pi.rangeend <= restart_point) ||
 		(pi.rangestart == -1 &&
-		filesize != -1 && filesize <= restart_point)) {
+		filesize != -1 && filesize <= restart_point))) {
 			/* already done */
 			if (verbose)
 fprintf(ttyout, "already done\n");



CVS commit: src/usr.bin/ftp

2023-08-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug 12 07:40:13 UTC 2023

Modified Files:
src/usr.bin/ftp: fetch.c

Log Message:
Don't finish downloading an empty file with 'already done' before it is
created locally.


To generate a diff of this commit:
cvs rdiff -u -r1.237 -r1.238 src/usr.bin/ftp/fetch.c

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



CVS commit: src/etc/rc.d

2023-07-22 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jul 22 10:31:35 UTC 2023

Modified Files:
src/etc/rc.d: iscsid_volumes

Log Message:
Don't specify a volume alias if none is given instead of using a default
name. Otherwise iscsictl fails for using non-unique names if more than
one volume is used.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/etc/rc.d/iscsid_volumes

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

Modified files:

Index: src/etc/rc.d/iscsid_volumes
diff -u src/etc/rc.d/iscsid_volumes:1.3 src/etc/rc.d/iscsid_volumes:1.4
--- src/etc/rc.d/iscsid_volumes:1.3	Sat Feb 18 07:51:52 2023
+++ src/etc/rc.d/iscsid_volumes	Sat Jul 22 10:31:35 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: iscsid_volumes,v 1.3 2023/02/18 07:51:52 mlelstv Exp $
+# $NetBSD: iscsid_volumes,v 1.4 2023/07/22 10:31:35 mlelstv Exp $
 #
 
 # PROVIDE: iscsid_volumes
@@ -35,6 +35,16 @@ iscsid_volumes_start()
 
 			if [ -f /etc/iscsi/auths ]; then
 while read entry dummy; do
+
+	case $entry in
+	*:chap:*|\
+	*:CHAP:*|\
+	*:none:*)
+		dummy=${entry#*:}
+		entry=${entry%%:*}:${dummy#*:}
+		;;
+	esac
+
 	case $entry in
 	\#*|"") ;;
 	"$user":*) pass=${entry#*:} ;;
@@ -63,7 +73,7 @@ iscsid_volumes_start()
 -u "$user" \
 -s "$pass" \
 -S "$mpass" \
--N "${alias:--}")
+${alias:+-N} ${alias:+"$alias"})
 			echo "$out"
 
 			case $out in



CVS commit: src/etc/rc.d

2023-07-22 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jul 22 10:31:35 UTC 2023

Modified Files:
src/etc/rc.d: iscsid_volumes

Log Message:
Don't specify a volume alias if none is given instead of using a default
name. Otherwise iscsictl fails for using non-unique names if more than
one volume is used.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/etc/rc.d/iscsid_volumes

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



CVS commit: src/sys/arch/amiga/dev

2023-07-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Jul 12 05:16:42 UTC 2023

Modified Files:
src/sys/arch/amiga/dev: grfabs_cc.c

Log Message:
Make inclusion of sys/intr.h explicit for spl*.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/amiga/dev/grfabs_cc.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/amiga/dev/grfabs_cc.c
diff -u src/sys/arch/amiga/dev/grfabs_cc.c:1.38 src/sys/arch/amiga/dev/grfabs_cc.c:1.39
--- src/sys/arch/amiga/dev/grfabs_cc.c:1.38	Mon Jan 23 21:22:44 2023
+++ src/sys/arch/amiga/dev/grfabs_cc.c	Wed Jul 12 05:16:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: grfabs_cc.c,v 1.38 2023/01/23 21:22:44 andvar Exp $ */
+/*	$NetBSD: grfabs_cc.c,v 1.39 2023/07/12 05:16:42 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -38,12 +38,13 @@
 #include "opt_amigaccgrf.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: grfabs_cc.c,v 1.38 2023/01/23 21:22:44 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grfabs_cc.c,v 1.39 2023/07/12 05:16:42 mlelstv Exp $");
 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 



CVS commit: src/sys/arch/amiga/dev

2023-07-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Jul 12 05:16:42 UTC 2023

Modified Files:
src/sys/arch/amiga/dev: grfabs_cc.c

Log Message:
Make inclusion of sys/intr.h explicit for spl*.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/amiga/dev/grfabs_cc.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/ftp

2023-07-02 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jul  2 10:02:09 UTC 2023

Modified Files:
src/usr.bin/ftp: fetch.c

Log Message:
Fix HTTPS through Proxy.

While a regular HTTP Proxy, requires the absolute URL with protocol
and host part, yyou must only send the relative URL through a
CONNECT tunnel (you are talking to the target server).


To generate a diff of this commit:
cvs rdiff -u -r1.236 -r1.237 src/usr.bin/ftp/fetch.c

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/ftp/fetch.c
diff -u src/usr.bin/ftp/fetch.c:1.236 src/usr.bin/ftp/fetch.c:1.237
--- src/usr.bin/ftp/fetch.c:1.236	Sat Feb 25 12:07:25 2023
+++ src/usr.bin/ftp/fetch.c	Sun Jul  2 10:02:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fetch.c,v 1.236 2023/02/25 12:07:25 mlelstv Exp $	*/
+/*	$NetBSD: fetch.c,v 1.237 2023/07/02 10:02:09 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1997-2015 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.236 2023/02/25 12:07:25 mlelstv Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.237 2023/07/02 10:02:09 mlelstv Exp $");
 #endif /* not lint */
 
 /*
@@ -801,7 +801,12 @@ handle_proxy(const char *url, const char
 	}
 
 	FREEPTR(pui.path);
-	pui.path = ftp_strdup(url);
+#ifdef WITH_SSL
+	if (ui->utype == HTTPS_URL_T)
+		pui.path = ftp_strdup(ui->path);
+	else
+#endif
+		pui.path = ftp_strdup(url);
 
 	freeurlinfo(ui);
 	*ui = pui;



CVS commit: src/usr.bin/ftp

2023-07-02 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jul  2 10:02:09 UTC 2023

Modified Files:
src/usr.bin/ftp: fetch.c

Log Message:
Fix HTTPS through Proxy.

While a regular HTTP Proxy, requires the absolute URL with protocol
and host part, yyou must only send the relative URL through a
CONNECT tunnel (you are talking to the target server).


To generate a diff of this commit:
cvs rdiff -u -r1.236 -r1.237 src/usr.bin/ftp/fetch.c

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



CVS commit: src/usr.sbin/ifwatchd

2023-07-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jul  1 12:36:10 UTC 2023

Modified Files:
src/usr.sbin/ifwatchd: ifwatchd.c

Log Message:
Don't call UP script when an IP address becomes deprecated.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/usr.sbin/ifwatchd/ifwatchd.c

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

Modified files:

Index: src/usr.sbin/ifwatchd/ifwatchd.c
diff -u src/usr.sbin/ifwatchd/ifwatchd.c:1.46 src/usr.sbin/ifwatchd/ifwatchd.c:1.47
--- src/usr.sbin/ifwatchd/ifwatchd.c:1.46	Sun Oct  4 20:36:32 2020
+++ src/usr.sbin/ifwatchd/ifwatchd.c	Sat Jul  1 12:36:10 2023
@@ -1,6 +1,6 @@
-/*	$NetBSD: ifwatchd.c,v 1.46 2020/10/04 20:36:32 roy Exp $	*/
+/*	$NetBSD: ifwatchd.c,v 1.47 2023/07/01 12:36:10 mlelstv Exp $	*/
 #include 
-__RCSID("$NetBSD: ifwatchd.c,v 1.46 2020/10/04 20:36:32 roy Exp $");
+__RCSID("$NetBSD: ifwatchd.c,v 1.47 2023/07/01 12:36:10 mlelstv Exp $");
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@ __RCSID("$NetBSD: ifwatchd.c,v 1.46 2020
 #include 
 
 enum event { ARRIVAL, DEPARTURE, UP, DOWN, CARRIER, NO_CARRIER };
-enum addrflag { NOTREADY, DETACHED, READY };
+enum addrflag { NOTREADY, DETACHED, DEPRECATED, READY };
 
 /* local functions */
 __dead static void usage(void);
@@ -303,6 +303,8 @@ check_addrflags(int af, int addrflags)
 			return NOTREADY;
 		if (addrflags & IN6_IFF_DETACHED)
 			return DETACHED;
+		if (addrflags & IN6_IFF_DEPRECATED)
+			return DEPRECATED;
 		break;
 	}
 	return READY;



  1   2   3   4   5   6   7   >