CVS commit: src/libexec/getty

2021-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Oct 12 23:40:38 UTC 2021

Modified Files:
src/libexec/getty: main.c

Log Message:
getty: Remove 2 second sleep before opening tty

This (apparently very old!) workaround to ensure that DTR stays down long
enough to be detected is now handled by serial drivers themselves. For
console devices (framebuffer, serial console, etc) this was an unnecessary
2 second penalty that we have all been paying since the beginning of time.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/libexec/getty/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/libexec/getty/main.c
diff -u src/libexec/getty/main.c:1.67 src/libexec/getty/main.c:1.68
--- src/libexec/getty/main.c:1.67	Wed Feb 26 15:44:57 2020
+++ src/libexec/getty/main.c	Tue Oct 12 23:40:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.67 2020/02/26 15:44:57 riastradh Exp $	*/
+/*	$NetBSD: main.c,v 1.68 2021/10/12 23:40:38 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "from: @(#)main.c	8.1 (Berkeley) 6/20/93";
 #else
-__RCSID("$NetBSD: main.c,v 1.67 2020/02/26 15:44:57 riastradh Exp $");
+__RCSID("$NetBSD: main.c,v 1.68 2021/10/12 23:40:38 jmcneill Exp $");
 #endif
 #endif /* not lint */
 
@@ -229,11 +229,6 @@ main(int argc, char *argv[], char *envp[
 			if (ttyaction(ttyn, "getty", "root"))
 syslog(LOG_WARNING, "%s: ttyaction failed",
 	ttyn);
-			/*
-			 * Delay the open so DTR stays down long enough
-			 * to be detected.
-			 */
-			(void)sleep(2);
 			while ((i = open(ttyn, O_RDWR)) == -1) {
 if ((repcnt % 10 == 0) &&
 (errno != ENXIO || !failopenlogged)) {



CVS commit: src/libexec/getty

2021-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Oct 12 23:40:38 UTC 2021

Modified Files:
src/libexec/getty: main.c

Log Message:
getty: Remove 2 second sleep before opening tty

This (apparently very old!) workaround to ensure that DTR stays down long
enough to be detected is now handled by serial drivers themselves. For
console devices (framebuffer, serial console, etc) this was an unnecessary
2 second penalty that we have all been paying since the beginning of time.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/libexec/getty/main.c

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



CVS commit: src

2021-10-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Oct 13 04:57:20 UTC 2021

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/lib/libc/sys: kqueue.2
src/sys/kern: kern_event.c
src/sys/sys: event.h
src/tests/kernel/kqueue: Makefile
Added Files:
src/tests/kernel/kqueue: t_timer.c

Log Message:
Add support for the NOTE_SECONDS, NOTE_MSECONDS, NOTE_USECONDS,
NOTE_NSECONDS, and NOTE_ABSTIME filter flags to EVFILT_TIMER,
API-compatible with the same in FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.364 -r1.365 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1135 -r1.1136 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.53 -r1.54 src/lib/libc/sys/kqueue.2
cvs rdiff -u -r1.131 -r1.132 src/sys/kern/kern_event.c
cvs rdiff -u -r1.47 -r1.48 src/sys/sys/event.h
cvs rdiff -u -r1.6 -r1.7 src/tests/kernel/kqueue/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/kqueue/t_timer.c

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

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.364 src/distrib/sets/lists/debug/mi:1.365
--- src/distrib/sets/lists/debug/mi:1.364	Sun Oct 10 17:47:38 2021
+++ src/distrib/sets/lists/debug/mi	Wed Oct 13 04:57:19 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.364 2021/10/10 17:47:38 thorpej Exp $
+# $NetBSD: mi,v 1.365 2021/10/13 04:57:19 thorpej Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -1767,6 +1767,7 @@
 ./usr/libdata/debug/usr/tests/kernel/kqueue/t_proc4.debug		tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/kqueue/t_scan.debug		tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/kqueue/t_sig.debug			tests-kernel-tests	debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/kernel/kqueue/t_timer.debug		tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/kqueue/t_vnode.debug		tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/kqueue/write/t_fifo.debug		tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/kqueue/write/t_pipe.debug		tests-kernel-tests	debug,atf,compattestfile

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1135 src/distrib/sets/lists/tests/mi:1.1136
--- src/distrib/sets/lists/tests/mi:1.1135	Sun Oct 10 17:47:38 2021
+++ src/distrib/sets/lists/tests/mi	Wed Oct 13 04:57:20 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1135 2021/10/10 17:47:38 thorpej Exp $
+# $NetBSD: mi,v 1.1136 2021/10/13 04:57:20 thorpej Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2187,6 +2187,7 @@
 ./usr/tests/kernel/kqueue/t_proc4			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/kqueue/t_scan			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/kqueue/t_sigtests-kernel-tests	compattestfile,atf
+./usr/tests/kernel/kqueue/t_timer			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/kqueue/t_vnode			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/kqueue/writetests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/kqueue/write/Atffile			tests-kernel-tests	compattestfile,atf

Index: src/lib/libc/sys/kqueue.2
diff -u src/lib/libc/sys/kqueue.2:1.53 src/lib/libc/sys/kqueue.2:1.54
--- src/lib/libc/sys/kqueue.2:1.53	Sat Oct 31 14:35:28 2020
+++ src/lib/libc/sys/kqueue.2	Wed Oct 13 04:57:19 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kqueue.2,v 1.53 2020/10/31 14:35:28 christos Exp $
+.\"	$NetBSD: kqueue.2,v 1.54 2021/10/13 04:57:19 thorpej Exp $
 .\"
 .\" Copyright (c) 2000 Jonathan Lemon
 .\" All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" $FreeBSD: src/lib/libc/sys/kqueue.2,v 1.22 2001/06/27 19:55:57 dd Exp $
 .\"
-.Dd October 30, 2020
+.Dd October 11, 2021
 .Dt KQUEUE 2
 .Os
 .Sh NAME
@@ -521,13 +521,72 @@ Establishes an arbitrary timer identifie
 .Va ident .
 When adding a timer,
 .Va data
-specifies the timeout period in milliseconds.
-The timer will be periodic unless EV_ONESHOT is specified.
+specifies the timeout period in units described below, or, if
+.Dv NOTE_ABSTIME
+is set in
+.Va fflags ,
+specifies the absolute time at which the timer should fire.
+The timer will repeat unless
+.Dv EV_ONESHOT
+is set in
+.Va flags
+or
+.Dv NOTE_ABSTIME
+is set in
+.Va fflags .
 On return,
 .Va data
 contains the number of times the timeout has expired since the last call to
 .Fn kevent .
-This filter automatically sets the EV_CLEAR flag internally.
+This filter automatically sets
+.Dv EV_CLEAR
+in
+.va flags
+for periodic timers.
+Timers created with
+.Dv NOTE_ABSTIME
+remain activated on the kqueue once the absolute time has passed unless
+.Dv EV_CLEAR
+or
+.Dv EV_ONESHOT
+are also specified.
+.Dv 

CVS commit: src

2021-10-12 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Oct 13 04:57:20 UTC 2021

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/lib/libc/sys: kqueue.2
src/sys/kern: kern_event.c
src/sys/sys: event.h
src/tests/kernel/kqueue: Makefile
Added Files:
src/tests/kernel/kqueue: t_timer.c

Log Message:
Add support for the NOTE_SECONDS, NOTE_MSECONDS, NOTE_USECONDS,
NOTE_NSECONDS, and NOTE_ABSTIME filter flags to EVFILT_TIMER,
API-compatible with the same in FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.364 -r1.365 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1135 -r1.1136 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.53 -r1.54 src/lib/libc/sys/kqueue.2
cvs rdiff -u -r1.131 -r1.132 src/sys/kern/kern_event.c
cvs rdiff -u -r1.47 -r1.48 src/sys/sys/event.h
cvs rdiff -u -r1.6 -r1.7 src/tests/kernel/kqueue/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/kqueue/t_timer.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

2021-10-12 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Oct 13 01:11:30 UTC 2021

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

Log Message:
Fix vmx(4) receive workqueue problem on qemu, reported by ozaki-r@n.o, thanks.

ESXi stops interrupt by vmxnet3_disable_intr() immediately.  In contrast, qemu
does not stop interrupt soon.  Hmm, qemu's behavior seems not to be correct,
however, there is no explicit specification of vmxnet3.  So, we have to accept
that behavior.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/if_vmx.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_vmx.c
diff -u src/sys/dev/pci/if_vmx.c:1.4 src/sys/dev/pci/if_vmx.c:1.5
--- src/sys/dev/pci/if_vmx.c:1.4	Thu Oct 15 04:37:48 2020
+++ src/sys/dev/pci/if_vmx.c	Wed Oct 13 01:11:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.4 2020/10/15 04:37:48 ryo Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.5 2021/10/13 01:11:29 knakahara Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.4 2020/10/15 04:37:48 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.5 2021/10/13 01:11:29 knakahara Exp $");
 
 #include 
 #include 
@@ -253,6 +253,7 @@ struct vmxnet3_queue {
 
 	void *vxq_si;
 	bool vxq_workqueue;
+	bool vxq_wq_enqueued;
 	struct work vxq_wq_cookie;
 };
 
@@ -2484,8 +2485,15 @@ vmxnet3_sched_handle_queue(struct vmxnet
 {
 
 	if (vmxq->vxq_workqueue) {
-		workqueue_enqueue(sc->vmx_queue_wq, >vxq_wq_cookie,
-		curcpu());
+		/*
+		 * When this function is called, "vmxq" is owned by one CPU.
+		 * so, atomic operation is not required here.
+		 */
+		if (!vmxq->vxq_wq_enqueued) {
+			vmxq->vxq_wq_enqueued = true;
+			workqueue_enqueue(sc->vmx_queue_wq,
+			>vxq_wq_cookie, curcpu());
+		}
 	} else {
 		softint_schedule(vmxq->vxq_si);
 	}
@@ -2625,6 +2633,7 @@ vmxnet3_handle_queue_work(struct work *w
 	struct vmxnet3_queue *vmxq;
 
 	vmxq = container_of(wk, struct vmxnet3_queue, vxq_wq_cookie);
+	vmxq->vxq_wq_enqueued = false;
 	vmxnet3_handle_queue(vmxq);
 }
 



CVS commit: src/sys/dev/pci

2021-10-12 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Oct 13 01:11:30 UTC 2021

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

Log Message:
Fix vmx(4) receive workqueue problem on qemu, reported by ozaki-r@n.o, thanks.

ESXi stops interrupt by vmxnet3_disable_intr() immediately.  In contrast, qemu
does not stop interrupt soon.  Hmm, qemu's behavior seems not to be correct,
however, there is no explicit specification of vmxnet3.  So, we have to accept
that behavior.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/if_vmx.c

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



CVS commit: src/tests/usr.bin

2021-10-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Oct 12 18:40:01 UTC 2021

Modified Files:
src/tests/usr.bin/c++: asan_common.subr
src/tests/usr.bin/cc: asan_common.subr

Log Message:
asan is supported on aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/c++/asan_common.subr
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/cc/asan_common.subr

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

Modified files:

Index: src/tests/usr.bin/c++/asan_common.subr
diff -u src/tests/usr.bin/c++/asan_common.subr:1.2 src/tests/usr.bin/c++/asan_common.subr:1.3
--- src/tests/usr.bin/c++/asan_common.subr:1.2	Tue Jan 29 20:07:03 2019
+++ src/tests/usr.bin/c++/asan_common.subr	Tue Oct 12 18:40:01 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: asan_common.subr,v 1.2 2019/01/29 20:07:03 mgorny Exp $
+#	$NetBSD: asan_common.subr,v 1.3 2021/10/12 18:40:01 skrll Exp $
 #
 # Copyright (c) 2018, 2019 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -27,6 +27,10 @@
 
 SUPPORT='n'
 test_target() {
+	if uname -p | grep -q "aarch64"; then
+		SUPPORT='y'
+	fi
+
 	if uname -m | grep -q "amd64"; then
 		SUPPORT='y'
 	fi

Index: src/tests/usr.bin/cc/asan_common.subr
diff -u src/tests/usr.bin/cc/asan_common.subr:1.1 src/tests/usr.bin/cc/asan_common.subr:1.2
--- src/tests/usr.bin/cc/asan_common.subr:1.1	Tue Jan 29 19:56:37 2019
+++ src/tests/usr.bin/cc/asan_common.subr	Tue Oct 12 18:40:01 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: asan_common.subr,v 1.1 2019/01/29 19:56:37 mgorny Exp $
+#	$NetBSD: asan_common.subr,v 1.2 2021/10/12 18:40:01 skrll Exp $
 #
 # Copyright (c) 2018, 2019 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -27,6 +27,10 @@
 
 SUPPORT='n'
 test_target() {
+	if uname -p | grep -q "aarch64"; then
+		SUPPORT='y'
+	fi
+
 	if uname -m | grep -q "amd64"; then
 		SUPPORT='y'
 	fi



CVS commit: src/tests/usr.bin

2021-10-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Oct 12 18:40:01 UTC 2021

Modified Files:
src/tests/usr.bin/c++: asan_common.subr
src/tests/usr.bin/cc: asan_common.subr

Log Message:
asan is supported on aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/c++/asan_common.subr
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/cc/asan_common.subr

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



CVS commit: src/tests/usr.bin/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 19:05:23 UTC 2021

Modified Files:
src/tests/usr.bin/indent: token-comment.0 token-comment.0.stdout

Log Message:
tests/indent: test formatting of long single-line code comments


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/indent/token-comment.0
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/token-comment.0.stdout

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



CVS commit: src/tests/usr.bin/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 19:05:23 UTC 2021

Modified Files:
src/tests/usr.bin/indent: token-comment.0 token-comment.0.stdout

Log Message:
tests/indent: test formatting of long single-line code comments


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/indent/token-comment.0
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/token-comment.0.stdout

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

Modified files:

Index: src/tests/usr.bin/indent/token-comment.0
diff -u src/tests/usr.bin/indent/token-comment.0:1.8 src/tests/usr.bin/indent/token-comment.0:1.9
--- src/tests/usr.bin/indent/token-comment.0:1.8	Tue Oct 12 18:54:56 2021
+++ src/tests/usr.bin/indent/token-comment.0	Tue Oct 12 19:05:22 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token-comment.0,v 1.8 2021/10/12 18:54:56 rillig Exp $ */
+/* $NetBSD: token-comment.0,v 1.9 2021/10/12 19:05:22 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -97,6 +97,13 @@ function(void)
 	code();			/* code comment  to line length 81 */
 	code();			/* code comment _ to line length 82 */
 
+/* $ In the following comments, the line length is measured after formatting. */
+	code();			/* code comment _ to line length 78*/
+	code();			/* code comment __ to line length 79*/
+	code();			/* code comment ___ to line length 80*/
+	code();			/* code comment  to line length 81*/
+	code();			/* code comment _ to line length 82*/
+
 	code();			/* short
  * multi-line
  * code

Index: src/tests/usr.bin/indent/token-comment.0.stdout
diff -u src/tests/usr.bin/indent/token-comment.0.stdout:1.10 src/tests/usr.bin/indent/token-comment.0.stdout:1.11
--- src/tests/usr.bin/indent/token-comment.0.stdout:1.10	Tue Oct 12 18:54:56 2021
+++ src/tests/usr.bin/indent/token-comment.0.stdout	Tue Oct 12 19:05:22 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token-comment.0.stdout,v 1.10 2021/10/12 18:54:56 rillig Exp $ */
+/* $NetBSD: token-comment.0.stdout,v 1.11 2021/10/12 19:05:22 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -102,6 +102,14 @@ function(void)
 	code();			/* code comment _ to line length
  * 82 */
 
+/* $ In the following comments, the line length is measured after formatting. */
+	code();			/* code comment _ to line length 78 */
+	code();			/* code comment __ to line length 79 */
+	code();			/* code comment ___ to line length 80 */
+	code();			/* code comment  to line length 81 */
+	code();			/* code comment _ to line length
+ * 82 */
+
 	code();			/* short multi-line code comment */
 
 	code();			/* long single-line code comment that is



CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 12 19:08:04 UTC 2021

Modified Files:
src/usr.sbin/inetd: Makefile inetd.8 inetd.c inetd.h parse_v2.c
Added Files:
src/usr.sbin/inetd: parse.c ratelimit.c

Log Message:
PR/56448: Solomon Ritzow: Various improvements.

Rate limiting code has been moved to ratelimit.c. I renamed
clear_ip_list to rl_clear_ip_list and broke the code up into more
functions. I have also made the per-IP rate limiting allocation more
efficient. IP addresses are now stored in their network format instead
of a string from getnameinfo (see inetd.h struct rl_ip_node). malloc
calls use only the space needed by the structure by using offsetof on
union members (I suppose this can be a bit dangerous if not done
correctly...). Per-IP rate limiting still supports textual comparison
using getnameinfo for address families other than AF_INET and AF_INET6, but I
don't think there are any that are actually compatible or used by inetd (I
haven't tested UNIX sockets with a remote bound to another file, but I did test
using IPv6 with the textual format by commenting out the IPv6 specific
code, and it works properly). Still potentially handy for the future.
The IP node list (se_rl_ip_list) now uses the  SLIST macros
instead of a custom list. I've broken rl_process up into helper functions
for each type of rate limiting and created a separate function for
address stringification, for use with printouts from the -d flag. I
tried to reduce stack memory use by moving printing code involving
string buffers into separate functions. I haven't tested rl_ipv6_eq on
a 32-bit system.

The code for the positional syntax has also been moved to parse.c.
Function try_biltin has been added to remove parse.c:parse_server's
dependency on the biltin structure definition.

File inetd.h has been updated with the proper function prototypes, and
the servtab structure has been update with the new IP node SLIST. I also
moved things around a bit. The way we (a peer and myself)
formatted inetd.h previously was somewhat confusing. Function and global
variable prototypes are now organized by the source file they are
defined in.

I also added a -f flag that I saw in another problem report
(https://gnats.netbsd.org/12823) that I thought could be useful. It
runs inetd in the foreground but without debug printouts or SO_DEBUG.
I'm not completely sure about the line "if (foreground) setsid()" that
I changed from "if (debug) setsid()".


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.64 -r1.65 src/usr.sbin/inetd/inetd.8
cvs rdiff -u -r1.136 -r1.137 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r0 -r1.1 src/usr.sbin/inetd/parse.c \
src/usr.sbin/inetd/ratelimit.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/inetd/parse_v2.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/inetd

2021-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 12 19:08:04 UTC 2021

Modified Files:
src/usr.sbin/inetd: Makefile inetd.8 inetd.c inetd.h parse_v2.c
Added Files:
src/usr.sbin/inetd: parse.c ratelimit.c

Log Message:
PR/56448: Solomon Ritzow: Various improvements.

Rate limiting code has been moved to ratelimit.c. I renamed
clear_ip_list to rl_clear_ip_list and broke the code up into more
functions. I have also made the per-IP rate limiting allocation more
efficient. IP addresses are now stored in their network format instead
of a string from getnameinfo (see inetd.h struct rl_ip_node). malloc
calls use only the space needed by the structure by using offsetof on
union members (I suppose this can be a bit dangerous if not done
correctly...). Per-IP rate limiting still supports textual comparison
using getnameinfo for address families other than AF_INET and AF_INET6, but I
don't think there are any that are actually compatible or used by inetd (I
haven't tested UNIX sockets with a remote bound to another file, but I did test
using IPv6 with the textual format by commenting out the IPv6 specific
code, and it works properly). Still potentially handy for the future.
The IP node list (se_rl_ip_list) now uses the  SLIST macros
instead of a custom list. I've broken rl_process up into helper functions
for each type of rate limiting and created a separate function for
address stringification, for use with printouts from the -d flag. I
tried to reduce stack memory use by moving printing code involving
string buffers into separate functions. I haven't tested rl_ipv6_eq on
a 32-bit system.

The code for the positional syntax has also been moved to parse.c.
Function try_biltin has been added to remove parse.c:parse_server's
dependency on the biltin structure definition.

File inetd.h has been updated with the proper function prototypes, and
the servtab structure has been update with the new IP node SLIST. I also
moved things around a bit. The way we (a peer and myself)
formatted inetd.h previously was somewhat confusing. Function and global
variable prototypes are now organized by the source file they are
defined in.

I also added a -f flag that I saw in another problem report
(https://gnats.netbsd.org/12823) that I thought could be useful. It
runs inetd in the foreground but without debug printouts or SO_DEBUG.
I'm not completely sure about the line "if (foreground) setsid()" that
I changed from "if (debug) setsid()".


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.64 -r1.65 src/usr.sbin/inetd/inetd.8
cvs rdiff -u -r1.136 -r1.137 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r0 -r1.1 src/usr.sbin/inetd/parse.c \
src/usr.sbin/inetd/ratelimit.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/inetd/parse_v2.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/inetd/Makefile
diff -u src/usr.sbin/inetd/Makefile:1.29 src/usr.sbin/inetd/Makefile:1.30
--- src/usr.sbin/inetd/Makefile:1.29	Fri Sep  3 16:24:28 2021
+++ src/usr.sbin/inetd/Makefile	Tue Oct 12 15:08:04 2021
@@ -1,12 +1,12 @@
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
-#	$NetBSD: Makefile,v 1.29 2021/09/03 20:24:28 rillig Exp $
+#	$NetBSD: Makefile,v 1.30 2021/10/12 19:08:04 christos Exp $
 
 .include 
 
 USE_FORT?= yes	# network server
 
 PROG=	inetd
-SRCS=	inetd.c parse_v2.c
+SRCS=	inetd.c parse.c parse_v2.c ratelimit.c
 MAN=	inetd.8
 MLINKS=	inetd.8 inetd.conf.5
 WARNS=	6

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.64 src/usr.sbin/inetd/inetd.8:1.65
--- src/usr.sbin/inetd/inetd.8:1.64	Tue Aug 31 07:16:00 2021
+++ src/usr.sbin/inetd/inetd.8	Tue Oct 12 15:08:04 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.64 2021/08/31 11:16:00 wiz Exp $
+.\"	$NetBSD: inetd.8,v 1.65 2021/10/12 19:08:04 christos Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -57,7 +57,7 @@
 .\"
 .\" from: @(#)inetd.8   8.4 (Berkeley) 6/1/94
 .\"
-.Dd August 29, 2021
+.Dd October 12, 2021
 .Dt INETD 8
 .Os
 .Sh NAME
@@ -92,7 +92,9 @@ The options available for
 .Nm :
 .Bl -tag -width Ds
 .It Fl d
-Turns on debugging.
+Turns on debugging and runs inetd in the foreground.
+.It Fl f
+Runs inetd in the foreground.
 .It Fl l
 Turns on libwrap connection logging.
 .El
@@ -519,7 +521,12 @@ Defaults to 40 if not specified.
 .It Sy ip_max
 Specifies the maximum number of server instances that may be spawned from
 .Nm
-within an interval of 60 seconds for a given IP address.
+within an interval of 60 seconds for a given IP address. Other address types 
+may also work if supported by
+.Xr getnameinfo 3
+, test thoroughly using -d. For example, connections from unnamed Unix sockets
+do not work, but connections from named Unix sockets may work. However, there is
+no way to only accept named Unix 

CVS commit: src/usr.bin/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 19:57:53 UTC 2021

Modified Files:
src/usr.bin/indent: pr_comment.c

Log Message:
indent: replace unreachable code with assertion


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.bin/indent/pr_comment.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/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 19:57:53 UTC 2021

Modified Files:
src/usr.bin/indent: pr_comment.c

Log Message:
indent: replace unreachable code with assertion


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.bin/indent/pr_comment.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/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.71 src/usr.bin/indent/pr_comment.c:1.72
--- src/usr.bin/indent/pr_comment.c:1.71	Tue Oct 12 19:56:07 2021
+++ src/usr.bin/indent/pr_comment.c	Tue Oct 12 19:57:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pr_comment.c,v 1.71 2021/10/12 19:56:07 rillig Exp $	*/
+/*	$NetBSD: pr_comment.c,v 1.72 2021/10/12 19:57:53 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.71 2021/10/12 19:56:07 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.72 2021/10/12 19:57:53 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -356,8 +356,7 @@ process_comment(void)
 		 * enough.
 		 */
 		while (*p != '\0') {
-		if (is_hspace(*p))
-			last_blank = com.e - com.buf;
+		assert(!is_hspace(*p));
 		*com.e++ = *p++;
 		}
 	}



CVS commit: src

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 18:22:01 UTC 2021

Modified Files:
src/tests/usr.bin/indent: elsecomment.0.stdout token-comment.0.stdout
src/usr.bin/indent: pr_comment.c

Log Message:
indent: fix wrapping for comments in otherwise empty lines

The comment above the code was wrong. The leading 3 characters were
indeed ignored, but the first of them was '/', not ' '. Of the trailing
3 characters, 2 were not ignored. The start and end of the comment would
not cancel out, they would rather sum up.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/elsecomment.0.stdout
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/indent/token-comment.0.stdout
cvs rdiff -u -r1.69 -r1.70 src/usr.bin/indent/pr_comment.c

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



CVS commit: src

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 18:22:01 UTC 2021

Modified Files:
src/tests/usr.bin/indent: elsecomment.0.stdout token-comment.0.stdout
src/usr.bin/indent: pr_comment.c

Log Message:
indent: fix wrapping for comments in otherwise empty lines

The comment above the code was wrong. The leading 3 characters were
indeed ignored, but the first of them was '/', not ' '. Of the trailing
3 characters, 2 were not ignored. The start and end of the comment would
not cancel out, they would rather sum up.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/indent/elsecomment.0.stdout
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/indent/token-comment.0.stdout
cvs rdiff -u -r1.69 -r1.70 src/usr.bin/indent/pr_comment.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/usr.bin/indent/elsecomment.0.stdout
diff -u src/tests/usr.bin/indent/elsecomment.0.stdout:1.1 src/tests/usr.bin/indent/elsecomment.0.stdout:1.2
--- src/tests/usr.bin/indent/elsecomment.0.stdout:1.1	Thu Apr  4 15:27:35 2019
+++ src/tests/usr.bin/indent/elsecomment.0.stdout	Tue Oct 12 18:22:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: elsecomment.0.stdout,v 1.1 2019/04/04 15:27:35 kamil Exp $	*/
+/*	$NetBSD: elsecomment.0.stdout,v 1.2 2021/10/12 18:22:01 rillig Exp $	*/
 /* $FreeBSD: head/usr.bin/indent/tests/elsecomment.0.stdout 334559 2018-06-03 14:03:20Z pstef $ */
 /* See r303484 and r309342 */
 void
@@ -23,7 +23,9 @@ t(void)
 
 
 
-	/* Old indent would remove the 3 blank lines above, awaiting "else". */
+	/*
+	 * Old indent would remove the 3 blank lines above, awaiting "else".
+	 */
 
 	if (1)
 	{

Index: src/tests/usr.bin/indent/token-comment.0.stdout
diff -u src/tests/usr.bin/indent/token-comment.0.stdout:1.8 src/tests/usr.bin/indent/token-comment.0.stdout:1.9
--- src/tests/usr.bin/indent/token-comment.0.stdout:1.8	Fri Oct  8 23:53:37 2021
+++ src/tests/usr.bin/indent/token-comment.0.stdout	Tue Oct 12 18:22:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token-comment.0.stdout,v 1.8 2021/10/08 23:53:37 rillig Exp $ */
+/* $NetBSD: token-comment.0.stdout,v 1.9 2021/10/12 18:22:01 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -10,8 +10,12 @@
  */
 
 /* 456789 123456789 123456789 123456789 123456789 123456789 123456789 12345 */
-/* 456789 123456789 123456789 123456789 123456789 123456789 123456789 123456 */
-/* 456789 123456789 123456789 123456789 123456789 123456789 123456789 1234567 */
+/*
+ * 456789 123456789 123456789 123456789 123456789 123456789 123456789 123456
+ */
+/*
+ * 456789 123456789 123456789 123456789 123456789 123456789 123456789 1234567
+ */
 /*
  * 456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678
  */

Index: src/usr.bin/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.69 src/usr.bin/indent/pr_comment.c:1.70
--- src/usr.bin/indent/pr_comment.c:1.69	Sat Oct  9 11:00:27 2021
+++ src/usr.bin/indent/pr_comment.c	Tue Oct 12 18:22:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pr_comment.c,v 1.69 2021/10/09 11:00:27 rillig Exp $	*/
+/*	$NetBSD: pr_comment.c,v 1.70 2021/10/12 18:22:01 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.69 2021/10/09 11:00:27 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.70 2021/10/12 18:22:01 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -172,19 +172,14 @@ process_comment(void)
 if (break_delim) {
 	for (const char *p = inp.s; *p != '\n'; p++) {
 	assert(*p != '\0');
-	assert(p < inp.e);
-	if (p[0] == '*' && p[1] == '/') {
-		/*
-		 * XXX: This computation ignores the leading " * ", as well as
-		 * the trailing ' ' '*' '/'.  In simple cases, these cancel
-		 * out since they are equally long.
-		 */
-		int right_margin = indentation_after_range(ps.com_ind,
-		inp.s, p + 2);
-		if (right_margin < adj_max_line_length)
-		break_delim = false;
-		break;
-	}
+	assert(inp.e - p >= 2);
+	if (!(p[0] == '*' && p[1] == '/'))
+		continue;
+
+	int len = 3 + indentation_after_range(ps.com_ind, inp.s, p + 2);
+	if (len <= adj_max_line_length)
+		break_delim = false;
+	break;
 	}
 }
 



CVS commit: src/tests/usr.bin/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 18:54:56 UTC 2021

Modified Files:
src/tests/usr.bin/indent: token-comment.0 token-comment.0.stdout

Log Message:
tests/indent: test long code comments


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/indent/token-comment.0
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/indent/token-comment.0.stdout

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

Modified files:

Index: src/tests/usr.bin/indent/token-comment.0
diff -u src/tests/usr.bin/indent/token-comment.0:1.7 src/tests/usr.bin/indent/token-comment.0:1.8
--- src/tests/usr.bin/indent/token-comment.0:1.7	Fri Oct  8 23:53:37 2021
+++ src/tests/usr.bin/indent/token-comment.0	Tue Oct 12 18:54:56 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token-comment.0,v 1.7 2021/10/08 23:53:37 rillig Exp $ */
+/* $NetBSD: token-comment.0,v 1.8 2021/10/12 18:54:56 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -91,6 +91,11 @@ function(void)
 	}
 
 	code();			/* code comment */
+	code();			/* code comment _ to line length 78 */
+	code();			/* code comment __ to line length 79 */
+	code();			/* code comment ___ to line length 80 */
+	code();			/* code comment  to line length 81 */
+	code();			/* code comment _ to line length 82 */
 
 	code();			/* short
  * multi-line
@@ -104,6 +109,11 @@ function(void)
  * the allowed line width */
 
 	code();			// C99 code comment
+	code();			// C99 code comment  to line length 78
+	code();			// C99 code comment _ to line length 79
+	code();			// C99 code comment __ to line length 80
+	code();			// C99 code comment ___ to line length 81
+	code();			// C99 code comment  to line length 82
 
 	if (cond) /* comment */
 		if (cond) /* comment */

Index: src/tests/usr.bin/indent/token-comment.0.stdout
diff -u src/tests/usr.bin/indent/token-comment.0.stdout:1.9 src/tests/usr.bin/indent/token-comment.0.stdout:1.10
--- src/tests/usr.bin/indent/token-comment.0.stdout:1.9	Tue Oct 12 18:22:01 2021
+++ src/tests/usr.bin/indent/token-comment.0.stdout	Tue Oct 12 18:54:56 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token-comment.0.stdout,v 1.9 2021/10/12 18:22:01 rillig Exp $ */
+/* $NetBSD: token-comment.0.stdout,v 1.10 2021/10/12 18:54:56 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -95,6 +95,12 @@ function(void)
 	}
 
 	code();			/* code comment */
+	code();			/* code comment _ to line length 78 */
+	code();			/* code comment __ to line length 79 */
+	code();			/* code comment ___ to line length 80 */
+	code();			/* code comment  to line length 81 */
+	code();			/* code comment _ to line length
+ * 82 */
 
 	code();			/* short multi-line code comment */
 
@@ -104,7 +110,15 @@ function(void)
 	code();			/* long multi-line code comment that is longer
  * than the allowed line width */
 
+/* $ Trailing C99 comments are not wrapped, as indent would not correctly */
+/* $ recognize the continuation lines as continued comments. For block */
+/* $ comments this works since the comment has not ended yet. */
 	code();			// C99 code comment
+	code();			// C99 code comment  to line length 78
+	code();			// C99 code comment _ to line length 79
+	code();			// C99 code comment __ to line length 80
+	code();			// C99 code comment ___ to line length 81
+	code();			// C99 code comment  to line length 82
 
 	if (cond)		/* comment */
 		if (cond)	/* comment */



CVS commit: src/tests/usr.bin/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 18:54:56 UTC 2021

Modified Files:
src/tests/usr.bin/indent: token-comment.0 token-comment.0.stdout

Log Message:
tests/indent: test long code comments


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/indent/token-comment.0
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/indent/token-comment.0.stdout

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



CVS commit: src/usr.bin/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 19:56:07 UTC 2021

Modified Files:
src/usr.bin/indent: pr_comment.c

Log Message:
indent: use high-level buffer API for processing comments

Document the trickery of copying the last word from the previous line
since that it not obvious at all.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/usr.bin/indent/pr_comment.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/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 19:56:07 UTC 2021

Modified Files:
src/usr.bin/indent: pr_comment.c

Log Message:
indent: use high-level buffer API for processing comments

Document the trickery of copying the last word from the previous line
since that it not obvious at all.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/usr.bin/indent/pr_comment.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/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.70 src/usr.bin/indent/pr_comment.c:1.71
--- src/usr.bin/indent/pr_comment.c:1.70	Tue Oct 12 18:22:01 2021
+++ src/usr.bin/indent/pr_comment.c	Tue Oct 12 19:56:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pr_comment.c,v 1.70 2021/10/12 18:22:01 rillig Exp $	*/
+/*	$NetBSD: pr_comment.c,v 1.71 2021/10/12 19:56:07 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.70 2021/10/12 18:22:01 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.71 2021/10/12 19:56:07 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -55,10 +55,31 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
 #include "indent.h"
 
 static void
-check_size_comment(size_t desired_size)
+com_add_char(char ch)
 {
-if (com.e + desired_size >= com.l)
-	buf_expand(, desired_size);
+if (com.e + 1 >= com.l)
+	buf_expand(, 1);
+*com.e++ = ch;
+}
+
+static void
+com_add_delim(void)
+{
+if (!opt.star_comment_cont)
+	return;
+size_t len = 3;
+if (com.e + len >= com.l)
+	buf_expand(, len);
+memcpy(com.e, " * ", len);
+com.e += len;
+}
+
+static void
+com_terminate(void)
+{
+if (com.e + 1 >= com.l)
+	buf_expand(, 1);
+*com.e = '\0';
 }
 
 /*
@@ -163,10 +184,10 @@ process_comment(void)
 }
 
 ps.comment_delta = 0;
-*com.e++ = '/';
-*com.e++ = token.e[-1];
+com_add_char('/');
+com_add_char(token.e[-1]);	/* either '*' or '/' */
 if (*inp.s != ' ' && !box_com)
-	*com.e++ = ' ';
+	com_add_char(' ');
 
 /* Don't put a break delimiter if this is a one-liner that won't wrap. */
 if (break_delim) {
@@ -191,8 +212,8 @@ process_comment(void)
 	prefix_blankline_requested = true;
 	dump_line();
 	com.e = com.s = t;
-	if (!box_com && opt.star_comment_cont)
-	*com.e++ = ' ', *com.e++ = '*', *com.e++ = ' ';
+	if (!box_com)
+	com_add_delim();
 }
 
 /* Start to copy the comment */
@@ -201,19 +222,17 @@ process_comment(void)
  * copied */
 	switch (*inp.s) {	/* this checks for various special cases */
 	case '\f':
-	check_size_comment(3);
 	if (!box_com) {	/* in a text comment, break the line here */
 		ps.use_ff = true;
 		dump_line();
 		last_blank = -1;
-		if (opt.star_comment_cont)
-		*com.e++ = ' ', *com.e++ = '*', *com.e++ = ' ';
+		com_add_delim();
 		inp.s++;
 		while (is_hspace(*inp.s))
 		inp.s++;
 	} else {
 		inbuf_skip();
-		*com.e++ = '\f';
+		com_add_char('\f');
 	}
 	break;
 
@@ -228,24 +247,22 @@ process_comment(void)
 	}
 
 	last_blank = -1;
-	check_size_comment(4);
 	if (box_com || ps.last_nl) {	/* if this is a boxed comment,
 		 * we handle the newline */
 		if (com.s == com.e)
-		*com.e++ = ' ';
+		com_add_char(' ');
 		if (!box_com && com.e - com.s > 3) {
 		dump_line();
-		if (opt.star_comment_cont)
-			*com.e++ = ' ', *com.e++ = '*', *com.e++ = ' ';
+		com_add_delim();
 		}
 		dump_line();
-		if (!box_com && opt.star_comment_cont)
-		*com.e++ = ' ', *com.e++ = '*', *com.e++ = ' ';
+		if (!box_com)
+		com_add_delim();
 
 	} else {
 		ps.last_nl = true;
 		if (!is_hspace(com.e[-1]))
-		*com.e++ = ' ';
+		com_add_char(' ');
 		last_blank = com.e - 1 - com.buf;
 	}
 	++line_no;
@@ -266,7 +283,6 @@ process_comment(void)
 
 	case '*':
 	inbuf_skip();
-	check_size_comment(4);
 	if (*inp.s == '/') {
 	end_of_comment:
 		inbuf_skip();
@@ -276,33 +292,33 @@ process_comment(void)
 		if (com.e > com.s + 3)
 			dump_line();
 		else
-			com.s = com.e;
-		*com.e++ = ' ';
+			com.s = com.e;	/* XXX: why not e = s? */
+		com_add_char(' ');
 		}
 
 		if (!is_hspace(com.e[-1]) && !box_com)
-		*com.e++ = ' ';	/* ensure blank before end */
-		if (token.e[-1] == '/')
-		*com.e = '\0';
-		else
-		*com.e++ = '*', *com.e++ = '/', *com.e = '\0';
+		com_add_char(' ');
+		if (token.e[-1] != '/') {
+		com_add_char('*');
+		com_add_char('/');
+		}
+		com_terminate();
 
 		ps.just_saw_decl = l_just_saw_decl;
 		return;
 
 	} else		/* handle isolated '*' */
-		*com.e++ = '*';
+		com_add_char('*');
 	break;
 
 	default:		/* we have a random char */
 	;
 	int 

CVS commit: src/sys/dev/ic

2021-10-12 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Oct 12 08:09:51 UTC 2021

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

Log Message:
Note that while sleeping (HUPCL), time passes.
Try to avoid the otherwise infinite loop.


To generate a diff of this commit:
cvs rdiff -u -r1.367 -r1.368 src/sys/dev/ic/com.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

2021-10-12 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Oct 12 08:09:51 UTC 2021

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

Log Message:
Note that while sleeping (HUPCL), time passes.
Try to avoid the otherwise infinite loop.


To generate a diff of this commit:
cvs rdiff -u -r1.367 -r1.368 src/sys/dev/ic/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/dev/ic/com.c
diff -u src/sys/dev/ic/com.c:1.367 src/sys/dev/ic/com.c:1.368
--- src/sys/dev/ic/com.c:1.367	Tue Oct 12 06:25:17 2021
+++ src/sys/dev/ic/com.c	Tue Oct 12 08:09:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.367 2021/10/12 06:25:17 kre Exp $ */
+/* $NetBSD: com.c,v 1.368 2021/10/12 08:09:50 kre Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.367 2021/10/12 06:25:17 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.368 2021/10/12 08:09:50 kre Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -994,6 +994,7 @@ comopen(dev_t dev, int flag, int mode, s
 uimax(diff.tv_usec / 1000, 1);
 kpause("comopen", false, mstohz(ms),
 >sc_lock);
+getmicrotime();
 			}
 			timerclear(>sc_hup_pending);
 		}



CVS commit: src/sys

2021-10-12 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Oct 12 08:36:29 UTC 2021

Modified Files:
src/sys/arch/m68k/m68k: pmap_motorola.c
src/sys/arch/vax/vax: pmap.c
src/sys/compat/linux/arch/aarch64: linux_commons.c
src/sys/compat/linux/arch/amd64: linux_commons.c
src/sys/compat/linux/arch/arm: linux_commons.c
src/sys/compat/linux/arch/i386: linux_commons.c
src/sys/dev/i2c: i2c_exec.c
src/sys/dev/pci: piixpm.c
src/sys/dev/scsipi: cd.c

Log Message:
fix various typos, mainly in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/m68k/m68k/pmap_motorola.c
cvs rdiff -u -r1.192 -r1.193 src/sys/arch/vax/vax/pmap.c
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/linux/arch/aarch64/linux_commons.c
cvs rdiff -u -r1.12 -r1.13 src/sys/compat/linux/arch/amd64/linux_commons.c
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/linux/arch/arm/linux_commons.c
cvs rdiff -u -r1.17 -r1.18 src/sys/compat/linux/arch/i386/linux_commons.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/i2c/i2c_exec.c
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pci/piixpm.c
cvs rdiff -u -r1.352 -r1.353 src/sys/dev/scsipi/cd.c

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



CVS commit: src/sys

2021-10-12 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Oct 12 08:36:29 UTC 2021

Modified Files:
src/sys/arch/m68k/m68k: pmap_motorola.c
src/sys/arch/vax/vax: pmap.c
src/sys/compat/linux/arch/aarch64: linux_commons.c
src/sys/compat/linux/arch/amd64: linux_commons.c
src/sys/compat/linux/arch/arm: linux_commons.c
src/sys/compat/linux/arch/i386: linux_commons.c
src/sys/dev/i2c: i2c_exec.c
src/sys/dev/pci: piixpm.c
src/sys/dev/scsipi: cd.c

Log Message:
fix various typos, mainly in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/m68k/m68k/pmap_motorola.c
cvs rdiff -u -r1.192 -r1.193 src/sys/arch/vax/vax/pmap.c
cvs rdiff -u -r1.1 -r1.2 src/sys/compat/linux/arch/aarch64/linux_commons.c
cvs rdiff -u -r1.12 -r1.13 src/sys/compat/linux/arch/amd64/linux_commons.c
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/linux/arch/arm/linux_commons.c
cvs rdiff -u -r1.17 -r1.18 src/sys/compat/linux/arch/i386/linux_commons.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/i2c/i2c_exec.c
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pci/piixpm.c
cvs rdiff -u -r1.352 -r1.353 src/sys/dev/scsipi/cd.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/m68k/m68k/pmap_motorola.c
diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.74 src/sys/arch/m68k/m68k/pmap_motorola.c:1.75
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.74	Fri Apr 16 00:13:48 2021
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Tue Oct 12 08:36:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.74 2021/04/16 00:13:48 mrg Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.75 2021/10/12 08:36:28 andvar Exp $*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -119,7 +119,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.74 2021/04/16 00:13:48 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.75 2021/10/12 08:36:28 andvar Exp $");
 
 #include 
 #include 
@@ -696,7 +696,7 @@ pmap_destroy(pmap_t pmap)
 /*
  * pmap_release:
  *
- *	Relese the resources held by a pmap.
+ *	Release the resources held by a pmap.
  *
  *	Note: THIS FUNCTION SHOULD BE MOVED INTO pmap_destroy().
  */

Index: src/sys/arch/vax/vax/pmap.c
diff -u src/sys/arch/vax/vax/pmap.c:1.192 src/sys/arch/vax/vax/pmap.c:1.193
--- src/sys/arch/vax/vax/pmap.c:1.192	Mon Aug  2 12:56:23 2021
+++ src/sys/arch/vax/vax/pmap.c	Tue Oct 12 08:36:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.192 2021/08/02 12:56:23 andvar Exp $	   */
+/*	$NetBSD: pmap.c,v 1.193 2021/10/12 08:36:28 andvar Exp $	   */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.192 2021/08/02 12:56:23 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.193 2021/10/12 08:36:28 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_cputype.h"
@@ -859,7 +859,7 @@ pmap_pinit(pmap_t pmap)
 
 	/*
 	 * Do not allocate any pte's here, we don't know the size and 
-	 * we'll get a page pault anyway when some page is referenced,
+	 * we'll get a page fault anyway when some page is referenced,
 	 * so do it then.
 	 */
 	pmap->pm_p0br = (struct pte *)KERNBASE;
@@ -935,8 +935,8 @@ pmap_release(struct pmap *pmap)
 
 /*
  * pmap_destroy(pmap): Remove a reference from the pmap. 
- * If the pmap is NULL then just return else decrese pm_count.
- * If this was the last reference we call's pmap_relaese to release this pmap.
+ * If the pmap is NULL then just return else decrease pm_count.
+ * If this was the last reference we call's pmap_release to release this pmap.
  */
 
 void

Index: src/sys/compat/linux/arch/aarch64/linux_commons.c
diff -u src/sys/compat/linux/arch/aarch64/linux_commons.c:1.1 src/sys/compat/linux/arch/aarch64/linux_commons.c:1.2
--- src/sys/compat/linux/arch/aarch64/linux_commons.c:1.1	Thu Sep 23 06:56:27 2021
+++ src/sys/compat/linux/arch/aarch64/linux_commons.c	Tue Oct 12 08:36:28 2021
@@ -1,8 +1,8 @@
-/*	$NetBSD: linux_commons.c,v 1.1 2021/09/23 06:56:27 ryo Exp $	*/
+/*	$NetBSD: linux_commons.c,v 1.2 2021/10/12 08:36:28 andvar Exp $	*/
 
 /*
  * This file includes C files from the common
- * area to decrese the number of files to compile
+ * area to decrease the number of files to compile
  * in order to make building a kernel go faster.
  *
  * Option headers and headers which depend on
@@ -13,7 +13,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_commons.c,v 1.1 2021/09/23 06:56:27 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_commons.c,v 1.2 2021/10/12 08:36:28 andvar Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sysv.h"

Index: src/sys/compat/linux/arch/amd64/linux_commons.c
diff -u src/sys/compat/linux/arch/amd64/linux_commons.c:1.12 src/sys/compat/linux/arch/amd64/linux_commons.c:1.13
--- 

CVS commit: src/sys/net/lagg

2021-10-12 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Oct 12 08:26:47 UTC 2021

Modified Files:
src/sys/net/lagg: files.lagg if_lagg.c if_laggproto.h

Log Message:
lagg: update capabilities of ifnet and ethercom

Commonly capabilities of all child interface are configured
to a lagg interface.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/net/lagg/files.lagg
cvs rdiff -u -r1.11 -r1.12 src/sys/net/lagg/if_lagg.c
cvs rdiff -u -r1.6 -r1.7 src/sys/net/lagg/if_laggproto.h

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



CVS commit: src/sys/net/lagg

2021-10-12 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Oct 12 08:26:47 UTC 2021

Modified Files:
src/sys/net/lagg: files.lagg if_lagg.c if_laggproto.h

Log Message:
lagg: update capabilities of ifnet and ethercom

Commonly capabilities of all child interface are configured
to a lagg interface.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/net/lagg/files.lagg
cvs rdiff -u -r1.11 -r1.12 src/sys/net/lagg/if_lagg.c
cvs rdiff -u -r1.6 -r1.7 src/sys/net/lagg/if_laggproto.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/net/lagg/files.lagg
diff -u src/sys/net/lagg/files.lagg:1.1 src/sys/net/lagg/files.lagg:1.2
--- src/sys/net/lagg/files.lagg:1.1	Mon May 17 04:07:43 2021
+++ src/sys/net/lagg/files.lagg	Tue Oct 12 08:26:47 2021
@@ -1,7 +1,8 @@
-#	$NetBSD: files.lagg,v 1.1 2021/05/17 04:07:43 yamaguchi Exp $
+#	$NetBSD: files.lagg,v 1.2 2021/10/12 08:26:47 yamaguchi Exp $
 
 file	net/lagg/if_lagg.c		lagg & ether	needs-flag
 file	net/lagg/if_lagg_lacp.c		lagg & ether
 file	net/lagg/if_laggproto.c		lagg
 
 defflag opt_lagg.h			LAGG_DEBUG LACP_DEBUG
+defparam opt_lagg.h			LAGG_SETCAPS_RETRY

Index: src/sys/net/lagg/if_lagg.c
diff -u src/sys/net/lagg/if_lagg.c:1.11 src/sys/net/lagg/if_lagg.c:1.12
--- src/sys/net/lagg/if_lagg.c:1.11	Tue Oct  5 04:17:58 2021
+++ src/sys/net/lagg/if_lagg.c	Tue Oct 12 08:26:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lagg.c,v 1.11 2021/10/05 04:17:58 yamaguchi Exp $	*/
+/*	$NetBSD: if_lagg.c,v 1.12 2021/10/12 08:26:47 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006 Reyk Floeter 
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.11 2021/10/05 04:17:58 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.12 2021/10/12 08:26:47 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -194,6 +194,7 @@ static void	lagg_port_teardown(struct la
 static void	lagg_port_syncvlan(struct lagg_softc *, struct lagg_port *);
 static void	lagg_port_purgevlan(struct lagg_softc *, struct lagg_port *);
 static void	lagg_lladdr_update(struct lagg_softc *);
+static void	lagg_capabilities_update(struct lagg_softc *);
 
 static struct if_clone	 lagg_cloner =
 IF_CLONE_INITIALIZER("lagg", lagg_clone_create, lagg_clone_destroy);
@@ -215,6 +216,10 @@ static enum lagg_iftypes
 #define LAGG_DPRINTF(_sc, _fmt, _args...)	__nothing
 #endif
 
+#ifndef LAGG_SETCAPS_RETRY
+#define LAGG_SETCAPS_RETRY	(LAGG_MAX_PORTS * 2)
+#endif
+
 static size_t
 lagg_sizeof_softc(enum lagg_iftypes ift)
 {
@@ -1806,6 +1811,181 @@ lagg_port_purgevlan(struct lagg_softc *s
 }
 
 static int
+lagg_setifcaps(struct lagg_port *lp, uint64_t cap)
+{
+	struct ifcapreq ifcr;
+	int error;
+
+	if (lp->lp_ifp->if_capenable == cap)
+		return 0;
+
+	memset(, 0, sizeof(ifcr));
+	ifcr.ifcr_capenable = cap;
+
+	IFNET_LOCK(lp->lp_ifp);
+	error = LAGG_PORT_IOCTL(lp, SIOCSIFCAP, );
+	IFNET_UNLOCK(lp->lp_ifp);
+
+	return error;
+}
+
+static int
+lagg_setethcaps(struct lagg_port *lp, int cap)
+{
+	struct ethercom *ec;
+	struct eccapreq eccr;
+	int error;
+
+	KASSERT(lp->lp_iftype == IFT_ETHER);
+	ec = (struct ethercom *)lp->lp_ifp;
+
+	if (ec->ec_capenable == cap)
+		return 0;
+
+	memset(, 0, sizeof(eccr));
+	eccr.eccr_capenable = cap;
+
+	IFNET_LOCK(lp->lp_ifp);
+	error = LAGG_PORT_IOCTL(lp, SIOCSETHERCAP, );
+	IFNET_UNLOCK(lp->lp_ifp);
+
+	return error;
+}
+
+static void
+lagg_ifcap_update(struct lagg_softc *sc)
+{
+	struct ifnet *ifp;
+	struct lagg_port *lp;
+	uint64_t cap, ena, pena;
+	size_t i;
+
+	KASSERT(LAGG_LOCKED(sc));
+
+	/* Get common capabilities for the lagg ports */
+	ena = ~(uint64_t)0;
+	cap = ~(uint64_t)0;
+	LAGG_PORTS_FOREACH(sc, lp) {
+		ena &= lp->lp_ifp->if_capenable;
+		cap &= lp->lp_ifp->if_capabilities;
+	}
+
+	if (ena == ~(uint64_t)0)
+		ena = 0;
+	if (cap == ~(uint64_t)0)
+		cap = 0;
+
+	/*
+	 * Apply common enabled capabilities back to the lagg ports.
+	 * May require several iterations if they are dependent.
+	 */
+	for (i = 0; i < LAGG_SETCAPS_RETRY; i++) {
+		pena = ena;
+		LAGG_PORTS_FOREACH(sc, lp) {
+			lagg_setifcaps(lp, ena);
+			ena &= lp->lp_ifp->if_capenable;
+		}
+
+		if (pena == ena)
+			break;
+	}
+
+	if (pena != ena) {
+		lagg_log(sc, LOG_DEBUG, "couldn't set "
+		"capabilities 0x%08"PRIx64, pena);
+	}
+
+	ifp = >sc_if;
+
+	if (ifp->if_capabilities != cap ||
+	ifp->if_capenable != ena) {
+		ifp->if_capabilities = cap;
+		ifp->if_capenable = ena;
+
+		lagg_log(sc, LOG_DEBUG,"capabilities "
+		"0x%08"PRIx64" enabled 0x%08"PRIx64,
+		cap, ena);
+	}
+}
+
+static void
+lagg_ethercap_update(struct lagg_softc *sc)
+{
+	struct ethercom *ec;
+	struct lagg_port *lp;
+	int cap, ena, pena;
+	size_t i;
+
+	KASSERT(LAGG_LOCKED(sc));
+
+	if (sc->sc_if.if_type != IFT_ETHER)
+		return;
+
+	/* Get common enabled capabilities for the lagg ports */
+	ena = ~0;
+	cap = ~0;
+	LAGG_PORTS_FOREACH(sc, lp) {
+		if (lp->lp_iftype == 

CVS commit: src/sys/dev/ic

2021-10-12 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Oct 12 06:25:17 UTC 2021

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

Log Message:
Now Jason has made this build, avoid a 50+ year
sleep to implement HUPCL.


To generate a diff of this commit:
cvs rdiff -u -r1.366 -r1.367 src/sys/dev/ic/com.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

2021-10-12 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Oct 12 06:25:17 UTC 2021

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

Log Message:
Now Jason has made this build, avoid a 50+ year
sleep to implement HUPCL.


To generate a diff of this commit:
cvs rdiff -u -r1.366 -r1.367 src/sys/dev/ic/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/dev/ic/com.c
diff -u src/sys/dev/ic/com.c:1.366 src/sys/dev/ic/com.c:1.367
--- src/sys/dev/ic/com.c:1.366	Mon Oct 11 18:39:06 2021
+++ src/sys/dev/ic/com.c	Tue Oct 12 06:25:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.366 2021/10/11 18:39:06 jmcneill Exp $ */
+/* $NetBSD: com.c,v 1.367 2021/10/12 06:25:17 kre Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.366 2021/10/11 18:39:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.367 2021/10/12 06:25:17 kre Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -986,9 +986,12 @@ comopen(dev_t dev, int flag, int mode, s
 		if (timerisset(>sc_hup_pending)) {
 			getmicrotime();
 			while (timercmp(, >sc_hup_pending, <)) {
+int ms;
+
+
 timersub(>sc_hup_pending, , );
-int ms = now.tv_sec * 1000 +
-uimin(now.tv_usec / 1000, 1);
+ms = diff.tv_sec * 1000 +
+uimax(diff.tv_usec / 1000, 1);
 kpause("comopen", false, mstohz(ms),
 >sc_lock);
 			}



CVS commit: src/share/man/man4

2021-10-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Oct 12 07:43:41 UTC 2021

Modified Files:
src/share/man/man4: hvn.4

Log Message:
Fix date.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/hvn.4

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



CVS commit: src/share/man/man4

2021-10-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Oct 12 07:43:41 UTC 2021

Modified Files:
src/share/man/man4: hvn.4

Log Message:
Fix date.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/hvn.4

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

Modified files:

Index: src/share/man/man4/hvn.4
diff -u src/share/man/man4/hvn.4:1.1 src/share/man/man4/hvn.4:1.2
--- src/share/man/man4/hvn.4:1.1	Tue Oct 12 04:55:19 2021
+++ src/share/man/man4/hvn.4	Tue Oct 12 07:43:41 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: hvn.4,v 1.1 2021/10/12 04:55:19 msaitoh Exp $
+.\"	$NetBSD: hvn.4,v 1.2 2021/10/12 07:43:41 wiz Exp $
 .\"
 .\"	$OpenBSD: hvn.4,v 1.5 2016/10/07 14:42:27 jmc Exp $
 .\"
@@ -16,7 +16,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd October 12 2021
+.Dd October 12, 2021
 .Dt HVN 4
 .Os
 .Sh NAME



CVS commit: src/share/man/man4

2021-10-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Oct 12 07:43:49 UTC 2021

Modified Files:
src/share/man/man4: wsmouse.4

Log Message:
Fix xrefs. Remove superfluous Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/share/man/man4/wsmouse.4

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



CVS commit: src/share/man/man4

2021-10-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Oct 12 07:43:49 UTC 2021

Modified Files:
src/share/man/man4: wsmouse.4

Log Message:
Fix xrefs. Remove superfluous Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/share/man/man4/wsmouse.4

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

Modified files:

Index: src/share/man/man4/wsmouse.4
diff -u src/share/man/man4/wsmouse.4:1.23 src/share/man/man4/wsmouse.4:1.24
--- src/share/man/man4/wsmouse.4:1.23	Mon Oct 11 18:06:06 2021
+++ src/share/man/man4/wsmouse.4	Tue Oct 12 07:43:49 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: wsmouse.4,v 1.23 2021/10/11 18:06:06 nia Exp $
+.\" $NetBSD: wsmouse.4,v 1.24 2021/10/12 07:43:49 wiz Exp $
 .\"
 .\" Copyright (c) 1999
 .\" 	Matthias Drochner.  All rights reserved.
@@ -137,7 +137,6 @@ decreased by the value given in this var
 .Va wr_delay_minimum
 specifies the minimum delay, in milliseconds, between two consecutive
 events.
-.Pp
 .It Dv WSMOUSEIO_SETREPEAT Pq Li "struct wsmouse_repeat"
 Set the automatic button repeating configuration.
 See
@@ -167,8 +166,9 @@ if (ioctl(fd, WSMOUSEIO_SETVERSION, 
 .El
 .Sh SEE ALSO
 .Xr btms 4 ,
-.Xr lms 4 ,
-.Xr mms 4 ,
+.Xr dreamcast/mms 4 ,
+.Xr i386/lms 4 ,
+.Xr i386/mms 4 ,
 .Xr pms 4 ,
 .Xr uep 4 ,
 .Xr ums 4 ,



CVS commit: src/sys/net/lagg

2021-10-12 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Oct 12 08:30:58 UTC 2021

Modified Files:
src/sys/net/lagg: if_lagg.c if_laggproto.h

Log Message:
Set a port interface of lagg(4) in promiscuous mode
when the lagg(4) is in promiscuous mode.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/net/lagg/if_lagg.c
cvs rdiff -u -r1.7 -r1.8 src/sys/net/lagg/if_laggproto.h

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



CVS commit: src/sys/net/lagg

2021-10-12 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Tue Oct 12 08:30:58 UTC 2021

Modified Files:
src/sys/net/lagg: if_lagg.c if_laggproto.h

Log Message:
Set a port interface of lagg(4) in promiscuous mode
when the lagg(4) is in promiscuous mode.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/net/lagg/if_lagg.c
cvs rdiff -u -r1.7 -r1.8 src/sys/net/lagg/if_laggproto.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/net/lagg/if_lagg.c
diff -u src/sys/net/lagg/if_lagg.c:1.12 src/sys/net/lagg/if_lagg.c:1.13
--- src/sys/net/lagg/if_lagg.c:1.12	Tue Oct 12 08:26:47 2021
+++ src/sys/net/lagg/if_lagg.c	Tue Oct 12 08:30:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lagg.c,v 1.12 2021/10/12 08:26:47 yamaguchi Exp $	*/
+/*	$NetBSD: if_lagg.c,v 1.13 2021/10/12 08:30:58 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006 Reyk Floeter 
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.12 2021/10/12 08:26:47 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.13 2021/10/12 08:30:58 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -180,6 +180,7 @@ static int	lagg_port_ioctl(struct ifnet 
 static int	lagg_port_output(struct ifnet *, struct mbuf *,
 		const struct sockaddr *, const struct rtentry *);
 static int	lagg_config_promisc(struct lagg_softc *, struct lagg_port *);
+static void	lagg_unconfig_promisc(struct lagg_softc *, struct lagg_port *);
 static struct lagg_variant *
 		lagg_variant_getref(struct lagg_softc *, struct psref *);
 static void	lagg_variant_putref(struct lagg_variant *, struct psref *);
@@ -2287,6 +2288,7 @@ lagg_port_setup(struct lagg_softc *sc,
 			goto remove_port;
 	}
 
+	lagg_config_promisc(sc, lp);
 	lagg_proto_startport(sc, lp);
 	lagg_capabilities_update(sc);
 
@@ -2390,6 +2392,7 @@ lagg_port_teardown(struct lagg_softc *sc
 	}
 
 	if (is_ifdetach == false) {
+		lagg_unconfig_promisc(sc, lp);
 		lagg_setifcaps(lp, lp->lp_ifcapenable);
 		if (lp->lp_iftype == IFT_ETHER)
 			lagg_setethcaps(lp, lp->lp_eccapenable);
@@ -2543,17 +2546,38 @@ static int
 lagg_config_promisc(struct lagg_softc *sc, struct lagg_port *lp)
 {
 	struct ifnet *ifp;
+	uint64_t chg_flags;
 	int error;
-	int status;
 
+	error = 0;
 	ifp = >sc_if;
-	status = ISSET(ifp->if_flags, IFF_PROMISC) ? 1 : 0;
+	chg_flags = ifp->if_flags ^ lp->lp_ifflags;
 
-	error = ifpromisc(lp->lp_ifp, status);
+	if (ISSET(chg_flags, IFF_PROMISC)) {
+		error = ifpromisc(lp->lp_ifp,
+		ISSET(ifp->if_flags, IFF_PROMISC) ? 1 : 0);
+		if (error == 0) {
+			lp->lp_ifflags ^= IFF_PROMISC;
+		}
+	}
 
 	return error;
 }
 
+static void
+lagg_unconfig_promisc(struct lagg_softc *sc, struct lagg_port *lp)
+{
+	int error;
+
+	if (ISSET(lp->lp_ifflags, IFF_PROMISC)) {
+		error = ifpromisc(lp->lp_ifp, 0);
+		if (error != 0) {
+			lagg_log(sc, LOG_DEBUG,
+			"couldn't unset promiscuous mode");
+		}
+	}
+}
+
 static int
 lagg_port_ioctl(struct ifnet *ifp, u_long cmd, void *data)
 {

Index: src/sys/net/lagg/if_laggproto.h
diff -u src/sys/net/lagg/if_laggproto.h:1.7 src/sys/net/lagg/if_laggproto.h:1.8
--- src/sys/net/lagg/if_laggproto.h:1.7	Tue Oct 12 08:26:47 2021
+++ src/sys/net/lagg/if_laggproto.h	Tue Oct 12 08:30:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_laggproto.h,v 1.7 2021/10/12 08:26:47 yamaguchi Exp $	*/
+/*	$NetBSD: if_laggproto.h,v 1.8 2021/10/12 08:30:58 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2021 Internet Initiative Japan Inc.
@@ -76,6 +76,7 @@ struct lagg_port {
 
 	u_char			 lp_iftype;
 	uint8_t			 lp_lladdr[ETHER_ADDR_LEN];
+	unsigned short		 lp_ifflags;
 	int			 lp_eccapenable;
 	uint64_t		 lp_ifcapenable;
 	uint64_t		 lp_mtu;



CVS commit: src/sys/dev/pci

2021-10-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 12 14:12:06 UTC 2021

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Intel 400 Series PCH-V devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1437 -r1.1438 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1437 src/sys/dev/pci/pcidevs:1.1438
--- src/sys/dev/pci/pcidevs:1.1437	Mon Oct 11 13:26:52 2021
+++ src/sys/dev/pci/pcidevs	Tue Oct 12 14:12:06 2021
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1437 2021/10/11 13:26:52 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1438 2021/10/12 14:12:06 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -6625,6 +6625,60 @@ product INTEL 3HS_SSRAM		0xa36f	300 Seri
 product INTEL 3HS_THERM		0xa379	300 Series Thermal
 product INTEL 3HS_SPI_2		0xa37b	300 Series SPI
 product INTEL 3HS_ISH		0xa37c	300 Series ISH
+product INTEL 4HS_V_AHCI	0xa382	400 Series PCH-V SATA (AHCI)
+product INTEL 4HS_V_RAID	0xa384	400 Series PCH-V SATA (RAID)
+product INTEL 4HS_V_P_RAID	0xa386	400 Series PCH-V SATA (RAID) premium
+product INTEL 4HS_V_OPTANE	0xa38e	400 Series PCH-V SATA (Optane)
+product INTEL 4HS_V_PCIE_1	0xa390	400 Series PCH-V PCIe Root Port 1
+product INTEL 4HS_V_PCIE_2	0xa391	400 Series PCH-V PCIe Root Port 2
+product INTEL 4HS_V_PCIE_3	0xa392	400 Series PCH-V PCIe Root Port 3
+product INTEL 4HS_V_PCIE_4	0xa393	400 Series PCH-V PCIe Root Port 4
+product INTEL 4HS_V_PCIE_5	0xa394	400 Series PCH-V PCIe Root Port 5
+product INTEL 4HS_V_PCIE_6	0xa395	400 Series PCH-V PCIe Root Port 6
+product INTEL 4HS_V_PCIE_7	0xa396	400 Series PCH-V PCIe Root Port 7
+product INTEL 4HS_V_PCIE_8	0xa397	400 Series PCH-V PCIe Root Port 8
+product INTEL 4HS_V_PCIE_9	0xa398	400 Series PCH-V PCIe Root Port 9
+product INTEL 4HS_V_PCIE_10	0xa399	400 Series PCH-V PCIe Root Port 10
+product INTEL 4HS_V_PCIE_11	0xa39a	400 Series PCH-V PCIe Root Port 11
+product INTEL 4HS_V_PCIE_12	0xa39b	400 Series PCH-V PCIe Root Port 12
+product INTEL 4HS_V_PCIE_13	0xa39c	400 Series PCH-V PCIe Root Port 13
+product INTEL 4HS_V_PCIE_14	0xa39d	400 Series PCH-V PCIe Root Port 14
+product INTEL 4HS_V_PCIE_15	0xa39e	400 Series PCH-V PCIe Root Port 15
+product INTEL 4HS_V_PCIE_16	0xa39f	400 Series PCH-V PCIe Root Port 16
+product INTEL 4HS_V_P2SB	0xa3a0	400 Series PCH-V P2SB
+product INTEL 4HS_V_PMC		0xa3a1	400 Series PCH-V PMC
+product INTEL 4HS_V_SMB		0xa3a3	400 Series PCH-V SMBus
+product INTEL 4HS_V_SPI		0xa3a4	400 Series PCH-V SPI (FLASH)
+product INTEL 4HS_V_TRACE	0xa3a6	400 Series PCH-V Trace Hub
+product INTEL 4HS_V_UART_0	0xa3a7	400 Series PCH-V UART 0
+product INTEL 4HS_V_UART_1	0xa3a8	400 Series PCH-V UART 1
+product INTEL 4HS_V_SPI_0	0xa3a9	400 Series PCH-V SPI 0
+product INTEL 4HS_V_SPI_1	0xa3aa	400 Series PCH-V SPI 1
+product INTEL 4HS_V_XHCI	0xa3af	400 Series PCH-V USB 3.2 Gen 1x1 xHCI
+product INTEL 4HS_V_XDCI	0xa3b0	400 Series PCH-V USB xDCI
+product INTEL 4HS_V_THERM	0xa3b1	400 Series PCH-V Thermal
+product INTEL 4HS_V_ISH		0xa3b5	400 Series PCH-V Integrated Sensor Hub
+product INTEL 4HS_V_HECI_1	0xa3ba	400 Series PCH-V HECI 1
+product INTEL 4HS_V_HECI_2	0xa3bb	400 Series PCH-V HECI 2
+product INTEL 4HS_V_IDER	0xa3bc	400 Series PCH-V IDE-R
+product INTEL 4HS_V_KT		0xa3bd	400 Series PCH-V KT
+product INTEL 4HS_V_HECI_3	0xa3be	400 Series PCH-V HECI 3
+product INTEL 4HS_V_B460_LPC	0xa3c8	B460 PCH-V LPC or eSPI
+product INTEL 4HS_V_H410_LPC	0xa3da	H410 PCH-V LPC or eSPI
+product INTEL 4HS_V_I2C_0	0xa3e0	400 Series PCH-V I2C 0
+product INTEL 4HS_V_I2C_1	0xa3e1	400 Series PCH-V I2C 1
+product INTEL 4HS_V_I2C_2	0xa3e2	400 Series PCH-V I2C 2
+product INTEL 4HS_V_I2C_3	0xa3e3	400 Series PCH-V I2C 3
+product INTEL 4HS_V_UART_2	0xa3e6	400 Series PCH-V UART 2
+product INTEL 4HS_V_PCIE_17	0xa3e7	400 Series PCH-V PCIe Root Port 17
+product INTEL 4HS_V_PCIE_18	0xa3e8	400 Series PCH-V PCIe Root Port 18
+product INTEL 4HS_V_PCIE_19	0xa3e9	400 Series PCH-V PCIe Root Port 19
+product INTEL 4HS_V_PCIE_20	0xa3ea	400 Series PCH-V PCIe Root Port 20
+product INTEL 4HS_V_PCIE_21	0xa3eb	400 Series PCH-V PCIe Root Port 21
+product INTEL 4HS_V_PCIE_22	0xa3ec	400 Series PCH-V PCIe Root Port 22
+product INTEL 4HS_V_PCIE_23	0xa3ed	400 Series PCH-V PCIe Root Port 23
+product INTEL 4HS_V_PCIE_24	0xa3ee	400 Series PCH-V PCIe Root Port 24
+product INTEL 4HS_V_CAVS	0xa3f0	400 Series PCH-V cAVS
 product INTEL 21152		0xb152	S21152BB PCI-PCI Bridge
 product INTEL 21154		0xb154	S21152BA,S21154AE/BE PCI-PCI Bridge
 product INTEL 21555		0xb555	21555 Non-Transparent PCI-PCI Bridge



CVS commit: src

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 13:24:00 UTC 2021

Modified Files:
src/lib/libcrypt: crypt-argon2.c crypt.h pw_gensalt.c util.c
src/tests/lib/libcrypt: t_crypt.c

Log Message:
crypt(3): Make Argon2 implementation match the reference impl by
making sure input salts are decoded as base64.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libcrypt/crypt-argon2.c \
src/lib/libcrypt/crypt.h
cvs rdiff -u -r1.9 -r1.10 src/lib/libcrypt/pw_gensalt.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libcrypt/util.c
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libcrypt/t_crypt.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.5 src/lib/libcrypt/crypt-argon2.c:1.6
--- src/lib/libcrypt/crypt-argon2.c:1.5	Tue Oct 12 12:11:04 2021
+++ src/lib/libcrypt/crypt-argon2.c	Tue Oct 12 13:24:00 2021
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include  /* for b64_pton... */
 
 #include 
 #include "crypt.h"
@@ -31,32 +32,6 @@
 #define ARGON2_ARGON2D_STR	"argon2d"
 #define ARGON2_ARGON2ID_STR	"argon2id"
 
-/* getnum also declared in pw_getsalt.c */
-/* maybe move to util.h?? */
-static int
-getnum(const char *str, size_t *num)
-{
-char *ep;
-unsigned long rv;
- 
-if (str == NULL) {
-*num = 0;
-return 0;
-}
-
-rv = strtoul(str, , 0);
-
-if (str == ep || *ep) {
-errno = EINVAL;
-return -1;
-}
-
-if (errno == ERANGE && rv == ULONG_MAX)
-return -1;
-*num = (size_t)rv;
-return 0;  
-}
-
 /* process params to argon2 */
 /* we don't force param order as input, */
 /* but we do provide the expected order to argon2 api */
@@ -152,7 +127,7 @@ static int decode_option(argon2_context 
 
 	a = strsep(, "$");
 
-	snprintf((char *)ctx->salt, ctx->saltlen, "%s", a);
+	b64_pton(a, ctx->salt, ctx->saltlen);
 
 	a = strsep(, "$");
 
@@ -196,10 +171,7 @@ __crypt_argon2(const char *pw, const cha
 	static char rbuf[512];
 
 	/* clear buffers */
-	memset(encodebuf, 0, sizeof(encodebuf));
-	memset(saltbuf, 0, sizeof(saltbuf));
-	memset(pwdbuf, 0, sizeof(pwdbuf));
-	memset(rbuf, 0, sizeof(rbuf));
+	explicit_memset(rbuf, 0, sizeof(rbuf));
 
 	/* we use static buffers to avoid allocation */
 	/* and easier cleanup */
@@ -242,18 +214,10 @@ __crypt_argon2(const char *pw, const cha
 	/* skip over '$' */
 	blkp++;
 
-	/* we don't use encoded here because it base64 encodes salt */
-	/* same encoding format as argon2 api, but with original salt */
-	snprintf(rbuf, sizeof(rbuf)-1, "$%s$v=%d$m=%d,t=%d,p=%d$%s$%s",
-			argon2_type2string(atype,0),
-			ctx.version,
-			ctx.m_cost,
-			ctx.t_cost,
-			ctx.threads,
-			ctx.salt,
-			blkp);
+	memcpy(rbuf, encodebuf, sizeof(encodebuf));
 
 	/* clear buffers */
+	explicit_memset(ebuf, 0, sizeof(ebuf));
 	explicit_memset(encodebuf, 0, sizeof(encodebuf));
 	explicit_memset(saltbuf, 0, sizeof(saltbuf));
 	explicit_memset(pwdbuf, 0, sizeof(pwdbuf));
Index: src/lib/libcrypt/crypt.h
diff -u src/lib/libcrypt/crypt.h:1.5 src/lib/libcrypt/crypt.h:1.6
--- src/lib/libcrypt/crypt.h:1.5	Mon Oct 21 02:36:48 2019
+++ src/lib/libcrypt/crypt.h	Tue Oct 12 13:24:00 2021
@@ -1,6 +1,9 @@
 /*
- * $NetBSD: crypt.h,v 1.5 2019/10/21 02:36:48 jhigh Exp $
+ * $NetBSD: crypt.h,v 1.6 2021/10/12 13:24:00 nia Exp $
  */
+
+#define crypt_private __attribute__((__visibility__("hidden")))
+
 char	*__md5crypt(const char *pw, const char *salt);	/* XXX */
 char *__bcrypt(const char *, const char *);	/* XXX */
 char *__crypt_sha1(const char *pw, const char *salt);
@@ -22,5 +25,7 @@ int __gensalt_new(char *salt, size_t sal
 int __gensalt_md5(char *salt, size_t saltsiz, const char *option);
 int __gensalt_sha1(char *salt, size_t saltsiz, const char *option);
 
+crypt_private int getnum(const char *, size_t *);
+
 #define SHA1_MAGIC "$sha1$"
 #define SHA1_SIZE 20

Index: src/lib/libcrypt/pw_gensalt.c
diff -u src/lib/libcrypt/pw_gensalt.c:1.9 src/lib/libcrypt/pw_gensalt.c:1.10
--- src/lib/libcrypt/pw_gensalt.c:1.9	Thu May 14 08:34:19 2020
+++ src/lib/libcrypt/pw_gensalt.c	Tue Oct 12 13:24:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pw_gensalt.c,v 1.9 2020/05/14 08:34:19 msaitoh Exp $	*/
+/*	$NetBSD: pw_gensalt.c,v 1.10 2021/10/12 13:24:00 nia Exp $	*/
 
 /*
  * Copyright 1997 Niels Provos 
@@ -34,7 +34,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: pw_gensalt.c,v 1.9 2020/05/14 08:34:19 msaitoh Exp $");
+__RCSID("$NetBSD: pw_gensalt.c,v 1.10 2021/10/12 13:24:00 nia Exp $");
 #endif /* not lint */
 
 #include 
@@ -81,30 +81,6 @@ static const struct pw_salt {
 	{ NULL, NULL }
 };
 
-static int
-getnum(const char *str, size_t *num)
-{
-	char *ep;
-	unsigned long rv;
-
-	if (str == NULL) {
-		*num = 0;
-		return 0;
-	}
-
-	rv = strtoul(str, , 0);
-
-	if (str == ep || *ep) {
-		errno = EINVAL;

CVS commit: src

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 13:24:00 UTC 2021

Modified Files:
src/lib/libcrypt: crypt-argon2.c crypt.h pw_gensalt.c util.c
src/tests/lib/libcrypt: t_crypt.c

Log Message:
crypt(3): Make Argon2 implementation match the reference impl by
making sure input salts are decoded as base64.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libcrypt/crypt-argon2.c \
src/lib/libcrypt/crypt.h
cvs rdiff -u -r1.9 -r1.10 src/lib/libcrypt/pw_gensalt.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libcrypt/util.c
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libcrypt/t_crypt.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

2021-10-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 12 14:13:18 UTC 2021

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1423 -r1.1424 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1422 -r1.1423 src/sys/dev/pci/pcidevs_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/pci

2021-10-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 12 14:15:34 UTC 2021

Modified Files:
src/sys/dev/pci: ichsmb.c pucdata.c

Log Message:
Add Intel 400 Series PCH-V devices.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/pci/ichsmb.c
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/pci/pucdata.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

2021-10-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 12 14:15:34 UTC 2021

Modified Files:
src/sys/dev/pci: ichsmb.c pucdata.c

Log Message:
Add Intel 400 Series PCH-V devices.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/pci/ichsmb.c
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/pci/pucdata.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/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.73 src/sys/dev/pci/ichsmb.c:1.74
--- src/sys/dev/pci/ichsmb.c:1.73	Mon Oct 11 15:47:10 2021
+++ src/sys/dev/pci/ichsmb.c	Tue Oct 12 14:15:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.73 2021/10/11 15:47:10 msaitoh Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.74 2021/10/12 14:15:34 msaitoh Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.44 2020/10/07 11:23:05 jsg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.73 2021/10/11 15:47:10 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.74 2021/10/12 14:15:34 msaitoh Exp $");
 
 #include 
 #include 
@@ -128,6 +128,7 @@ ichsmb_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_INTEL_3HS_SMB:
 		case PCI_PRODUCT_INTEL_3HS_U_SMB:
 		case PCI_PRODUCT_INTEL_4HS_H_SMB:
+		case PCI_PRODUCT_INTEL_4HS_V_SMB:
 		case PCI_PRODUCT_INTEL_CORE4G_M_SMB:
 		case PCI_PRODUCT_INTEL_CORE5G_M_SMB:
 		case PCI_PRODUCT_INTEL_CMTLK_SMB:

Index: src/sys/dev/pci/pucdata.c
diff -u src/sys/dev/pci/pucdata.c:1.111 src/sys/dev/pci/pucdata.c:1.112
--- src/sys/dev/pci/pucdata.c:1.111	Mon Oct 11 15:43:19 2021
+++ src/sys/dev/pci/pucdata.c	Tue Oct 12 14:15:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.111 2021/10/11 15:43:19 msaitoh Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.112 2021/10/12 14:15:34 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 Christopher G. Demetriou.  All rights reserved.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.111 2021/10/11 15:43:19 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.112 2021/10/12 14:15:34 msaitoh Exp $");
 
 #include 
 #include 
@@ -2046,6 +2046,15 @@ const struct puc_device_description puc_
 	},
 	},
 
+	/* Intel 400 Series (V) KT */
+	{   "Intel 400 Series (V) KT",
+	{	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_4HS_V_KT, 0, 0 },
+	{	0x,	0x,	0,	0	},
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ },
+	},
+	},
+
 	/* Intel 495 Series KT */
 	{   "Intel 495 Series KT",
 	{	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_495_YU_KT, 0, 0 },



CVS commit: src/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 15:27:41 UTC 2021

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

Log Message:
crypt(3): clean up some leftover debug goo


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 15:27:41 UTC 2021

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

Log Message:
crypt(3): clean up some leftover debug goo


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.7 src/lib/libcrypt/crypt-argon2.c:1.8
--- src/lib/libcrypt/crypt-argon2.c:1.7	Tue Oct 12 15:25:39 2021
+++ src/lib/libcrypt/crypt-argon2.c	Tue Oct 12 15:27:41 2021
@@ -276,7 +276,6 @@ __crypt_argon2(const char *pw, const cha
 		return 0;
 	}
 
-	puts(encodebuf);
 	memcpy(rbuf, encodebuf, sizeof(encodebuf));
 
 	/* clear buffers */



CVS commit: src/tests/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 13:24:21 UTC 2021

Modified Files:
src/tests/lib/libcrypt: t_crypt.c

Log Message:
remove comment, it's fixed


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libcrypt/t_crypt.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/lib/libcrypt/t_crypt.c
diff -u src/tests/lib/libcrypt/t_crypt.c:1.5 src/tests/lib/libcrypt/t_crypt.c:1.6
--- src/tests/lib/libcrypt/t_crypt.c:1.5	Tue Oct 12 13:24:00 2021
+++ src/tests/lib/libcrypt/t_crypt.c	Tue Oct 12 13:24:21 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: t_crypt.c,v 1.5 2021/10/12 13:24:00 nia Exp $ */
+/* $NetBSD: t_crypt.c,v 1.6 2021/10/12 13:24:21 nia Exp $ */
 
 /*
  * This version is derived from the original implementation of FreeSec
@@ -61,7 +61,7 @@
  *	by now.	 The code requires a 32-bit integer type, though.
  */
 #include 
-__RCSID("$NetBSD: t_crypt.c,v 1.5 2021/10/12 13:24:00 nia Exp $");
+__RCSID("$NetBSD: t_crypt.c,v 1.6 2021/10/12 13:24:21 nia Exp $");
 
 #include 
 #include 
@@ -111,10 +111,6 @@ static const struct {
 /* 31 */	{ "_/!..", "" }, /* invalid character in count */
 /* 32 */	{ "_/..!", "" }, /* invalid character in salt */
 #if defined(HAVE_ARGON2)
-/*
- * The below are reference values from the official Argon2 test suite. 
- * NOTE: Upstream Argon2 uses base64-encoded salts, whereas NetBSD doesn't...
- */
 /* Argon2i version number 16 */
 /* 33 */	{ "$argon2i$v=16$m=256,t=2,p=1$c29tZXNhbHQ$/U3YPXYsSb3q9XxHvc0MLxur+GP960kN9j7emXX8zwY", "password" },
 /* 34 */	{ "$argon2i$v=16$m=65536,t=1,p=1$c29tZXNhbHQ$gWMFUrjzsfSM2xmSxMZ4ZD1JCytetP9sSzQ4tWIXJLI", "password" },



CVS commit: src/tests/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 13:24:21 UTC 2021

Modified Files:
src/tests/lib/libcrypt: t_crypt.c

Log Message:
remove comment, it's fixed


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libcrypt/t_crypt.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

2021-10-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 12 14:12:06 UTC 2021

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Intel 400 Series PCH-V devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1437 -r1.1438 src/sys/dev/pci/pcidevs

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



CVS commit: src/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 15:25:39 UTC 2021

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

Log Message:
crypt(3): match the Argon2 reference implementation's Base64 exactly

There are too many minor variations regarding padding and exact alphabet
to safely use the implementation in libc or an existing implementation
in libcrypt.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libcrypt/crypt-argon2.c \
src/lib/libcrypt/crypt.h
cvs rdiff -u -r1.10 -r1.11 src/lib/libcrypt/pw_gensalt.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libcrypt/util.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

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 15:25:39 UTC 2021

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

Log Message:
crypt(3): match the Argon2 reference implementation's Base64 exactly

There are too many minor variations regarding padding and exact alphabet
to safely use the implementation in libc or an existing implementation
in libcrypt.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libcrypt/crypt-argon2.c \
src/lib/libcrypt/crypt.h
cvs rdiff -u -r1.10 -r1.11 src/lib/libcrypt/pw_gensalt.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libcrypt/util.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.6 src/lib/libcrypt/crypt-argon2.c:1.7
--- src/lib/libcrypt/crypt-argon2.c:1.6	Tue Oct 12 13:24:00 2021
+++ src/lib/libcrypt/crypt-argon2.c	Tue Oct 12 15:25:39 2021
@@ -7,7 +7,6 @@
 #include 
 #include 
 #include 
-#include  /* for b64_pton... */
 
 #include 
 #include "crypt.h"
@@ -32,17 +31,84 @@
 #define ARGON2_ARGON2D_STR	"argon2d"
 #define ARGON2_ARGON2ID_STR	"argon2id"
 
+
+/*
+ * Some macros for constant-time comparisons. These work over values in
+ * the 0..255 range. Returned value is 0x00 on "false", 0xFF on "true".
+ */
+#define EQ(x, y) 0U - ((unsigned)(x) ^ (unsigned)(y))) >> 8) & 0xFF) ^ 0xFF)
+#define GT(x, y) unsigned)(y) - (unsigned)(x)) >> 8) & 0xFF)
+#define GE(x, y) (GT(y, x) ^ 0xFF)
+#define LT(x, y) GT(y, x)
+#define LE(x, y) GE(y, x)
+
+static unsigned
+b64_char_to_byte(int c)
+{
+unsigned x;
+
+x = (GE(c, 'A') & LE(c, 'Z') & (c - 'A')) |
+(GE(c, 'a') & LE(c, 'z') & (c - ('a' - 26))) |
+(GE(c, '0') & LE(c, '9') & (c - ('0' - 52))) | (EQ(c, '+') & 62) |
+(EQ(c, '/') & 63);
+return x | (EQ(x, 0) & (EQ(c, 'A') ^ 0xFF));
+}
+
+static const char *
+from_base64(void *dst, size_t *dst_len, const char *src)
+{
+	size_t len;
+	unsigned char *buf;
+	unsigned acc, acc_len;
+
+	buf = (unsigned char *)dst;
+	len = 0;
+	acc = 0;
+	acc_len = 0;
+	for (;;) {
+		unsigned d;
+
+		d = b64_char_to_byte(*src);
+		if (d == 0xFF) {
+			break;
+		}
+		src++;
+		acc = (acc << 6) + d;
+		acc_len += 6;
+		if (acc_len >= 8) {
+			acc_len -= 8;
+			if ((len++) >= *dst_len) {
+return NULL;
+			}
+			*buf++ = (acc >> acc_len) & 0xFF;
+		}
+	}
+
+	/*
+	 * If the input length is equal to 1 modulo 4 (which is
+	 * invalid), then there will remain 6 unprocessed bits;
+	 * otherwise, only 0, 2 or 4 bits are buffered. The buffered
+	 * bits must also all be zero.
+	 */
+	if (acc_len > 4 || (acc & (((unsigned)1 << acc_len) - 1)) != 0) {
+		return NULL;
+	}
+	*dst_len = len;
+	return src;
+}
+
 /* process params to argon2 */
 /* we don't force param order as input, */
 /* but we do provide the expected order to argon2 api */
-static int decode_option(argon2_context * ctx, argon2_type * atype, const char * option) 
+static int
+decode_option(argon2_context *ctx, argon2_type *atype, const char *option) 
 {
-	size_t tmp=0;
-char * in = 0,*inp;
-char * a=0;
-char * p=0;
+	size_t tmp = 0;
+char *in = 0, *inp;
+char *a = 0;
+char *p = 0;
 	size_t sl;
-	interror=0;
+	int error = 0;
 
 in = (char *)strdup(option);
 	inp = in;
@@ -127,7 +193,12 @@ static int decode_option(argon2_context 
 
 	a = strsep(, "$");
 
-	b64_pton(a, ctx->salt, ctx->saltlen);
+	sl = ctx->saltlen;
+
+	if (from_base64(ctx->salt, , a) == NULL)
+		return -1;
+
+	ctx->saltlen = sl;
 
 	a = strsep(, "$");
 
@@ -151,11 +222,9 @@ __crypt_argon2(const char *pw, const cha
 {
 	/* we use the libargon2 api to generate */
 	/* return code */
-	int rc=0;
+	int rc = 0;
 	/* output buffer */
 	char ebuf[32];
-	/* ptr into argon2 encoded buffer */
-	char * blkp=0;
 	/* argon2 variable, default to id */
 	argon2_type atype = Argon2_id;
 	/* default to current argon2 version */
@@ -184,7 +253,7 @@ __crypt_argon2(const char *pw, const cha
 	ctx.salt = (uint8_t *)saltbuf;
 	ctx.saltlen = sizeof(saltbuf);
 
-	ctx.pwd= (uint8_t *)pwdbuf;
+	ctx.pwd = (uint8_t *)pwdbuf;
 	ctx.pwdlen = sizeof(pwdbuf);
 
 	/* decode salt string to argon2 params */
@@ -197,8 +266,9 @@ __crypt_argon2(const char *pw, const cha
 	}
 
 	rc = argon2_hash(ctx.t_cost, ctx.m_cost,
-		ctx.threads, pw, strlen(pw), ctx.salt, strlen((char*)ctx.salt),
-		ebuf, sizeof(ebuf), encodebuf, sizeof(encodebuf), atype, ctx.version);
+	ctx.threads, pw, strlen(pw), ctx.salt, ctx.saltlen,
+	ebuf, sizeof(ebuf), encodebuf, sizeof(encodebuf),
+	atype, ctx.version);
 
 	if (rc != ARGON2_OK) {
 		fprintf(stderr, "argon2: failed: %s\n",
@@ -206,14 +276,7 @@ __crypt_argon2(const char *pw, const cha
 		return 0;
 	}
 
-	/* get encoded passwd */
-	if ((blkp = strrchr(encodebuf, '$')) == NULL) {
-		return 0;
-	}
-
-	/* skip over '$' */
-	blkp++;
-
+	puts(encodebuf);
 	

CVS commit: src

2021-10-12 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Oct 12 15:25:27 UTC 2021

Modified Files:
src/lib/libcrypt: crypt.3
src/share/man/man8: compat_linux.8

Log Message:
fix typos in man pages.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libcrypt/crypt.3
cvs rdiff -u -r1.44 -r1.45 src/share/man/man8/compat_linux.8

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.3
diff -u src/lib/libcrypt/crypt.3:1.29 src/lib/libcrypt/crypt.3:1.30
--- src/lib/libcrypt/crypt.3:1.29	Mon Oct 21 05:16:51 2019
+++ src/lib/libcrypt/crypt.3	Tue Oct 12 15:25:27 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: crypt.3,v 1.29 2019/10/21 05:16:51 wiz Exp $
+.\"	$NetBSD: crypt.3,v 1.30 2021/10/12 15:25:27 andvar Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -250,7 +250,7 @@ using argon2i on the first pass, and arg
 passes.
 We parameterize on three variables.
 First, m_cost (m), specifies the memory usage in KB.
-Second, t_cost (t), specfies the number of iterations.
+Second, t_cost (t), specifies the number of iterations.
 Third, parallelism (p) specifies the number of threads.
 A valid Argon2 encoded password looks similar to
 .Bd -literal

Index: src/share/man/man8/compat_linux.8
diff -u src/share/man/man8/compat_linux.8:1.44 src/share/man/man8/compat_linux.8:1.45
--- src/share/man/man8/compat_linux.8:1.44	Sun Sep 26 11:22:29 2021
+++ src/share/man/man8/compat_linux.8	Tue Oct 12 15:25:27 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: compat_linux.8,v 1.44 2021/09/26 11:22:29 nia Exp $
+.\"	$NetBSD: compat_linux.8,v 1.45 2021/10/12 15:25:27 andvar Exp $
 .\"
 .\" Copyright (c) 1995 Frank van der Linden
 .\" All rights reserved.
@@ -195,7 +195,7 @@ You must create or get a valid copy of t
 .Nm
 is generally not enabled in
 .Dv GENERIC
-kernels for secuity reasons,
+kernels for security reasons,
 but is available as a module.
 It must be added to
 .Xr modules.conf 5



CVS commit: src

2021-10-12 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Oct 12 15:25:27 UTC 2021

Modified Files:
src/lib/libcrypt: crypt.3
src/share/man/man8: compat_linux.8

Log Message:
fix typos in man pages.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libcrypt/crypt.3
cvs rdiff -u -r1.44 -r1.45 src/share/man/man8/compat_linux.8

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



CVS commit: src/share/man/man5

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 11:08:14 UTC 2021

Modified Files:
src/share/man/man5: passwd.conf.5

Log Message:
passwd.conf.5: document using argon2


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/share/man/man5/passwd.conf.5

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



CVS commit: src/share/man/man5

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 11:08:14 UTC 2021

Modified Files:
src/share/man/man5: passwd.conf.5

Log Message:
passwd.conf.5: document using argon2


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/share/man/man5/passwd.conf.5

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

Modified files:

Index: src/share/man/man5/passwd.conf.5
diff -u src/share/man/man5/passwd.conf.5:1.11 src/share/man/man5/passwd.conf.5:1.12
--- src/share/man/man5/passwd.conf.5:1.11	Mon Jul  3 21:30:59 2017
+++ src/share/man/man5/passwd.conf.5	Tue Oct 12 11:08:14 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: passwd.conf.5,v 1.11 2017/07/03 21:30:59 wiz Exp $
+.\"	$NetBSD: passwd.conf.5,v 1.12 2021/10/12 11:08:14 nia Exp $
 .\"
 .\" Copyright 1997 Niels Provos 
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 3, 2010
+.Dd October 12, 2021
 .Dt PASSWD.CONF 5
 .Os
 .Sh NAME
@@ -59,19 +59,34 @@ Some fields and their possible values th
 The cipher to use for local passwords.
 .Pp
 Possible values are:
+.Dq argon2d, ,
+.Dq argon2i, ,
+.Dq argon2id, ,
 .Dq old ,
 .Dq newsalt, ,
 .Dq md5 ,
 .Dq sha1, ,
 and
 .Dq blowfish, .
+.Pp
+For
+.Dq argon2d ,
+.Dq argon2i ,
+and
+.Dq argon2id ,
+optional hardness parameters can be specified as described in the
+manual for
+.Xr pwhash 1 .
+.Pp
 For
 .Dq newsalt
 the value of rounds is a 24-bit integer with a minimum of 7250 rounds.
+.Pp
 For
 .Dq sha1
 the value of rounds is a 32-bit integer, 0 means use the default
 of 24680.
+.Pp
 For
 .Dq blowfish
 the value can be between 4 and 31.



CVS commit: src/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 12:03:47 UTC 2021

Modified Files:
src/lib/libcrypt: pw_gensalt.3

Log Message:
pw_gensalt.3: add argon2 bits


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libcrypt/pw_gensalt.3

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



CVS commit: src/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 12:03:47 UTC 2021

Modified Files:
src/lib/libcrypt: pw_gensalt.3

Log Message:
pw_gensalt.3: add argon2 bits


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libcrypt/pw_gensalt.3

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/pw_gensalt.3
diff -u src/lib/libcrypt/pw_gensalt.3:1.7 src/lib/libcrypt/pw_gensalt.3:1.8
--- src/lib/libcrypt/pw_gensalt.3:1.7	Wed Mar 25 22:09:48 2020
+++ src/lib/libcrypt/pw_gensalt.3	Tue Oct 12 12:03:47 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pw_gensalt.3,v 1.7 2020/03/25 22:09:48 wiz Exp $
+.\"	$NetBSD: pw_gensalt.3,v 1.8 2021/10/12 12:03:47 nia Exp $
 .\"
 .\" Copyright (c) 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd March 25, 2020
+.Dd October 12, 2021
 .Dt PW_GENSALT 3
 .Os
 .Sh NAME
@@ -132,10 +132,22 @@ This is of the form:
 The
 .Li 2
 in the salt string indicates the current blowfish version.
-.\" .It argon2
-.\" .It argon2id
-.\" .It argon2i
-.\" .It argon2
+.It argon2d
+This is of the form:
+.Li $argon2d$v=19$m=MEMORY,t=TIME,p=THREADS$$
+.It argon2i
+This is of the form:
+.Li $argon2i$v=19$m=MEMORY,t=TIME,p=THREADS$$
+.It argon2id
+This is of the form:
+.Li $argon2id$v=19$m=MEMORY,t=TIME,p=THREADS$$
+.It argon2
+An alias for
+.Dq argon2id .
+.Pp
+See
+.Xr crypt 3
+for details on the Argon2 parameters.
 .El
 .Sh RETURN VALUES
 Upon successful completion, a value of 0 is returned.



CVS commit: src/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 09:40:39 UTC 2021

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

Log Message:
crypt-argon2: improve resilience of the parser.

Allow the version number to be unspecified as in the argon2 upstream
test suite, properly defaulting to a version if the v= block is
entirely missing, and treating the remaining block as parameters.

Fix a null pointer derefence when the encoded password is unspecified
in the settings string.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.2 src/lib/libcrypt/crypt-argon2.c:1.3
--- src/lib/libcrypt/crypt-argon2.c:1.2	Thu May 14 08:34:19 2020
+++ src/lib/libcrypt/crypt-argon2.c	Tue Oct 12 09:40:38 2021
@@ -95,15 +95,24 @@ static int decode_option(argon2_context 
 
 	a = strsep(, "$");
 
-	if ((getnum(a, ))<0) { /* on error, default to current */
-/* should start thinking about aborting */
-		ctx->version = ARGON2_VERSION_NUMBER;
+	/* parse the version number of the hash, if it's there */
+	if (strncmp(a, "v=", 2) == 0) {
+		a += 2;
+		if ((getnum(a, ))<0) { /* on error, default to current */
+			/* should start thinking about aborting */
+			ctx->version = ARGON2_VERSION_NUMBER;
+		} else {
+			ctx->version = tmp;
+		}
+		a = strsep(, "$");
 	} else {
-		ctx->version = tmp;
+		/*
+		 * This is a parameter list, not a version number, use the
+		 * default version.
+		 */
+		ctx->version = ARGON2_VERSION_NUMBER;
 	}
 
-	a = strsep(, "$");
-
 	/* parse labelled argon2 params */
 	/* m_cost (m)
 	 * t_cost (t)
@@ -143,12 +152,12 @@ static int decode_option(argon2_context 
 
 	a = strsep(, "$");
 
-	snprintf((char *)ctx->salt,ctx->saltlen, "%s", a);
+	snprintf((char *)ctx->salt, ctx->saltlen, "%s", a);
 
 	a = strsep(, "$");
 
-	if (*a) {
-		snprintf((char *)ctx->pwd,ctx->pwdlen, "%s", a);
+	if (a) {
+		snprintf((char *)ctx->pwd, ctx->pwdlen, "%s", a);
 	} else {
 		/* don't care if passwd hash is missing */
 		/* if missing, most likely coming from */
@@ -212,7 +221,7 @@ __crypt_argon2(const char *pw, const cha
 	rc = decode_option(, , salt);
 
 	if (rc < 0) {
-	/* unable to parse input params */
+		/* unable to parse input params */
 		return 0;
 	}
 
@@ -221,7 +230,8 @@ __crypt_argon2(const char *pw, const cha
 		ebuf, sizeof(ebuf), encodebuf, sizeof(encodebuf), atype, ctx.version);
 
 	if (rc != ARGON2_OK) {
-		fprintf(stderr, "Failed: %s\n", argon2_error_message(rc));
+		fprintf(stderr, "argon2: failed: %s\n",
+		argon2_error_message(rc));
 		return 0;
 	}
 



CVS commit: src/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 09:40:39 UTC 2021

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

Log Message:
crypt-argon2: improve resilience of the parser.

Allow the version number to be unspecified as in the argon2 upstream
test suite, properly defaulting to a version if the v= block is
entirely missing, and treating the remaining block as parameters.

Fix a null pointer derefence when the encoded password is unspecified
in the settings string.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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/tests/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 10:52:40 UTC 2021

Modified Files:
src/tests/lib/libcrypt: Makefile t_crypt.c

Log Message:
Add libcrypt tests for Argon2i/Argon2i, based on reference hashes
from the argon2 test suite.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libcrypt/Makefile
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libcrypt/t_crypt.c

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



CVS commit: src/tests/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 10:52:40 UTC 2021

Modified Files:
src/tests/lib/libcrypt: Makefile t_crypt.c

Log Message:
Add libcrypt tests for Argon2i/Argon2i, based on reference hashes
from the argon2 test suite.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libcrypt/Makefile
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libcrypt/t_crypt.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/lib/libcrypt/Makefile
diff -u src/tests/lib/libcrypt/Makefile:1.1 src/tests/lib/libcrypt/Makefile:1.2
--- src/tests/lib/libcrypt/Makefile:1.1	Tue Dec 27 00:47:23 2011
+++ src/tests/lib/libcrypt/Makefile	Tue Oct 12 10:52:40 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2011/12/27 00:47:23 christos Exp $
+# $NetBSD: Makefile,v 1.2 2021/10/12 10:52:40 nia Exp $
 
 NOMAN=		# defined 
 
@@ -12,4 +12,8 @@ WARNS?=		4
 
 TESTS_C=	t_crypt
 
+.if defined(MKARGON2) && ${MKARGON2} != "no"
+CPPFLAGS+=	-DHAVE_ARGON2
+.endif
+
 .include 

Index: src/tests/lib/libcrypt/t_crypt.c
diff -u src/tests/lib/libcrypt/t_crypt.c:1.3 src/tests/lib/libcrypt/t_crypt.c:1.4
--- src/tests/lib/libcrypt/t_crypt.c:1.3	Wed Dec 28 22:07:40 2011
+++ src/tests/lib/libcrypt/t_crypt.c	Tue Oct 12 10:52:40 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: t_crypt.c,v 1.3 2011/12/28 22:07:40 christos Exp $ */
+/* $NetBSD: t_crypt.c,v 1.4 2021/10/12 10:52:40 nia Exp $ */
 
 /*
  * This version is derived from the original implementation of FreeSec
@@ -61,7 +61,7 @@
  *	by now.	 The code requires a 32-bit integer type, though.
  */
 #include 
-__RCSID("$NetBSD: t_crypt.c,v 1.3 2011/12/28 22:07:40 christos Exp $");
+__RCSID("$NetBSD: t_crypt.c,v 1.4 2021/10/12 10:52:40 nia Exp $");
 
 #include 
 #include 
@@ -110,7 +110,28 @@ static const struct {
 /* 30 */	{ "_", "" }, /* zero iteration count */
 /* 31 */	{ "_/!..", "" }, /* invalid character in count */
 /* 32 */	{ "_/..!", "" }, /* invalid character in salt */
-/* 33 */	{ NULL, NULL }
+#if defined(HAVE_ARGON2)
+/*
+ * The below are reference values from the official Argon2 test suite. 
+ * NOTE: Upstream Argon2 uses base64-encoded salts, whereas NetBSD doesn't...
+ */
+/* Argon2i version number 16 */
+/* 33 */	{ "$argon2i$v=16$m=256,t=2,p=1$somesalt$/U3YPXYsSb3q9XxHvc0MLxur+GP960kN9j7emXX8zwY", "password" },
+/* 34 */	{ "$argon2i$v=16$m=65536,t=1,p=1$somesalt$gWMFUrjzsfSM2xmSxMZ4ZD1JCytetP9sSzQ4tWIXJLI", "password" },
+/* 35 */	{ "$argon2i$v=16$m=65536,t=2,p=1$diffsalt$eaEDuQ/orvhXDLMfyLIiWXeJFvgza3vaw4kladTxxJc", "password" },
+/* 36 */	{ "$argon2i$v=16$m=65536,t=2,p=1$somesalt$6ckCB0tnVFMaOgvlGeW69ASzDOabPwGsO/ISKZYBCaM", "differentpassword" },
+/* Argon2i version number 19 */
+/* 37 */	{ "$argon2i$v=19$m=256,t=2,p=1$somesalt$iekCn0Y3spW+sCcFanM2xBT63UP2sghkUoHLIUpWRS8", "password" },
+/* 38 */	{ "$argon2i$v=19$m=65536,t=1,p=1$somesalt$0WgHXE2YXhPr6uVgz4uUw7XYoWxRkWtvSsLaOsEbvs8", "password" },
+/* 39 */	{ "$argon2i$v=19$m=65536,t=2,p=1$diffsalt$sDV8zPvvkfOGCw26RHsjSMvv7K2vmQq/6cxAcmxSEnE", "password" },
+/* 40 */	{ "$argon2i$v=19$m=65536,t=2,p=1$somesalt$FK6NoBr+qHAMI1jc73xTWNkCEoK9iGY6RWL1n7dNIu4", "differentpassword" },
+/* Argon2id version number 19 */
+/* 41 */	{ "$argon2id$v=19$m=256,t=2,p=2$somesalt$bQk8UB/VmZZF4Oo79iDXuL5/0ttZwg2f/5U52iv1cDc", "password" },
+/* 42 */	{ "$argon2id$v=19$m=65536,t=4,p=1$somesalt$kCXUjmjvc5XMqQedpMTsOv+zyJEf5PhtGiUghW9jFyw", "password" },
+/* 43 */	{ "$argon2id$v=19$m=65536,t=2,p=1$diffsalt$vfMrBczELrFdWP0ZsfhWsRPaHppYdP3MVEMIVlqoFBw", "password" },
+/* 44 */	{ "$argon2id$v=19$m=65536,t=2,p=1$somesalt$C4TWUs9rDEvq7w3+J4umqA32aWKB1+DSiRuBfYxFj94", "differentpassword" },
+#endif
+/* 45 */	{ NULL, NULL }
 };
 
 ATF_TC(crypt_salts);



CVS commit: src/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 10:51:33 UTC 2021

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

Log Message:
crypt-argon2: Properly honor user's version number.

Follow upstream by defaulting to 0x10 if it's not specified.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 10:51:33 UTC 2021

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

Log Message:
crypt-argon2: Properly honor user's version number.

Follow upstream by defaulting to 0x10 if it's not specified.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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.3 src/lib/libcrypt/crypt-argon2.c:1.4
--- src/lib/libcrypt/crypt-argon2.c:1.3	Tue Oct 12 09:40:38 2021
+++ src/lib/libcrypt/crypt-argon2.c	Tue Oct 12 10:51:33 2021
@@ -100,7 +100,7 @@ static int decode_option(argon2_context 
 		a += 2;
 		if ((getnum(a, ))<0) { /* on error, default to current */
 			/* should start thinking about aborting */
-			ctx->version = ARGON2_VERSION_NUMBER;
+			ctx->version = ARGON2_VERSION_10;
 		} else {
 			ctx->version = tmp;
 		}
@@ -110,7 +110,7 @@ static int decode_option(argon2_context 
 		 * This is a parameter list, not a version number, use the
 		 * default version.
 		 */
-		ctx->version = ARGON2_VERSION_NUMBER;
+		ctx->version = ARGON2_VERSION_10;
 	}
 
 	/* parse labelled argon2 params */
@@ -184,7 +184,6 @@ __crypt_argon2(const char *pw, const cha
 	/* argon2 variable, default to id */
 	argon2_type atype = Argon2_id;
 	/* default to current argon2 version */
-	int version=ARGON2_VERSION_NUMBER;
 	/* argon2 context to collect params */
 	argon2_context ctx = ARGON2_CONTEXT_INITIALIZER;
 	/* argon2 encoded buffer */
@@ -247,7 +246,7 @@ __crypt_argon2(const char *pw, const cha
 	/* same encoding format as argon2 api, but with original salt */
 	snprintf(rbuf, sizeof(rbuf)-1, "$%s$v=%d$m=%d,t=%d,p=%d$%s$%s",
 			argon2_type2string(atype,0),
-			version,
+			ctx.version,
 			ctx.m_cost,
 			ctx.t_cost,
 			ctx.threads,



CVS commit: src/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 12:11:04 UTC 2021

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

Log Message:
paranoia: use explicit_memset


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 12:11:04 UTC 2021

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

Log Message:
paranoia: use explicit_memset


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.4 src/lib/libcrypt/crypt-argon2.c:1.5
--- src/lib/libcrypt/crypt-argon2.c:1.4	Tue Oct 12 10:51:33 2021
+++ src/lib/libcrypt/crypt-argon2.c	Tue Oct 12 12:11:04 2021
@@ -254,9 +254,9 @@ __crypt_argon2(const char *pw, const cha
 			blkp);
 
 	/* clear buffers */
-	memset(encodebuf, 0, sizeof(encodebuf));
-	memset(saltbuf, 0, sizeof(saltbuf));
-	memset(pwdbuf, 0, sizeof(pwdbuf));
+	explicit_memset(encodebuf, 0, sizeof(encodebuf));
+	explicit_memset(saltbuf, 0, sizeof(saltbuf));
+	explicit_memset(pwdbuf, 0, sizeof(pwdbuf));
 
 	/* return encoded str */
 	return rbuf;



CVS commit: src/etc

2021-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 12 17:19:20 UTC 2021

Modified Files:
src/etc: MAKEDEV.tmpl

Log Message:
PR/56452: RVP: MAKEDEV should also create /dev/dri/renderD* devices


To generate a diff of this commit:
cvs rdiff -u -r1.225 -r1.226 src/etc/MAKEDEV.tmpl

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

Modified files:

Index: src/etc/MAKEDEV.tmpl
diff -u src/etc/MAKEDEV.tmpl:1.225 src/etc/MAKEDEV.tmpl:1.226
--- src/etc/MAKEDEV.tmpl:1.225	Sun Oct 10 09:03:08 2021
+++ src/etc/MAKEDEV.tmpl	Tue Oct 12 13:19:20 2021
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: MAKEDEV.tmpl,v 1.225 2021/10/10 13:03:08 jmcneill Exp $
+#	$NetBSD: MAKEDEV.tmpl,v 1.226 2021/10/12 17:19:20 christos Exp $
 #
 # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2127,8 +2127,10 @@ atabus[0-9]*)
 
 drm[0-9]*)
 	unit=${i#drm}
+	unit2=$((unit + 128))
 	makedir dri 755
 	mkdev dri/card$unit c %drm_chr% $unit 660
+	mkdev dri/renderD${unit2} c %drm_chr% ${unit2} 660
 	;;
 
 drvctl)



CVS commit: src/etc

2021-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 12 17:19:20 UTC 2021

Modified Files:
src/etc: MAKEDEV.tmpl

Log Message:
PR/56452: RVP: MAKEDEV should also create /dev/dri/renderD* devices


To generate a diff of this commit:
cvs rdiff -u -r1.225 -r1.226 src/etc/MAKEDEV.tmpl

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



CVS commit: src/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 17:27:26 UTC 2021

Modified Files:
src/lib/libcrypt: crypt.3

Log Message:
crypt.3: note parallelism caveats


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/libcrypt/crypt.3

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



CVS commit: src/lib/libcrypt

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 17:27:26 UTC 2021

Modified Files:
src/lib/libcrypt: crypt.3

Log Message:
crypt.3: note parallelism caveats


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/libcrypt/crypt.3

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.3
diff -u src/lib/libcrypt/crypt.3:1.30 src/lib/libcrypt/crypt.3:1.31
--- src/lib/libcrypt/crypt.3:1.30	Tue Oct 12 15:25:27 2021
+++ src/lib/libcrypt/crypt.3	Tue Oct 12 17:27:26 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: crypt.3,v 1.30 2021/10/12 15:25:27 andvar Exp $
+.\"	$NetBSD: crypt.3,v 1.31 2021/10/12 17:27:26 nia Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)crypt.3	8.2 (Berkeley) 12/11/93
 .\"
-.Dd January 1, 2012
+.Dd October 12, 2021
 .Dt CRYPT 3
 .Os
 .Sh NAME
@@ -252,6 +252,7 @@ We parameterize on three variables.
 First, m_cost (m), specifies the memory usage in KB.
 Second, t_cost (t), specifies the number of iterations.
 Third, parallelism (p) specifies the number of threads.
+this is currently ignored and one thread will always be used.
 A valid Argon2 encoded password looks similar to
 .Bd -literal
 $argon2id$v=19$m=4096,t=6,p=1$qCatF9a1s/6TgcYB$ \



CVS commit: src/lib/libcrypt

2021-10-12 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Tue Oct 12 15:55:31 UTC 2021

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

Log Message:
added missing copyright header. pointed out by nia. no functional change


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 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.8 src/lib/libcrypt/crypt-argon2.c:1.9
--- src/lib/libcrypt/crypt-argon2.c:1.8	Tue Oct 12 15:27:41 2021
+++ src/lib/libcrypt/crypt-argon2.c	Tue Oct 12 15:55:31 2021
@@ -1,3 +1,29 @@
+/*
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include 
 #include  
 #include 



CVS commit: src/lib/libcrypt

2021-10-12 Thread Jason High
Module Name:src
Committed By:   jhigh
Date:   Tue Oct 12 15:55:31 UTC 2021

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

Log Message:
added missing copyright header. pointed out by nia. no functional change


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 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

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 17:24:37 UTC 2021

Modified Files:
src/external/apache2: Makefile
src/lib/libcrypt: Makefile
src/tests/usr.bin: Makefile
src/usr.bin/pwhash: pwhash.1
Removed Files:
src/external/apache2/argon2: Makefile
src/external/apache2/argon2/lib: Makefile
src/external/apache2/argon2/lib/libargon2: Makefile
src/external/apache2/argon2/usr.bin: Makefile
src/external/apache2/argon2/usr.bin/argon2: Makefile
src/tests/usr.bin/argon2: Makefile t_argon2.sh

Log Message:
Fix release builds with MKARGON2=yes

This changes argon2 from a separately built library into a private
dependency of libcrypt and removes the argon2(1) utility (we already
have pwhash(1)). Giving libcrypt more library dependencies
complicates things (e.g. libcrypt is a dependency of openssl).
pthreads support gets disabled in argon2 for similar reasons.

For testing argon2, we rely on the libcrypt test suite.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/apache2/Makefile
cvs rdiff -u -r1.1 -r0 src/external/apache2/argon2/Makefile
cvs rdiff -u -r1.1 -r0 src/external/apache2/argon2/lib/Makefile
cvs rdiff -u -r1.2 -r0 src/external/apache2/argon2/lib/libargon2/Makefile
cvs rdiff -u -r1.1 -r0 src/external/apache2/argon2/usr.bin/Makefile
cvs rdiff -u -r1.2 -r0 src/external/apache2/argon2/usr.bin/argon2/Makefile
cvs rdiff -u -r1.27 -r1.28 src/lib/libcrypt/Makefile
cvs rdiff -u -r1.34 -r1.35 src/tests/usr.bin/Makefile
cvs rdiff -u -r1.1 -r0 src/tests/usr.bin/argon2/Makefile
cvs rdiff -u -r1.3 -r0 src/tests/usr.bin/argon2/t_argon2.sh
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/pwhash/pwhash.1

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



CVS commit: src

2021-10-12 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Oct 12 17:24:37 UTC 2021

Modified Files:
src/external/apache2: Makefile
src/lib/libcrypt: Makefile
src/tests/usr.bin: Makefile
src/usr.bin/pwhash: pwhash.1
Removed Files:
src/external/apache2/argon2: Makefile
src/external/apache2/argon2/lib: Makefile
src/external/apache2/argon2/lib/libargon2: Makefile
src/external/apache2/argon2/usr.bin: Makefile
src/external/apache2/argon2/usr.bin/argon2: Makefile
src/tests/usr.bin/argon2: Makefile t_argon2.sh

Log Message:
Fix release builds with MKARGON2=yes

This changes argon2 from a separately built library into a private
dependency of libcrypt and removes the argon2(1) utility (we already
have pwhash(1)). Giving libcrypt more library dependencies
complicates things (e.g. libcrypt is a dependency of openssl).
pthreads support gets disabled in argon2 for similar reasons.

For testing argon2, we rely on the libcrypt test suite.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/apache2/Makefile
cvs rdiff -u -r1.1 -r0 src/external/apache2/argon2/Makefile
cvs rdiff -u -r1.1 -r0 src/external/apache2/argon2/lib/Makefile
cvs rdiff -u -r1.2 -r0 src/external/apache2/argon2/lib/libargon2/Makefile
cvs rdiff -u -r1.1 -r0 src/external/apache2/argon2/usr.bin/Makefile
cvs rdiff -u -r1.2 -r0 src/external/apache2/argon2/usr.bin/argon2/Makefile
cvs rdiff -u -r1.27 -r1.28 src/lib/libcrypt/Makefile
cvs rdiff -u -r1.34 -r1.35 src/tests/usr.bin/Makefile
cvs rdiff -u -r1.1 -r0 src/tests/usr.bin/argon2/Makefile
cvs rdiff -u -r1.3 -r0 src/tests/usr.bin/argon2/t_argon2.sh
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/pwhash/pwhash.1

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

Modified files:

Index: src/external/apache2/Makefile
diff -u src/external/apache2/Makefile:1.3 src/external/apache2/Makefile:1.4
--- src/external/apache2/Makefile:1.3	Mon Nov 11 22:44:57 2019
+++ src/external/apache2/Makefile	Tue Oct 12 17:24:36 2021
@@ -1,11 +1,7 @@
-#	$NetBSD: Makefile,v 1.3 2019/11/11 22:44:57 joerg Exp $
+#	$NetBSD: Makefile,v 1.4 2021/10/12 17:24:36 nia Exp $
 
 .include 
 
-.if (defined(MKARGON2) && ${MKARGON2} != "no")
-SUBDIR+= argon2
-.endif
-
 .if (${MKLLVM} != "no" || ${MKLLVMRT} != "no")
 SUBDIR+= llvm
 .endif

Index: src/lib/libcrypt/Makefile
diff -u src/lib/libcrypt/Makefile:1.27 src/lib/libcrypt/Makefile:1.28
--- src/lib/libcrypt/Makefile:1.27	Wed Mar 25 17:11:06 2020
+++ src/lib/libcrypt/Makefile	Tue Oct 12 17:24:36 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.27 2020/03/25 17:11:06 christos Exp $
+#	$NetBSD: Makefile,v 1.28 2021/10/12 17:24:36 nia Exp $
 
 .include 
 
@@ -14,9 +14,18 @@ SRCS=	crypt.c md5crypt.c bcrypt.c crypt-
 SRCS+=	hmac_sha1.c
 
 .if defined(HAVE_ARGON2)
+ARGON2DIR=	${NETBSDSRCDIR}/external/apache2/argon2
+.PATH: ${ARGON2DIR}/dist/phc-winner-argon2/src \
+	${ARGON2DIR}/dist/phc-winner-argon2/src/blake2 \
+	${ARGON2DIR}/dist/phc-winner-argon2/include
+CPPFLAGS+=	-DHAVE_ARGON2 -DARGON2_NO_THREADS
+CPPFLAGS+=	-I${ARGON2DIR}/dist/phc-winner-argon2/include
 SRCS+=		crypt-argon2.c
-CFLAGS+=	-DHAVE_ARGON2 -I../../external/apache2/argon2/dist/phc-winner-argon2/include/
-LDADD+=		-largon2 
+# libargon2 sources
+.  for src in argon2.c core.c blake2b.c encoding.c ref.c
+SRCS+=		${src}
+COPTS.${src}+=	-Wno-error
+.  endfor
 .endif
 
 WARNS?=	5

Index: src/tests/usr.bin/Makefile
diff -u src/tests/usr.bin/Makefile:1.34 src/tests/usr.bin/Makefile:1.35
--- src/tests/usr.bin/Makefile:1.34	Sun Nov  1 22:28:32 2020
+++ src/tests/usr.bin/Makefile	Tue Oct 12 17:24:36 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.34 2020/11/01 22:28:32 christos Exp $
+#	$NetBSD: Makefile,v 1.35 2021/10/12 17:24:36 nia Exp $
 #
 
 .include 
@@ -16,8 +16,4 @@ TESTS_SUBDIRS=	awk basename bzip2 cc cmp
 TESTS_SUBDIRS+=	c++
 .endif
 
-.if (defined(MKARGON2) && ${MKARGON2} != "no")
-TESTS_SUBDIRS+=	argon2
-.endif
-
 .include 

Index: src/usr.bin/pwhash/pwhash.1
diff -u src/usr.bin/pwhash/pwhash.1:1.9 src/usr.bin/pwhash/pwhash.1:1.10
--- src/usr.bin/pwhash/pwhash.1:1.9	Mon Oct 21 02:36:48 2019
+++ src/usr.bin/pwhash/pwhash.1	Tue Oct 12 17:24:37 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pwhash.1,v 1.9 2019/10/21 02:36:48 jhigh Exp $
+.\"	$NetBSD: pwhash.1,v 1.10 2021/10/12 17:24:37 nia Exp $
 .\"	$OpenBSD: encrypt.1,v 1.16 2000/11/09 17:52:07 aaron Exp $
 .\"
 .\" Copyright (c) 1996, Jason Downs.  All rights reserved.
@@ -79,12 +79,15 @@ Following the required 
 .Ar variant 
 name, three optional comma-delimited parameters may be provided,
 
-t=n Specify the number of iterations to n.  The default is 3.
+t=n Specify the number of iterations to n.
+The default is 3.
 
-m=n Specify the memory usage in KB  to n. The default is 4096.
-
-p=n Specify the number of threads to n. The default is 1.
+m=n Specify the memory usage in KB  to n.
+The default is 4096.
 
+p=n Specify the number of threads to n.

CVS commit: src/sys/sys

2021-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 12 17:06:26 UTC 2021

Modified Files:
src/sys/sys: socket.h

Log Message:
Revert previous change because it causes uninitialized warnings with KMSAN.
The previous code was correct. Add a comment explaining why. Requested by chuq@


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/sys/socket.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/sys/socket.h
diff -u src/sys/sys/socket.h:1.129 src/sys/sys/socket.h:1.130
--- src/sys/sys/socket.h:1.129	Sun Nov  4 11:30:29 2018
+++ src/sys/sys/socket.h	Tue Oct 12 13:06:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: socket.h,v 1.129 2018/11/04 16:30:29 christos Exp $	*/
+/*	$NetBSD: socket.h,v 1.130 2021/10/12 17:06:26 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -392,10 +392,13 @@ struct sockcred {
 
 /*
  * Compute size of a sockcred structure with groups.
+ *
+ * The (ngrps - 1) is to account for struct sockcred being defined with
+ * already one group member. This code works correctly when ngroups == 0
+ * because of unsigned arithmetic wrap-around.
  */
 #define	SOCKCREDSIZE(ngrps) \
-	(/*CONSTCOND*/sizeof(struct sockcred) + (sizeof(gid_t) * \
-	((ngrps) ? ((ngrps) - 1) : 0)))
+	(/*LINTED*/sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1)))
 #endif /* _NETBSD_SOURCE */
 
 



CVS commit: src/sys/sys

2021-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 12 17:06:26 UTC 2021

Modified Files:
src/sys/sys: socket.h

Log Message:
Revert previous change because it causes uninitialized warnings with KMSAN.
The previous code was correct. Add a comment explaining why. Requested by chuq@


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/sys/socket.h

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



CVS commit: src/usr.bin/config

2021-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 12 17:14:10 UTC 2021

Modified Files:
src/usr.bin/config: lint.c

Log Message:
PR/56453: Wataru Ashihara: config(1): Assertion fails in config -L
Only compare pointers when one is found.


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

2021-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 12 17:14:10 UTC 2021

Modified Files:
src/usr.bin/config: lint.c

Log Message:
PR/56453: Wataru Ashihara: config(1): Assertion fails in config -L
Only compare pointers when one is found.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/config/lint.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/config/lint.c
diff -u src/usr.bin/config/lint.c:1.15 src/usr.bin/config/lint.c:1.16
--- src/usr.bin/config/lint.c:1.15	Wed Oct 29 13:14:50 2014
+++ src/usr.bin/config/lint.c	Tue Oct 12 13:14:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lint.c,v 1.15 2014/10/29 17:14:50 christos Exp $	*/
+/*	$NetBSD: lint.c,v 1.16 2021/10/12 17:14:10 christos Exp $	*/
 
 /*
  *  Copyright (c) 2007 The NetBSD Foundation.
@@ -31,7 +31,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: lint.c,v 1.15 2014/10/29 17:14:50 christos Exp $");
+__RCSID("$NetBSD: lint.c,v 1.16 2021/10/12 17:14:10 christos Exp $");
 
 #include 
 #include 
@@ -80,11 +80,11 @@ do_emit_option(const char *name, struct 
 	printf("%s\t%s", ot->ot_name, dl->dl_name);
 	if (ot->ot_type == OT_PARAM) {
 		struct defoptlist *dl2 = dlhash_lookup(defoptlint, dl->dl_name);
-		if (dl2 != NULL)
+		if (dl2 != NULL) {
+			assert(dl2 == dl);
 			value = dl2->dl_lintvalue;
-		else
+		} else
 			value = dl->dl_value;
-		assert(dl2 == dl);
 		printf("=\"%s\"", value ? value : "1");
 	}
 	printf("\n");



CVS commit: src/usr.bin/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:20:22 UTC 2021

Modified Files:
src/usr.bin/indent: pr_comment.c

Log Message:
indent: in process_comment, negate box_com to may_wrap

In the new line 213, may_wrap could only be true and was therefore a
redundant condition.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/indent/pr_comment.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/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:20:22 UTC 2021

Modified Files:
src/usr.bin/indent: pr_comment.c

Log Message:
indent: in process_comment, negate box_com to may_wrap

In the new line 213, may_wrap could only be true and was therefore a
redundant condition.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/usr.bin/indent/pr_comment.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/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.74 src/usr.bin/indent/pr_comment.c:1.75
--- src/usr.bin/indent/pr_comment.c:1.74	Tue Oct 12 22:04:03 2021
+++ src/usr.bin/indent/pr_comment.c	Tue Oct 12 22:20:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pr_comment.c,v 1.74 2021/10/12 22:04:03 rillig Exp $	*/
+/*	$NetBSD: pr_comment.c,v 1.75 2021/10/12 22:20:22 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.74 2021/10/12 22:04:03 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.75 2021/10/12 22:20:22 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -112,23 +112,20 @@ process_comment(void)
 adj_max_line_length = opt.max_line_length;
 ps.just_saw_decl = 0;
 last_blank = -1;		/* no blanks found so far */
-bool box_com = false;	/* at first, assume that we are not in a boxed
- * comment or some other comment that should
- * not be touched */
+bool may_wrap = true;
 ps.stats.comments++;
 
 /* Figure where to align and how to treat the comment */
 
-if (ps.col_1 && !opt.format_col1_comments) { /* if the comment starts in
- * column 1, it should not be touched */
-	box_com = true;
+if (ps.col_1 && !opt.format_col1_comments) {
+	may_wrap = false;
 	break_delim = false;
 	ps.com_ind = 0;
 
 } else {
 	if (*inp.s == '-' || *inp.s == '*' || token.e[-1] == '/' ||
 	(*inp.s == '\n' && !opt.format_block_comments)) {
-	box_com = true;
+	may_wrap = false;
 	break_delim = false;
 	}
 
@@ -159,7 +156,7 @@ process_comment(void)
 	}
 }
 
-if (box_com) {
+if (!may_wrap) {
 	/*
 	 * Find out how much indentation there was originally, because that
 	 * much will have to be ignored by dump_line(). This is a box comment,
@@ -186,7 +183,7 @@ process_comment(void)
 ps.comment_delta = 0;
 com_add_char('/');
 com_add_char(token.e[-1]);	/* either '*' or '/' */
-if (*inp.s != ' ' && !box_com)
+if (*inp.s != ' ' && may_wrap)
 	com_add_char(' ');
 
 /* Don't put a break delimiter if this is a one-liner that won't wrap. */
@@ -213,8 +210,7 @@ process_comment(void)
 	prefix_blankline_requested = true;
 	dump_line();
 	com.e = com.s = t;
-	if (!box_com)
-	com_add_delim();
+	com_add_delim();
 }
 
 /* Start to copy the comment */
@@ -223,7 +219,7 @@ process_comment(void)
  * copied */
 	switch (*inp.s) {	/* this checks for various special cases */
 	case '\f':
-	if (!box_com) {	/* in a text comment, break the line here */
+	if (may_wrap) {	/* in a text comment, break the line here */
 		ps.use_ff = true;
 		dump_line();
 		last_blank = -1;
@@ -248,16 +244,16 @@ process_comment(void)
 	}
 
 	last_blank = -1;
-	if (box_com || ps.last_nl) {	/* if this is a boxed comment,
+	if (!may_wrap || ps.last_nl) {	/* if this is a boxed comment,
 		 * we handle the newline */
 		if (com.s == com.e)
 		com_add_char(' ');
-		if (!box_com && com.e - com.s > 3) {
+		if (may_wrap && com.e - com.s > 3) {
 		dump_line();
 		com_add_delim();
 		}
 		dump_line();
-		if (!box_com)
+		if (may_wrap)
 		com_add_delim();
 
 	} else {
@@ -267,7 +263,7 @@ process_comment(void)
 		last_blank = com.e - 1 - com.buf;
 	}
 	++line_no;
-	if (!box_com) {
+	if (may_wrap) {
 		int asterisks_to_skip = 1;
 		do {		/* flush any blanks and/or tabs at start of
  * next line */
@@ -297,7 +293,7 @@ process_comment(void)
 		com_add_char(' ');
 		}
 
-		if (!is_hspace(com.e[-1]) && !box_com)
+		if (!is_hspace(com.e[-1]) && may_wrap)
 		com_add_char(' ');
 		if (token.e[-1] != '/') {
 		com_add_char('*');
@@ -331,7 +327,7 @@ process_comment(void)
 
 	/* XXX: signed character comparison '>' does not work for UTF-8 */
 	if (now_len > adj_max_line_length &&
-		!box_com && com.e[-1] > ' ') {
+		may_wrap && com.e[-1] > ' ') {
 
 		/* the comment is too long, it must be broken up */
 		if (last_blank == -1) {



CVS commit: src/usr.bin/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:22:35 UTC 2021

Modified Files:
src/usr.bin/indent: pr_comment.c

Log Message:
indent: in process_comment, migrate int variable to bool

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/indent/pr_comment.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/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:22:35 UTC 2021

Modified Files:
src/usr.bin/indent: pr_comment.c

Log Message:
indent: in process_comment, migrate int variable to bool

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/indent/pr_comment.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/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.75 src/usr.bin/indent/pr_comment.c:1.76
--- src/usr.bin/indent/pr_comment.c:1.75	Tue Oct 12 22:20:22 2021
+++ src/usr.bin/indent/pr_comment.c	Tue Oct 12 22:22:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pr_comment.c,v 1.75 2021/10/12 22:20:22 rillig Exp $	*/
+/*	$NetBSD: pr_comment.c,v 1.76 2021/10/12 22:22:35 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.75 2021/10/12 22:20:22 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.76 2021/10/12 22:22:35 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -264,11 +264,12 @@ process_comment(void)
 	}
 	++line_no;
 	if (may_wrap) {
-		int asterisks_to_skip = 1;
+		bool skip_asterisk = true;
 		do {		/* flush any blanks and/or tabs at start of
  * next line */
 		inbuf_skip();
-		if (*inp.s == '*' && --asterisks_to_skip >= 0) {
+		if (*inp.s == '*' && skip_asterisk) {
+			skip_asterisk = false;
 			inbuf_skip();
 			if (*inp.s == '/')
 			goto end_of_comment;



CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:42:01 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
inetd.8: new sentence, new line; minor formatting issues


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.sbin/inetd/inetd.8

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/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.65 src/usr.sbin/inetd/inetd.8:1.66
--- src/usr.sbin/inetd/inetd.8:1.65	Tue Oct 12 19:08:04 2021
+++ src/usr.sbin/inetd/inetd.8	Tue Oct 12 22:42:01 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.65 2021/10/12 19:08:04 christos Exp $
+.\"	$NetBSD: inetd.8,v 1.66 2021/10/12 22:42:01 rillig Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -92,9 +92,13 @@ The options available for
 .Nm :
 .Bl -tag -width Ds
 .It Fl d
-Turns on debugging and runs inetd in the foreground.
+Turns on debugging and runs
+.Nm
+in the foreground.
 .It Fl f
-Runs inetd in the foreground.
+Runs
+.Nm
+in the foreground.
 .It Fl l
 Turns on libwrap connection logging.
 .El
@@ -508,10 +512,10 @@ The value 
 .Li yes
 or
 .Li no .
-Equivalent to 
-.Em wait/nowait 
+Equivalent to
+.Em wait/nowait
 in positional notation.
-This option is automatically determined for internal 
+This option is automatically determined for internal
 services, and is mandatory for all others.
 .It Sy service_max
 Equivalent to
@@ -521,12 +525,14 @@ Defaults to 40 if not specified.
 .It Sy ip_max
 Specifies the maximum number of server instances that may be spawned from
 .Nm
-within an interval of 60 seconds for a given IP address. Other address types 
-may also work if supported by
-.Xr getnameinfo 3
-, test thoroughly using -d. For example, connections from unnamed Unix sockets
-do not work, but connections from named Unix sockets may work. However, there is
-no way to only accept named Unix sockets.
+within an interval of 60 seconds for a given IP address.
+Other address types may also work if supported by
+.Xr getnameinfo 3 ,
+test thoroughly using
+.Fl d .
+For example, connections from unnamed Unix sockets
+do not work, but connections from named Unix sockets may work.
+However, there is no way to only accept named Unix sockets.
 .It Sy user
 The user to run the program as.
 Equivalent to



CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:42:01 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
inetd.8: new sentence, new line; minor formatting issues


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.sbin/inetd/inetd.8

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



CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:47:18 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
inetd.8: remove trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/inetd/inetd.8

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/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.66 src/usr.sbin/inetd/inetd.8:1.67
--- src/usr.sbin/inetd/inetd.8:1.66	Tue Oct 12 22:42:01 2021
+++ src/usr.sbin/inetd/inetd.8	Tue Oct 12 22:47:18 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.66 2021/10/12 22:42:01 rillig Exp $
+.\"	$NetBSD: inetd.8,v 1.67 2021/10/12 22:47:18 rillig Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -113,17 +113,17 @@ the
 .Fl d
 option is also given on the command line.
 .Pp
-Services can be specified using the legacy `positional' notation or the 
+Services can be specified using the legacy `positional' notation or the
 `key-values' notation described in the sections
 .Sx Positional Notation
-and 
+and
 .Sx Key-Values Notation
 below.
 .Ss Positional Notation
 There must be an entry for each field of the configuration
 file, with entries for each field separated by a tab or
 a space.
-Comments are denoted by a ``#'' at the beginning of a line (see subsection 
+Comments are denoted by a ``#'' at the beginning of a line (see subsection
 .Sx Key-Values Notation
 for defining comments in key-values definitions).
 There must be an entry for each field (except for one
@@ -160,7 +160,7 @@ Note that restricted listen addresses ar
 UNIX-domain services, and are not supported for
 .Em Sun-RPC
 services.
-All 
+All
 .Em Sun-RPC
 services always listen on all interfaces.
 .Pp
@@ -205,7 +205,7 @@ parameter is the path name to listen on.
 The
 .Em service-spec
 parameter must not begin with a dot.
-See 
+See
 .Sx Directives .
 .Pp
 The
@@ -400,49 +400,49 @@ It is possible to quote an argument usin
 This allows you to have, e.g., spaces in paths and parameters.
 .Ss Key-Values Notation
 In key-values notation, keys are separated from their associated values by `=',
-values are separated by whitespace, and key-values options are separated by 
+values are separated by whitespace, and key-values options are separated by
 commas.
 A service definition is terminated by a semicolon.
 Multiple definitions may exist on a single line (and a line may
 end with a positional definition.
 A key-values definition has the following form:
 .Bd -filled -offset indent
-[listen-addr:]service-spec {on|off}  = [value1], 
+[listen-addr:]service-spec {on|off}  = [value1],
  = [value1] [value2] ...,  =, ...;
 .Ed
 .Pp
 Values may be in quotes, and support the following escape sequences.
 .Bl -hang -width "\xXX" -offset indent
-.It Sy \e\e 
+.It Sy \e\e
 Backslash.
-.It Sy \en 
+.It Sy \en
 Line feed.
-.It Sy \et 
+.It Sy \et
 Tab.
-.It Sy \er 
+.It Sy \er
 Carriage return.
-.It Sy \e' 
+.It Sy \e'
 Single quote.
-.It Sy \e" 
+.It Sy \e"
 Double quote.
-.It Sy \exXX 
+.It Sy \exXX
 Hexadecimal byte value, replace XX.
 .El
 .Pp
-.Em [listen-addr:]service-spec 
-has the same form as in positional notation. If 
+.Em [listen-addr:]service-spec
+has the same form as in positional notation. If
 .Em service-spec
 is followed by
 .Em on
 then the service definition is active by default.
 If
 .Em service-spec
-is followed by 
+is followed by
 .Em off
 then the service definition is parsed and errors are output to
 the system log, but the service is not active and no sockets are created.
 .Pp
-Comments that exist between the initial on/off directive 
+Comments that exist between the initial on/off directive
 and the closing semicolon may begin in any column and may exist on the same line
 as non-comment text.
 Note: editor syntax highlighting may be misleading!
@@ -450,12 +450,12 @@ Note: editor syntax highlighting may be 
 Syntax and semantic error detection is performed on a best-effort basis.
 If an error with a service definition is easily detectable, it will
 log the error using
-.Xr syslog 3 
-and continue reading the configuration file if possible, skipping the erroneous 
-definition or file. 
-Otherwise, it is up to the user to write definitions that conform to the 
+.Xr syslog 3
+and continue reading the configuration file if possible, skipping the erroneous
+definition or file.
+Otherwise, it is up to the user to write definitions that conform to the
 documentation.
-Errors may be worded differently depending on the ordering of 
+Errors may be worded differently depending on the ordering of
 options in the service definition.
 .Pp
 The following are the available values for
@@ -466,33 +466,33 @@ Set the listen address for this service.
 This can be an IPv4 or IPv6 address or a hostname.
 .It Sy socktype
 Equivalent to
-.Em socket-type 
+.Em socket-type
 in positional notation.
 .Em socktype
-is 

CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:47:18 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
inetd.8: remove trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/inetd/inetd.8

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



CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:51:28 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c inetd.h parse.c ratelimit.c

Log Message:
inetd: remove trailing whitespace, add space after 'if' and 'for'

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/inetd/parse.c \
src/usr.sbin/inetd/ratelimit.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/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.137 src/usr.sbin/inetd/inetd.c:1.138
--- src/usr.sbin/inetd/inetd.c:1.137	Tue Oct 12 19:08:04 2021
+++ src/usr.sbin/inetd/inetd.c	Tue Oct 12 22:51:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.137 2021/10/12 19:08:04 christos Exp $	*/
+/*	$NetBSD: inetd.c,v 1.138 2021/10/12 22:51:28 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.137 2021/10/12 19:08:04 christos Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.138 2021/10/12 22:51:28 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -1399,7 +1399,7 @@ allocchange(void)
 bool
 try_biltin(struct servtab *sep)
 {
-	for(size_t i = 0; i < __arraycount(biltins); i++) {
+	for (size_t i = 0; i < __arraycount(biltins); i++) {
 		if (biltins[i].bi_socktype == sep->se_socktype &&
 		strcmp(biltins[i].bi_service, sep->se_service) == 0) {
 			sep->se_bi = [i];

Index: src/usr.sbin/inetd/inetd.h
diff -u src/usr.sbin/inetd/inetd.h:1.4 src/usr.sbin/inetd/inetd.h:1.5
--- src/usr.sbin/inetd/inetd.h:1.4	Tue Oct 12 19:08:04 2021
+++ src/usr.sbin/inetd/inetd.h	Tue Oct 12 22:51:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.h,v 1.4 2021/10/12 19:08:04 christos Exp $	*/
+/*	$NetBSD: inetd.h,v 1.5 2021/10/12 22:51:28 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -197,8 +197,8 @@ struct rl_ip_node {
 		/* align for efficient comparison in rl_try_get, could use 8 instead */
 		struct in6_addr	ipv6_addr __attribute__((aligned(16)));
 #endif
-		/* 
-		 * other_addr is used for other address types besides the 
+		/*
+		 * other_addr is used for other address types besides the
 		 * special cases (IPv4/IPv6), using getnameinfo.
 		 */
 		struct {
@@ -208,13 +208,13 @@ struct rl_ip_node {
 			char other_addr[];
 		};
 	};
-	/* 
+	/*
 	 * Do not declare further members after union, offsetof is used to
 	 * determine malloc size.
 	 */
 };
 
-/* 
+/*
  * From inetd.c
  */
 
@@ -262,7 +262,7 @@ extern char	*defhost;
 extern char	*policy;
 
 /*
- * From ratelimit.c 
+ * From ratelimit.c
  */
 
 int	rl_process(struct servtab *, int);

Index: src/usr.sbin/inetd/parse.c
diff -u src/usr.sbin/inetd/parse.c:1.1 src/usr.sbin/inetd/parse.c:1.2
--- src/usr.sbin/inetd/parse.c:1.1	Tue Oct 12 19:08:04 2021
+++ src/usr.sbin/inetd/parse.c	Tue Oct 12 22:51:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.1 2021/10/12 19:08:04 christos Exp $	*/
+/*	$NetBSD: parse.c,v 1.2 2021/10/12 22:51:28 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.1 2021/10/12 19:08:04 christos Exp $");
+__RCSID("$NetBSD: parse.c,v 1.2 2021/10/12 22:51:28 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -453,11 +453,11 @@ more:
 		goto more;
 	}
 
-	if(arg[0] == '.') {
+	if (arg[0] == '.') {
 		if (strcmp([1], "include") == 0) {
 			/* include directive */
 			arg = skip();
-			if(arg == NULL) {
+			if (arg == NULL) {
 LOG_TOO_FEW_ARGS();
 return NULL;
 			}
@@ -736,7 +736,7 @@ do { \
 
 	/* Parse user:group token */
 	arg = skip();
-	if(arg == NULL) {
+	if (arg == NULL) {
 		LOG_TOO_FEW_ARGS();
 		freeconfig(sep);
 		goto more;
Index: src/usr.sbin/inetd/ratelimit.c
diff -u src/usr.sbin/inetd/ratelimit.c:1.1 src/usr.sbin/inetd/ratelimit.c:1.2
--- src/usr.sbin/inetd/ratelimit.c:1.1	Tue Oct 12 19:08:04 2021
+++ src/usr.sbin/inetd/ratelimit.c	Tue Oct 12 22:51:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ratelimit.c,v 1.1 2021/10/12 19:08:04 christos Exp $	*/
+/*	$NetBSD: ratelimit.c,v 1.2 2021/10/12 22:51:28 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: ratelimit.c,v 1.1 2021/10/12 19:08:04 christos Exp $");
+__RCSID("$NetBSD: ratelimit.c,v 1.2 2021/10/12 22:51:28 rillig Exp $");
 
 #include 
 
@@ -89,7 +89,7 @@ rl_process(struct servtab *sep, int ctrl
 		sep->se_time = now;
 	}
 
-	if(!rl_process_service_max(sep, ctrl, ) 
+	if (!rl_process_service_max(sep, ctrl, )
 	|| !rl_process_ip_max(sep, ctrl, )) {
 		return -1;
 	}
@@ -225,7 +225,7 @@ 

CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:51:28 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c inetd.h parse.c ratelimit.c

Log Message:
inetd: remove trailing whitespace, add space after 'if' and 'for'

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/inetd/parse.c \
src/usr.sbin/inetd/ratelimit.c

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



CVS commit: src

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 21:08:37 UTC 2021

Modified Files:
src/tests/usr.bin/indent: token-comment.0 token-comment.0.stdout
src/usr.bin/indent: pr_comment.c

Log Message:
indent: fix formatting of single-line comments (since today)

The change in pr_comment.c 1.70 from 3 hours ago did not cover all edge
cases correctly. Now it works for comments that are aligned with tabs.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/token-comment.0
cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/indent/token-comment.0.stdout
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/indent/pr_comment.c

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



CVS commit: src

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 21:08:37 UTC 2021

Modified Files:
src/tests/usr.bin/indent: token-comment.0 token-comment.0.stdout
src/usr.bin/indent: pr_comment.c

Log Message:
indent: fix formatting of single-line comments (since today)

The change in pr_comment.c 1.70 from 3 hours ago did not cover all edge
cases correctly. Now it works for comments that are aligned with tabs.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/indent/token-comment.0
cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/indent/token-comment.0.stdout
cvs rdiff -u -r1.72 -r1.73 src/usr.bin/indent/pr_comment.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/usr.bin/indent/token-comment.0
diff -u src/tests/usr.bin/indent/token-comment.0:1.10 src/tests/usr.bin/indent/token-comment.0:1.11
--- src/tests/usr.bin/indent/token-comment.0:1.10	Tue Oct 12 20:52:02 2021
+++ src/tests/usr.bin/indent/token-comment.0	Tue Oct 12 21:08:37 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token-comment.0,v 1.10 2021/10/12 20:52:02 rillig Exp $ */
+/* $NetBSD: token-comment.0,v 1.11 2021/10/12 21:08:37 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -25,6 +25,10 @@
 /* x			... line length 81*/
 /* x			 line length 82*/
 
+/* And now the same idea but the comment ends with a space already. */
+/* x			 line length 78 */
+/* x			. line length 79 */
+
 /* This is a traditional C block comment. */
 
 // This is a C99 line comment.

Index: src/tests/usr.bin/indent/token-comment.0.stdout
diff -u src/tests/usr.bin/indent/token-comment.0.stdout:1.12 src/tests/usr.bin/indent/token-comment.0.stdout:1.13
--- src/tests/usr.bin/indent/token-comment.0.stdout:1.12	Tue Oct 12 20:52:02 2021
+++ src/tests/usr.bin/indent/token-comment.0.stdout	Tue Oct 12 21:08:37 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token-comment.0.stdout,v 1.12 2021/10/12 20:52:02 rillig Exp $ */
+/* $NetBSD: token-comment.0.stdout,v 1.13 2021/10/12 21:08:37 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -26,14 +26,8 @@
 
 /* x			. line length 75 */
 /* x			.. line length 76 */
-/* $ FIXME: the following comment is short enough for a single line. */
-/*
- * x			... line length 77
- */
-/* $ FIXME: the following comment is short enough for a single line. */
-/*
- * x			 line length 78
- */
+/* x			... line length 77 */
+/* x			 line length 78 */
 /*
  * x			. line length 79
  */
@@ -47,6 +41,12 @@
  * x			 line length 82
  */
 
+/* And now the same idea but the comment ends with a space already. */
+/* x			 line length 78 */
+/*
+ * x			. line length 79
+ */
+
 /* This is a traditional C block comment. */
 
 // This is a C99 line comment.

Index: src/usr.bin/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.72 src/usr.bin/indent/pr_comment.c:1.73
--- src/usr.bin/indent/pr_comment.c:1.72	Tue Oct 12 19:57:53 2021
+++ src/usr.bin/indent/pr_comment.c	Tue Oct 12 21:08:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pr_comment.c,v 1.72 2021/10/12 19:57:53 rillig Exp $	*/
+/*	$NetBSD: pr_comment.c,v 1.73 2021/10/12 21:08:37 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.72 2021/10/12 19:57:53 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.73 2021/10/12 21:08:37 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -197,7 +197,8 @@ process_comment(void)
 	if (!(p[0] == '*' && p[1] == '/'))
 		continue;
 
-	int len = 3 + indentation_after_range(ps.com_ind, inp.s, p + 2);
+	int len = indentation_after_range(ps.com_ind + 3, inp.s, p) +
+		(is_hspace(p[-1]) ? 2 : 3);
 	if (len <= adj_max_line_length)
 		break_delim = false;
 	break;



CVS commit: src/tests/usr.bin/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 20:52:03 UTC 2021

Modified Files:
src/tests/usr.bin/indent: token-comment.0 token-comment.0.stdout

Log Message:
tests/indent: test more single-line comments


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/indent/token-comment.0
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/token-comment.0.stdout

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



CVS commit: src/tests/usr.bin/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 20:52:03 UTC 2021

Modified Files:
src/tests/usr.bin/indent: token-comment.0 token-comment.0.stdout

Log Message:
tests/indent: test more single-line comments


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/indent/token-comment.0
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/token-comment.0.stdout

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

Modified files:

Index: src/tests/usr.bin/indent/token-comment.0
diff -u src/tests/usr.bin/indent/token-comment.0:1.9 src/tests/usr.bin/indent/token-comment.0:1.10
--- src/tests/usr.bin/indent/token-comment.0:1.9	Tue Oct 12 19:05:22 2021
+++ src/tests/usr.bin/indent/token-comment.0	Tue Oct 12 20:52:02 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token-comment.0,v 1.9 2021/10/12 19:05:22 rillig Exp $ */
+/* $NetBSD: token-comment.0,v 1.10 2021/10/12 20:52:02 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -15,6 +15,16 @@
 /* 456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678 */
 /* 456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 */
 
+/* $ In the following comments, the line length is measured after formatting. */
+/* x			. line length 75*/
+/* x			.. line length 76*/
+/* x			... line length 77*/
+/* x			 line length 78*/
+/* x			. line length 79*/
+/* x			.. line length 80*/
+/* x			... line length 81*/
+/* x			 line length 82*/
+
 /* This is a traditional C block comment. */
 
 // This is a C99 line comment.

Index: src/tests/usr.bin/indent/token-comment.0.stdout
diff -u src/tests/usr.bin/indent/token-comment.0.stdout:1.11 src/tests/usr.bin/indent/token-comment.0.stdout:1.12
--- src/tests/usr.bin/indent/token-comment.0.stdout:1.11	Tue Oct 12 19:05:22 2021
+++ src/tests/usr.bin/indent/token-comment.0.stdout	Tue Oct 12 20:52:02 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: token-comment.0.stdout,v 1.11 2021/10/12 19:05:22 rillig Exp $ */
+/* $NetBSD: token-comment.0.stdout,v 1.12 2021/10/12 20:52:02 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -24,6 +24,29 @@
  * 123456789
  */
 
+/* x			. line length 75 */
+/* x			.. line length 76 */
+/* $ FIXME: the following comment is short enough for a single line. */
+/*
+ * x			... line length 77
+ */
+/* $ FIXME: the following comment is short enough for a single line. */
+/*
+ * x			 line length 78
+ */
+/*
+ * x			. line length 79
+ */
+/*
+ * x			.. line length 80
+ */
+/*
+ * x			... line length 81
+ */
+/*
+ * x			 line length 82
+ */
+
 /* This is a traditional C block comment. */
 
 // This is a C99 line comment.



CVS commit: src/lib/libcrypt

2021-10-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Oct 12 21:41:13 UTC 2021

Modified Files:
src/lib/libcrypt: crypt.3

Log Message:
Capitalize word.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libcrypt/crypt.3

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



CVS commit: src/lib/libcrypt

2021-10-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Oct 12 21:41:13 UTC 2021

Modified Files:
src/lib/libcrypt: crypt.3

Log Message:
Capitalize word.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/lib/libcrypt/crypt.3

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.3
diff -u src/lib/libcrypt/crypt.3:1.31 src/lib/libcrypt/crypt.3:1.32
--- src/lib/libcrypt/crypt.3:1.31	Tue Oct 12 17:27:26 2021
+++ src/lib/libcrypt/crypt.3	Tue Oct 12 21:41:13 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: crypt.3,v 1.31 2021/10/12 17:27:26 nia Exp $
+.\"	$NetBSD: crypt.3,v 1.32 2021/10/12 21:41:13 wiz Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -252,7 +252,7 @@ We parameterize on three variables.
 First, m_cost (m), specifies the memory usage in KB.
 Second, t_cost (t), specifies the number of iterations.
 Third, parallelism (p) specifies the number of threads.
-this is currently ignored and one thread will always be used.
+This is currently ignored and one thread will always be used.
 A valid Argon2 encoded password looks similar to
 .Bd -literal
 $argon2id$v=19$m=4096,t=6,p=1$qCatF9a1s/6TgcYB$ \



CVS commit: src/usr.bin/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:04:03 UTC 2021

Modified Files:
src/usr.bin/indent: pr_comment.c

Log Message:
indent: negate a few condition in process_comment

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/usr.bin/indent/pr_comment.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/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.73 src/usr.bin/indent/pr_comment.c:1.74
--- src/usr.bin/indent/pr_comment.c:1.73	Tue Oct 12 21:08:37 2021
+++ src/usr.bin/indent/pr_comment.c	Tue Oct 12 22:04:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pr_comment.c,v 1.73 2021/10/12 21:08:37 rillig Exp $	*/
+/*	$NetBSD: pr_comment.c,v 1.74 2021/10/12 22:04:03 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c
 
 #include 
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.73 2021/10/12 21:08:37 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.74 2021/10/12 22:04:03 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -315,14 +315,17 @@ process_comment(void)
 	default:		/* we have a random char */
 	;
 	int now_len = indentation_after_range(ps.com_ind, com.s, com.e);
-	do {
+	for (;;) {
 		char ch = inbuf_next();
 		if (is_hspace(ch))
 		last_blank = com.e - com.buf;
 		com_add_char(ch);
 		now_len++;
-	} while (memchr("*\n\r\b\t", *inp.s, 6) == NULL &&
-		(now_len < adj_max_line_length || last_blank == -1));
+		if (memchr("*\n\r\b\t", *inp.s, 6) != NULL)
+		break;
+		if (now_len >= adj_max_line_length && last_blank != -1)
+		break;
+	}
 
 	ps.last_nl = false;
 



CVS commit: src/usr.bin/indent

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:04:03 UTC 2021

Modified Files:
src/usr.bin/indent: pr_comment.c

Log Message:
indent: negate a few condition in process_comment

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/usr.bin/indent/pr_comment.c

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