CVS commit: [netbsd-7-0] src/sys/kern

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 15 04:48:16 UTC 2018

Modified Files:
src/sys/kern [netbsd-7-0]: uipc_mbuf.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1602):

sys/kern/uipc_mbuf.c: revision 1.211 (via patch)

Modify m_defrag, so that it never frees the first mbuf of the chain. While
here use the given 'flags' argument, and not M_DONTWAIT.

We have a problem with several drivers: they poll an mbuf chain from their
queues and call m_defrag on them, but m_defrag could update the mbuf
pointer, so the mbuf in the queue is no longer valid. It is not easy to
fix each driver, because doing pop+push will reorder the queue, and we
don't really want that to happen.

This problem was independently spotted by me, Kengo, Masanobu, and other
people too it seems (perhaps PR/53218).

Now m_defrag leaves the first mbuf in place, and compresses the chain
only starting from the second mbuf in the chain.

It is important not to compress the first mbuf with hacks, because the
storage of this first mbuf may be shared with other mbufs.


To generate a diff of this commit:
cvs rdiff -u -r1.158.4.1.2.2 -r1.158.4.1.2.3 src/sys/kern/uipc_mbuf.c

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

Modified files:

Index: src/sys/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.158.4.1.2.2 src/sys/kern/uipc_mbuf.c:1.158.4.1.2.3
--- src/sys/kern/uipc_mbuf.c:1.158.4.1.2.2	Tue Apr 17 08:30:08 2018
+++ src/sys/kern/uipc_mbuf.c	Tue May 15 04:48:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.2 2018/04/17 08:30:08 martin Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.3 2018/05/15 04:48:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.2 2018/04/17 08:30:08 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.3 2018/05/15 04:48:16 martin Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_nmbclusters.h"
@@ -1376,30 +1376,35 @@ m_makewritable(struct mbuf **mp, int off
 }
 
 /*
- * Copy the mbuf chain to a new mbuf chain that is as short as possible.
- * Return the new mbuf chain on success, NULL on failure.  On success,
- * free the old mbuf chain.
+ * Compress the mbuf chain. Return the new mbuf chain on success, NULL on
+ * failure. The first mbuf is preserved, and on success the pointer returned
+ * is the same as the one passed.
  */
 struct mbuf *
 m_defrag(struct mbuf *mold, int flags)
 {
 	struct mbuf *m0, *mn, *n;
-	size_t sz = mold->m_pkthdr.len;
+	int sz;
 
 #ifdef DIAGNOSTIC
 	if ((mold->m_flags & M_PKTHDR) == 0)
 		panic("m_defrag: not a mbuf chain header");
 #endif
 
-	m0 = m_gethdr(flags, MT_DATA);
+	if (mold->m_next == NULL)
+		return mold;
+
+	m0 = m_get(flags, MT_DATA);
 	if (m0 == NULL)
 		return NULL;
-	M_COPY_PKTHDR(m0, mold);
 	mn = m0;
 
+	sz = mold->m_pkthdr.len - mold->m_len;
+	KASSERT(sz >= 0);
+
 	do {
-		if (sz > MHLEN) {
-			MCLGET(mn, M_DONTWAIT);
+		if (sz > MLEN) {
+			MCLGET(mn, flags);
 			if ((mn->m_flags & M_EXT) == 0) {
 m_freem(m0);
 return NULL;
@@ -1415,7 +1420,7 @@ m_defrag(struct mbuf *mold, int flags)
 
 		if (sz > 0) {
 			/* need more mbufs */
-			n = m_get(M_NOWAIT, MT_DATA);
+			n = m_get(flags, MT_DATA);
 			if (n == NULL) {
 m_freem(m0);
 return NULL;
@@ -1426,9 +1431,10 @@ m_defrag(struct mbuf *mold, int flags)
 		}
 	} while (sz > 0);
 
-	m_freem(mold);
+	m_freem(mold->m_next);
+	mold->m_next = m0;
 
-	return m0;
+	return mold;
 }
 
 int



CVS commit: [netbsd-7-0] src/sys/kern

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 15 04:48:16 UTC 2018

Modified Files:
src/sys/kern [netbsd-7-0]: uipc_mbuf.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1602):

sys/kern/uipc_mbuf.c: revision 1.211 (via patch)

Modify m_defrag, so that it never frees the first mbuf of the chain. While
here use the given 'flags' argument, and not M_DONTWAIT.

We have a problem with several drivers: they poll an mbuf chain from their
queues and call m_defrag on them, but m_defrag could update the mbuf
pointer, so the mbuf in the queue is no longer valid. It is not easy to
fix each driver, because doing pop+push will reorder the queue, and we
don't really want that to happen.

This problem was independently spotted by me, Kengo, Masanobu, and other
people too it seems (perhaps PR/53218).

Now m_defrag leaves the first mbuf in place, and compresses the chain
only starting from the second mbuf in the chain.

It is important not to compress the first mbuf with hacks, because the
storage of this first mbuf may be shared with other mbufs.


To generate a diff of this commit:
cvs rdiff -u -r1.158.4.1.2.2 -r1.158.4.1.2.3 src/sys/kern/uipc_mbuf.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/bta2dpd/bta2dpd

2018-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue May 15 04:25:25 UTC 2018

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

Log Message:
Use the correct tag options.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.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/bta2dpd/bta2dpd/bta2dpd.8
diff -u src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.2 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.3
--- src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8:1.2	Sat Jan 28 23:52:45 2017
+++ src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8	Tue May 15 04:25:25 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bta2dpd.8,v 1.2 2017/01/28 23:52:45 wiz Exp $
+.\"	$NetBSD: bta2dpd.8,v 1.3 2018/05/15 04:25:25 nat Exp $
 .\"
 .\" Copyright (c) 2015 - 2016  Nathanial Sloss 
 .\" All rights reserved.
@@ -85,7 +85,7 @@ The
 daemon is used to transmit/receive audio to/from Bluetooth devices such as
 speakers or headphones, using the Advanced Audio Distribution Profile
 (A2DP).
-.Bl -tag -indent width
+.Bl -tag -width indent
 .It Fl a Ar address
 Remote device address.
 The
@@ -165,7 +165,7 @@ command as stated in
 .Sx EXAMPLES .
 .El
 .Ss Channel Modes
-.Bl -tag -indent width
+.Bl -tag -width indent
 .It Fl f Ar channel_mode
 .Bl -tag -width 2n
 .It Ar 0
@@ -194,9 +194,9 @@ This defaults to 44.1 kHz.
 A value of 0 will arbitrate from the highest to lowest frequency.
 .El
 .Ss Sub Band Codec (SBC) Encoding Options
-.Bl -tag -indent width
+.Bl -tag -width indent
 .It Fl A Ar bitpool_allocation
-.Bl -tag width 2n
+.Bl -tag -width 2n
 .It Ar 0
 Bit Allocation is negotiated starting with Loudness then SNR.
 .It Ar S



CVS commit: src/usr.sbin/bta2dpd/bta2dpd

2018-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue May 15 04:25:25 UTC 2018

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

Log Message:
Use the correct tag options.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.8

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



CVS commit: src/sys/dev/i2c

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 15 02:02:18 UTC 2018

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

Log Message:
Fix a problem reported by jmcneill@ where by a system with multuple i2c
busses would end up with "ghost" device instances on the second bus.  This
issue was previously masked on ARM systems by the empty-child-devices
array issue fixed recently (that effectively blocked all indirect config
of i2c busses on those systems).

To fix this problem, we require that indirectly-configured devices have
to fully specify their parent spec and address, e.g.:

foo* at iic0 addr 0x55

NOT

foo* at iic? addr ?

or even:

foo* at iic? addr 0x55

This is needed because of how indirect configuration works... attach
directives in the kernel config file are enumerated, calling the bus's
search routine, which in the case of i2c, enumerates all i2c addresses
and calls the match routine for each address.  Because we can't always
reliably probe for i2c devices, we ended up with erroneous matches.

Direct configuration of i2c is still allowed to use wildcarded parent specs
and locators.


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

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

Modified files:

Index: src/sys/dev/i2c/i2c.c
diff -u src/sys/dev/i2c/i2c.c:1.57 src/sys/dev/i2c/i2c.c:1.58
--- src/sys/dev/i2c/i2c.c:1.57	Sun Dec 10 16:53:32 2017
+++ src/sys/dev/i2c/i2c.c	Tue May 15 02:02:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2c.c,v 1.57 2017/12/10 16:53:32 bouyer Exp $	*/
+/*	$NetBSD: i2c.c,v 1.58 2018/05/15 02:02:18 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.57 2017/12/10 16:53:32 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.58 2018/05/15 02:02:18 thorpej Exp $");
 
 #include 
 #include 
@@ -121,7 +121,7 @@ iic_print(void *aux, const char *pnp)
 {
 	struct i2c_attach_args *ia = aux;
 
-	if (ia->ia_addr != (i2c_addr_t)-1)
+	if (ia->ia_addr != (i2c_addr_t)IICCF_ADDR_DEFAULT)
 		aprint_normal(" addr 0x%x", ia->ia_addr);
 
 	return UNCONF;
@@ -133,6 +133,16 @@ iic_search(device_t parent, cfdata_t cf,
 	struct iic_softc *sc = device_private(parent);
 	struct i2c_attach_args ia;
 
+	/*
+	 * I2C doesn't have any regular probing capability.  If we
+	 * encounter a cfdata with a wild-carded address or a wild-
+	 * carded parent spec, we skip them because they can only
+	 * be used for direct-coniguration.
+	 */
+	if (cf->cf_loc[IICCF_ADDR] == IICCF_ADDR_DEFAULT ||
+	cf->cf_pspec->cfp_unit == DVUNIT_ANY)
+		return 0;
+
 	ia.ia_tag = sc->sc_tag;
 	ia.ia_size = cf->cf_loc[IICCF_SIZE];
 	ia.ia_type = sc->sc_type;
@@ -146,8 +156,7 @@ iic_search(device_t parent, cfdata_t cf,
 		if (sc->sc_devices[ia.ia_addr] != NULL)
 			continue;
 
-		if (cf->cf_loc[IICCF_ADDR] != -1 &&
-		cf->cf_loc[IICCF_ADDR] != ia.ia_addr)
+		if (cf->cf_loc[IICCF_ADDR] != ia.ia_addr)
 			continue;
 
 		if (config_match(parent, cf, ) > 0)



CVS commit: src/sys/dev/i2c

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 15 02:02:18 UTC 2018

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

Log Message:
Fix a problem reported by jmcneill@ where by a system with multuple i2c
busses would end up with "ghost" device instances on the second bus.  This
issue was previously masked on ARM systems by the empty-child-devices
array issue fixed recently (that effectively blocked all indirect config
of i2c busses on those systems).

To fix this problem, we require that indirectly-configured devices have
to fully specify their parent spec and address, e.g.:

foo* at iic0 addr 0x55

NOT

foo* at iic? addr ?

or even:

foo* at iic? addr 0x55

This is needed because of how indirect configuration works... attach
directives in the kernel config file are enumerated, calling the bus's
search routine, which in the case of i2c, enumerates all i2c addresses
and calls the match routine for each address.  Because we can't always
reliably probe for i2c devices, we ended up with erroneous matches.

Direct configuration of i2c is still allowed to use wildcarded parent specs
and locators.


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

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



CVS commit: src/sys/arch

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 15 01:53:27 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: ALL GENERIC XEN3_DOM0
src/sys/arch/i386/conf: ALL GENERIC XEN3_DOM0

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.

N.B. The x86 platforms are sort of a mess, here... legacy indirect
config and ACPI direct config sort of smashed together with the
same config file directives.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.490 -r1.491 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.149 -r1.150 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.438 -r1.439 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1177 -r1.1178 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/i386/conf/XEN3_DOM0

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



CVS commit: src/sys/arch

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 15 01:53:27 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: ALL GENERIC XEN3_DOM0
src/sys/arch/i386/conf: ALL GENERIC XEN3_DOM0

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.

N.B. The x86 platforms are sort of a mess, here... legacy indirect
config and ACPI direct config sort of smashed together with the
same config file directives.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.490 -r1.491 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.149 -r1.150 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.438 -r1.439 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1177 -r1.1178 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/i386/conf/XEN3_DOM0

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/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.86 src/sys/arch/amd64/conf/ALL:1.87
--- src/sys/arch/amd64/conf/ALL:1.86	Tue May  1 16:16:05 2018
+++ src/sys/arch/amd64/conf/ALL	Tue May 15 01:53:27 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.86 2018/05/01 16:16:05 maya Exp $
+# $NetBSD: ALL,v 1.87 2018/05/15 01:53:27 thorpej Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.86 $"
+#ident		"ALL-$Revision: 1.87 $"
 
 maxusers	64		# estimated number of users
 
@@ -594,7 +594,7 @@ wbsio*	at isa? port 0x2e
 wbsio*	at isa? port 0x4e
 
 # IBM Hawk Integrated Systems Management Processor
-ibmhawk0	at iic? addr 0x37
+ibmhawk0	at iic0 addr 0x37
 
 # Intel Integrated Memory Controller SMBus (experimental)
 imc* at pci? dev ? function ?		# Intel Integrated Memory Controller,
@@ -610,8 +610,8 @@ lm*	at wbsio?
 smsc0	at isa? port 0x02e
 
 # SMSC LPC47M192 hardware monitor
-smscmon*	at iic? addr 0x2c
-smscmon*	at iic? addr 0x2d	# (alternate address)
+smscmon*	at iic0 addr 0x2c
+smscmon*	at iic0 addr 0x2d	# (alternate address)
 
 # AMD 768 and 8111 power/ACPI controllers
 amdpm*	at pci? dev ? function ?	# RNG and SMBus 1.0 interface
@@ -639,20 +639,20 @@ dwiic*		at pci?			# I2C controller
 iic*		at dwiic?
 
 # dbCool Thermal monitor and fan controller
-dbcool* at iic? addr 0x2C		# Unknown other motherboard(s)
-dbcool* at iic? addr 0x2D		# Tyan S2881
-dbcool* at iic? addr 0x2E		# Tyan S2882-D
+dbcool* at iic0 addr 0x2C		# Unknown other motherboard(s)
+dbcool* at iic0 addr 0x2D		# Tyan S2881
+dbcool* at iic0 addr 0x2E		# Tyan S2882-D
 
 # IBM Hawk Integrated Systems Management Processor
-ibmhawk0	at iic?	addr 0x37
+ibmhawk0	at iic0	addr 0x37
 
 # LM7[89] and compatible hardware monitors
 # Use flags to select temp sensor type (see lm(4) man page for details)
-lm0	at iic?	addr 0x2e flags 0x0
+lm0	at iic0	addr 0x2e flags 0x0
 
 # SMSC LPC47M192 hardware monitor
-smscmon*	at iic? addr 0x2c
-#smscmon*	at iic? addr 0x2d	# (alternate address)
+smscmon*	at iic0 addr 0x2c
+#smscmon*	at iic0 addr 0x2d	# (alternate address)
 
 # IBM Thinkpad Active Protection System
 aps0	at isa? port 0x1600
@@ -685,22 +685,22 @@ ug0	at isa? port 0xe0
 viaenv* 	at pci? dev ? function ?
 
 # Serial Presence Detect capable memory modules and optional temp sensors
-spdmem* at iic? addr 0x50
-spdmem* at iic? addr 0x51
-spdmem* at iic? addr 0x52
-spdmem* at iic? addr 0x53
-spdmem* at iic? addr 0x54
-spdmem* at iic? addr 0x55
-spdmem* at iic? addr 0x56
-spdmem* at iic? addr 0x57
-sdtemp* at iic? addr 0x18
-sdtemp* at iic? addr 0x19
-sdtemp* at iic? addr 0x1a
-sdtemp* at iic? addr 0x1b
-sdtemp* at iic? addr 0x1c
-sdtemp* at iic? addr 0x1d
-sdtemp* at iic? addr 0x1e
-sdtemp* at iic? addr 0x1f
+spdmem* at iic0 addr 0x50
+spdmem* at iic0 addr 0x51
+spdmem* at iic0 addr 0x52
+spdmem* at iic0 addr 0x53
+spdmem* at iic0 addr 0x54
+spdmem* at iic0 addr 0x55
+spdmem* at iic0 addr 0x56
+spdmem* at iic0 addr 0x57
+sdtemp* at iic0 addr 0x18
+sdtemp* at iic0 addr 0x19
+sdtemp* at iic0 addr 0x1a
+sdtemp* at iic0 addr 0x1b
+sdtemp* at iic0 addr 0x1c
+sdtemp* at iic0 addr 0x1d
+sdtemp* at iic0 addr 0x1e
+sdtemp* at iic0 addr 0x1f
 
 # I2C HID devices
 ihidev* at iic?

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.490 src/sys/arch/amd64/conf/GENERIC:1.491
--- src/sys/arch/amd64/conf/GENERIC:1.490	Fri May 11 07:44:47 2018
+++ src/sys/arch/amd64/conf/GENERIC	Tue May 15 01:53:27 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.490 2018/05/11 07:44:47 maya Exp $
+# $NetBSD: GENERIC,v 1.491 2018/05/15 01:53:27 thorpej Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 

CVS commit: src/usr.bin/usbhidaction

2018-05-14 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue May 15 01:41:30 UTC 2018

Modified Files:
src/usr.bin/usbhidaction: usbhidaction.1 usbhidaction.c

Log Message:
Add an optional '-p pidfile' parameter.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/usbhidaction/usbhidaction.1
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/usbhidaction/usbhidaction.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/usbhidaction/usbhidaction.1
diff -u src/usr.bin/usbhidaction/usbhidaction.1:1.15 src/usr.bin/usbhidaction/usbhidaction.1:1.16
--- src/usr.bin/usbhidaction/usbhidaction.1:1.15	Wed Apr 30 13:11:01 2008
+++ src/usr.bin/usbhidaction/usbhidaction.1	Tue May 15 01:41:29 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: usbhidaction.1,v 1.15 2008/04/30 13:11:01 martin Exp $
+.\" $NetBSD: usbhidaction.1,v 1.16 2018/05/15 01:41:29 jmcneill Exp $
 .\"
 .\" Copyright (c) 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 20, 2004
+.Dd May 14, 2018
 .Dt USBHIDACTION 1
 .Os
 .Sh NAME
@@ -39,6 +39,7 @@
 .Op Fl d
 .Op Fl i
 .Fl f Ar device
+.Op Fl p Ar pidfile
 .Op Fl t Ar table
 .Op Fl v
 .Op Ar arg ...
@@ -69,6 +70,14 @@ If it is a relative
 path, it is taken to be the name of the device under
 .Pa /dev .
 An absolute path is taken to be the literal device pathname.
+.It Fl p Ar pidfile
+Writes a file containing the process ID of the program.
+The file name has the form
+.Pa /var/run/usbhidaction.pid .
+If the option is not given,
+.Ar pidfile
+defaults to
+.Pa usbhidaction .
 .It Fl t Ar table
 Specify a path name for the HID usage table file.
 .It Fl v

Index: src/usr.bin/usbhidaction/usbhidaction.c
diff -u src/usr.bin/usbhidaction/usbhidaction.c:1.28 src/usr.bin/usbhidaction/usbhidaction.c:1.29
--- src/usr.bin/usbhidaction/usbhidaction.c:1.28	Sun Dec 10 20:38:14 2017
+++ src/usr.bin/usbhidaction/usbhidaction.c	Tue May 15 01:41:29 2018
@@ -1,4 +1,4 @@
-/*  $NetBSD: usbhidaction.c,v 1.28 2017/12/10 20:38:14 bouyer Exp $ */
+/*  $NetBSD: usbhidaction.c,v 1.29 2018/05/15 01:41:29 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: usbhidaction.c,v 1.28 2017/12/10 20:38:14 bouyer Exp $");
+__RCSID("$NetBSD: usbhidaction.c,v 1.29 2018/05/15 01:41:29 jmcneill Exp $");
 #endif
 
 #include 
@@ -95,13 +95,14 @@ main(int argc, char **argv)
 	struct command *cmd;
 	int reportid;
 	const char *table = NULL;
+	const char *pidfn = NULL;
 
 	setprogname(argv[0]);
 	(void)setlinebuf(stdout);
 
 	demon = 1;
 	ignore = 0;
-	while ((ch = getopt(argc, argv, "c:df:it:v")) != -1) {
+	while ((ch = getopt(argc, argv, "c:df:ip:t:v")) != -1) {
 		switch(ch) {
 		case 'c':
 			conf = optarg;
@@ -115,6 +116,9 @@ main(int argc, char **argv)
 		case 'f':
 			dev = optarg;
 			break;
+		case 'p':
+			pidfn = optarg;
+			break;
 		case 't':
 			table = optarg;
 			break;
@@ -169,7 +173,7 @@ main(int argc, char **argv)
 	if (demon) {
 		if (daemon(0, 0) < 0)
 			err(EXIT_FAILURE, "daemon()");
-		(void)pidfile(NULL);
+		(void)pidfile(pidfn);
 		isdemon = 1;
 	}
 
@@ -214,7 +218,7 @@ usage(void)
 {
 
 	(void)fprintf(stderr, "usage: %s -c config_file [-d] -f hid_dev "
-		"[-i] [-t table] [-v]\n", getprogname());
+		"[-i] [-p pidfile] [-t table] [-v]\n", getprogname());
 	exit(EXIT_FAILURE);
 }
 



CVS commit: src/usr.bin/usbhidaction

2018-05-14 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue May 15 01:41:30 UTC 2018

Modified Files:
src/usr.bin/usbhidaction: usbhidaction.1 usbhidaction.c

Log Message:
Add an optional '-p pidfile' parameter.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/usbhidaction/usbhidaction.1
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/usbhidaction/usbhidaction.c

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



Re: CVS commit: src/sys/arch/alpha/conf

2018-05-14 Thread Jason Thorpe
Oh, but to be clear, the iic instances themselves would not be in conflict, 
because they are direct-configured by THEIR parents, and alipm and tsc wont 
both exist on a given machine.

It’s the i2c devices themselves I was referring to in my previous message.

The autoconfig system used to be able to handle “foo0” being specified at 
multiple parents (but it would only attach one of them).  Has that changed?

-- thorpej
Sent from my iPhone.

> On May 14, 2018, at 6:24 PM, Jason Thorpe  wrote:
> 
> They would have conflicted already in the old stuff.  This would be a great 
> application for using direct configuration of i2c on this platform.
> 
> -- thorpej
> Sent from my iPhone.
> 
>> On May 14, 2018, at 6:11 PM, Jonathan A. Kollasch  
>> wrote:
>> 
>> Module Name:src
>> Committed By:jakllsch
>> Date:Mon May 14 22:11:30 UTC 2018
>> 
>> Modified Files:
>>   src/sys/arch/alpha/conf: GENERIC
>> 
>> Log Message:
>> Move iic0 at alipm? to iic1.  Using iic0 will conflict with the
>> iic0 at tsciic? on the API CS20.
>> 
>> XXX: Enumerate the similar-to-DS20L I2C devices on the CS20, which
>> IIRC are not all on the tsciic(4) I2C bus, and comment GENERIC
>> accordingly.
>> 
>> 
>> To generate a diff of this commit:
>> cvs rdiff -u -r1.380 -r1.381 src/sys/arch/alpha/conf/GENERIC
>> 
>> Please note that diffs are not public domain; they are subject to the
>> copyright notices on the relevant files.
>> 


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

2018-05-14 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue May 15 01:26:46 UTC 2018

Modified Files:
src/sys/arch/arm/sunxi: sun50i_a64_acodec.c

Log Message:
Add outputs.mute control


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sun50i_a64_acodec.c

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



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

2018-05-14 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue May 15 01:26:46 UTC 2018

Modified Files:
src/sys/arch/arm/sunxi: sun50i_a64_acodec.c

Log Message:
Add outputs.mute control


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sun50i_a64_acodec.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sun50i_a64_acodec.c
diff -u src/sys/arch/arm/sunxi/sun50i_a64_acodec.c:1.5 src/sys/arch/arm/sunxi/sun50i_a64_acodec.c:1.6
--- src/sys/arch/arm/sunxi/sun50i_a64_acodec.c:1.5	Sun May 13 01:01:37 2018
+++ src/sys/arch/arm/sunxi/sun50i_a64_acodec.c	Tue May 15 01:26:45 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i_a64_acodec.c,v 1.5 2018/05/13 01:01:37 jmcneill Exp $ */
+/* $NetBSD: sun50i_a64_acodec.c,v 1.6 2018/05/15 01:26:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sun50i_a64_acodec.c,v 1.5 2018/05/13 01:01:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sun50i_a64_acodec.c,v 1.6 2018/05/15 01:26:45 jmcneill Exp $");
 
 #include 
 #include 
@@ -111,6 +111,7 @@ enum a64_acodec_mixer_ctrl {
 	A64_CODEC_RECORD_CLASS,
 
 	A64_CODEC_OUTPUT_MASTER_VOLUME,
+	A64_CODEC_OUTPUT_MUTE,
 	A64_CODEC_OUTPUT_SOURCE,
 	A64_CODEC_INPUT_LINE_VOLUME,
 	A64_CODEC_INPUT_HP_VOLUME,
@@ -228,11 +229,6 @@ a64_acodec_trigger_output(void *priv, vo
 	a64_acodec_pr_set_clear(sc, A64_MIX_DAC_CTRL,
 	A64_DACAREN | A64_DACALEN | A64_RMIXEN | A64_LMIXEN |
 	A64_RHPPAMUTE | A64_LHPPAMUTE, 0);
-	/* Unmute DAC l/r channels to output mixer */
-	a64_acodec_pr_set_clear(sc, A64_OL_MIX_CTRL,
-	A64_LMIXMUTE_LDAC, 0);
-	a64_acodec_pr_set_clear(sc, A64_OR_MIX_CTRL,
-	A64_RMIXMUTE_RDAC, 0);
 
 	return 0;
 }
@@ -255,11 +251,6 @@ a64_acodec_halt_output(void *priv)
 {
 	struct a64_acodec_softc * const sc = priv;
 
-	/* Mute DAC l/r channels to output mixer */
-	a64_acodec_pr_set_clear(sc, A64_OL_MIX_CTRL,
-	0, A64_LMIXMUTE_LDAC);
-	a64_acodec_pr_set_clear(sc, A64_OR_MIX_CTRL,
-	0, A64_RMIXMUTE_RDAC);
 	/* Disable DAC analog l/r channels, HP PA, and output mixer */
 	a64_acodec_pr_set_clear(sc, A64_MIX_DAC_CTRL,
 	0, A64_DACAREN | A64_DACALEN | A64_RMIXEN | A64_LMIXEN |
@@ -308,6 +299,22 @@ a64_acodec_set_port(void *priv, mixer_ct
 		a64_acodec_pr_write(sc, mix->reg, val);
 		return 0;
 
+	case A64_CODEC_OUTPUT_MUTE:
+		if (mc->un.ord < 0 || mc->un.ord > 1)
+			return EINVAL;
+		if (mc->un.ord) {
+			a64_acodec_pr_set_clear(sc, A64_OL_MIX_CTRL,
+			0, A64_LMIXMUTE_LDAC);
+			a64_acodec_pr_set_clear(sc, A64_OR_MIX_CTRL,
+			0, A64_RMIXMUTE_RDAC);
+		} else {
+			a64_acodec_pr_set_clear(sc, A64_OL_MIX_CTRL,
+			A64_LMIXMUTE_LDAC, 0);
+			a64_acodec_pr_set_clear(sc, A64_OR_MIX_CTRL,
+			A64_RMIXMUTE_RDAC, 0);
+		}
+		return 0;
+
 	case A64_CODEC_OUTPUT_SOURCE:
 		if (mc->un.mask & A64_OUTPUT_SOURCE_LINE)
 			a64_acodec_pr_set_clear(sc, A64_LINEOUT_CTRL0,
@@ -360,6 +367,14 @@ a64_acodec_get_port(void *priv, mixer_ct
 		mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = nvol;
 		return 0;
 
+	case A64_CODEC_OUTPUT_MUTE:
+		mc->un.ord = 1;
+		if (a64_acodec_pr_read(sc, A64_OL_MIX_CTRL) & A64_LMIXMUTE_LDAC)
+			mc->un.ord = 0;
+		if (a64_acodec_pr_read(sc, A64_OR_MIX_CTRL) & A64_RMIXMUTE_RDAC)
+			mc->un.ord = 0;
+		return 0;
+
 	case A64_CODEC_OUTPUT_SOURCE:
 		mc->un.mask = 0;
 		if (a64_acodec_pr_read(sc, A64_LINEOUT_CTRL0) & A64_LINEOUT_EN)
@@ -435,6 +450,18 @@ a64_acodec_query_devinfo(void *priv, mix
 		strcpy(di->un.v.units.name, AudioNvolume);
 		return 0;
 
+	case A64_CODEC_OUTPUT_MUTE:
+		di->mixer_class = A64_CODEC_OUTPUT_CLASS;
+		strcpy(di->label.name, AudioNmute);
+		di->type = AUDIO_MIXER_ENUM;
+		di->next = di->prev = AUDIO_MIXER_LAST;
+		di->un.e.num_mem = 2;
+		strcpy(di->un.e.member[0].label.name, AudioNoff);
+		di->un.e.member[0].ord = 0;
+		strcpy(di->un.e.member[1].label.name, AudioNon);
+		di->un.e.member[1].ord = 1;
+		return 0;
+
 	case A64_CODEC_OUTPUT_SOURCE:
 		di->mixer_class = A64_CODEC_OUTPUT_CLASS;
 		strcpy(di->label.name, AudioNsource);
@@ -573,6 +600,12 @@ a64_acodec_attach(device_t parent, devic
 	a64_acodec_pr_set_clear(sc, A64_JACK_MIC_CTRL,
 	A64_JACKDETEN | A64_INNERRESEN | A64_AUTOPLEN, 0);
 
+	/* Unmute DAC to output mixer */
+	a64_acodec_pr_set_clear(sc, A64_OL_MIX_CTRL,
+	A64_LMIXMUTE_LDAC, 0);
+	a64_acodec_pr_set_clear(sc, A64_OR_MIX_CTRL,
+	A64_RMIXMUTE_RDAC, 0);
+
 	sc->sc_dai.dai_jack_detect = a64_acodec_dai_jack_detect;
 	sc->sc_dai.dai_hw_if = _acodec_hw_if;
 	sc->sc_dai.dai_dev = self;



CVS commit: src/sys/arch/evbarm/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 15 01:24:23 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: ARMADAXP ARMADILLO210 ARMADILLO9 CUBOX DNS323
GUMSTIX KUROBOX_PRO KURONAS_X4 MMNET_GENERIC MPCSA_GENERIC MV2120
TEAMASA_NPWR VTC100

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/conf/ARMADAXP
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/evbarm/conf/ARMADILLO210
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/evbarm/conf/ARMADILLO9 \
src/sys/arch/evbarm/conf/MPCSA_GENERIC
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/CUBOX
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/DNS323
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/evbarm/conf/GUMSTIX
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/conf/KUROBOX_PRO
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/KURONAS_X4
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/evbarm/conf/MMNET_GENERIC
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/evbarm/conf/MV2120
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/evbarm/conf/TEAMASA_NPWR
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbarm/conf/VTC100

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/evbarm/conf/ARMADAXP
diff -u src/sys/arch/evbarm/conf/ARMADAXP:1.21 src/sys/arch/evbarm/conf/ARMADAXP:1.22
--- src/sys/arch/evbarm/conf/ARMADAXP:1.21	Thu Sep 14 07:58:40 2017
+++ src/sys/arch/evbarm/conf/ARMADAXP	Tue May 15 01:24:23 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: ARMADAXP,v 1.21 2017/09/14 07:58:40 mrg Exp $
+#	$NetBSD: ARMADAXP,v 1.22 2018/05/15 01:24:23 thorpej Exp $
 #
 #	ARMADA XP DEV BOARD
 #
@@ -185,7 +185,7 @@ spiflash0	at spiflashbus?
 m25p0		at spi? slave 0
 
 # TWSI SDRAM Serial Presence Detect
-spdmem0		at iic? addr 0x56
+spdmem0		at iic0 addr 0x56
 
 # On-chip Cryptographic Engines and Security Accelerator (S/W chaining)
 mvcesa* 	at mvsoc? offset ? irq ?

Index: src/sys/arch/evbarm/conf/ARMADILLO210
diff -u src/sys/arch/evbarm/conf/ARMADILLO210:1.38 src/sys/arch/evbarm/conf/ARMADILLO210:1.39
--- src/sys/arch/evbarm/conf/ARMADILLO210:1.38	Thu Sep 14 07:58:40 2017
+++ src/sys/arch/evbarm/conf/ARMADILLO210	Tue May 15 01:24:23 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: ARMADILLO210,v 1.38 2017/09/14 07:58:40 mrg Exp $
+#	$NetBSD: ARMADILLO210,v 1.39 2018/05/15 01:24:23 thorpej Exp $
 #
 #	ARMADILLO210 -- Atmark Techno, Armadillo-210
 #
@@ -156,7 +156,7 @@ epled0		at epgpio0 port 4 bit1 1 bit2 0
 # I^2C Controller Unit
 armadillo9iic0	at epgpio0 port 1 bit1 4 bit2 5
 iic*		at armadillo9iic?
-seeprom0	at iic? addr 0x50 size 128
+seeprom0	at iic0 addr 0x50 size 128
 
 # MII/PHY support
 lxtphy* at mii? phy ?			# Level One LXT-970 PHYs

Index: src/sys/arch/evbarm/conf/ARMADILLO9
diff -u src/sys/arch/evbarm/conf/ARMADILLO9:1.55 src/sys/arch/evbarm/conf/ARMADILLO9:1.56
--- src/sys/arch/evbarm/conf/ARMADILLO9:1.55	Thu Sep 14 07:58:40 2017
+++ src/sys/arch/evbarm/conf/ARMADILLO9	Tue May 15 01:24:23 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: ARMADILLO9,v 1.55 2017/09/14 07:58:40 mrg Exp $
+#	$NetBSD: ARMADILLO9,v 1.56 2018/05/15 01:24:23 thorpej Exp $
 #
 #	ARMADILLO9 -- Atmark Techno, Armadillo-9
 #
@@ -167,8 +167,8 @@ epled0		at epgpio0 port 4 bit1 0 bit2 1
 # I^2C Controller Unit
 armadillo9iic0	at epgpio0 port 1 bit1 4 bit2 5
 iic*		at armadillo9iic?
-seeprom0	at iic? addr 0x50 size 128
-#s3531rtc0	at iic? addr 0x30
+seeprom0	at iic0 addr 0x50 size 128
+#s3531rtc0	at iic0 addr 0x30
 
 # PCMCIA bus support
 pcmcia*	at eppcic0 controller ? socket ?
Index: src/sys/arch/evbarm/conf/MPCSA_GENERIC
diff -u src/sys/arch/evbarm/conf/MPCSA_GENERIC:1.55 src/sys/arch/evbarm/conf/MPCSA_GENERIC:1.56
--- src/sys/arch/evbarm/conf/MPCSA_GENERIC:1.55	Tue Jan 23 15:08:11 2018
+++ src/sys/arch/evbarm/conf/MPCSA_GENERIC	Tue May 15 01:24:23 2018
@@ -1,4 +1,4 @@
-# $NetBSD: MPCSA_GENERIC,v 1.55 2018/01/23 15:08:11 sevan Exp $
+# $NetBSD: MPCSA_GENERIC,v 1.56 2018/05/15 01:24:23 thorpej Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include		"arch/evbarm/conf/std.mpcsa"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.55 $"
+#ident 		"GENERIC-$Revision: 1.56 $"
 
 maxusers	32		# estimated number of users
 
@@ -302,9 +302,9 @@ com*	at pcmcom? slave ?		# ...and the sl
 # Hardware monitors
 
 # AMD 768 and 8111 power/ACPI controllers
-#dbcool* at iic? addr 0x2C		# Unknown other motherboard(s)
-#dbcool* at iic? addr 0x2D		# Tyan S2881
-#dbcool* at iic? addr 0x2E		# Tyan S2882-D
+#dbcool* at iic0 addr 0x2C		# Unknown other motherboard(s)
+#dbcool* at iic0 addr 0x2D		# Tyan S2881
+#dbcool* at iic0 addr 0x2E		# Tyan S2882-D
 
 # 1-Wire support
 #gpioow* 	at gpio? offset 6 mask 0x1	# 1-wire bitbanging via gpio

Index: 

CVS commit: src/sys/arch/evbarm/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 15 01:24:23 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: ARMADAXP ARMADILLO210 ARMADILLO9 CUBOX DNS323
GUMSTIX KUROBOX_PRO KURONAS_X4 MMNET_GENERIC MPCSA_GENERIC MV2120
TEAMASA_NPWR VTC100

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/conf/ARMADAXP
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/evbarm/conf/ARMADILLO210
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/evbarm/conf/ARMADILLO9 \
src/sys/arch/evbarm/conf/MPCSA_GENERIC
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/CUBOX
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/DNS323
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/evbarm/conf/GUMSTIX
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/conf/KUROBOX_PRO
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/KURONAS_X4
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/evbarm/conf/MMNET_GENERIC
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/evbarm/conf/MV2120
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/evbarm/conf/TEAMASA_NPWR
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbarm/conf/VTC100

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



CVS commit: src/share/man/man7

2018-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue May 15 01:07:37 UTC 2018

Modified Files:
src/share/man/man7: intro.7

Log Message:
Update the introduction page to section 7 of the manual noting the audio
spec.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/share/man/man7/intro.7

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



CVS commit: src/share/man/man7

2018-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue May 15 01:07:37 UTC 2018

Modified Files:
src/share/man/man7: intro.7

Log Message:
Update the introduction page to section 7 of the manual noting the audio
spec.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/share/man/man7/intro.7

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/man7/intro.7
diff -u src/share/man/man7/intro.7:1.23 src/share/man/man7/intro.7:1.24
--- src/share/man/man7/intro.7:1.23	Sun Jul  1 16:18:00 2012
+++ src/share/man/man7/intro.7	Tue May 15 01:07:37 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: intro.7,v 1.23 2012/07/01 16:18:00 christos Exp $
+.\"	$NetBSD: intro.7,v 1.24 2018/05/15 01:07:37 nat Exp $
 .\"
 .\" Copyright (c) 1983, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)intro.7	8.1 (Berkeley) 6/5/93
 .\"
-.Dd July 1, 2012
+.Dd May 15, 2018
 .Dt INTRO 7
 .Os
 .Sh NAME
@@ -42,6 +42,9 @@ This section contains miscellaneous docu
 map of
 .Tn ASCII
 character set
+.It Xr audio 7
+the
+.Nx audio specification
 .It Xr c 7
 the C programming language
 .It Xr environ 7



CVS commit: src/sys/arch/sandpoint/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 15 01:07:06 UTC 2018

Modified Files:
src/sys/arch/sandpoint/conf: GENERIC

Log Message:
Revert previous; we actually use direct-configuration of I2C in this
kernel config.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/sandpoint/conf/GENERIC

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



CVS commit: src/sys/arch/sandpoint/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 15 01:07:06 UTC 2018

Modified Files:
src/sys/arch/sandpoint/conf: GENERIC

Log Message:
Revert previous; we actually use direct-configuration of I2C in this
kernel config.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/sandpoint/conf/GENERIC

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/sandpoint/conf/GENERIC
diff -u src/sys/arch/sandpoint/conf/GENERIC:1.98 src/sys/arch/sandpoint/conf/GENERIC:1.99
--- src/sys/arch/sandpoint/conf/GENERIC:1.98	Tue May 15 00:57:15 2018
+++ src/sys/arch/sandpoint/conf/GENERIC	Tue May 15 01:07:06 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.98 2018/05/15 00:57:15 thorpej Exp $
+# $NetBSD: GENERIC,v 1.99 2018/05/15 01:07:06 thorpej Exp $
 #
 # machine description file for GENERIC NAS
 # 
@@ -22,7 +22,7 @@ include 	"arch/sandpoint/conf/std.sandpo
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.98 $"
+#ident 		"GENERIC-$Revision: 1.99 $"
 
 maxusers	32
 
@@ -175,12 +175,12 @@ com0		at eumb? unit 0			# console at 0x4
 satmgr0 	at eumb? unit 1 		# satmgr at 0x4600
 ociic*		at eumb?
 iic*		at ociic?
-lmtemp*		at iic0 addr 0x48		# LM75 temperature sensor
-rs5c372rtc*	at iic0 addr 0x32
-s390rtc*	at iic0 addr 0x30
-pcf8563rtc*	at iic0 addr 0x51
-dsrtc*		at iic0 addr 0x68
-strtc*		at iic0 addr 0x68
+lmtemp*		at iic? addr 0x48		# LM75 temperature sensor
+rs5c372rtc*	at iic? addr 0x32
+s390rtc*	at iic? addr 0x30
+pcf8563rtc*	at iic? addr 0x51
+dsrtc*		at iic? addr 0x68
+strtc*		at iic? addr 0x68
 options 	STRTC_NO_WATCHDOG
 options 	STRTC_NO_USERRAM
 



CVS commit: src/sys/arch/sandpoint/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 15 00:57:15 UTC 2018

Modified Files:
src/sys/arch/sandpoint/conf: GENERIC

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/sandpoint/conf/GENERIC

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/sandpoint/conf/GENERIC
diff -u src/sys/arch/sandpoint/conf/GENERIC:1.97 src/sys/arch/sandpoint/conf/GENERIC:1.98
--- src/sys/arch/sandpoint/conf/GENERIC:1.97	Tue Jan 23 14:47:56 2018
+++ src/sys/arch/sandpoint/conf/GENERIC	Tue May 15 00:57:15 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.97 2018/01/23 14:47:56 sevan Exp $
+# $NetBSD: GENERIC,v 1.98 2018/05/15 00:57:15 thorpej Exp $
 #
 # machine description file for GENERIC NAS
 # 
@@ -22,7 +22,7 @@ include 	"arch/sandpoint/conf/std.sandpo
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.97 $"
+#ident 		"GENERIC-$Revision: 1.98 $"
 
 maxusers	32
 
@@ -175,12 +175,12 @@ com0		at eumb? unit 0			# console at 0x4
 satmgr0 	at eumb? unit 1 		# satmgr at 0x4600
 ociic*		at eumb?
 iic*		at ociic?
-lmtemp*		at iic? addr 0x48		# LM75 temperature sensor
-rs5c372rtc*	at iic? addr 0x32
-s390rtc*	at iic? addr 0x30
-pcf8563rtc*	at iic? addr 0x51
-dsrtc*		at iic? addr 0x68
-strtc*		at iic? addr 0x68
+lmtemp*		at iic0 addr 0x48		# LM75 temperature sensor
+rs5c372rtc*	at iic0 addr 0x32
+s390rtc*	at iic0 addr 0x30
+pcf8563rtc*	at iic0 addr 0x51
+dsrtc*		at iic0 addr 0x68
+strtc*		at iic0 addr 0x68
 options 	STRTC_NO_WATCHDOG
 options 	STRTC_NO_USERRAM
 



CVS commit: src/sys/arch/sandpoint/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 15 00:57:15 UTC 2018

Modified Files:
src/sys/arch/sandpoint/conf: GENERIC

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/sandpoint/conf/GENERIC

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



CVS commit: src

2018-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue May 15 00:54:02 UTC 2018

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man4: audio.4
src/share/man/man7: Makefile
src/share/man/man9: audio.9
Added Files:
src/share/man/man7: audio.7

Log Message:
Add the audio mixer specification to section 7 of the manual.
See posting on tech-kern - "NetBSD Audio Specification 2018."


To generate a diff of this commit:
cvs rdiff -u -r1.1585 -r1.1586 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.84 -r1.85 src/share/man/man4/audio.4
cvs rdiff -u -r1.31 -r1.32 src/share/man/man7/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man7/audio.7
cvs rdiff -u -r1.45 -r1.46 src/share/man/man9/audio.9

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/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1585 src/distrib/sets/lists/man/mi:1.1586
--- src/distrib/sets/lists/man/mi:1.1585	Wed May  9 05:59:28 2018
+++ src/distrib/sets/lists/man/mi	Tue May 15 00:54:01 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1585 2018/05/09 05:59:28 msaitoh Exp $
+# $NetBSD: mi,v 1.1586 2018/05/15 00:54:01 nat Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2267,6 +2267,7 @@
 ./usr/share/man/cat5/wtmpx.0			man-sys-catman		.cat
 ./usr/share/man/cat5/ypserv.acl.0		man-obsolete		obsolete
 ./usr/share/man/cat7/ascii.0			man-reference-catman	.cat
+./usr/share/man/cat7/audio.0			man-reference-catman	.cat
 ./usr/share/man/cat7/atf.0			man-atf-catman		.cat,atf
 ./usr/share/man/cat7/c.0			man-reference-catman	.cat
 ./usr/share/man/cat7/c78.0			man-reference-catman	.cat
@@ -5308,6 +5309,7 @@
 ./usr/share/man/html5/wtmp.html			man-sys-htmlman		html
 ./usr/share/man/html5/wtmpx.html		man-sys-htmlman		html
 ./usr/share/man/html7/ascii.html		man-reference-htmlman	html
+./usr/share/man/html7/audio.html		man-reference-htmlman	html
 ./usr/share/man/html7/atf.html			man-atf-htmlman		html,atf
 ./usr/share/man/html7/c.html			man-reference-htmlman	html
 ./usr/share/man/html7/c78.html			man-reference-htmlman	html
@@ -8319,6 +8321,7 @@
 ./usr/share/man/man5/wtmpx.5			man-sys-man		.man
 ./usr/share/man/man5/ypserv.acl.5		man-obsolete		obsolete
 ./usr/share/man/man7/ascii.7			man-reference-man	.man
+./usr/share/man/man7/audio.7			man-reference-man	.man
 ./usr/share/man/man7/atf.7			man-atf-man		.man,atf
 ./usr/share/man/man7/c.7			man-reference-man	.man
 ./usr/share/man/man7/c78.7			man-reference-man	.man

Index: src/share/man/man4/audio.4
diff -u src/share/man/man4/audio.4:1.84 src/share/man/man4/audio.4:1.85
--- src/share/man/man4/audio.4:1.84	Sat Jan 13 19:57:35 2018
+++ src/share/man/man4/audio.4	Tue May 15 00:54:01 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.4,v 1.84 2018/01/13 19:57:35 uwe Exp $
+.\"	$NetBSD: audio.4,v 1.85 2018/05/15 00:54:01 nat Exp $
 .\"
 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 27, 2017
+.Dd May 15, 2018
 .Dt AUDIO 4
 .Os
 .Sh NAME
@@ -811,6 +811,8 @@ string values.
 .Xr bba 4
 .Ss USB
 .Xr uaudio 4
+.Ss The NetBSD audio specification
+.Xr audio 7
 .Sh HISTORY
 Support for virtual channels and mixing first appeared in
 .Nx 8.0 .

Index: src/share/man/man7/Makefile
diff -u src/share/man/man7/Makefile:1.31 src/share/man/man7/Makefile:1.32
--- src/share/man/man7/Makefile:1.31	Tue Dec  2 03:51:48 2014
+++ src/share/man/man7/Makefile	Tue May 15 00:54:01 2018
@@ -1,14 +1,14 @@
-#	$NetBSD: Makefile,v 1.31 2014/12/02 03:51:48 msaitoh Exp $
+#	$NetBSD: Makefile,v 1.32 2018/05/15 00:54:01 nat Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/5/93
 
 .include 
 
 # missing: eqnchar.7 man.7 ms.7 term.7
 
-MAN=	ascii.7 c.7 environ.7 glob.7 hier.7 hostname.7 intro.7 mailaddr.7 \
-	module.7 nls.7 operator.7 orders.7 pkgsrc.7 release.7  rfc6056.7 \
-	security.7 script.7 setuid.7 signal.7 src.7 sticky.7 symlink.7 \
-	sysctl.7 tests.7
+MAN=	ascii.7 audio.7 c.7 environ.7 glob.7 hier.7 hostname.7 intro.7 \
+	mailaddr.7 module.7 nls.7 operator.7 orders.7 pkgsrc.7 release.7 \
+	rfc6056.7 security.7 script.7 setuid.7 signal.7 src.7 sticky.7 \
+	symlink.7 sysctl.7 tests.7
 
 CLEANFILES=	tests.7
 .if ${MKKYUA} != "no"

Index: src/share/man/man9/audio.9
diff -u src/share/man/man9/audio.9:1.45 src/share/man/man9/audio.9:1.46
--- src/share/man/man9/audio.9:1.45	Mon Jul  3 21:28:48 2017
+++ src/share/man/man9/audio.9	Tue May 15 00:54:01 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.9,v 1.45 2017/07/03 21:28:48 wiz Exp $
+.\"	$NetBSD: audio.9,v 1.46 2018/05/15 00:54:01 nat Exp $
 .\"
 .\" Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 13, 

CVS commit: src

2018-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue May 15 00:54:02 UTC 2018

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man4: audio.4
src/share/man/man7: Makefile
src/share/man/man9: audio.9
Added Files:
src/share/man/man7: audio.7

Log Message:
Add the audio mixer specification to section 7 of the manual.
See posting on tech-kern - "NetBSD Audio Specification 2018."


To generate a diff of this commit:
cvs rdiff -u -r1.1585 -r1.1586 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.84 -r1.85 src/share/man/man4/audio.4
cvs rdiff -u -r1.31 -r1.32 src/share/man/man7/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man7/audio.7
cvs rdiff -u -r1.45 -r1.46 src/share/man/man9/audio.9

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



CVS commit: src/sys/arch/zaurus/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 15 00:44:56 UTC 2018

Modified Files:
src/sys/arch/zaurus/conf: GENERIC INSTALL INSTALL_C700

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/zaurus/conf/GENERIC
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/zaurus/conf/INSTALL
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/zaurus/conf/INSTALL_C700

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/zaurus/conf/GENERIC
diff -u src/sys/arch/zaurus/conf/GENERIC:1.75 src/sys/arch/zaurus/conf/GENERIC:1.76
--- src/sys/arch/zaurus/conf/GENERIC:1.75	Thu Sep 14 07:58:44 2017
+++ src/sys/arch/zaurus/conf/GENERIC	Tue May 15 00:44:56 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC,v 1.75 2017/09/14 07:58:44 mrg Exp $
+#	$NetBSD: GENERIC,v 1.76 2018/05/15 00:44:56 thorpej Exp $
 #
 # GENERIC machine description file
 #
@@ -192,7 +192,7 @@ scoop0 at pxaip?
 scoop1 at pxaip?
 
 # alternate GPIO contoller for SL-C1000
-ioexp0 at iic? addr 0x18
+ioexp0 at iic0 addr 0x18
 
 # ADC, touchpad, backlight
 zssp0 at pxaip?
@@ -218,7 +218,7 @@ wsdisplay* at w100lcd? console ?
 lcdctl0 at zssp0
 
 # WM8750 Audio
-zaudio0 at iic? addr 0x1b
+zaudio0 at iic0 addr 0x1b
 audio* at zaudio?
 #options 	ZAUDIO_VOLUME_STRIDE=8
 

Index: src/sys/arch/zaurus/conf/INSTALL
diff -u src/sys/arch/zaurus/conf/INSTALL:1.35 src/sys/arch/zaurus/conf/INSTALL:1.36
--- src/sys/arch/zaurus/conf/INSTALL:1.35	Sun Jan 28 01:09:58 2018
+++ src/sys/arch/zaurus/conf/INSTALL	Tue May 15 00:44:56 2018
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.35 2018/01/28 01:09:58 rin Exp $
+# $NetBSD: INSTALL,v 1.36 2018/05/15 00:44:56 thorpej Exp $
 #
 # INSTALL config file (GENERIC with memory disk root)
 #
@@ -68,7 +68,7 @@ no zrc0 at pxaip?
 no ztp0 at zssp?
 no wsmouse* at ztp?
 
-no zaudio0 at iic?
+no zaudio0 at iic0
 no audio* at zaudio?
 no spkr* at audio?
 

Index: src/sys/arch/zaurus/conf/INSTALL_C700
diff -u src/sys/arch/zaurus/conf/INSTALL_C700:1.2 src/sys/arch/zaurus/conf/INSTALL_C700:1.3
--- src/sys/arch/zaurus/conf/INSTALL_C700:1.2	Fri Aug 12 09:26:35 2016
+++ src/sys/arch/zaurus/conf/INSTALL_C700	Tue May 15 00:44:56 2018
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL_C700,v 1.2 2016/08/12 09:26:35 nonaka Exp $
+# $NetBSD: INSTALL_C700,v 1.3 2018/05/15 00:44:56 thorpej Exp $
 #
 # INSTALL config file (C700 with memory disk root)
 #
@@ -15,7 +15,7 @@ no makeoptions	LOADADDRESS
 makeoptions	LOADADDRESS="0xc040"
 
 no scoop1 at pxaip?
-no ioexp0 at iic?
+no ioexp0 at iic0
 
 no lcd0 at pxaip?
 no wsdisplay* at lcd?



CVS commit: src/sys/arch/zaurus/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 15 00:44:56 UTC 2018

Modified Files:
src/sys/arch/zaurus/conf: GENERIC INSTALL INSTALL_C700

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/zaurus/conf/GENERIC
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/zaurus/conf/INSTALL
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/zaurus/conf/INSTALL_C700

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



CVS commit: src/sys/arch/alpha/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 15 00:42:35 UTC 2018

Modified Files:
src/sys/arch/alpha/conf: GENERIC

Log Message:
Actully, we can STAR the iic instances (the configuration code can
handle pinned pspecs to STAR'd potential parents).


To generate a diff of this commit:
cvs rdiff -u -r1.381 -r1.382 src/sys/arch/alpha/conf/GENERIC

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



CVS commit: src/sys/arch/alpha/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 15 00:42:35 UTC 2018

Modified Files:
src/sys/arch/alpha/conf: GENERIC

Log Message:
Actully, we can STAR the iic instances (the configuration code can
handle pinned pspecs to STAR'd potential parents).


To generate a diff of this commit:
cvs rdiff -u -r1.381 -r1.382 src/sys/arch/alpha/conf/GENERIC

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/alpha/conf/GENERIC
diff -u src/sys/arch/alpha/conf/GENERIC:1.381 src/sys/arch/alpha/conf/GENERIC:1.382
--- src/sys/arch/alpha/conf/GENERIC:1.381	Mon May 14 22:11:30 2018
+++ src/sys/arch/alpha/conf/GENERIC	Tue May 15 00:42:35 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.381 2018/05/14 22:11:30 jakllsch Exp $
+# $NetBSD: GENERIC,v 1.382 2018/05/15 00:42:35 thorpej Exp $
 #
 # This machine description file is used to generate the default NetBSD
 # kernel.
@@ -19,7 +19,7 @@ include 	"arch/alpha/conf/std.alpha"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident		"GENERIC-$Revision: 1.381 $"
+ident		"GENERIC-$Revision: 1.382 $"
 
 maxusers 32
 
@@ -210,7 +210,7 @@ mcmem*	at	mcbus? mid ?
 
 tsc*	at	mainbus0
 tsciic* 	at	tsc?
-iic0 	at	tsciic?
+iic* 	at	tsciic?
 
 # DECpc AXP150 (Jensen) internal bus support
 jensenio* at	mainbus0
@@ -536,7 +536,7 @@ ld*	at	mlx? unit ?
 
 # Acer Labs M7101 SMBus controller
 alipm* 	at pci? dev ? function ?
-iic1 	at alipm?
+iic* 	at alipm?
 
 # AlphaServer DS20L i2c devices
 #lmenv* 	at iic0 addr 0x2c



CVS commit: src/sys/dev

2018-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue May 15 00:28:00 UTC 2018

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

Log Message:
Expose the audio_info structure of vchan zero(0) the mix ring to allow
setting the hardware gain and balance via audioctl(1) using the -p 0
switch.

It is not possible to influence the hardware gain/blance from the
audio_info structure of vchans 1 onwards.  It is now possible to return
the audio mixers audio format from the audio_info structure of vchan 0 to
ease applications configuring for mmapped play back.

This is conformant to the audio specification posted on tech-kern see:
"NetBSD Audio Specification 2018"
or audio.7 manual page to be added in a follow up commit.


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

2018-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue May 15 00:28:00 UTC 2018

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

Log Message:
Expose the audio_info structure of vchan zero(0) the mix ring to allow
setting the hardware gain and balance via audioctl(1) using the -p 0
switch.

It is not possible to influence the hardware gain/blance from the
audio_info structure of vchans 1 onwards.  It is now possible to return
the audio mixers audio format from the audio_info structure of vchan 0 to
ease applications configuring for mmapped play back.

This is conformant to the audio specification posted on tech-kern see:
"NetBSD Audio Specification 2018"
or audio.7 manual page to be added in a follow up commit.


To generate a diff of this commit:
cvs rdiff -u -r1.453 -r1.454 src/sys/dev/audio.c

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

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.453 src/sys/dev/audio.c:1.454
--- src/sys/dev/audio.c:1.453	Tue May 15 00:19:08 2018
+++ src/sys/dev/audio.c	Tue May 15 00:28:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.453 2018/05/15 00:19:08 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.454 2018/05/15 00:28:00 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.453 2018/05/15 00:19:08 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.454 2018/05/15 00:28:00 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -3076,7 +3076,7 @@ audio_ioctl(dev_t dev, struct audio_soft
 
 	KASSERT(mutex_owned(sc->sc_lock));
 
-	if (sc->sc_usemixer) {
+	if (sc->sc_usemixer && chan->deschan != 0) {
 		SIMPLEQ_FOREACH(pchan, >sc_audiochan, entries) {
 			if (pchan->chan == chan->deschan)
 break;
@@ -3086,7 +3086,10 @@ audio_ioctl(dev_t dev, struct audio_soft
 	} else
 		pchan = chan;
 
-	vc = pchan->vc;
+	if (chan->deschan != 0)
+		vc = pchan->vc;
+	else
+		vc = >sc_mixring;
 
 	DPRINTF(("audio_ioctl(%lu,'%c',%lu)\n",
 		 IOCPARM_LEN(cmd), (char)IOCGROUP(cmd), cmd&0xff));
@@ -3100,7 +3103,7 @@ audio_ioctl(dev_t dev, struct audio_soft
 			*(int*)addr = chan->chan;
 		break;
 	case AUDIO_SETCHAN:
-		if ((int *)addr != NULL && *(int*)addr > 0)
+		if ((int *)addr != NULL && *(int*)addr >= 0)
 			chan->deschan = *(int*)addr;
 		break;
 	case FIONBIO:
@@ -4195,6 +4198,12 @@ audio_set_vchan_defaults(struct audio_so
 
 	if (error == 0)
 		error = audiosetinfo(sc, , true, vc);
+	if (error == 0) {
+		vc = >sc_mixring;
+
+		vc->sc_rparams = sc->sc_vchan_params;
+		vc->sc_pparams = sc->sc_vchan_params;
+	}
 
 	return error;
 }
@@ -4559,6 +4568,9 @@ audiosetinfo(struct audio_softc *sc, str
 	rp = vc->sc_rparams;	/* case setting the modes fails. */
 	nr = np = 0;
 
+	if (vc == >sc_mixring)
+		goto done;
+
 	if (SPECIFIED(p->sample_rate)) {
 		pp.sample_rate = p->sample_rate;
 		np++;
@@ -4644,9 +4656,10 @@ audiosetinfo(struct audio_softc *sc, str
 			vc->sc_mode &= ~AUMODE_RECORD;
 	}
 
+done:
 	oldpus = vc->sc_pustream;
 	oldrus = vc->sc_rustream;
-	if (modechange || reset) {
+	if (vc != >sc_mixring && (modechange || reset)) {
 		int indep;
 
 		indep = audio_get_props(sc) & AUDIO_PROP_INDEPENDENT;
@@ -4741,23 +4754,41 @@ audiosetinfo(struct audio_softc *sc, str
 		if (error)
 			goto cleanup;
 	}
-	if (SPECIFIED(p->gain))
-		vc->sc_swvol = p->gain;
+	if (SPECIFIED(p->gain)) {
+		if (!sc->sc_usemixer || vc == >sc_mixring) {
+			au_get_gain(sc, >sc_outports, , );
+			error = au_set_gain(sc, >sc_outports, p->gain, balance);
+			if (error)
+goto cleanup;
+		} else
+			vc->sc_swvol = p->gain;
+	}
 
-	if (SPECIFIED(r->gain))
-		vc->sc_recswvol = r->gain;
+	if (SPECIFIED(r->gain)) {
+		if (!sc->sc_usemixer || vc == >sc_mixring) {
+			au_get_gain(sc, >sc_outports, , );
+			error = au_set_gain(sc, >sc_outports, r->gain, balance);
+			if (error)
+goto cleanup;
+		} else
+			vc->sc_recswvol = r->gain;
+	}
 
 	if (SPECIFIED_CH(p->balance)) {
-		au_get_gain(sc, >sc_outports, , );
-		error = au_set_gain(sc, >sc_outports, gain, p->balance);
-		if (error)
-			goto cleanup;
+		if (!sc->sc_usemixer || vc == >sc_mixring) {
+			au_get_gain(sc, >sc_outports, , );
+			error = au_set_gain(sc, >sc_outports, gain, p->balance);
+			if (error)
+goto cleanup;
+		}
 	}
 	if (SPECIFIED_CH(r->balance)) {
-		au_get_gain(sc, >sc_inports, , );
-		error = au_set_gain(sc, >sc_inports, gain, r->balance);
-		if (error)
-			goto cleanup;
+		if (!sc->sc_usemixer || vc == >sc_mixring) {
+			au_get_gain(sc, >sc_inports, , );
+			error = au_set_gain(sc, >sc_inports, gain, r->balance);
+			if (error)
+goto cleanup;
+		}
 	}
 
 	if (SPECIFIED(ai->monitor_gain) && sc->sc_monitor_port != -1) {
@@ -4901,8 +4932,13 @@ audiogetinfo(struct audio_softc *sc, str
 		r->avail_ports = sc->sc_inports.allports;
 		p->avail_ports = sc->sc_outports.allports;
 
-		au_get_gain(sc, >sc_inports, >gain, >balance);
-		

CVS commit: src/sys/dev

2018-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue May 15 00:19:08 UTC 2018

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

Log Message:
Fix numbering of vchan mixer controls to correspond to the vchan number in
use.
This makes the numbering of vchans consistient for audioctl and mixerctl.


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

2018-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue May 15 00:19:08 UTC 2018

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

Log Message:
Fix numbering of vchan mixer controls to correspond to the vchan number in
use.
This makes the numbering of vchans consistient for audioctl and mixerctl.


To generate a diff of this commit:
cvs rdiff -u -r1.452 -r1.453 src/sys/dev/audio.c

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

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.452 src/sys/dev/audio.c:1.453
--- src/sys/dev/audio.c:1.452	Tue Feb  6 04:39:18 2018
+++ src/sys/dev/audio.c	Tue May 15 00:19:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.452 2018/02/06 04:39:18 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.453 2018/05/15 00:19:08 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.452 2018/02/06 04:39:18 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.453 2018/05/15 00:19:08 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -5784,6 +5784,9 @@ unitscopy(mixer_devinfo_t *di, const cha
 static int
 audio_query_devinfo(struct audio_softc *sc, mixer_devinfo_t *di)
 {
+	struct audio_chan *chan;
+	unsigned int j;
+
 	KASSERT(mutex_owned(sc->sc_lock));
 
 	if (sc->sc_static_nmixer_states == 0 || sc->sc_nmixer_states == 0)
@@ -5799,18 +5802,40 @@ audio_query_devinfo(struct audio_softc *
 			di->type = AUDIO_MIXER_CLASS;
 		} else if ((di->index - sc->sc_static_nmixer_states) % 2 == 0) {
 			di->mixer_class = sc->sc_static_nmixer_states -1;
+			j = 0;
+			SIMPLEQ_FOREACH(chan, >sc_audiochan, entries) {
+if (j == (di->index -
+sc->sc_static_nmixer_states) / 2)
+	break;
+j++;
+			}
+			if (j != (di->index - sc->sc_static_nmixer_states) / 2)
+return 0;
+
+			j = chan->deschan;
+
 			snprintf(di->label.name, sizeof(di->label.name),
-			AudioNdac"%d",
-			(di->index - sc->sc_static_nmixer_states) / 2);
+			AudioNdac"%d", j);
 			di->type = AUDIO_MIXER_VALUE;
 			di->next = di->prev = AUDIO_MIXER_LAST;
 			di->un.v.num_channels = 1;
 			unitscopy(di, AudioNvolume);
 		} else {
 			di->mixer_class = sc->sc_static_nmixer_states -1;
+			j = 0;
+			SIMPLEQ_FOREACH(chan, >sc_audiochan, entries) {
+if (j == (di->index -
+sc->sc_static_nmixer_states) / 2)
+	break;
+j++;
+			}
+			if (j != (di->index - sc->sc_static_nmixer_states) / 2)
+return 0;
+
+			j = chan->deschan;
+
 			snprintf(di->label.name, sizeof(di->label.name),
-			AudioNmicrophone "%d",
-			(di->index - sc->sc_static_nmixer_states) / 2);
+			AudioNmicrophone "%d", j);
 			di->type = AUDIO_MIXER_VALUE;
 			di->next = di->prev = AUDIO_MIXER_LAST;
 			di->un.v.num_channels = 1;



Re: CVS commit: src/sys/arch/alpha/conf

2018-05-14 Thread Jason Thorpe
They would have conflicted already in the old stuff.  This would be a great 
application for using direct configuration of i2c on this platform.

-- thorpej
Sent from my iPhone.

> On May 14, 2018, at 6:11 PM, Jonathan A. Kollasch  wrote:
> 
> Module Name:src
> Committed By:jakllsch
> Date:Mon May 14 22:11:30 UTC 2018
> 
> Modified Files:
>src/sys/arch/alpha/conf: GENERIC
> 
> Log Message:
> Move iic0 at alipm? to iic1.  Using iic0 will conflict with the
> iic0 at tsciic? on the API CS20.
> 
> XXX: Enumerate the similar-to-DS20L I2C devices on the CS20, which
> IIRC are not all on the tsciic(4) I2C bus, and comment GENERIC
> accordingly.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.380 -r1.381 src/sys/arch/alpha/conf/GENERIC
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 


CVS commit: src/sys/arch/alpha/conf

2018-05-14 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon May 14 22:11:30 UTC 2018

Modified Files:
src/sys/arch/alpha/conf: GENERIC

Log Message:
Move iic0 at alipm? to iic1.  Using iic0 will conflict with the
iic0 at tsciic? on the API CS20.

XXX: Enumerate the similar-to-DS20L I2C devices on the CS20, which
IIRC are not all on the tsciic(4) I2C bus, and comment GENERIC
accordingly.


To generate a diff of this commit:
cvs rdiff -u -r1.380 -r1.381 src/sys/arch/alpha/conf/GENERIC

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/alpha/conf/GENERIC
diff -u src/sys/arch/alpha/conf/GENERIC:1.380 src/sys/arch/alpha/conf/GENERIC:1.381
--- src/sys/arch/alpha/conf/GENERIC:1.380	Mon May 14 21:11:39 2018
+++ src/sys/arch/alpha/conf/GENERIC	Mon May 14 22:11:30 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.380 2018/05/14 21:11:39 thorpej Exp $
+# $NetBSD: GENERIC,v 1.381 2018/05/14 22:11:30 jakllsch Exp $
 #
 # This machine description file is used to generate the default NetBSD
 # kernel.
@@ -19,7 +19,7 @@ include 	"arch/alpha/conf/std.alpha"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident		"GENERIC-$Revision: 1.380 $"
+ident		"GENERIC-$Revision: 1.381 $"
 
 maxusers 32
 
@@ -536,7 +536,7 @@ ld*	at	mlx? unit ?
 
 # Acer Labs M7101 SMBus controller
 alipm* 	at pci? dev ? function ?
-iic0 	at alipm?
+iic1 	at alipm?
 
 # AlphaServer DS20L i2c devices
 #lmenv* 	at iic0 addr 0x2c



CVS commit: src/sys/arch/alpha/conf

2018-05-14 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon May 14 22:11:30 UTC 2018

Modified Files:
src/sys/arch/alpha/conf: GENERIC

Log Message:
Move iic0 at alipm? to iic1.  Using iic0 will conflict with the
iic0 at tsciic? on the API CS20.

XXX: Enumerate the similar-to-DS20L I2C devices on the CS20, which
IIRC are not all on the tsciic(4) I2C bus, and comment GENERIC
accordingly.


To generate a diff of this commit:
cvs rdiff -u -r1.380 -r1.381 src/sys/arch/alpha/conf/GENERIC

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



CVS commit: src/sys/arch/mmeye/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon May 14 22:01:57 UTC 2018

Modified Files:
src/sys/arch/mmeye/conf: MMEYE_WLF

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/mmeye/conf/MMEYE_WLF

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



CVS commit: src/sys/arch/mmeye/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon May 14 22:01:57 UTC 2018

Modified Files:
src/sys/arch/mmeye/conf: MMEYE_WLF

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/mmeye/conf/MMEYE_WLF

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/mmeye/conf/MMEYE_WLF
diff -u src/sys/arch/mmeye/conf/MMEYE_WLF:1.23 src/sys/arch/mmeye/conf/MMEYE_WLF:1.24
--- src/sys/arch/mmeye/conf/MMEYE_WLF:1.23	Thu Sep 14 07:58:42 2017
+++ src/sys/arch/mmeye/conf/MMEYE_WLF	Mon May 14 22:01:57 2018
@@ -1,4 +1,4 @@
-# $NetBSD: MMEYE_WLF,v 1.23 2017/09/14 07:58:42 mrg Exp $
+# $NetBSD: MMEYE_WLF,v 1.24 2018/05/14 22:01:57 thorpej Exp $
 #
 # MMEYE_WLF -- Brains Inc. MMEYE-WLF platforms kernel
 #
@@ -22,7 +22,7 @@ include 	"arch/mmeye/conf/std.mmeye"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.23 $"
+#ident 		"GENERIC-$Revision: 1.24 $"
 
 maxusers	16		# estimated number of users
 
@@ -159,7 +159,7 @@ sci0	at shb?
 
 rtciic0	at mainbus? addr1 0xb10e
 iic* at rtciic?
-rs5c372rtc* at iic? addr 0x32
+rs5c372rtc* at iic0 addr 0x32
 
 #ac97x	at mainbus? addr1 0xb300-0xb30f irq1 1	# AD1881A
 audio* at audiobus?



CVS commit: src/sys/arch/hpcarm/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon May 14 21:58:15 UTC 2018

Modified Files:
src/sys/arch/hpcarm/conf: NETBOOKPRO

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/hpcarm/conf/NETBOOKPRO

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



CVS commit: src/sys/arch/hpcarm/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon May 14 21:58:15 UTC 2018

Modified Files:
src/sys/arch/hpcarm/conf: NETBOOKPRO

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/hpcarm/conf/NETBOOKPRO

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/hpcarm/conf/NETBOOKPRO
diff -u src/sys/arch/hpcarm/conf/NETBOOKPRO:1.22 src/sys/arch/hpcarm/conf/NETBOOKPRO:1.23
--- src/sys/arch/hpcarm/conf/NETBOOKPRO:1.22	Thu Sep 14 07:58:41 2017
+++ src/sys/arch/hpcarm/conf/NETBOOKPRO	Mon May 14 21:58:14 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: NETBOOKPRO,v 1.22 2017/09/14 07:58:41 mrg Exp $
+#	$NetBSD: NETBOOKPRO,v 1.23 2018/05/14 21:58:14 thorpej Exp $
 #
 #	NETBOOKPRO -- Psion Teklogix NETBOOK PRO
 #
@@ -8,7 +8,7 @@ include	"arch/hpcarm/conf/files.netbookp
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.22 $"
+#ident 		"GENERIC-$Revision: 1.23 $"
 
 # estimated number of users
 maxusers	32
@@ -175,9 +175,9 @@ spkr*	at audio?		# PC speaker (synthesiz
 nbpiic0	at pxaip? addr 0x4030 intr 18
 iic*	at nbpiic?
 
-nbppcon* at iic? addr 0x13			# PCon
-r2025rtc* at iic? addr 0x32			# R2025S RTC
-seeprom* at iic? addr 0x53 size 128
+nbppcon* at iic0 addr 0x13			# PCon
+r2025rtc* at iic0 addr 0x32			# R2025S RTC
+seeprom* at iic0 addr 0x53 size 128
 
 nbppm* at nbppcon? tag 0x05
 hpcapm* at nbppm?



CVS commit: src/sys/arch/evbmips/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon May 14 21:50:02 UTC 2018

Modified Files:
src/sys/arch/evbmips/conf: GDIUM LOONGSON

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/evbmips/conf/GDIUM
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/evbmips/conf/LOONGSON

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



CVS commit: src/sys/arch/evbmips/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon May 14 21:50:02 UTC 2018

Modified Files:
src/sys/arch/evbmips/conf: GDIUM LOONGSON

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/evbmips/conf/GDIUM
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/evbmips/conf/LOONGSON

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/evbmips/conf/GDIUM
diff -u src/sys/arch/evbmips/conf/GDIUM:1.29 src/sys/arch/evbmips/conf/GDIUM:1.30
--- src/sys/arch/evbmips/conf/GDIUM:1.29	Thu Sep 14 07:58:40 2017
+++ src/sys/arch/evbmips/conf/GDIUM	Mon May 14 21:50:02 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GDIUM,v 1.29 2017/09/14 07:58:40 mrg Exp $
+# $NetBSD: GDIUM,v 1.30 2018/05/14 21:50:02 thorpej Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/evbmips/conf/std.gdium"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GDIUM-$Revision: 1.29 $"
+#ident 		"GDIUM-$Revision: 1.30 $"
 
 maxusers	16
 
@@ -152,11 +152,11 @@ bonito0		at mainbus0
 pci0		at bonito0
 voyager0	at pci0 dev ? function ?
 voyagerfb0	at voyager0
-iic*		at voyager0
-strtc*	at iic? addr 0x68
+iic0		at voyager0
+strtc*	at iic0 addr 0x68
 options	STRTC_NO_USERRAM
-lmtemp*	at iic? addr 0x48
-#stvii*	at iic? addr 0x40
+lmtemp*	at iic0 addr 0x48
+#stvii*	at iic0 addr 0x40
 #genfb0		at pci0 dev ? function ?
 wsdisplay0	at wsemuldisplaydev?
 ehci*		at pci0 dev ? function ?

Index: src/sys/arch/evbmips/conf/LOONGSON
diff -u src/sys/arch/evbmips/conf/LOONGSON:1.36 src/sys/arch/evbmips/conf/LOONGSON:1.37
--- src/sys/arch/evbmips/conf/LOONGSON:1.36	Thu Jan 18 23:17:09 2018
+++ src/sys/arch/evbmips/conf/LOONGSON	Mon May 14 21:50:02 2018
@@ -1,4 +1,4 @@
-# $NetBSD: LOONGSON,v 1.36 2018/01/18 23:17:09 maya Exp $
+# $NetBSD: LOONGSON,v 1.37 2018/05/14 21:50:02 thorpej Exp $
 #
 # LOONGSON machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/evbmips/conf/std.loongson
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"LOONGSON-$Revision: 1.36 $"
+#ident 		"LOONGSON-$Revision: 1.37 $"
 
 maxusers	16
 
@@ -168,11 +168,11 @@ sisfb0		at pci0 dev ? function ?
 voyager0	at pci0 dev ? function ?	# SM502 on GDIUM
 voyagerfb0	at voyager0			# framebuffer portion
 pwmclock0	at voyager0			# clock and CPU freq scaling
-iic*		at voyager0
-strtc*		at iic? addr 0x68		# GDIUM's real time clock
+iic0		at voyager0
+strtc*		at iic0 addr 0x68		# GDIUM's real time clock
 options 	STRTC_NO_USERRAM
-lmtemp*		at iic? addr 0x48		# GDIUM's temperature sensor
-stvii*		at iic? addr 0x40		# GDIUM's onboard microcontroller
+lmtemp*		at iic0 addr 0x48		# GDIUM's temperature sensor
+stvii*		at iic0 addr 0x40		# GDIUM's onboard microcontroller
 lynxfb0		at pci0 dev ? function ?	# SM712 on Yeeloong Notebook
 #genfb0		at pci0 dev ? function ?
 wsdisplay*	at wsemuldisplaydev?



CVS commit: src/sys/arch/alpha/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon May 14 21:11:39 UTC 2018

Modified Files:
src/sys/arch/alpha/conf: GENERIC

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.379 -r1.380 src/sys/arch/alpha/conf/GENERIC

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/alpha/conf/GENERIC
diff -u src/sys/arch/alpha/conf/GENERIC:1.379 src/sys/arch/alpha/conf/GENERIC:1.380
--- src/sys/arch/alpha/conf/GENERIC:1.379	Tue Jan 23 14:47:53 2018
+++ src/sys/arch/alpha/conf/GENERIC	Mon May 14 21:11:39 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.379 2018/01/23 14:47:53 sevan Exp $
+# $NetBSD: GENERIC,v 1.380 2018/05/14 21:11:39 thorpej Exp $
 #
 # This machine description file is used to generate the default NetBSD
 # kernel.
@@ -19,7 +19,7 @@ include 	"arch/alpha/conf/std.alpha"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident		"GENERIC-$Revision: 1.379 $"
+ident		"GENERIC-$Revision: 1.380 $"
 
 maxusers 32
 
@@ -210,7 +210,7 @@ mcmem*	at	mcbus? mid ?
 
 tsc*	at	mainbus0
 tsciic* 	at	tsc?
-iic* 	at	tsciic?
+iic0 	at	tsciic?
 
 # DECpc AXP150 (Jensen) internal bus support
 jensenio* at	mainbus0
@@ -536,21 +536,21 @@ ld*	at	mlx? unit ?
 
 # Acer Labs M7101 SMBus controller
 alipm* 	at pci? dev ? function ?
-iic* 	at alipm?
+iic0 	at alipm?
 
 # AlphaServer DS20L i2c devices
-#lmenv* 	at iic? addr 0x2c
-#lmenv* 	at iic? addr 0x2d
-#lmenv* 	at iic? addr 0x2e
-#lmenv* 	at iic? addr 0x2f
-#spdmem* 	at iic? addr 0x50
-#spdmem* 	at iic? addr 0x51
-#spdmem* 	at iic? addr 0x52
-#spdmem* 	at iic? addr 0x53
-#spdmem* 	at iic? addr 0x54
-#spdmem* 	at iic? addr 0x55
-#spdmem* 	at iic? addr 0x56
-#spdmem* 	at iic? addr 0x57
+#lmenv* 	at iic0 addr 0x2c
+#lmenv* 	at iic0 addr 0x2d
+#lmenv* 	at iic0 addr 0x2e
+#lmenv* 	at iic0 addr 0x2f
+#spdmem* 	at iic0 addr 0x50
+#spdmem* 	at iic0 addr 0x51
+#spdmem* 	at iic0 addr 0x52
+#spdmem* 	at iic0 addr 0x53
+#spdmem* 	at iic0 addr 0x54
+#spdmem* 	at iic0 addr 0x55
+#spdmem* 	at iic0 addr 0x56
+#spdmem* 	at iic0 addr 0x57
 #seeprom* 	at iic0 addr 0x51 flags 0x2
 
 # PCMCIA USB controllers



CVS commit: src/sys/arch/alpha/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon May 14 21:11:39 UTC 2018

Modified Files:
src/sys/arch/alpha/conf: GENERIC

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.379 -r1.380 src/sys/arch/alpha/conf/GENERIC

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



CVS commit: src/sys/arch/acorn32/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon May 14 21:05:17 UTC 2018

Modified Files:
src/sys/arch/acorn32/conf: EB7500ATX GENERIC INSTALL LOWMEM_WSCONS NC

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/acorn32/conf/EB7500ATX
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/acorn32/conf/GENERIC
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/acorn32/conf/INSTALL
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/acorn32/conf/LOWMEM_WSCONS
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/acorn32/conf/NC

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



CVS commit: src/sys/arch/acorn32/conf

2018-05-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon May 14 21:05:17 UTC 2018

Modified Files:
src/sys/arch/acorn32/conf: EB7500ATX GENERIC INSTALL LOWMEM_WSCONS NC

Log Message:
Fully specifiy the location of indirectly-configured I2C devices. In
particular, the parent spec must not be wild-carded, as doing so doesn't
work well on systems where more than one I2C bus is present.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/acorn32/conf/EB7500ATX
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/acorn32/conf/GENERIC
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/acorn32/conf/INSTALL
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/acorn32/conf/LOWMEM_WSCONS
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/acorn32/conf/NC

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/acorn32/conf/EB7500ATX
diff -u src/sys/arch/acorn32/conf/EB7500ATX:1.64 src/sys/arch/acorn32/conf/EB7500ATX:1.65
--- src/sys/arch/acorn32/conf/EB7500ATX:1.64	Tue Jan 23 14:47:53 2018
+++ src/sys/arch/acorn32/conf/EB7500ATX	Mon May 14 21:05:17 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: EB7500ATX,v 1.64 2018/01/23 14:47:53 sevan Exp $
+#	$NetBSD: EB7500ATX,v 1.65 2018/05/14 21:05:17 thorpej Exp $
 #
 #	EB7500ATX --- NetBSD/acorn32 complete configuration
 #
@@ -22,7 +22,7 @@ include 	"arch/acorn32/conf/std.acorn32"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"EB7500ATX-$Revision: 1.64 $"
+#ident		"EB7500ATX-$Revision: 1.65 $"
 
 # estimated number of users
 maxusers	32
@@ -159,10 +159,10 @@ clock*	at iomd?
 
 # IIC bus device
 #iomdiic* at iomd?
-#iic* at iomdiic?
+#iic0 at iomdiic?
 
 # RTC device via IIC bus
-#pcfrtc*	at iic? addr 0x50
+#pcfrtc*	at iic0 addr 0x50
 
 # VIDC device
 vidc0		at mainbus?

Index: src/sys/arch/acorn32/conf/GENERIC
diff -u src/sys/arch/acorn32/conf/GENERIC:1.124 src/sys/arch/acorn32/conf/GENERIC:1.125
--- src/sys/arch/acorn32/conf/GENERIC:1.124	Tue Jan 23 14:47:53 2018
+++ src/sys/arch/acorn32/conf/GENERIC	Mon May 14 21:05:17 2018
@@ -1,4 +1,4 @@
-# 	$NetBSD: GENERIC,v 1.124 2018/01/23 14:47:53 sevan Exp $
+# 	$NetBSD: GENERIC,v 1.125 2018/05/14 21:05:17 thorpej Exp $
 #
 #	GENERIC --- NetBSD/acorn32 complete configuration
 #
@@ -22,7 +22,7 @@ include 	"arch/acorn32/conf/std.acorn32"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.124 $"
+#ident		"GENERIC-$Revision: 1.125 $"
 
 # estimated number of users
 maxusers	32
@@ -166,7 +166,7 @@ iomdiic* at iomd?
 iic0 at iomdiic?
 
 # RTC device via IIC bus
-pcfrtc*	at iic? addr 0x50
+pcfrtc*	at iic0 addr 0x50
 
 # VIDC device
 vidc0		at mainbus?

Index: src/sys/arch/acorn32/conf/INSTALL
diff -u src/sys/arch/acorn32/conf/INSTALL:1.78 src/sys/arch/acorn32/conf/INSTALL:1.79
--- src/sys/arch/acorn32/conf/INSTALL:1.78	Thu Sep 14 07:58:38 2017
+++ src/sys/arch/acorn32/conf/INSTALL	Mon May 14 21:05:17 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL,v 1.78 2017/09/14 07:58:38 mrg Exp $
+#	$NetBSD: INSTALL,v 1.79 2018/05/14 21:05:17 thorpej Exp $
 #
 #	INSTALL -- NetBSD/acorn32 install configuration
 #
@@ -22,7 +22,7 @@ include 	"arch/acorn32/conf/std.acorn32"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"INSTALL-$Revision: 1.78 $"
+#ident		"INSTALL-$Revision: 1.79 $"
 
 # estimated number of users
 maxusers	32
@@ -148,7 +148,7 @@ iomdiic* at iomd?
 iic0 at iomdiic?
 
 # RTC device via IIC bus
-pcfrtc*	at iic? addr 0x50
+pcfrtc*	at iic0 addr 0x50
 
 # VIDC device
 vidc0		at mainbus?

Index: src/sys/arch/acorn32/conf/LOWMEM_WSCONS
diff -u src/sys/arch/acorn32/conf/LOWMEM_WSCONS:1.72 src/sys/arch/acorn32/conf/LOWMEM_WSCONS:1.73
--- src/sys/arch/acorn32/conf/LOWMEM_WSCONS:1.72	Thu Sep 14 07:58:38 2017
+++ src/sys/arch/acorn32/conf/LOWMEM_WSCONS	Mon May 14 21:05:17 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: LOWMEM_WSCONS,v 1.72 2017/09/14 07:58:38 mrg Exp $
+#	$NetBSD: LOWMEM_WSCONS,v 1.73 2018/05/14 21:05:17 thorpej Exp $
 #
 #	LOWMEM_WSCONS -- RiscPC config with wscons for SMALL machines
 #
@@ -126,7 +126,7 @@ iomdiic* at iomd?
 iic0 at iomdiic?
 
 # RTC device via IIC bus
-pcfrtc*	at iic? addr 0x50
+pcfrtc*	at iic0 addr 0x50
 
 # VIDC device
 vidc0		at mainbus?

Index: src/sys/arch/acorn32/conf/NC
diff -u src/sys/arch/acorn32/conf/NC:1.71 src/sys/arch/acorn32/conf/NC:1.72
--- src/sys/arch/acorn32/conf/NC:1.71	Thu Sep 14 07:58:38 2017
+++ src/sys/arch/acorn32/conf/NC	Mon May 14 21:05:17 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: NC,v 1.71 2017/09/14 07:58:38 mrg Exp $
+#	$NetBSD: NC,v 1.72 2018/05/14 21:05:17 thorpej Exp $
 #
 #	NC - with wscons
 #
@@ -122,7 +122,7 @@ iomdiic* at iomd?
 iic0 at iomdiic?
 
 # RTC device via IIC bus
-pcfrtc*	at iic? addr 0x50
+pcfrtc*	at iic0 addr 0x50
 
 # VIDC device
 vidc0		at mainbus?



CVS commit: [netbsd-8] src/doc

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 19:24:10 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #805, #822 and #823.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.197 -r1.1.2.198 src/doc/CHANGES-8.0

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.197 src/doc/CHANGES-8.0:1.1.2.198
--- src/doc/CHANGES-8.0:1.1.2.197	Sat May 12 10:44:25 2018
+++ src/doc/CHANGES-8.0	Mon May 14 19:24:10 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.197 2018/05/12 10:44:25 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.198 2018/05/14 19:24:10 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13400,3 +13400,24 @@ sys/netinet6/in6_proto.c			1.125
 	Increase the default size of some receive buffers from 8k to 16k.
 	[roy, ticket #821]
 
+sys/kern/kern_lwp.c1.192
+
+	Revert previous, do not wait interruptibly when exiting.
+	The change caused other deadlocks and the golang issue
+	is not reproducable with later versions.
+	[gson, ticket #805]
+
+lib/libc/string/stresep.c			1.4
+tests/lib/libc/string/t_stresep.c		1.4
+
+	Fix memmove with of-by-one length in stresep(3) and add
+	a test.
+	[maya, ticket #822]
+
+sys/net/npf/npf_alg_icmp.c			1.27-1.30
+sys/net/npf/npf_inet.c1.45-1.47
+sys/net/npf/npf_sendpkt.c			1.19
+
+	Fix use-after-free and strengthen.
+	[maxv, ticket #823]
+



CVS commit: [netbsd-8] src/doc

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 19:24:10 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Tickets #805, #822 and #823.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.197 -r1.1.2.198 src/doc/CHANGES-8.0

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



CVS commit: [netbsd-8] src/sys/net/npf

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 19:22:30 UTC 2018

Modified Files:
src/sys/net/npf [netbsd-8]: npf_alg_icmp.c npf_inet.c npf_sendpkt.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #823):

sys/net/npf/npf_inet.c: revision 1.45-1.47
sys/net/npf/npf_alg_icmp.c: revision 1.27-1.30
sys/net/npf/npf_sendpkt.c: revision 1.19

Fix use-after-free.

The nbuf can be reallocated as a result of caching 'enpc', so it is
necessary to recache 'npc', otherwise it contains pointers to the freed
mbuf - pointers which are then used in the ruleset machinery.

We recache 'npc' when we are sure we won't use 'enpc' anymore, because
'enpc' can be clobbered as a result of caching 'npc' (in other words,
only one of the two can be cached at the same time).
Also, we recache 'npc' unconditionally, because there is no way to know
whether the nbuf got clobbered relatively to it. We can't use the
NBUF_DATAREF_RESET flag, because it is stored in the nbuf and not in the
cache.

Discussed with rmind@.

Change npf_cache_all so that it ensures the potential ICMP Query Id is in
the nbuf. In such a way that we don't need to ensure that later.
Change npfa_icmp4_inspect and npfa_icmp6_inspect so that they touch neither
the nbuf nor npc. Adapt their callers accordingly.

In the end, if a packet has a Query Id, we set NPC_ICMP_ID in npc and leave
right away, without recaching npc (not needed since we didn't touch the
nbuf).

This fixes the handling of Query Id packets (that I broke in my previous
commit), and also fixes another possible use-after-free.

Retrieve the complete IPv4 header right away, and make sure we did retrieve
the IPv6 option header we were iterating on.

Ah, fix compilation. I tested my previous change by loading the kernel
module from the filesystem, but the Makefile didn't have DIAGNOSTIC
enabled, and the two KASSERTs I added did not compile properly.

If we fail to advance inside TCP/UDP/ICMPv4/ICMPv6, stop pretending L4
is unknown, and error out right away.

This prevents bugs in machinery, if a place looks for L4 in 'npc_proto'
without checking the cache too. I've seen a ~similar problem already.

In addition to checking L4 in the cache, here we also need to check the
protocol. The NPF entry point does not ensure that
ICMPv6 can be set only in IPv6
ICMPv4 can be set only in IPv4
So we could have ICMPv6 in IPv4.

apply some INET6 so this compiles in INET6-less kernels again.


To generate a diff of this commit:
cvs rdiff -u -r1.24.8.1 -r1.24.8.2 src/sys/net/npf/npf_alg_icmp.c
cvs rdiff -u -r1.37.6.1 -r1.37.6.2 src/sys/net/npf/npf_inet.c
cvs rdiff -u -r1.16.8.1 -r1.16.8.2 src/sys/net/npf/npf_sendpkt.c

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



CVS commit: [netbsd-8] src/sys/net/npf

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 19:22:30 UTC 2018

Modified Files:
src/sys/net/npf [netbsd-8]: npf_alg_icmp.c npf_inet.c npf_sendpkt.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #823):

sys/net/npf/npf_inet.c: revision 1.45-1.47
sys/net/npf/npf_alg_icmp.c: revision 1.27-1.30
sys/net/npf/npf_sendpkt.c: revision 1.19

Fix use-after-free.

The nbuf can be reallocated as a result of caching 'enpc', so it is
necessary to recache 'npc', otherwise it contains pointers to the freed
mbuf - pointers which are then used in the ruleset machinery.

We recache 'npc' when we are sure we won't use 'enpc' anymore, because
'enpc' can be clobbered as a result of caching 'npc' (in other words,
only one of the two can be cached at the same time).
Also, we recache 'npc' unconditionally, because there is no way to know
whether the nbuf got clobbered relatively to it. We can't use the
NBUF_DATAREF_RESET flag, because it is stored in the nbuf and not in the
cache.

Discussed with rmind@.

Change npf_cache_all so that it ensures the potential ICMP Query Id is in
the nbuf. In such a way that we don't need to ensure that later.
Change npfa_icmp4_inspect and npfa_icmp6_inspect so that they touch neither
the nbuf nor npc. Adapt their callers accordingly.

In the end, if a packet has a Query Id, we set NPC_ICMP_ID in npc and leave
right away, without recaching npc (not needed since we didn't touch the
nbuf).

This fixes the handling of Query Id packets (that I broke in my previous
commit), and also fixes another possible use-after-free.

Retrieve the complete IPv4 header right away, and make sure we did retrieve
the IPv6 option header we were iterating on.

Ah, fix compilation. I tested my previous change by loading the kernel
module from the filesystem, but the Makefile didn't have DIAGNOSTIC
enabled, and the two KASSERTs I added did not compile properly.

If we fail to advance inside TCP/UDP/ICMPv4/ICMPv6, stop pretending L4
is unknown, and error out right away.

This prevents bugs in machinery, if a place looks for L4 in 'npc_proto'
without checking the cache too. I've seen a ~similar problem already.

In addition to checking L4 in the cache, here we also need to check the
protocol. The NPF entry point does not ensure that
ICMPv6 can be set only in IPv6
ICMPv4 can be set only in IPv4
So we could have ICMPv6 in IPv4.

apply some INET6 so this compiles in INET6-less kernels again.


To generate a diff of this commit:
cvs rdiff -u -r1.24.8.1 -r1.24.8.2 src/sys/net/npf/npf_alg_icmp.c
cvs rdiff -u -r1.37.6.1 -r1.37.6.2 src/sys/net/npf/npf_inet.c
cvs rdiff -u -r1.16.8.1 -r1.16.8.2 src/sys/net/npf/npf_sendpkt.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/net/npf/npf_alg_icmp.c
diff -u src/sys/net/npf/npf_alg_icmp.c:1.24.8.1 src/sys/net/npf/npf_alg_icmp.c:1.24.8.2
--- src/sys/net/npf/npf_alg_icmp.c:1.24.8.1	Wed May  9 15:35:37 2018
+++ src/sys/net/npf/npf_alg_icmp.c	Mon May 14 19:22:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_alg_icmp.c,v 1.24.8.1 2018/05/09 15:35:37 martin Exp $	*/
+/*	$NetBSD: npf_alg_icmp.c,v 1.24.8.2 2018/05/14 19:22:30 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.24.8.1 2018/05/09 15:35:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.24.8.2 2018/05/14 19:22:30 martin Exp $");
 
 #include 
 #include 
@@ -120,13 +120,15 @@ npfa_icmp_match(npf_cache_t *npc, npf_na
 /*
  * npfa_icmp{4,6}_inspect: retrieve unique identifiers - either ICMP query
  * ID or TCP/UDP ports of the original packet, which is embedded.
+ *
+ * => Sets hasqid=true if the packet has a Query Id. In this case neither
+ *the nbuf nor npc is touched.
  */
 
 static bool
-npfa_icmp4_inspect(const int type, npf_cache_t *npc)
+npfa_icmp4_inspect(const int type, npf_cache_t *npc, bool *hasqid)
 {
 	nbuf_t *nbuf = npc->npc_nbuf;
-	u_int offby;
 
 	/* Per RFC 792. */
 	switch (type) {
@@ -147,12 +149,8 @@ npfa_icmp4_inspect(const int type, npf_c
 	case ICMP_TSTAMPREPLY:
 	case ICMP_IREQ:
 	case ICMP_IREQREPLY:
-		/* Should contain ICMP query ID - ensure. */
-		offby = offsetof(struct icmp, icmp_id);
-		if (!nbuf_advance(nbuf, offby, sizeof(uint16_t))) {
-			return false;
-		}
-		npc->npc_info |= NPC_ICMP_ID;
+		/* Contains ICMP query ID. */
+		*hasqid = true;
 		return true;
 	default:
 		break;
@@ -161,10 +159,9 @@ npfa_icmp4_inspect(const int type, npf_c
 }
 
 static bool
-npfa_icmp6_inspect(const int type, npf_cache_t *npc)
+npfa_icmp6_inspect(const int type, npf_cache_t *npc, bool *hasqid)
 {
 	nbuf_t *nbuf = npc->npc_nbuf;
-	u_int offby;
 
 	/* Per RFC 4443. */
 	switch (type) {
@@ -180,12 +177,8 @@ npfa_icmp6_inspect(const int type, npf_c
 
 	case ICMP6_ECHO_REQUEST:
 	case ICMP6_ECHO_REPLY:
-		/* 

CVS commit: [netbsd-8] src

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 19:17:39 UTC 2018

Modified Files:
src/lib/libc/string [netbsd-8]: stresep.c
src/tests/lib/libc/string [netbsd-8]: t_stresep.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #822):

lib/libc/string/stresep.c: revision 1.4
tests/lib/libc/string/t_stresep.c: revision 1.4

PR/52499: Justin: stresep uses memmove with of-by-one length
Add test from PR/52499


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 src/lib/libc/string/stresep.c
cvs rdiff -u -r1.3 -r1.3.22.1 src/tests/lib/libc/string/t_stresep.c

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



CVS commit: [netbsd-8] src

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 19:17:39 UTC 2018

Modified Files:
src/lib/libc/string [netbsd-8]: stresep.c
src/tests/lib/libc/string [netbsd-8]: t_stresep.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #822):

lib/libc/string/stresep.c: revision 1.4
tests/lib/libc/string/t_stresep.c: revision 1.4

PR/52499: Justin: stresep uses memmove with of-by-one length
Add test from PR/52499


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 src/lib/libc/string/stresep.c
cvs rdiff -u -r1.3 -r1.3.22.1 src/tests/lib/libc/string/t_stresep.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/libc/string/stresep.c
diff -u src/lib/libc/string/stresep.c:1.3 src/lib/libc/string/stresep.c:1.3.4.1
--- src/lib/libc/string/stresep.c:1.3	Sun Feb 12 17:19:00 2017
+++ src/lib/libc/string/stresep.c	Mon May 14 19:17:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: stresep.c,v 1.3 2017/02/12 17:19:00 maya Exp $	*/
+/*	$NetBSD: stresep.c,v 1.3.4.1 2018/05/14 19:17:39 martin Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)strsep.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: stresep.c,v 1.3 2017/02/12 17:19:00 maya Exp $");
+__RCSID("$NetBSD: stresep.c,v 1.3.4.1 2018/05/14 19:17:39 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -66,6 +66,7 @@ stresep(char **stringp, const char *deli
 	char *s;
 	const char *spanp;
 	int c, sc;
+	size_t l;
 	char *tok;
 
 	_DIAGASSERT(stringp != NULL);
@@ -73,22 +74,25 @@ stresep(char **stringp, const char *deli
 
 	if ((s = *stringp) == NULL)
 		return NULL;
+	l = strlen(s) + 1;
 	for (tok = s;;) {
 		c = *s++;
+		l--;
 		while (esc != '\0' && c == esc) {
-			memmove(s - 1, s, strlen(s));
+			memmove(s - 1, s, l);
 			c = *s++;
+			l--;
 		}
 		spanp = delim;
 		do {
 			if ((sc = *spanp++) == c) {
-if (c == 0)
+if (c == '\0')
 	s = NULL;
 else
-	s[-1] = 0;
+	s[-1] = '\0';
 *stringp = s;
 return tok;
 			}
-		} while (sc != 0);
+		} while (sc != '\0');
 	}
 }

Index: src/tests/lib/libc/string/t_stresep.c
diff -u src/tests/lib/libc/string/t_stresep.c:1.3 src/tests/lib/libc/string/t_stresep.c:1.3.22.1
--- src/tests/lib/libc/string/t_stresep.c:1.3	Fri Feb 15 23:56:32 2013
+++ src/tests/lib/libc/string/t_stresep.c	Mon May 14 19:17:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_stresep.c,v 1.3 2013/02/15 23:56:32 christos Exp $ */
+/*	$NetBSD: t_stresep.c,v 1.3.22.1 2018/05/14 19:17:39 martin Exp $ */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -61,6 +61,12 @@ ATF_TC_BODY(stresep_basic, tc)
 	expect("bar  foo");
 	expect("   baz");
 	expect("bar  ");
+
+	char brkstr2[] = "aa bb cc\\ \\ \\ \\ dd-";
+	q = brkstr2;
+	expect("aa");
+	expect("bb");
+	expect("ccdd-");
 }
 
 ATF_TP_ADD_TCS(tp)



CVS commit: [netbsd-8] src/sys/kern

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 19:11:21 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: kern_lwp.c

Log Message:
Pull up following revision(s) (requested by gson in ticket #805):

sys/kern/kern_lwp.c: revision 1.192

PR/kern/53202: Kernel hangs running t_ptrace_wait:resume1 test, revert
previous.


To generate a diff of this commit:
cvs rdiff -u -r1.189.2.1 -r1.189.2.2 src/sys/kern/kern_lwp.c

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

Modified files:

Index: src/sys/kern/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.189.2.1 src/sys/kern/kern_lwp.c:1.189.2.2
--- src/sys/kern/kern_lwp.c:1.189.2.1	Sun Dec 10 09:35:03 2017
+++ src/sys/kern/kern_lwp.c	Mon May 14 19:11:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.189.2.1 2017/12/10 09:35:03 snj Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.189.2.2 2018/05/14 19:11:21 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -211,7 +211,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.189.2.1 2017/12/10 09:35:03 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.189.2.2 2018/05/14 19:11:21 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -645,9 +645,8 @@ lwp_wait(struct lwp *l, lwpid_t lid, lwp
 		 */
 		if (exiting) {
 			KASSERT(p->p_nlwps > 1);
-			error = cv_wait_sig(>p_lwpcv, p->p_lock);
-			if (error == 0)
-error = EAGAIN;
+			cv_wait(>p_lwpcv, p->p_lock);
+			error = EAGAIN;
 			break;
 		}
 



CVS commit: [netbsd-8] src/sys/kern

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 19:11:21 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: kern_lwp.c

Log Message:
Pull up following revision(s) (requested by gson in ticket #805):

sys/kern/kern_lwp.c: revision 1.192

PR/kern/53202: Kernel hangs running t_ptrace_wait:resume1 test, revert
previous.


To generate a diff of this commit:
cvs rdiff -u -r1.189.2.1 -r1.189.2.2 src/sys/kern/kern_lwp.c

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



CVS commit: [netbsd-7-0] src/sys/net/npf

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 19:03:48 UTC 2018

Modified Files:
src/sys/net/npf [netbsd-7-0]: npf_alg_icmp.c npf_inet.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1605):

sys/net/npf/npf_inet.c: revision 1.45
sys/net/npf/npf_alg_icmp.c: revision 1.27-1.29

Fix use-after-free.

The nbuf can be reallocated as a result of caching 'enpc', so it is
necessary to recache 'npc', otherwise it contains pointers to the freed
mbuf - pointers which are then used in the ruleset machinery.
We recache 'npc' when we are sure we won't use 'enpc' anymore, because
'enpc' can be clobbered as a result of caching 'npc' (in other words,
only one of the two can be cached at the same time).
Also, we recache 'npc' unconditionally, because there is no way to know
whether the nbuf got clobbered relatively to it. We can't use the
NBUF_DATAREF_RESET flag, because it is stored in the nbuf and not in the
cache.
Discussed with rmind@.

Change npf_cache_all so that it ensures the potential ICMP Query Id is in
the nbuf. In such a way that we don't need to ensure that later.
Change npfa_icmp4_inspect and npfa_icmp6_inspect so that they touch neither
the nbuf nor npc. Adapt their callers accordingly.
In the end, if a packet has a Query Id, we set NPC_ICMP_ID in npc and leave
right away, without recaching npc (not needed since we didn't touch the
nbuf).
This fixes the handling of Query Id packets (that I broke in my previous
commit), and also fixes another possible use-after-free.

Ah, fix compilation. I tested my previous change by loading the kernel
module from the filesystem, but the Makefile didn't have DIAGNOSTIC
enabled, and the two KASSERTs I added did not compile properly.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.6.1 src/sys/net/npf/npf_alg_icmp.c
cvs rdiff -u -r1.32 -r1.32.6.1 src/sys/net/npf/npf_inet.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/net/npf/npf_alg_icmp.c
diff -u src/sys/net/npf/npf_alg_icmp.c:1.23 src/sys/net/npf/npf_alg_icmp.c:1.23.6.1
--- src/sys/net/npf/npf_alg_icmp.c:1.23	Sun Jul 20 00:37:41 2014
+++ src/sys/net/npf/npf_alg_icmp.c	Mon May 14 19:03:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_alg_icmp.c,v 1.23 2014/07/20 00:37:41 rmind Exp $	*/
+/*	$NetBSD: npf_alg_icmp.c,v 1.23.6.1 2018/05/14 19:03:48 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.23 2014/07/20 00:37:41 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.23.6.1 2018/05/14 19:03:48 martin Exp $");
 
 #include 
 #include 
@@ -118,13 +118,15 @@ npfa_icmp_match(npf_cache_t *npc, npf_na
 /*
  * npfa_icmp{4,6}_inspect: retrieve unique identifiers - either ICMP query
  * ID or TCP/UDP ports of the original packet, which is embedded.
+ *
+ * => Sets hasqid=true if the packet has a Query Id. In this case neither
+ *the nbuf nor npc is touched.
  */
 
 static bool
-npfa_icmp4_inspect(const int type, npf_cache_t *npc)
+npfa_icmp4_inspect(const int type, npf_cache_t *npc, bool *hasqid)
 {
 	nbuf_t *nbuf = npc->npc_nbuf;
-	u_int offby;
 
 	/* Per RFC 792. */
 	switch (type) {
@@ -148,12 +150,8 @@ npfa_icmp4_inspect(const int type, npf_c
 	case ICMP_TSTAMPREPLY:
 	case ICMP_IREQ:
 	case ICMP_IREQREPLY:
-		/* Should contain ICMP query ID - ensure. */
-		offby = offsetof(struct icmp, icmp_id);
-		if (!nbuf_advance(nbuf, offby, sizeof(uint16_t))) {
-			return false;
-		}
-		npc->npc_info |= NPC_ICMP_ID;
+		/* Contains ICMP query ID. */
+		*hasqid = true;
 		return true;
 	default:
 		break;
@@ -162,10 +160,9 @@ npfa_icmp4_inspect(const int type, npf_c
 }
 
 static bool
-npfa_icmp6_inspect(const int type, npf_cache_t *npc)
+npfa_icmp6_inspect(const int type, npf_cache_t *npc, bool *hasqid)
 {
 	nbuf_t *nbuf = npc->npc_nbuf;
-	u_int offby;
 
 	/* Per RFC 4443. */
 	switch (type) {
@@ -184,12 +181,8 @@ npfa_icmp6_inspect(const int type, npf_c
 
 	case ICMP6_ECHO_REQUEST:
 	case ICMP6_ECHO_REPLY:
-		/* Should contain ICMP query ID - ensure. */
-		offby = offsetof(struct icmp6_hdr, icmp6_id);
-		if (!nbuf_advance(nbuf, offby, sizeof(uint16_t))) {
-			return false;
-		}
-		npc->npc_info |= NPC_ICMP_ID;
+		/* Contains ICMP query ID. */
+		*hasqid = true;
 		return true;
 	default:
 		break;
@@ -200,13 +193,13 @@ npfa_icmp6_inspect(const int type, npf_c
 /*
  * npfa_icmp_inspect: ALG ICMP inspector.
  *
- * => Returns true if "enpc" is filled.
+ * => Returns false if there is a problem with the format.
  */
 static bool
 npfa_icmp_inspect(npf_cache_t *npc, npf_cache_t *enpc)
 {
 	nbuf_t *nbuf = npc->npc_nbuf;
-	bool ret;
+	bool ret, hasqid = false;
 
 	KASSERT(npf_iscached(npc, NPC_IP46));
 	KASSERT(npf_iscached(npc, NPC_ICMP));
@@ -225,10 +218,10 @@ npfa_icmp_inspect(npf_cache_t *npc, npf_
 	 */
 	if (npf_iscached(npc, NPC_IP4)) {
 		

CVS commit: [netbsd-7-0] src/sys/net/npf

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 19:03:48 UTC 2018

Modified Files:
src/sys/net/npf [netbsd-7-0]: npf_alg_icmp.c npf_inet.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1605):

sys/net/npf/npf_inet.c: revision 1.45
sys/net/npf/npf_alg_icmp.c: revision 1.27-1.29

Fix use-after-free.

The nbuf can be reallocated as a result of caching 'enpc', so it is
necessary to recache 'npc', otherwise it contains pointers to the freed
mbuf - pointers which are then used in the ruleset machinery.
We recache 'npc' when we are sure we won't use 'enpc' anymore, because
'enpc' can be clobbered as a result of caching 'npc' (in other words,
only one of the two can be cached at the same time).
Also, we recache 'npc' unconditionally, because there is no way to know
whether the nbuf got clobbered relatively to it. We can't use the
NBUF_DATAREF_RESET flag, because it is stored in the nbuf and not in the
cache.
Discussed with rmind@.

Change npf_cache_all so that it ensures the potential ICMP Query Id is in
the nbuf. In such a way that we don't need to ensure that later.
Change npfa_icmp4_inspect and npfa_icmp6_inspect so that they touch neither
the nbuf nor npc. Adapt their callers accordingly.
In the end, if a packet has a Query Id, we set NPC_ICMP_ID in npc and leave
right away, without recaching npc (not needed since we didn't touch the
nbuf).
This fixes the handling of Query Id packets (that I broke in my previous
commit), and also fixes another possible use-after-free.

Ah, fix compilation. I tested my previous change by loading the kernel
module from the filesystem, but the Makefile didn't have DIAGNOSTIC
enabled, and the two KASSERTs I added did not compile properly.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.6.1 src/sys/net/npf/npf_alg_icmp.c
cvs rdiff -u -r1.32 -r1.32.6.1 src/sys/net/npf/npf_inet.c

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



CVS commit: src/sys

2018-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon May 14 17:34:26 UTC 2018

Modified Files:
src/sys/netinet: ip_input.c
src/sys/netinet6: ip6_input.c
src/sys/netipsec: ipsec.c ipsec.h ipsec6.h
src/sys/rump/librump/rumpnet: net_stub.c

Log Message:
Merge ipsec4_input and ipsec6_input into ipsec_ip_input. Make the argument
a bool for clarity. Optimize the function: if M_CANFASTFWD is not there
(because already removed by the firewall) leave now.

Makes it easier to see that M_CANFASTFWD is not removed on IPv6.


To generate a diff of this commit:
cvs rdiff -u -r1.382 -r1.383 src/sys/netinet/ip_input.c
cvs rdiff -u -r1.201 -r1.202 src/sys/netinet6/ip6_input.c
cvs rdiff -u -r1.163 -r1.164 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.81 -r1.82 src/sys/netipsec/ipsec.h
cvs rdiff -u -r1.28 -r1.29 src/sys/netipsec/ipsec6.h
cvs rdiff -u -r1.35 -r1.36 src/sys/rump/librump/rumpnet/net_stub.c

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

Modified files:

Index: src/sys/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.382 src/sys/netinet/ip_input.c:1.383
--- src/sys/netinet/ip_input.c:1.382	Thu May 10 05:08:53 2018
+++ src/sys/netinet/ip_input.c	Mon May 14 17:34:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.382 2018/05/10 05:08:53 maxv Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.383 2018/05/14 17:34:26 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.382 2018/05/10 05:08:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.383 2018/05/14 17:34:26 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -729,7 +729,7 @@ ip_input(struct mbuf *m)
 #ifdef IPSEC
 		/* Check the security policy (SP) for the packet */
 		if (ipsec_used) {
-			if (ipsec4_input(m, IP_FORWARDING) != 0) {
+			if (ipsec_ip_input(m, true) != 0) {
 goto out;
 			}
 		}
@@ -776,7 +776,7 @@ ours:
 	 */
 	if (ipsec_used &&
 	(inetsw[ip_protox[ip->ip_p]].pr_flags & PR_LASTHDR) != 0) {
-		if (ipsec4_input(m, 0) != 0) {
+		if (ipsec_ip_input(m, false) != 0) {
 			goto out;
 		}
 	}

Index: src/sys/netinet6/ip6_input.c
diff -u src/sys/netinet6/ip6_input.c:1.201 src/sys/netinet6/ip6_input.c:1.202
--- src/sys/netinet6/ip6_input.c:1.201	Tue May  1 07:21:39 2018
+++ src/sys/netinet6/ip6_input.c	Mon May 14 17:34:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_input.c,v 1.201 2018/05/01 07:21:39 maxv Exp $	*/
+/*	$NetBSD: ip6_input.c,v 1.202 2018/05/14 17:34:26 maxv Exp $	*/
 /*	$KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.201 2018/05/01 07:21:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.202 2018/05/14 17:34:26 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -742,7 +742,7 @@ hbhcheck:
 			& PR_LASTHDR) != 0) {
 int error;
 
-error = ipsec6_input(m);
+error = ipsec_ip_input(m, false);
 if (error)
 	goto bad;
 			}

Index: src/sys/netipsec/ipsec.c
diff -u src/sys/netipsec/ipsec.c:1.163 src/sys/netipsec/ipsec.c:1.164
--- src/sys/netipsec/ipsec.c:1.163	Thu May 10 05:15:14 2018
+++ src/sys/netipsec/ipsec.c	Mon May 14 17:34:26 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.163 2018/05/10 05:15:14 maxv Exp $ */
+/* $NetBSD: ipsec.c,v 1.164 2018/05/14 17:34:26 maxv Exp $ */
 /* $FreeBSD: ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */
 /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.163 2018/05/10 05:15:14 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.164 2018/05/14 17:34:26 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -697,7 +697,7 @@ ipsec4_output(struct mbuf *m, struct inp
 }
 
 int
-ipsec4_input(struct mbuf *m, int flags)
+ipsec_ip_input(struct mbuf *m, bool forward)
 {
 	struct secpolicy *sp;
 	int error, s;
@@ -709,8 +709,7 @@ ipsec4_input(struct mbuf *m, int flags)
 		return EINVAL;
 	}
 
-	if (flags == 0) {
-		/* We are done. */
+	if (!forward || !(m->m_flags & M_CANFASTFWD)) {
 		return 0;
 	}
 
@@ -719,12 +718,14 @@ ipsec4_input(struct mbuf *m, int flags)
 	 * it is a Fast Forward candidate.
 	 */
 	s = splsoftnet();
-	sp = ipsec_checkpolicy(m, IPSEC_DIR_OUTBOUND, flags, , NULL);
+	sp = ipsec_checkpolicy(m, IPSEC_DIR_OUTBOUND, IP_FORWARDING,
+	, NULL);
 	if (sp != NULL) {
 		m->m_flags &= ~M_CANFASTFWD;
 		KEY_SP_UNREF();
 	}
 	splx(s);
+
 	return 0;
 }
 
@@ -1828,21 +1829,6 @@ skippolicycheck:
 	*needipsecp = needipsec;
 	return sp;
 }
-
-int
-ipsec6_input(struct mbuf *m)
-{
-	int s, error;
-
-	s = splsoftnet();
-	error = ipsec_in_reject(m, NULL);
-	splx(s);
-	if (error) {
-		return EINVAL;
-	}
-
-	return 0;
-}
 #endif /* INET6 */
 
 /*

Index: src/sys/netipsec/ipsec.h
diff -u src/sys/netipsec/ipsec.h:1.81 src/sys/netipsec/ipsec.h:1.82
--- 

CVS commit: src/sys

2018-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon May 14 17:34:26 UTC 2018

Modified Files:
src/sys/netinet: ip_input.c
src/sys/netinet6: ip6_input.c
src/sys/netipsec: ipsec.c ipsec.h ipsec6.h
src/sys/rump/librump/rumpnet: net_stub.c

Log Message:
Merge ipsec4_input and ipsec6_input into ipsec_ip_input. Make the argument
a bool for clarity. Optimize the function: if M_CANFASTFWD is not there
(because already removed by the firewall) leave now.

Makes it easier to see that M_CANFASTFWD is not removed on IPv6.


To generate a diff of this commit:
cvs rdiff -u -r1.382 -r1.383 src/sys/netinet/ip_input.c
cvs rdiff -u -r1.201 -r1.202 src/sys/netinet6/ip6_input.c
cvs rdiff -u -r1.163 -r1.164 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.81 -r1.82 src/sys/netipsec/ipsec.h
cvs rdiff -u -r1.28 -r1.29 src/sys/netipsec/ipsec6.h
cvs rdiff -u -r1.35 -r1.36 src/sys/rump/librump/rumpnet/net_stub.c

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



CVS commit: src/sys/netinet

2018-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon May 14 17:26:16 UTC 2018

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

Log Message:
Don't crash if there is no inner IP header.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/netinet/ip_mroute.c

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



CVS commit: src/sys/netinet

2018-05-14 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon May 14 17:26:16 UTC 2018

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

Log Message:
Don't crash if there is no inner IP header.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/netinet/ip_mroute.c

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

Modified files:

Index: src/sys/netinet/ip_mroute.c
diff -u src/sys/netinet/ip_mroute.c:1.158 src/sys/netinet/ip_mroute.c:1.159
--- src/sys/netinet/ip_mroute.c:1.158	Mon May  7 19:34:03 2018
+++ src/sys/netinet/ip_mroute.c	Mon May 14 17:26:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_mroute.c,v 1.158 2018/05/07 19:34:03 maxv Exp $	*/
+/*	$NetBSD: ip_mroute.c,v 1.159 2018/05/14 17:26:16 maxv Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -93,7 +93,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.158 2018/05/07 19:34:03 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.159 2018/05/14 17:26:16 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1828,7 +1828,7 @@ vif_encapcheck(struct mbuf *m, int off, 
 	 */
 
 	/* Obtain the outer IP header and the vif pointer. */
-	m_copydata((struct mbuf *)m, 0, sizeof(ip), (void *));
+	m_copydata(m, 0, sizeof(ip), (void *));
 	vifp = (struct vif *)arg;
 
 	/*
@@ -1849,7 +1849,9 @@ vif_encapcheck(struct mbuf *m, int off, 
 		return 0;
 
 	/* Check that the inner destination is multicast. */
-	m_copydata((struct mbuf *)m, off, sizeof(ip), (void *));
+	if (off + sizeof(ip) > m->m_pkthdr.len)
+		return 0;
+	m_copydata(m, off, sizeof(ip), (void *));
 	if (!IN_MULTICAST(ip.ip_dst.s_addr))
 		return 0;
 



CVS commit: src/sys/arch

2018-05-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon May 14 17:15:54 UTC 2018

Modified Files:
src/sys/arch/aarch64/include: armreg.h
src/sys/arch/arm/cortex: gtmr.c
src/sys/arch/arm/include: armreg.h

Log Message:
Workaround A-008585 errata in GTMR.

Register reads and writes may provide unstable results if the counter
hardware is active at the same time. This results in non-monotonic
counters seen by both the gtmr interrupt and time counter.

The loops are currently applied unconditionally, restricting them to
appropiate FDT markers can be applied later.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/aarch64/include/armreg.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/cortex/gtmr.c
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/arm/include/armreg.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/arch/aarch64/include/armreg.h
diff -u src/sys/arch/aarch64/include/armreg.h:1.9 src/sys/arch/aarch64/include/armreg.h:1.10
--- src/sys/arch/aarch64/include/armreg.h:1.9	Sun Apr  1 04:35:03 2018
+++ src/sys/arch/aarch64/include/armreg.h	Mon May 14 17:15:54 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: armreg.h,v 1.9 2018/04/01 04:35:03 ryo Exp $ */
+/* $NetBSD: armreg.h,v 1.10 2018/05/14 17:15:54 joerg Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -1005,6 +1005,13 @@ gtmr_cntp_ctl_write(uint32_t val)
 /*
  * Counter-timer Virtual Timer TimerValue register
  */
+static inline uint32_t
+gtmr_cntv_tval_read(void)
+{
+
+	return reg_cntv_tval_el0_read();
+}
+
 static inline void
 gtmr_cntv_tval_write(uint32_t val)
 {

Index: src/sys/arch/arm/cortex/gtmr.c
diff -u src/sys/arch/arm/cortex/gtmr.c:1.26 src/sys/arch/arm/cortex/gtmr.c:1.27
--- src/sys/arch/arm/cortex/gtmr.c:1.26	Mon May 14 17:11:38 2018
+++ src/sys/arch/arm/cortex/gtmr.c	Mon May 14 17:15:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtmr.c,v 1.26 2018/05/14 17:11:38 joerg Exp $	*/
+/*	$NetBSD: gtmr.c,v 1.27 2018/05/14 17:15:54 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.26 2018/05/14 17:11:38 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.27 2018/05/14 17:15:54 joerg Exp $");
 
 #include 
 #include 
@@ -50,6 +50,51 @@ __KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.2
 #include 
 #include 
 
+#define stable_write(reg) \
+static void \
+reg ## _stable_write(struct gtmr_softc *sc, uint64_t val) \
+{ \
+	static int max_retry = 0; \
+	int retry; \
+	reg ## _write(val); \
+	retry = 0; \
+	while (reg ## _read() != (val) && retry++ < 200) \
+		reg ## _write(val); \
+	if (retry > max_retry) { \
+		aprint_verbose_dev(sc->sc_dev, #reg "_write max retries %d -> %d\n", \
+		max_retry, retry); \
+		max_retry = retry; \
+	} \
+}
+
+stable_write(gtmr_cntv_tval);
+
+#define stable_read(reg) \
+static uint64_t \
+reg ## _stable_read(struct gtmr_softc *sc) \
+{ \
+	static int max_retry = 0; \
+	uint64_t oval, val; \
+	int retry = 0; \
+	val = reg ## _read(); \
+	while (++retry < 200) { \
+		oval = val; \
+		val = reg ## _read(); \
+		if (val == oval) \
+			break; \
+	} \
+	if (retry > max_retry) { \
+		aprint_verbose_dev(sc->sc_dev, #reg "_read max retries %d -> %d\n", \
+		max_retry, retry); \
+		max_retry = retry; \
+	} \
+	return val; \
+}
+
+stable_read(gtmr_cntv_cval);
+stable_read(gtmr_cntvct);
+stable_read(gtmr_cntpct);
+
 static int gtmr_match(device_t, cfdata_t, void *);
 static void gtmr_attach(device_t, device_t, void *);
 
@@ -150,6 +195,7 @@ gtmr_attach(device_t parent, device_t se
 
 	gtmr_timecounter.tc_name = device_xname(sc->sc_dev);
 	gtmr_timecounter.tc_frequency = sc->sc_freq;
+	gtmr_timecounter.tc_priv = sc;
 
 	tc_init(_timecounter);
 
@@ -177,8 +223,8 @@ gtmr_init_cpu_clock(struct cpu_info *ci)
 	 * Get now and update the compare timer.
 	 */
 	arm_isb();
-	ci->ci_lastintr = gtmr_cntvct_read();
-	gtmr_cntv_tval_write(sc->sc_autoinc);
+	ci->ci_lastintr = gtmr_cntvct_stable_read(sc);
+	gtmr_cntv_tval_stable_write(sc, sc->sc_autoinc);
 	splx(s);
 	KASSERT(gtmr_cntvct_read() != 0);
 }
@@ -210,11 +256,11 @@ gtmr_delay(unsigned int n)
 	unsigned int delta = 0, usecs = 0;
 
 	arm_isb();
-	uint64_t last = gtmr_cntpct_read();
+	uint64_t last = gtmr_cntpct_stable_read(sc);
 
 	while (n > usecs) {
 		arm_isb();
-		uint64_t curr = gtmr_cntpct_read();
+		uint64_t curr = gtmr_cntpct_stable_read(sc);
 		if (curr < last)
 			delta += curr + (UINT64_MAX - last);
 		else
@@ -246,11 +292,11 @@ gtmr_intr(void *arg)
 	if ((ctl & CNTCTL_ISTATUS) == 0)
 		return 0;
 
-	const uint64_t now = gtmr_cntvct_read();
+	const uint64_t now = gtmr_cntvct_stable_read(sc);
 	uint64_t delta = now - ci->ci_lastintr;
 
 #ifdef DIAGNOSTIC
-	const uint64_t then = gtmr_cntv_cval_read();
+	const uint64_t then = gtmr_cntv_cval_stable_read(sc);
 	struct gtmr_percpu * const pc = percpu_getref(sc->sc_percpu);
 	KASSERTMSG(then <= now, 

CVS commit: src/sys/arch

2018-05-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon May 14 17:15:54 UTC 2018

Modified Files:
src/sys/arch/aarch64/include: armreg.h
src/sys/arch/arm/cortex: gtmr.c
src/sys/arch/arm/include: armreg.h

Log Message:
Workaround A-008585 errata in GTMR.

Register reads and writes may provide unstable results if the counter
hardware is active at the same time. This results in non-monotonic
counters seen by both the gtmr interrupt and time counter.

The loops are currently applied unconditionally, restricting them to
appropiate FDT markers can be applied later.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/aarch64/include/armreg.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/cortex/gtmr.c
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/arm/include/armreg.h

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



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

2018-05-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon May 14 17:11:38 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: gtmr.c

Log Message:
Remove a number of debug #if 0s.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/cortex/gtmr.c

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

Modified files:

Index: src/sys/arch/arm/cortex/gtmr.c
diff -u src/sys/arch/arm/cortex/gtmr.c:1.25 src/sys/arch/arm/cortex/gtmr.c:1.26
--- src/sys/arch/arm/cortex/gtmr.c:1.25	Mon May 14 17:09:41 2018
+++ src/sys/arch/arm/cortex/gtmr.c	Mon May 14 17:11:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtmr.c,v 1.25 2018/05/14 17:09:41 joerg Exp $	*/
+/*	$NetBSD: gtmr.c,v 1.26 2018/05/14 17:11:38 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.25 2018/05/14 17:09:41 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.26 2018/05/14 17:11:38 joerg Exp $");
 
 #include 
 #include 
@@ -172,9 +172,6 @@ gtmr_init_cpu_clock(struct cpu_info *ci)
 	 */
 	gtmr_cntv_ctl_write(CNTCTL_ENABLE);
 	gtmr_cntp_ctl_write(CNTCTL_ENABLE);
-#if 0
-	printf("%s: cntctl=%#x\n", __func__, gtmr_cntv_ctl_read());
-#endif
 
 	/*
 	 * Get now and update the compare timer.
@@ -182,47 +179,8 @@ gtmr_init_cpu_clock(struct cpu_info *ci)
 	arm_isb();
 	ci->ci_lastintr = gtmr_cntvct_read();
 	gtmr_cntv_tval_write(sc->sc_autoinc);
-#if 0
-	printf("%s: %s: delta cval = %"PRIu64"\n",
-	__func__, ci->ci_data.cpu_name,
-	gtmr_cntv_cval_read() - ci->ci_lastintr);
-#endif
 	splx(s);
 	KASSERT(gtmr_cntvct_read() != 0);
-#if 0
-	printf("%s: %s: ctl %#x cmp %#"PRIx64" now %#"PRIx64"\n",
-	__func__, ci->ci_data.cpu_name, gtmr_cntv_ctl_read(),
-	gtmr_cntv_cval_read(), gtmr_cntvct_read());
-
-	s = splsched();
-
-	arm_isb();
-	uint64_t now64;
-	uint64_t start64 = gtmr_cntvct_read();
-	do {
-		arm_isb();
-		now64 = gtmr_cntvct_read();
-	} while (start64 == now64);
-	start64 = now64;
-	uint64_t end64 = start64 + 64;
-	uint32_t start32 = arm_pmccntr_read();
-	do {
-		arm_isb();
-		now64 = gtmr_cntvct_read();
-	} while (end64 != now64);
-	uint32_t end32 = arm_pmccntr_read();
-
-	uint32_t diff32 = end64 - start64;
-	printf("%s: %s: %u cycles per tick\n",
-	__func__, ci->ci_data.cpu_name, (end32 - start32) / diff32);
-
-	printf("%s: %s: status %#x cmp %#"PRIx64" now %#"PRIx64"\n",
-	__func__, ci->ci_data.cpu_name, gtmr_cntv_ctl_read(),
-	gtmr_cntv_cval_read(), gtmr_cntvct_read());
-	splx(s);
-#elif 0
-	delay(100 / hz + 1000);
-#endif
 }
 
 void
@@ -299,10 +257,6 @@ gtmr_intr(void *arg)
 	"%"PRId64, then + pc->pc_delta - ci->ci_lastintr - sc->sc_autoinc);
 #endif
 
-#if 0
-	printf("%s(%p): %s: now %#"PRIx64" delta %"PRIu64"\n",
-	 __func__, cf, ci->ci_data.cpu_name, now, delta);
-#endif
 	KASSERTMSG(delta > sc->sc_autoinc / 100,
 	"%s: interrupting too quickly (delta=%"PRIu64") autoinc=%lu",
 	ci->ci_data.cpu_name, delta, sc->sc_autoinc);



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

2018-05-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon May 14 17:11:38 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: gtmr.c

Log Message:
Remove a number of debug #if 0s.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/cortex/gtmr.c

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



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

2018-05-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon May 14 17:09:41 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: gtmr.c gtmr_var.h

Log Message:
Remove unused gtmr_bootdelay.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/cortex/gtmr.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/cortex/gtmr_var.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/arch/arm/cortex/gtmr.c
diff -u src/sys/arch/arm/cortex/gtmr.c:1.24 src/sys/arch/arm/cortex/gtmr.c:1.25
--- src/sys/arch/arm/cortex/gtmr.c:1.24	Sun Apr  1 04:35:04 2018
+++ src/sys/arch/arm/cortex/gtmr.c	Mon May 14 17:09:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtmr.c,v 1.24 2018/04/01 04:35:04 ryo Exp $	*/
+/*	$NetBSD: gtmr.c,v 1.25 2018/05/14 17:09:41 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.24 2018/04/01 04:35:04 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.25 2018/05/14 17:09:41 joerg Exp $");
 
 #include 
 #include 
@@ -270,23 +270,6 @@ gtmr_delay(unsigned int n)
 	}
 }
 
-void
-gtmr_bootdelay(unsigned int ticks)
-{
-	const uint32_t ctl = gtmr_cntv_ctl_read();
-	gtmr_cntv_ctl_write(ctl | CNTCTL_ENABLE | CNTCTL_IMASK);
-
-	/* Write Timer/Value to set new compare time */
-	gtmr_cntv_tval_write(ticks);
-
-	/* Spin until compare time is hit */
-	while ((gtmr_cntv_ctl_read() & CNTCTL_ISTATUS) == 0) {
-		/* spin */
-	}
-
-	gtmr_cntv_ctl_write(ctl);
-}
-
 /*
  * gtmr_intr:
  *

Index: src/sys/arch/arm/cortex/gtmr_var.h
diff -u src/sys/arch/arm/cortex/gtmr_var.h:1.9 src/sys/arch/arm/cortex/gtmr_var.h:1.10
--- src/sys/arch/arm/cortex/gtmr_var.h:1.9	Thu Nov 30 14:50:34 2017
+++ src/sys/arch/arm/cortex/gtmr_var.h	Mon May 14 17:09:41 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmr_var.h,v 1.9 2017/11/30 14:50:34 skrll Exp $ */
+/* $NetBSD: gtmr_var.h,v 1.10 2018/05/14 17:09:41 joerg Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -51,7 +51,6 @@ void	gtmr_init(device_t);
 int	gtmr_intr(void *);
 void	gtmr_init_cpu_clock(struct cpu_info *);
 void	gtmr_delay(unsigned int n);
-void	gtmr_bootdelay(unsigned int n);
 #ifdef __HAVE_GENERIC_CPU_INITCLOCKS
 void	gtmr_cpu_initclocks(void);
 #else



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

2018-05-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon May 14 17:09:41 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: gtmr.c gtmr_var.h

Log Message:
Remove unused gtmr_bootdelay.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/cortex/gtmr.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/cortex/gtmr_var.h

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



CVS commit: [netbsd-7] src/doc

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:21:48 UTC 2018

Modified Files:
src/doc [netbsd-7]: CHANGES-7.2

Log Message:
Tickets #1604 and #1605


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.88 -r1.1.2.89 src/doc/CHANGES-7.2

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



CVS commit: [netbsd-7] src/doc

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:21:48 UTC 2018

Modified Files:
src/doc [netbsd-7]: CHANGES-7.2

Log Message:
Tickets #1604 and #1605


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.88 -r1.1.2.89 src/doc/CHANGES-7.2

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

Modified files:

Index: src/doc/CHANGES-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.88 src/doc/CHANGES-7.2:1.1.2.89
--- src/doc/CHANGES-7.2:1.1.2.88	Sun May  6 09:54:18 2018
+++ src/doc/CHANGES-7.2	Mon May 14 16:21:48 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.88 2018/05/06 09:54:18 martin Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.89 2018/05/14 16:21:48 martin Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -5470,3 +5470,14 @@ sys/kern/kern_runq.c1.46
 	historical data.
 	[mlelstv, ticket #1603]
 
+sys/dev/ic/hme.c1.97
+
+	Fix mis-placed right parenthesis.
+	[pgoyette, ticket #1604]
+
+sys/net/npf/npf_alg_icmp.c			1.27-1.29
+sys/net/npf/npf_inet.c1.45
+
+	Fix use-after-free.
+	[maxv, ticket #1605]
+



CVS commit: [netbsd-7-1] src/doc

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:21:13 UTC 2018

Modified Files:
src/doc [netbsd-7-1]: CHANGES-7.1.3

Log Message:
Ticket #1605


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/doc/CHANGES-7.1.3

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

Modified files:

Index: src/doc/CHANGES-7.1.3
diff -u src/doc/CHANGES-7.1.3:1.1.2.10 src/doc/CHANGES-7.1.3:1.1.2.11
--- src/doc/CHANGES-7.1.3:1.1.2.10	Thu May  3 15:15:17 2018
+++ src/doc/CHANGES-7.1.3	Mon May 14 16:21:13 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.3,v 1.1.2.10 2018/05/03 15:15:17 martin Exp $
+# $NetBSD: CHANGES-7.1.3,v 1.1.2.11 2018/05/14 16:21:13 martin Exp $
 
 A complete list of changes from the NetBSD 7.1.2 release to the NetBSD 7.1.3
 release:
@@ -122,3 +122,9 @@ sys/kern/uipc_mbuf.c1.211 (patch)
 	the chain.
 	[maxv, ticket #1602]
 
+sys/net/npf/npf_alg_icmp.c			1.27-1.29
+sys/net/npf/npf_inet.c1.45
+
+	Fix use-after-free.
+	[maxv, ticket #1605]
+



CVS commit: [netbsd-7-0] src/doc

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:20:55 UTC 2018

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.3

Log Message:
Ticket #1605


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.103 -r1.1.2.104 src/doc/CHANGES-7.0.3

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

Modified files:

Index: src/doc/CHANGES-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.103 src/doc/CHANGES-7.0.3:1.1.2.104
--- src/doc/CHANGES-7.0.3:1.1.2.103	Thu May  3 15:16:06 2018
+++ src/doc/CHANGES-7.0.3	Mon May 14 16:20:55 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.103 2018/05/03 15:16:06 martin Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.104 2018/05/14 16:20:55 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5430,3 +5430,9 @@ sys/kern/uipc_mbuf.c1.211 (patch)
 	the chain.
 	[maxv, ticket #1602]
 
+sys/net/npf/npf_alg_icmp.c			1.27-1.29
+sys/net/npf/npf_inet.c1.45
+
+	Fix use-after-free.
+	[maxv, ticket #1605]
+



CVS commit: [netbsd-7-1] src/doc

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:21:13 UTC 2018

Modified Files:
src/doc [netbsd-7-1]: CHANGES-7.1.3

Log Message:
Ticket #1605


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/doc/CHANGES-7.1.3

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



CVS commit: [netbsd-7-0] src/doc

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:20:55 UTC 2018

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.3

Log Message:
Ticket #1605


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.103 -r1.1.2.104 src/doc/CHANGES-7.0.3

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



CVS commit: [netbsd-7-1] src/sys/net/npf

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:17:19 UTC 2018

Modified Files:
src/sys/net/npf [netbsd-7-1]: npf_alg_icmp.c npf_inet.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1605):

sys/net/npf/npf_inet.c: revision 1.45
sys/net/npf/npf_alg_icmp.c: revision 1.27-1.29

Fix use-after-free.

The nbuf can be reallocated as a result of caching 'enpc', so it is
necessary to recache 'npc', otherwise it contains pointers to the freed
mbuf - pointers which are then used in the ruleset machinery.
We recache 'npc' when we are sure we won't use 'enpc' anymore, because
'enpc' can be clobbered as a result of caching 'npc' (in other words,
only one of the two can be cached at the same time).
Also, we recache 'npc' unconditionally, because there is no way to know
whether the nbuf got clobbered relatively to it. We can't use the
NBUF_DATAREF_RESET flag, because it is stored in the nbuf and not in the
cache.
Discussed with rmind@.

Change npf_cache_all so that it ensures the potential ICMP Query Id is in
the nbuf. In such a way that we don't need to ensure that later.
Change npfa_icmp4_inspect and npfa_icmp6_inspect so that they touch neither
the nbuf nor npc. Adapt their callers accordingly.
In the end, if a packet has a Query Id, we set NPC_ICMP_ID in npc and leave
right away, without recaching npc (not needed since we didn't touch the
nbuf).
This fixes the handling of Query Id packets (that I broke in my previous
commit), and also fixes another possible use-after-free.

Ah, fix compilation. I tested my previous change by loading the kernel
module from the filesystem, but the Makefile didn't have DIAGNOSTIC
enabled, and the two KASSERTs I added did not compile properly.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.12.1 src/sys/net/npf/npf_alg_icmp.c
cvs rdiff -u -r1.32 -r1.32.10.1 src/sys/net/npf/npf_inet.c

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



CVS commit: [netbsd-7-1] src/sys/net/npf

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:17:19 UTC 2018

Modified Files:
src/sys/net/npf [netbsd-7-1]: npf_alg_icmp.c npf_inet.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1605):

sys/net/npf/npf_inet.c: revision 1.45
sys/net/npf/npf_alg_icmp.c: revision 1.27-1.29

Fix use-after-free.

The nbuf can be reallocated as a result of caching 'enpc', so it is
necessary to recache 'npc', otherwise it contains pointers to the freed
mbuf - pointers which are then used in the ruleset machinery.
We recache 'npc' when we are sure we won't use 'enpc' anymore, because
'enpc' can be clobbered as a result of caching 'npc' (in other words,
only one of the two can be cached at the same time).
Also, we recache 'npc' unconditionally, because there is no way to know
whether the nbuf got clobbered relatively to it. We can't use the
NBUF_DATAREF_RESET flag, because it is stored in the nbuf and not in the
cache.
Discussed with rmind@.

Change npf_cache_all so that it ensures the potential ICMP Query Id is in
the nbuf. In such a way that we don't need to ensure that later.
Change npfa_icmp4_inspect and npfa_icmp6_inspect so that they touch neither
the nbuf nor npc. Adapt their callers accordingly.
In the end, if a packet has a Query Id, we set NPC_ICMP_ID in npc and leave
right away, without recaching npc (not needed since we didn't touch the
nbuf).
This fixes the handling of Query Id packets (that I broke in my previous
commit), and also fixes another possible use-after-free.

Ah, fix compilation. I tested my previous change by loading the kernel
module from the filesystem, but the Makefile didn't have DIAGNOSTIC
enabled, and the two KASSERTs I added did not compile properly.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.12.1 src/sys/net/npf/npf_alg_icmp.c
cvs rdiff -u -r1.32 -r1.32.10.1 src/sys/net/npf/npf_inet.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/net/npf/npf_alg_icmp.c
diff -u src/sys/net/npf/npf_alg_icmp.c:1.23 src/sys/net/npf/npf_alg_icmp.c:1.23.12.1
--- src/sys/net/npf/npf_alg_icmp.c:1.23	Sun Jul 20 00:37:41 2014
+++ src/sys/net/npf/npf_alg_icmp.c	Mon May 14 16:17:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_alg_icmp.c,v 1.23 2014/07/20 00:37:41 rmind Exp $	*/
+/*	$NetBSD: npf_alg_icmp.c,v 1.23.12.1 2018/05/14 16:17:19 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.23 2014/07/20 00:37:41 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.23.12.1 2018/05/14 16:17:19 martin Exp $");
 
 #include 
 #include 
@@ -118,13 +118,15 @@ npfa_icmp_match(npf_cache_t *npc, npf_na
 /*
  * npfa_icmp{4,6}_inspect: retrieve unique identifiers - either ICMP query
  * ID or TCP/UDP ports of the original packet, which is embedded.
+ *
+ * => Sets hasqid=true if the packet has a Query Id. In this case neither
+ *the nbuf nor npc is touched.
  */
 
 static bool
-npfa_icmp4_inspect(const int type, npf_cache_t *npc)
+npfa_icmp4_inspect(const int type, npf_cache_t *npc, bool *hasqid)
 {
 	nbuf_t *nbuf = npc->npc_nbuf;
-	u_int offby;
 
 	/* Per RFC 792. */
 	switch (type) {
@@ -148,12 +150,8 @@ npfa_icmp4_inspect(const int type, npf_c
 	case ICMP_TSTAMPREPLY:
 	case ICMP_IREQ:
 	case ICMP_IREQREPLY:
-		/* Should contain ICMP query ID - ensure. */
-		offby = offsetof(struct icmp, icmp_id);
-		if (!nbuf_advance(nbuf, offby, sizeof(uint16_t))) {
-			return false;
-		}
-		npc->npc_info |= NPC_ICMP_ID;
+		/* Contains ICMP query ID. */
+		*hasqid = true;
 		return true;
 	default:
 		break;
@@ -162,10 +160,9 @@ npfa_icmp4_inspect(const int type, npf_c
 }
 
 static bool
-npfa_icmp6_inspect(const int type, npf_cache_t *npc)
+npfa_icmp6_inspect(const int type, npf_cache_t *npc, bool *hasqid)
 {
 	nbuf_t *nbuf = npc->npc_nbuf;
-	u_int offby;
 
 	/* Per RFC 4443. */
 	switch (type) {
@@ -184,12 +181,8 @@ npfa_icmp6_inspect(const int type, npf_c
 
 	case ICMP6_ECHO_REQUEST:
 	case ICMP6_ECHO_REPLY:
-		/* Should contain ICMP query ID - ensure. */
-		offby = offsetof(struct icmp6_hdr, icmp6_id);
-		if (!nbuf_advance(nbuf, offby, sizeof(uint16_t))) {
-			return false;
-		}
-		npc->npc_info |= NPC_ICMP_ID;
+		/* Contains ICMP query ID. */
+		*hasqid = true;
 		return true;
 	default:
 		break;
@@ -200,13 +193,13 @@ npfa_icmp6_inspect(const int type, npf_c
 /*
  * npfa_icmp_inspect: ALG ICMP inspector.
  *
- * => Returns true if "enpc" is filled.
+ * => Returns false if there is a problem with the format.
  */
 static bool
 npfa_icmp_inspect(npf_cache_t *npc, npf_cache_t *enpc)
 {
 	nbuf_t *nbuf = npc->npc_nbuf;
-	bool ret;
+	bool ret, hasqid = false;
 
 	KASSERT(npf_iscached(npc, NPC_IP46));
 	KASSERT(npf_iscached(npc, NPC_ICMP));
@@ -225,10 +218,10 @@ npfa_icmp_inspect(npf_cache_t *npc, npf_
 	 */
 	if (npf_iscached(npc, NPC_IP4)) {
 	

CVS commit: [netbsd-7] src/sys/net/npf

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:16:04 UTC 2018

Modified Files:
src/sys/net/npf [netbsd-7]: npf_alg_icmp.c npf_inet.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1605):

sys/net/npf/npf_inet.c: revision 1.45
sys/net/npf/npf_alg_icmp.c: revision 1.27-1.29

Fix use-after-free.

The nbuf can be reallocated as a result of caching 'enpc', so it is
necessary to recache 'npc', otherwise it contains pointers to the freed
mbuf - pointers which are then used in the ruleset machinery.
We recache 'npc' when we are sure we won't use 'enpc' anymore, because
'enpc' can be clobbered as a result of caching 'npc' (in other words,
only one of the two can be cached at the same time).
Also, we recache 'npc' unconditionally, because there is no way to know
whether the nbuf got clobbered relatively to it. We can't use the
NBUF_DATAREF_RESET flag, because it is stored in the nbuf and not in the
cache.
Discussed with rmind@.

Change npf_cache_all so that it ensures the potential ICMP Query Id is in
the nbuf. In such a way that we don't need to ensure that later.
Change npfa_icmp4_inspect and npfa_icmp6_inspect so that they touch neither
the nbuf nor npc. Adapt their callers accordingly.
In the end, if a packet has a Query Id, we set NPC_ICMP_ID in npc and leave
right away, without recaching npc (not needed since we didn't touch the
nbuf).
This fixes the handling of Query Id packets (that I broke in my previous
commit), and also fixes another possible use-after-free.

Ah, fix compilation. I tested my previous change by loading the kernel
module from the filesystem, but the Makefile didn't have DIAGNOSTIC
enabled, and the two KASSERTs I added did not compile properly.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.2.1 src/sys/net/npf/npf_alg_icmp.c
cvs rdiff -u -r1.32.2.2 -r1.32.2.3 src/sys/net/npf/npf_inet.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/net/npf/npf_alg_icmp.c
diff -u src/sys/net/npf/npf_alg_icmp.c:1.23 src/sys/net/npf/npf_alg_icmp.c:1.23.2.1
--- src/sys/net/npf/npf_alg_icmp.c:1.23	Sun Jul 20 00:37:41 2014
+++ src/sys/net/npf/npf_alg_icmp.c	Mon May 14 16:16:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_alg_icmp.c,v 1.23 2014/07/20 00:37:41 rmind Exp $	*/
+/*	$NetBSD: npf_alg_icmp.c,v 1.23.2.1 2018/05/14 16:16:04 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.23 2014/07/20 00:37:41 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.23.2.1 2018/05/14 16:16:04 martin Exp $");
 
 #include 
 #include 
@@ -118,13 +118,15 @@ npfa_icmp_match(npf_cache_t *npc, npf_na
 /*
  * npfa_icmp{4,6}_inspect: retrieve unique identifiers - either ICMP query
  * ID or TCP/UDP ports of the original packet, which is embedded.
+ *
+ * => Sets hasqid=true if the packet has a Query Id. In this case neither
+ *the nbuf nor npc is touched.
  */
 
 static bool
-npfa_icmp4_inspect(const int type, npf_cache_t *npc)
+npfa_icmp4_inspect(const int type, npf_cache_t *npc, bool *hasqid)
 {
 	nbuf_t *nbuf = npc->npc_nbuf;
-	u_int offby;
 
 	/* Per RFC 792. */
 	switch (type) {
@@ -148,12 +150,8 @@ npfa_icmp4_inspect(const int type, npf_c
 	case ICMP_TSTAMPREPLY:
 	case ICMP_IREQ:
 	case ICMP_IREQREPLY:
-		/* Should contain ICMP query ID - ensure. */
-		offby = offsetof(struct icmp, icmp_id);
-		if (!nbuf_advance(nbuf, offby, sizeof(uint16_t))) {
-			return false;
-		}
-		npc->npc_info |= NPC_ICMP_ID;
+		/* Contains ICMP query ID. */
+		*hasqid = true;
 		return true;
 	default:
 		break;
@@ -162,10 +160,9 @@ npfa_icmp4_inspect(const int type, npf_c
 }
 
 static bool
-npfa_icmp6_inspect(const int type, npf_cache_t *npc)
+npfa_icmp6_inspect(const int type, npf_cache_t *npc, bool *hasqid)
 {
 	nbuf_t *nbuf = npc->npc_nbuf;
-	u_int offby;
 
 	/* Per RFC 4443. */
 	switch (type) {
@@ -184,12 +181,8 @@ npfa_icmp6_inspect(const int type, npf_c
 
 	case ICMP6_ECHO_REQUEST:
 	case ICMP6_ECHO_REPLY:
-		/* Should contain ICMP query ID - ensure. */
-		offby = offsetof(struct icmp6_hdr, icmp6_id);
-		if (!nbuf_advance(nbuf, offby, sizeof(uint16_t))) {
-			return false;
-		}
-		npc->npc_info |= NPC_ICMP_ID;
+		/* Contains ICMP query ID. */
+		*hasqid = true;
 		return true;
 	default:
 		break;
@@ -200,13 +193,13 @@ npfa_icmp6_inspect(const int type, npf_c
 /*
  * npfa_icmp_inspect: ALG ICMP inspector.
  *
- * => Returns true if "enpc" is filled.
+ * => Returns false if there is a problem with the format.
  */
 static bool
 npfa_icmp_inspect(npf_cache_t *npc, npf_cache_t *enpc)
 {
 	nbuf_t *nbuf = npc->npc_nbuf;
-	bool ret;
+	bool ret, hasqid = false;
 
 	KASSERT(npf_iscached(npc, NPC_IP46));
 	KASSERT(npf_iscached(npc, NPC_ICMP));
@@ -225,10 +218,10 @@ npfa_icmp_inspect(npf_cache_t *npc, npf_
 	 */
 	if (npf_iscached(npc, NPC_IP4)) {
 		

CVS commit: [netbsd-7] src/sys/net/npf

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:16:04 UTC 2018

Modified Files:
src/sys/net/npf [netbsd-7]: npf_alg_icmp.c npf_inet.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1605):

sys/net/npf/npf_inet.c: revision 1.45
sys/net/npf/npf_alg_icmp.c: revision 1.27-1.29

Fix use-after-free.

The nbuf can be reallocated as a result of caching 'enpc', so it is
necessary to recache 'npc', otherwise it contains pointers to the freed
mbuf - pointers which are then used in the ruleset machinery.
We recache 'npc' when we are sure we won't use 'enpc' anymore, because
'enpc' can be clobbered as a result of caching 'npc' (in other words,
only one of the two can be cached at the same time).
Also, we recache 'npc' unconditionally, because there is no way to know
whether the nbuf got clobbered relatively to it. We can't use the
NBUF_DATAREF_RESET flag, because it is stored in the nbuf and not in the
cache.
Discussed with rmind@.

Change npf_cache_all so that it ensures the potential ICMP Query Id is in
the nbuf. In such a way that we don't need to ensure that later.
Change npfa_icmp4_inspect and npfa_icmp6_inspect so that they touch neither
the nbuf nor npc. Adapt their callers accordingly.
In the end, if a packet has a Query Id, we set NPC_ICMP_ID in npc and leave
right away, without recaching npc (not needed since we didn't touch the
nbuf).
This fixes the handling of Query Id packets (that I broke in my previous
commit), and also fixes another possible use-after-free.

Ah, fix compilation. I tested my previous change by loading the kernel
module from the filesystem, but the Makefile didn't have DIAGNOSTIC
enabled, and the two KASSERTs I added did not compile properly.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.2.1 src/sys/net/npf/npf_alg_icmp.c
cvs rdiff -u -r1.32.2.2 -r1.32.2.3 src/sys/net/npf/npf_inet.c

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



CVS commit: [netbsd-7] src/sys/dev/ic

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:11:09 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-7]: hme.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #1604):

sys/dev/ic/hme.c: revision 1.97

Fix mis-placed right paren.  kern/53271


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.90.2.1 src/sys/dev/ic/hme.c

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



CVS commit: [netbsd-7] src/sys/dev/ic

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:11:09 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-7]: hme.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #1604):

sys/dev/ic/hme.c: revision 1.97

Fix mis-placed right paren.  kern/53271


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.90.2.1 src/sys/dev/ic/hme.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/hme.c
diff -u src/sys/dev/ic/hme.c:1.90 src/sys/dev/ic/hme.c:1.90.2.1
--- src/sys/dev/ic/hme.c:1.90	Sun Aug 10 16:44:35 2014
+++ src/sys/dev/ic/hme.c	Mon May 14 16:11:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hme.c,v 1.90 2014/08/10 16:44:35 tls Exp $	*/
+/*	$NetBSD: hme.c,v 1.90.2.1 2018/05/14 16:11:09 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.90 2014/08/10 16:44:35 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.90.2.1 2018/05/14 16:11:09 martin Exp $");
 
 /* #define HMEDEBUG */
 
@@ -752,7 +752,7 @@ hme_get(struct hme_softc *sc, int ri, ui
 			pktlen = m0->m_pkthdr.len - ETHER_HDR_LEN;
 		} else if (ntohs(eh->ether_type) == ETHERTYPE_VLAN) {
 			evh = (struct ether_vlan_header *)eh;
-			if (ntohs(evh->evl_proto != ETHERTYPE_IP))
+			if (ntohs(evh->evl_proto) != ETHERTYPE_IP)
 goto swcsum;
 			ip = (struct ip *)((char *)eh + ETHER_HDR_LEN +
 			ETHER_VLAN_ENCAP_LEN);



CVS commit: [netbsd-6] src/doc

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:08:15 UTC 2018

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
Ticket #1548


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.337 -r1.1.2.338 src/doc/CHANGES-6.2

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.337 src/doc/CHANGES-6.2:1.1.2.338
--- src/doc/CHANGES-6.2:1.1.2.337	Thu May  3 15:05:46 2018
+++ src/doc/CHANGES-6.2	Mon May 14 16:08:15 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.337 2018/05/03 15:05:46 martin Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.338 2018/05/14 16:08:15 martin Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -21246,3 +21246,8 @@ sys/kern/uipc_mbuf.c1.211 (patch)
 	the chain.
 	[maxv, ticket #1547]
 
+sys/dev/ic/hme.c1.97
+
+	Fix mis-placed right parenthesis.
+	[pgoyette, ticket #1548]
+



CVS commit: [netbsd-6] src/doc

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:08:15 UTC 2018

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
Ticket #1548


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.337 -r1.1.2.338 src/doc/CHANGES-6.2

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



CVS commit: [netbsd-6] src/sys/dev/ic

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:07:06 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-6]: hme.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #1548):

sys/dev/ic/hme.c: revision 1.97

Fix mis-placed right paren.  kern/53271


To generate a diff of this commit:
cvs rdiff -u -r1.87.2.1 -r1.87.2.2 src/sys/dev/ic/hme.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/hme.c
diff -u src/sys/dev/ic/hme.c:1.87.2.1 src/sys/dev/ic/hme.c:1.87.2.2
--- src/sys/dev/ic/hme.c:1.87.2.1	Wed Jul  4 19:43:10 2012
+++ src/sys/dev/ic/hme.c	Mon May 14 16:07:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hme.c,v 1.87.2.1 2012/07/04 19:43:10 riz Exp $	*/
+/*	$NetBSD: hme.c,v 1.87.2.2 2018/05/14 16:07:06 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.87.2.1 2012/07/04 19:43:10 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.87.2.2 2018/05/14 16:07:06 martin Exp $");
 
 /* #define HMEDEBUG */
 
@@ -752,7 +752,7 @@ hme_get(struct hme_softc *sc, int ri, ui
 			pktlen = m0->m_pkthdr.len - ETHER_HDR_LEN;
 		} else if (ntohs(eh->ether_type) == ETHERTYPE_VLAN) {
 			evh = (struct ether_vlan_header *)eh;
-			if (ntohs(evh->evl_proto != ETHERTYPE_IP))
+			if (ntohs(evh->evl_proto) != ETHERTYPE_IP)
 goto swcsum;
 			ip = (struct ip *)((char *)eh + ETHER_HDR_LEN +
 			ETHER_VLAN_ENCAP_LEN);



CVS commit: [netbsd-6] src/sys/dev/ic

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:07:06 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-6]: hme.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #1548):

sys/dev/ic/hme.c: revision 1.97

Fix mis-placed right paren.  kern/53271


To generate a diff of this commit:
cvs rdiff -u -r1.87.2.1 -r1.87.2.2 src/sys/dev/ic/hme.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/libc/sys

2018-05-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon May 14 12:44:40 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_ptrace.c

Log Message:
Revert previous change in t_ptrace.c

By a mistake this file started to include 
This is not needed.

The include was intended to be add just in t_ptrace_wait.c.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_ptrace.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/libc/sys/t_ptrace.c
diff -u src/tests/lib/libc/sys/t_ptrace.c:1.3 src/tests/lib/libc/sys/t_ptrace.c:1.4
--- src/tests/lib/libc/sys/t_ptrace.c:1.3	Sun May 13 23:14:47 2018
+++ src/tests/lib/libc/sys/t_ptrace.c	Mon May 14 12:44:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace.c,v 1.3 2018/05/13 23:14:47 kamil Exp $	*/
+/*	$NetBSD: t_ptrace.c,v 1.4 2018/05/14 12:44:40 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,11 +27,10 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace.c,v 1.3 2018/05/13 23:14:47 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace.c,v 1.4 2018/05/14 12:44:40 kamil Exp $");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



CVS commit: src/tests/lib/libc/sys

2018-05-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon May 14 12:44:40 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_ptrace.c

Log Message:
Revert previous change in t_ptrace.c

By a mistake this file started to include 
This is not needed.

The include was intended to be add just in t_ptrace_wait.c.

Sponsored by 


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

2018-05-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon May 14 12:42:34 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_ptrace_amd64_wait.h

Log Message:
Simplify the x86_64_cve_2018_8897 ATF ptrace(2) test

Do not call _exit() from the child, ad this code shall not be reached.
Put there assert().

No functional change. The test still passes.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_ptrace_amd64_wait.h

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/libc/sys/t_ptrace_amd64_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_amd64_wait.h:1.3 src/tests/lib/libc/sys/t_ptrace_amd64_wait.h:1.4
--- src/tests/lib/libc/sys/t_ptrace_amd64_wait.h:1.3	Sun May 13 23:14:47 2018
+++ src/tests/lib/libc/sys/t_ptrace_amd64_wait.h	Mon May 14 12:42:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_amd64_wait.h,v 1.3 2018/05/13 23:14:47 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_amd64_wait.h,v 1.4 2018/05/14 12:42:34 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -239,7 +239,6 @@ trigger_cve_2018_8897(void)
 
 ATF_TC_BODY(x86_64_cve_2018_8897, tc)
 {
-	const int exitval = 5;
 	const int sigval = SIGSTOP;
 	pid_t child, wpid;
 #if defined(TWAIT_HAVE_STATUS)
@@ -274,8 +273,8 @@ ATF_TC_BODY(x86_64_cve_2018_8897, tc)
 
 		trigger_cve_2018_8897();
 
-		DPRINTF("Before exiting of the child process\n");
-		_exit(exitval);
+		/* NOTREACHED */
+		FORKEE_ASSERTX(0 && "This shall not be reached");
 	}
 	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
 



CVS commit: src/tests/lib/libc/sys

2018-05-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon May 14 12:42:34 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_ptrace_amd64_wait.h

Log Message:
Simplify the x86_64_cve_2018_8897 ATF ptrace(2) test

Do not call _exit() from the child, ad this code shall not be reached.
Put there assert().

No functional change. The test still passes.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_ptrace_amd64_wait.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/ixgbe

2018-05-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 14 09:21:36 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixv.c

Log Message:
 Fix panic or hangup when "sysctl -w hw.ixgN.debug=1".

XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.96 src/sys/dev/pci/ixgbe/ixv.c:1.97
--- src/sys/dev/pci/ixgbe/ixv.c:1.96	Tue May  8 09:45:54 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Mon May 14 09:21:36 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.96 2018/05/08 09:45:54 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.97 2018/05/14 09:21:36 msaitoh Exp $*/
 
 /**
 
@@ -2639,21 +2639,18 @@ ixv_print_debug_info(struct adapter *ada
 static int
 ixv_sysctl_debug(SYSCTLFN_ARGS)
 {
-	struct sysctlnode node;
-	struct adapter *adapter;
+	struct sysctlnode node = *rnode;
+	struct adapter *adapter = (struct adapter *)node.sysctl_data;
 	interror, result;
 
-	node = *rnode;
 	node.sysctl_data = 
 	error = sysctl_lookup(SYSCTLFN_CALL());
 
 	if (error || newp == NULL)
 		return error;
 
-	if (result == 1) {
-		adapter = (struct adapter *)node.sysctl_data;
+	if (result == 1)
 		ixv_print_debug_info(adapter);
-	}
 
 	return 0;
 } /* ixv_sysctl_debug */



CVS commit: src/sys/dev/pci/ixgbe

2018-05-14 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 14 09:21:36 UTC 2018

Modified Files:
src/sys/dev/pci/ixgbe: ixv.c

Log Message:
 Fix panic or hangup when "sysctl -w hw.ixgN.debug=1".

XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/pci/ixgbe/ixv.c

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



Re: CVS commit: src/sys/netipsec

2018-05-14 Thread Maxime Villard

Le 14/05/2018 à 04:16, Ryota Ozaki a écrit :

Module Name:src
Committed By:   ozaki-r
Date:   Mon May 14 02:16:30 UTC 2018

Modified Files:
src/sys/netipsec: xform_tcp.c

Log Message:
Restore TCP header inclusions for TCP_SIGNATURE


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/netipsec/xform_tcp.c

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


arrrfff yes this file doesn't get built by default, phew


CVS commit: src/usr.sbin/wakeonlan

2018-05-14 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon May 14 06:52:33 UTC 2018

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

Log Message:
End sentence with a dot.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/wakeonlan/wakeonlan.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/wakeonlan/wakeonlan.8
diff -u src/usr.sbin/wakeonlan/wakeonlan.8:1.4 src/usr.sbin/wakeonlan/wakeonlan.8:1.5
--- src/usr.sbin/wakeonlan/wakeonlan.8:1.4	Sun May 13 22:44:58 2018
+++ src/usr.sbin/wakeonlan/wakeonlan.8	Mon May 14 06:52:33 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: wakeonlan.8,v 1.4 2018/05/13 22:44:58 sevan Exp $
+.\" $NetBSD: wakeonlan.8,v 1.5 2018/05/14 06:52:33 wiz Exp $
 .\"
 .\" Copyright (c) 2009 - 2017 Marc Balmer 
 .\"
@@ -64,7 +64,7 @@ Ethernet host name data base.
 The
 .Nm
 utility first appeared in
-.Nx 6.0
+.Nx 6.0 .
 .Sh AUTHORS
 .Nm
 was written by



CVS commit: src/usr.sbin/wakeonlan

2018-05-14 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon May 14 06:52:33 UTC 2018

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

Log Message:
End sentence with a dot.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/wakeonlan/wakeonlan.8

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