CVS commit: src/distrib/utils/embedded/files

2021-07-20 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Tue Jul 20 19:31:23 UTC 2021

Modified Files:
src/distrib/utils/embedded/files: ec2_init

Log Message:
Extract just the random bits to feed to /dev/urandom.

This makes no difference in the randomness of the pool, but it improves
on the estimation (if any) of how many random bits were obtained.
Also make the ftp -q time out a bit longer since I got some time outs.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/utils/embedded/files/ec2_init

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

Modified files:

Index: src/distrib/utils/embedded/files/ec2_init
diff -u src/distrib/utils/embedded/files/ec2_init:1.3 src/distrib/utils/embedded/files/ec2_init:1.4
--- src/distrib/utils/embedded/files/ec2_init:1.3	Thu Jul 15 19:03:17 2021
+++ src/distrib/utils/embedded/files/ec2_init	Tue Jul 20 19:31:23 2021
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: ec2_init,v 1.3 2021/07/15 19:03:17 rhialto Exp $
+# $NetBSD: ec2_init,v 1.4 2021/07/20 19:31:23 rhialto Exp $
 #
 # PROVIDE: ec2_init
 # REQUIRE: NETWORKING
@@ -28,6 +28,11 @@ ec2_newuser()
 	useradd -g users -G wheel,operator -m "${EC2_USER}"
 }
 
+extract_random_seed()
+{
+	sed -n -e '/random_seed/s/.*"random_seed": *"\([A-Za-z0-9+/=]*\)".*/\1/p'
+}
+
 ec2_init()
 {
 	(
@@ -38,7 +43,7 @@ ec2_init()
 	try=0
 	while [ $((try++)) -lt 20 ]
 	do
-		HOSTNAME=$(ftp -o - -q 1 "${METADATA_URL}${HOSTNAME_URL}")
+		HOSTNAME=$(ftp -o - -q 2 "${METADATA_URL}${HOSTNAME_URL}")
 		if [ -n "$HOSTNAME" ]; then
 			echo "Setting EC2 hostname: ${HOSTNAME}"
 			echo "$HOSTNAME" > /etc/myname
@@ -53,7 +58,7 @@ ec2_init()
 	id "${EC2_USER}" >/dev/null 2>&1 || ec2_newuser
 
 	# fetch the public key from Amazon Web Services
-	EC2_SSH_KEY=$(ftp -o - -q 1 "${METADATA_URL}${SSH_KEY_URL}")
+	EC2_SSH_KEY=$(ftp -o - -q 2 "${METADATA_URL}${SSH_KEY_URL}")
 
 	if [ -n "$EC2_SSH_KEY" ]; then
 		# A key pair is associated with this instance, add it
@@ -71,10 +76,11 @@ ec2_init()
 		fi
 	fi
 
-	# May contain a "random_seed". Everything else doesn't matter.
-	OS_METADATA="$(ftp -o - -q 1 ${OS_METADATA_URL})"
+	# May contain a "random_seed".
+	OS_METADATA="$(ftp -o - -q 2 ${OS_METADATA_URL})"
 	if echo "$OS_METADATA" | grep -q random_seed; then
-		echo "$OS_METADATA" >> /dev/urandom
+		echo "$OS_METADATA" | extract_random_seed |
+		base64 -di >> /dev/urandom
 	fi
 	)
 }



CVS commit: src/distrib/amd64/liveimage/emuimage

2021-07-20 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Tue Jul 20 19:27:51 UTC 2021

Modified Files:
src/distrib/amd64/liveimage/emuimage: ec2_init

Log Message:
Don't override /etc/rc.conf if it sets ec2_init.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/amd64/liveimage/emuimage/ec2_init

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

Modified files:

Index: src/distrib/amd64/liveimage/emuimage/ec2_init
diff -u src/distrib/amd64/liveimage/emuimage/ec2_init:1.3 src/distrib/amd64/liveimage/emuimage/ec2_init:1.4
--- src/distrib/amd64/liveimage/emuimage/ec2_init:1.3	Thu Jul 15 17:20:25 2021
+++ src/distrib/amd64/liveimage/emuimage/ec2_init	Tue Jul 20 19:27:51 2021
@@ -1,4 +1,4 @@
-# $NetBSD: ec2_init,v 1.3 2021/07/15 17:20:25 rhialto Exp $
+# $NetBSD: ec2_init,v 1.4 2021/07/20 19:27:51 rhialto Exp $
 
 is_ec2() {
 	val=NO
@@ -23,4 +23,9 @@ is_ec2() {
 	printf $val
 }
 
-ec2_init=$(is_ec2)
+# Don't override /etc/rc.conf
+if [ -z "$ec2_init" ]
+then
+	ec2_init=$(is_ec2)
+fi
+



CVS commit: src/distrib/utils/embedded/files

2021-07-15 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Thu Jul 15 19:03:17 UTC 2021

Modified Files:
src/distrib/utils/embedded/files: ec2_init

Log Message:
Add some OpenStack support.

I found that in the cloud I tried, by the time this script runs, there
is no default route in effect yet. That takes some 5 to 10 seconds
longer. So I added a retry loop, and to make that easier, changed the
order of queries.  To make sure it doesn't wait ~forever for a
non-existent service I added the -q 1 option to ftp invocations.

I also added OpenStack-specific metadata which contains a different
random_seed of 512 bytes every time it is requested.  See
https://github.com/openstack/nova/blob/master/nova/api/metadata/base.py#L355
It may not be trusted data but only in the strictest sense of the word.
The data can only be observed by people with access to the cloud's
overlay network for the particular VM.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/utils/embedded/files/ec2_init

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

Modified files:

Index: src/distrib/utils/embedded/files/ec2_init
diff -u src/distrib/utils/embedded/files/ec2_init:1.2 src/distrib/utils/embedded/files/ec2_init:1.3
--- src/distrib/utils/embedded/files/ec2_init:1.2	Thu Jul  1 18:05:45 2021
+++ src/distrib/utils/embedded/files/ec2_init	Thu Jul 15 19:03:17 2021
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: ec2_init,v 1.2 2021/07/01 18:05:45 jmcneill Exp $
+# $NetBSD: ec2_init,v 1.3 2021/07/15 19:03:17 rhialto Exp $
 #
 # PROVIDE: ec2_init
 # REQUIRE: NETWORKING
@@ -20,6 +20,8 @@ HOSTNAME_URL="hostname"
 
 SSH_KEY_FILE="/home/${EC2_USER}/.ssh/authorized_keys"
 
+OS_METADATA_URL="http://169.254.169.254/openstack/latest/meta_data.json;
+
 ec2_newuser()
 {
 	echo "Creating EC2 user account ${EC2_USER}"
@@ -31,11 +33,27 @@ ec2_init()
 	(
 	umask 022
 
+	# set hostname; it may be 5-10 seconds for the metadata service
+	# to  become reachable.
+	try=0
+	while [ $((try++)) -lt 20 ]
+	do
+		HOSTNAME=$(ftp -o - -q 1 "${METADATA_URL}${HOSTNAME_URL}")
+		if [ -n "$HOSTNAME" ]; then
+			echo "Setting EC2 hostname: ${HOSTNAME}"
+			echo "$HOSTNAME" > /etc/myname
+			hostname "$HOSTNAME"
+			break
+		fi
+		echo "EC2 hostname not available yet (try $try)"
+		sleep 1
+	done
+
 	# create EC2 user
 	id "${EC2_USER}" >/dev/null 2>&1 || ec2_newuser
 
-	# fetch the key pair from Amazon Web Services
-	EC2_SSH_KEY=$(ftp -o - "${METADATA_URL}${SSH_KEY_URL}")
+	# fetch the public key from Amazon Web Services
+	EC2_SSH_KEY=$(ftp -o - -q 1 "${METADATA_URL}${SSH_KEY_URL}")
 
 	if [ -n "$EC2_SSH_KEY" ]; then
 		# A key pair is associated with this instance, add it
@@ -48,16 +66,16 @@ ec2_init()
 
 		grep -q "$EC2_SSH_KEY" "$SSH_KEY_FILE"
 		if [ $? -ne 0 ]; then
-			echo "Setting EC2 SSH key pair: ${EC2_SSH_KEY##* }"
+			echo "Setting EC2 SSH public key for user ${EC2_USER}: ${EC2_SSH_KEY##* }"
 			echo "$EC2_SSH_KEY" >> "$SSH_KEY_FILE"
 		fi
 	fi
 
-	# set hostname
-	HOSTNAME=$(ftp -o - "${METADATA_URL}${HOSTNAME_URL}")
-	echo "Setting EC2 hostname: ${HOSTNAME}"
-	echo "$HOSTNAME" > /etc/myname
-	hostname "$HOSTNAME"
+	# May contain a "random_seed". Everything else doesn't matter.
+	OS_METADATA="$(ftp -o - -q 1 ${OS_METADATA_URL})"
+	if echo "$OS_METADATA" | grep -q random_seed; then
+		echo "$OS_METADATA" >> /dev/urandom
+	fi
 	)
 }
 



CVS commit: src/distrib/amd64/liveimage/emuimage

2021-07-15 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Thu Jul 15 17:20:25 UTC 2021

Modified Files:
src/distrib/amd64/liveimage/emuimage: ec2_init

Log Message:
Recognize OpenStack too (it also has a metadata service).

Typical values for machdep.dmi are:

machdep.dmi.system-vendor = OpenStack Foundation
machdep.dmi.system-product = OpenStack Nova
machdep.dmi.system-version = 17.0.12
machdep.dmi.system-serial = c46130fb-a56e-43f2-9d98-492d24656b9c
machdep.dmi.system-uuid = 680b8119-0d74-4f78-a6fd-e79dfede905c
machdep.dmi.bios-vendor = SeaBIOS
machdep.dmi.bios-version = 1.10.2-1ubuntu1
machdep.dmi.bios-date = 20140401
machdep.dmi.chassis-vendor = QEMU
machdep.dmi.chassis-type = QEMU
machdep.dmi.chassis-version = pc-i440fx-2.8
machdep.dmi.processor-vendor = QEMU
machdep.dmi.processor-version = pc-i440fx-2.8
machdep.dmi.processor-frequency = 2000 MHz


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/amd64/liveimage/emuimage/ec2_init

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

Modified files:

Index: src/distrib/amd64/liveimage/emuimage/ec2_init
diff -u src/distrib/amd64/liveimage/emuimage/ec2_init:1.2 src/distrib/amd64/liveimage/emuimage/ec2_init:1.3
--- src/distrib/amd64/liveimage/emuimage/ec2_init:1.2	Wed Sep  9 13:25:48 2020
+++ src/distrib/amd64/liveimage/emuimage/ec2_init	Thu Jul 15 17:20:25 2021
@@ -1,4 +1,4 @@
-# $NetBSD: ec2_init,v 1.2 2020/09/09 13:25:48 jmcneill Exp $
+# $NetBSD: ec2_init,v 1.3 2021/07/15 17:20:25 rhialto Exp $
 
 is_ec2() {
 	val=NO
@@ -13,6 +13,10 @@ is_ec2() {
 			*amazon*)
 val=YES
 ;;
+			# OpenStack is not EC2 but it does have a metadata service.
+			*openstack*)
+val=YES
+;;
 			esac
 		fi
 	done



CVS commit: src/usr.bin/patch

2020-11-17 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Tue Nov 17 20:49:12 UTC 2020

Modified Files:
src/usr.bin/patch: pch.c util.c

Log Message:
Remove heuristic for dealing with trailing newlines being truncated by mailers.

Patch and explanation taken from bsdimp:
https://bsdimp.blogspot.com/2020/08/a-35-year-old-bug-in-patch-found-in.html
https://svnweb.freebsd.org/base?view=revision=364291

Every version of patch since the first one posted to mod.sources in 1985 have
included a heuristic for coping with the state of email messaging at the
time. This heuristic would add up to 4 blank lines to a patch if it thought it
needed it. The trouble is, though this causes at least one bug.

The bug in my case is that if you have a context diff whose last hunk only
deletes 3 or fewer lines, then if you try to reverse apply it with -R, it will
fail. The reason for this is the heuristic builds an internal representation
that includes those blank lines. However, it should really replicate the lines
from the pattern lines line it would any other time, not assume they are blank
lines. Removing this heuristic will prevent patch from misapplying the lines
removed after applying a 'fuzz' factor to the previous blank line in the file. I
believe this will only affect 'new-style' 4.3BSD context diffs and not the
older-style 4.2BSD diffs and plain, non-context diffs. It won't affect any of
the newer formats, since they don't use the 'omitted' construct in the same way.

Since this heuristic was put into patch at a time when email / etc ate trailing
white space on a regular basis, and since it's clear that this heuristic is the
wrong thing to do at least some of the time, it's better to remove it
entirely. It's not been needed for maybe 20 years since patch files are not
usually corrupted. If there are a small number of patch files that would benefit
from this corruption fixing, those already-currupt patches can be fixed by the
addition of blank lines. I'd wager that no one will ever come to me with an
example of a once-working patch file that breaks with this change. However, I
have 2 patches from the first 195 patches to 2.11BSD that are affected by this
bug, suggesting that the relative frequency of the issue has changed
signficantly since the original heuristic was put into place.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/patch/pch.c
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/patch/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/usr.bin/patch/pch.c
diff -u src/usr.bin/patch/pch.c:1.30 src/usr.bin/patch/pch.c:1.31
--- src/usr.bin/patch/pch.c:1.30	Mon Jun 18 18:33:31 2018
+++ src/usr.bin/patch/pch.c	Tue Nov 17 20:49:12 2020
@@ -1,7 +1,7 @@
 /*
  * $OpenBSD: pch.c,v 1.37 2007/09/02 15:19:33 deraadt Exp $
  * $DragonFly: src/usr.bin/patch/pch.c,v 1.6 2008/08/10 23:35:40 joerg Exp $
- * $NetBSD: pch.c,v 1.30 2018/06/18 18:33:31 christos Exp $
+ * $NetBSD: pch.c,v 1.31 2020/11/17 20:49:12 rhialto Exp $
  */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pch.c,v 1.30 2018/06/18 18:33:31 christos Exp $");
+__RCSID("$NetBSD: pch.c,v 1.31 2020/11/17 20:49:12 rhialto Exp $");
 
 #include 
 #include 
@@ -556,16 +556,11 @@ another_hunk(void)
 			ret = pgets(buf, buf_len, pfp);
 			p_input_line++;
 			if (ret == NULL) {
-if (p_max - p_end < 4) {
-	/* assume blank lines got chopped */
-	strlcpy(buf, "  \n", buf_len);
-} else {
-	if (repl_beginning && repl_could_be_missing) {
-		repl_missing = true;
-		goto hunk_done;
-	}
-	fatal("unexpected end of file in patch\n");
+if (repl_beginning && repl_could_be_missing) {
+	repl_missing = true;
+	goto hunk_done;
 }
+fatal("unexpected end of file in patch\n");
 			}
 			p_end++;
 			if (p_end >= hunkmax)

Index: src/usr.bin/patch/util.c
diff -u src/usr.bin/patch/util.c:1.28 src/usr.bin/patch/util.c:1.29
--- src/usr.bin/patch/util.c:1.28	Mon Jun 18 18:33:31 2018
+++ src/usr.bin/patch/util.c	Tue Nov 17 20:49:12 2020
@@ -1,7 +1,7 @@
 /*
  * $OpenBSD: util.c,v 1.32 2006/03/11 19:41:30 otto Exp $
  * $DragonFly: src/usr.bin/patch/util.c,v 1.9 2007/09/29 23:11:10 swildner Exp $
- * $NetBSD: util.c,v 1.28 2018/06/18 18:33:31 christos Exp $
+ * $NetBSD: util.c,v 1.29 2020/11/17 20:49:12 rhialto Exp $
  */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: util.c,v 1.28 2018/06/18 18:33:31 christos Exp $");
+__RCSID("$NetBSD: util.c,v 1.29 2020/11/17 20:49:12 rhialto Exp $");
 
 #include 
 #include 
@@ -417,7 +417,7 @@ checked_in(char *file)
 void
 version(void)
 {
-	printf("Patch version 2.0-12u8-NetBSD\n");
+	printf("Patch version 2.0-12u9-NetBSD\n");
 	my_exit(EXIT_SUCCESS);
 }
 



CVS commit: src/libexec/httpd

2020-09-12 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Sat Sep 12 14:44:25 UTC 2020

Modified Files:
src/libexec/httpd: content-bozo.c

Log Message:
bozohttpd: correct .m4a to audio/mp4.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/libexec/httpd/content-bozo.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/httpd/content-bozo.c
diff -u src/libexec/httpd/content-bozo.c:1.17 src/libexec/httpd/content-bozo.c:1.18
--- src/libexec/httpd/content-bozo.c:1.17	Sat Sep 12 12:39:28 2020
+++ src/libexec/httpd/content-bozo.c	Sat Sep 12 14:44:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: content-bozo.c,v 1.17 2020/09/12 12:39:28 rhialto Exp $	*/
+/*	$NetBSD: content-bozo.c,v 1.18 2020/09/12 14:44:25 rhialto Exp $	*/
 
 /*	$eterna: content-bozo.c,v 1.17 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -135,7 +135,7 @@ static bozo_content_map_t static_content
 	{ ".snd",	"audio/basic",			"",		"", NULL },
 	{ ".mpga",	"audio/mpeg",			"",		"", NULL },
 	{ ".mp2",	"audio/mpeg",			"",		"", NULL },
-	{ ".m4a",	"audio/mpeg",			"",		"", NULL },
+	{ ".m4a",	"audio/mp4",			"",		"", NULL },
 	{ ".aif",	"audio/x-aiff",			"",		"", NULL },
 	{ ".aiff",	"audio/x-aiff",			"",		"", NULL },
 	{ ".aifc",	"audio/x-aiff",			"",		"", NULL },



CVS commit: src/libexec/httpd

2020-09-12 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Sat Sep 12 12:39:28 UTC 2020

Modified Files:
src/libexec/httpd: CHANGES content-bozo.c

Log Message:
bozohttpd: add .m4a and .m4v file extensions.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/libexec/httpd/CHANGES
cvs rdiff -u -r1.16 -r1.17 src/libexec/httpd/content-bozo.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/httpd/CHANGES
diff -u src/libexec/httpd/CHANGES:1.41 src/libexec/httpd/CHANGES:1.42
--- src/libexec/httpd/CHANGES:1.41	Thu Aug 20 07:55:10 2020
+++ src/libexec/httpd/CHANGES	Sat Sep 12 12:39:28 2020
@@ -1,4 +1,7 @@
-$NetBSD: CHANGES,v 1.41 2020/08/20 07:55:10 mrg Exp $
+$NetBSD: CHANGES,v 1.42 2020/09/12 12:39:28 rhialto Exp $
+
+changes in bozohttpd 20200912:
+	o  add .m4a and .m4v file extensions.
 
 changes in bozohttpd 20200820:
 	o  make this work on sun2 by reducing mmap window there.

Index: src/libexec/httpd/content-bozo.c
diff -u src/libexec/httpd/content-bozo.c:1.16 src/libexec/httpd/content-bozo.c:1.17
--- src/libexec/httpd/content-bozo.c:1.16	Fri Nov 23 08:11:20 2018
+++ src/libexec/httpd/content-bozo.c	Sat Sep 12 12:39:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: content-bozo.c,v 1.16 2018/11/23 08:11:20 mrg Exp $	*/
+/*	$NetBSD: content-bozo.c,v 1.17 2020/09/12 12:39:28 rhialto Exp $	*/
 
 /*	$eterna: content-bozo.c,v 1.17 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -135,6 +135,7 @@ static bozo_content_map_t static_content
 	{ ".snd",	"audio/basic",			"",		"", NULL },
 	{ ".mpga",	"audio/mpeg",			"",		"", NULL },
 	{ ".mp2",	"audio/mpeg",			"",		"", NULL },
+	{ ".m4a",	"audio/mpeg",			"",		"", NULL },
 	{ ".aif",	"audio/x-aiff",			"",		"", NULL },
 	{ ".aiff",	"audio/x-aiff",			"",		"", NULL },
 	{ ".aifc",	"audio/x-aiff",			"",		"", NULL },
@@ -167,6 +168,7 @@ static bozo_content_map_t static_content
 	{ ".ts",	"video/mpeg",			"",		"", NULL },
 	{ ".vob",	"video/mpeg",			"",		"", NULL },
 	{ ".mp4",	"video/mp4",			"",		"", NULL },
+	{ ".m4v",	"video/mp4",			"",		"", NULL },
 	{ ".qt",	"video/quicktime",		"",		"", NULL },
 	{ ".mov",	"video/quicktime",		"",		"", NULL },
 	{ ".avi",	"video/x-msvideo",		"",		"", NULL },



CVS commit: src/sys/dev/hid

2020-04-24 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Fri Apr 24 13:29:46 UTC 2020

Modified Files:
src/sys/dev/hid: hidkbdmap.c

Log Message:
For usb keyboards with encoding *.swapctrlcaps, keep KS_Cmd1 on the same
key as KS_Control_L. This brings them in line with wskbdmap_mfii.c.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hid/hidkbdmap.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/hid/hidkbdmap.c
diff -u src/sys/dev/hid/hidkbdmap.c:1.2 src/sys/dev/hid/hidkbdmap.c:1.3
--- src/sys/dev/hid/hidkbdmap.c:1.2	Sat Jan 11 21:43:10 2020
+++ src/sys/dev/hid/hidkbdmap.c	Fri Apr 24 13:29:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hidkbdmap.c,v 1.2 2020/01/11 21:43:10 nia Exp $	*/
+/*	$NetBSD: hidkbdmap.c,v 1.3 2020/04/24 13:29:46 rhialto Exp $	*/
 
 /*
  * Copyright (c) 1999,2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hidkbdmap.c,v 1.2 2020/01/11 21:43:10 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hidkbdmap.c,v 1.3 2020/04/24 13:29:46 rhialto Exp $");
 
 #include 
 #include 
@@ -279,8 +279,8 @@ Static const keysym_t hidkbd_keydesc_us_
 
 Static const keysym_t hidkbd_keydesc_swapctrlcaps[] = {
 /*  pos  command		normal		shifted */
-KC(57), 			KS_Control_L,
-KC(224), KS_Cmd1,		KS_Caps_Lock,
+KC(57),  KS_Cmd1,		KS_Control_L,
+KC(224), 			KS_Caps_Lock,
 };
 
 Static const keysym_t hidkbd_keydesc_de[] = {