CVS commit: src/doc

2017-11-22 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Nov 23 07:41:28 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
Mention gcc-5.5 import.


To generate a diff of this commit:
cvs rdiff -u -r1.2333 -r1.2334 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2333 src/doc/CHANGES:1.2334
--- src/doc/CHANGES:1.2333	Fri Nov 17 16:21:44 2017
+++ src/doc/CHANGES	Thu Nov 23 07:41:27 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2333 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2334 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -84,4 +84,5 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	acpi(4): Updated ACPICA to 20171110. [christos 2017]
 	sunxinand(4): Add driver for Allwinner NAND Flash Controller.
 		[jmcneill 20171113]
+	gcc: Import GCC 5.5.  [mrg 20171113]
 	libtre: Update to the latest git source. [rin 20171117]



CVS commit: src/sys/netinet6

2017-11-22 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Nov 23 07:09:20 UTC 2017

Modified Files:
src/sys/netinet6: in6.c

Log Message:
Fix a race condition of in6_ifinit

in6_ifinit checks the number of IPv6 addresses on a given interface and
if it's zero (i.e., an IPv6 address being assigned to the interface
is the first one), call if_addr_init. However, the actual assignment of
the address (ifa_insert) is out of in6_ifinit. The check and the
assignment must be done atomically.

Fix it by holding in6_ifaddr_lock during in6_ifinit and ifa_insert.
And also add missing pserialize to IFADDR_READER_FOREACH.


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 src/sys/netinet6/in6.c

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

Modified files:

Index: src/sys/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.253 src/sys/netinet6/in6.c:1.254
--- src/sys/netinet6/in6.c:1.253	Thu Nov 23 07:06:14 2017
+++ src/sys/netinet6/in6.c	Thu Nov 23 07:09:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.253 2017/11/23 07:06:14 ozaki-r Exp $	*/
+/*	$NetBSD: in6.c,v 1.254 2017/11/23 07:09:20 ozaki-r Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.253 2017/11/23 07:06:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.254 2017/11/23 07:09:20 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1258,30 +1258,36 @@ in6_update_ifa1(struct ifnet *ifp, struc
 		 */
 		ifaref(>ia_ifa);
 	}
+
+	/* Must execute in6_ifinit and ifa_insert atomically */
+	mutex_enter(_ifaddr_lock);
+
 	/* reset the interface and routing table appropriately. */
 	error = in6_ifinit(ifp, ia, >ifra_addr, hostIsNew);
 	if (error != 0) {
 		if (hostIsNew)
 			free(ia, M_IFADDR);
+		mutex_exit(_ifaddr_lock);
 		return error;
 	}
 
 	/*
 	 * We are done if we have simply modified an existing address.
 	 */
-	if (!hostIsNew)
+	if (!hostIsNew) {
+		mutex_exit(_ifaddr_lock);
 		return error;
+	}
 
 	/*
 	 * Insert ia to the global list and ifa to the interface's list.
 	 * A reference to it is already gained above.
 	 */
-	mutex_enter(_ifaddr_lock);
 	IN6_ADDRLIST_WRITER_INSERT_TAIL(ia);
-	mutex_exit(_ifaddr_lock);
-
 	ifa_insert(ifp, >ia_ifa);
 
+	mutex_exit(_ifaddr_lock);
+
 	/*
 	 * Beyond this point, we should call in6_purgeaddr upon an error,
 	 * not just go to unlink.
@@ -1755,28 +1761,30 @@ in6_ifinit(struct ifnet *ifp, struct in6
 	const struct sockaddr_in6 *sin6, int newhost)
 {
 	int	error = 0, ifacount = 0;
-	int	s = splsoftnet();
+	int s;
 	struct ifaddr *ifa;
 
+	KASSERT(mutex_owned(_ifaddr_lock));
+
 	/*
 	 * Give the interface a chance to initialize
 	 * if this is its first address,
 	 * and to validate the address if necessary.
 	 */
+	s = pserialize_read_enter();
 	IFADDR_READER_FOREACH(ifa, ifp) {
 		if (ifa->ifa_addr->sa_family != AF_INET6)
 			continue;
 		ifacount++;
 	}
+	pserialize_read_exit(s);
 
 	ia->ia_addr = *sin6;
 
 	if (ifacount == 0 &&
 	(error = if_addr_init(ifp, >ia_ifa, true)) != 0) {
-		splx(s);
 		return error;
 	}
-	splx(s);
 
 	ia->ia_ifa.ifa_metric = ifp->if_metric;
 



CVS commit: src/sys/netinet6

2017-11-22 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Nov 23 07:06:14 UTC 2017

Modified Files:
src/sys/netinet6: in6.c

Log Message:
Tweak a condition; we don't need to care ifacount to be negative


To generate a diff of this commit:
cvs rdiff -u -r1.252 -r1.253 src/sys/netinet6/in6.c

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

Modified files:

Index: src/sys/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.252 src/sys/netinet6/in6.c:1.253
--- src/sys/netinet6/in6.c:1.252	Thu Nov 23 07:05:02 2017
+++ src/sys/netinet6/in6.c	Thu Nov 23 07:06:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.252 2017/11/23 07:05:02 ozaki-r Exp $	*/
+/*	$NetBSD: in6.c,v 1.253 2017/11/23 07:06:14 ozaki-r Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.252 2017/11/23 07:05:02 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.253 2017/11/23 07:06:14 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1771,7 +1771,7 @@ in6_ifinit(struct ifnet *ifp, struct in6
 
 	ia->ia_addr = *sin6;
 
-	if (ifacount <= 0 &&
+	if (ifacount == 0 &&
 	(error = if_addr_init(ifp, >ia_ifa, true)) != 0) {
 		splx(s);
 		return error;



CVS commit: src/sys/netinet6

2017-11-22 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Nov 23 07:05:02 UTC 2017

Modified Files:
src/sys/netinet6: in6.c

Log Message:
Remove unnecessary goto because there is no cleanup code to share (NFC)


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/sys/netinet6/in6.c

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

Modified files:

Index: src/sys/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.251 src/sys/netinet6/in6.c:1.252
--- src/sys/netinet6/in6.c:1.251	Fri Nov 17 07:37:12 2017
+++ src/sys/netinet6/in6.c	Thu Nov 23 07:05:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.251 2017/11/17 07:37:12 ozaki-r Exp $	*/
+/*	$NetBSD: in6.c,v 1.252 2017/11/23 07:05:02 ozaki-r Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.251 2017/11/17 07:37:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.252 2017/11/23 07:05:02 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1187,7 +1187,7 @@ in6_update_ifa1(struct ifnet *ifp, struc
 error = EINVAL;
 if (hostIsNew)
 	free(ia, M_IFADDR);
-goto exit;
+return error;
 			}
 
 			if (!IN6_ARE_ADDR_EQUAL(>ia_prefixmask.sin6_addr,
@@ -1263,7 +1263,7 @@ in6_update_ifa1(struct ifnet *ifp, struc
 	if (error != 0) {
 		if (hostIsNew)
 			free(ia, M_IFADDR);
-		goto exit;
+		return error;
 	}
 
 	/*
@@ -1357,7 +1357,6 @@ in6_update_ifa1(struct ifnet *ifp, struc
 
   cleanup:
 	in6_purgeaddr(>ia_ifa);
-  exit:
 	return error;
 }
 



CVS commit: src/tests/net/arp

2017-11-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Nov 23 06:22:12 UTC 2017

Modified Files:
src/tests/net/arp: t_arp.sh

Log Message:
Clean up the arp_rtm subtest...

1. Be assertive when claiming the pid of the background route monitor command,
   not polite...  (ie: $! will give you the pid, $? is just 0 there).
2. Since "wait 0" simply (always) exits with status 127, immediately (we
   know without thinking that we have no child with pid 0) the waits were
   ineffective - now (after fix #1) they work .. which requires the
   route monitor that watches the arp -d to exit after 1 message, not 2,
   as 1 is all it gets.   (If there really should be 2, someone needs to
   find out why the kernel is sending only 1 - I am not that someone).
3. The file contents need to be read only once, no matter how many patterns
   we need to look for, save some work, and do it that way (this is not
   really a bug,m but saving time for the ATF tests is always a good thing.)

Not sure if this will stop it randomly failing on bablyon5, but it might.
(The likely cause is that the "route.monitor" has not flushed its stdout
buffers at the time the "grep -A 3"  [aside: why that way to read the file??]
is performed, so fails to find its expected output ... the route monitor would
get an extra message once interfaces start being destroyed, I assume, and
would exit then, flushing its buffer, but by then it is too late.
If that is/was the cause, then it should be fixed now.)


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/tests/net/arp/t_arp.sh

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

Modified files:

Index: src/tests/net/arp/t_arp.sh
diff -u src/tests/net/arp/t_arp.sh:1.33 src/tests/net/arp/t_arp.sh:1.34
--- src/tests/net/arp/t_arp.sh:1.33	Wed Jun 28 08:17:50 2017
+++ src/tests/net/arp/t_arp.sh	Thu Nov 23 06:22:12 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_arp.sh,v 1.33 2017/06/28 08:17:50 ozaki-r Exp $
+#	$NetBSD: t_arp.sh,v 1.34 2017/11/23 06:22:12 kre Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -626,7 +626,7 @@ arp_rtm_body()
 {
 	local macaddr_src= macaddr_dst=
 	local file=./tmp
-	local pid= str=
+	local pid= hdr= what= addr=
 
 	rump_server_start $SOCKSRC
 	rump_server_start $SOCKDST
@@ -641,33 +641,31 @@ arp_rtm_body()
 
 	# Test ping and a resulting routing message (RTM_ADD)
 	rump.route -n monitor -c 1 > $file &
-	pid=$?
+	pid=$!
 	sleep 1
 	atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP4DST
 	wait $pid
 	$DEBUG && cat $file
 
-	str="RTM_ADD.+"
-	atf_check -s exit:0 -o match:"$str" cat $file
-	str=""
-	atf_check -s exit:0 -o match:"$str" cat $file
-	str="$IP4DST link#2"
-	atf_check -s exit:0 -o match:"$str" cat $file
+	hdr="RTM_ADD.+"
+	what=""
+	addr="$IP4DST link#2"
+	atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \
+		cat $file
 
 	# Test arp -d and resulting routing messages (RTM_DELETE)
-	rump.route -n monitor -c 2 > $file &
-	pid=$?
+	rump.route -n monitor -c 1 > $file &
+	pid=$!
 	sleep 1
 	atf_check -s exit:0 -o ignore rump.arp -d $IP4DST
 	wait $pid
 	$DEBUG && cat $file
 
-	str="RTM_DELETE.+"
-	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
-	str=""
-	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
-	str="$IP4DST $macaddr_dst"
-	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
+	hdr="RTM_DELETE.+"
+	what=""
+	addr="$IP4DST $macaddr_dst"
+	atf_check -s exit:0 -o match:"$hdr" -o match:"$what" -o match:"$addr" \
+		grep -A 3 RTM_DELETE $file
 
 	rump_server_destroy_ifaces
 }



CVS commit: src/tests/net/if_vlan

2017-11-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Nov 23 04:59:49 UTC 2017

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
Since there was already a test to verify that vlan tag 4096 is
detected as invalid, become the "someone" referred to in the
previous commit log, and add tests for 0 and 4095 as well, and
while here, throw in a few more that might elicit bugs.

And if the shell running the tests is able, add tests of a few
random vlan tags between 2 and 4093 (1 and 4094 are always tested)
to check that anything in range works (well, partially check...)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/if_vlan/t_vlan.sh

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

Modified files:

Index: src/tests/net/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.6 src/tests/net/if_vlan/t_vlan.sh:1.7
--- src/tests/net/if_vlan/t_vlan.sh:1.6	Thu Nov 23 04:12:36 2017
+++ src/tests/net/if_vlan/t_vlan.sh	Thu Nov 23 04:59:49 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.6 2017/11/23 04:12:36 kre Exp $
+#	$NetBSD: t_vlan.sh,v 1.7 2017/11/23 04:59:49 kre Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -337,9 +337,22 @@ vlan_vlanid_body_common()
 	$config_and_ping 4094
 	# $config_and_ping 4095 #reserved vlan id
 
+	if [ "${RANDOM:-0}" != "${RANDOM:-0}" ]
+	then
+		for TAG in $(( ${RANDOM:-0} % 4092 + 2 )) \
+			   $(( ${RANDOM:-0} % 4092 + 2 )) \
+			   $(( ${RANDOM:-0} % 4092 + 2 ))
+		do
+			$config_and_ping "${TAG}"
+		done
+	fi
+
 	export RUMP_SERVER=$SOCK_LOCAL
-	atf_check -s not-exit:0 -e ignore \
-	rump.ifconfig vlan0 vlan 4096 vlanif shmif0
+	for TAG in 0 4095 4096 $((4096*4 + 1)) 65536 65537 $((65536 + 4095))
+	do
+		atf_check -s not-exit:0 -e not-empty \
+		rump.ifconfig vlan0 vlan "${TAG}" vlanif shmif0
+	done
 
 	atf_check -s exit:0 rump.ifconfig vlan0 vlan 1 vlanif shmif0
 	atf_check -s not-exit:0 -e ignore \



CVS commit: src/tests/net/if_vlan

2017-11-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Nov 23 04:12:36 UTC 2017

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
Don't attempt to test vlan tags 0 or 4095, which are now rejected
as invalid (perhaps someone could add a test to verify that they
continue to be rejected?)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/net/if_vlan/t_vlan.sh

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

Modified files:

Index: src/tests/net/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.5 src/tests/net/if_vlan/t_vlan.sh:1.6
--- src/tests/net/if_vlan/t_vlan.sh:1.5	Thu Nov 16 06:31:00 2017
+++ src/tests/net/if_vlan/t_vlan.sh	Thu Nov 23 04:12:36 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.5 2017/11/16 06:31:00 msaitoh Exp $
+#	$NetBSD: t_vlan.sh,v 1.6 2017/11/23 04:12:36 kre Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -332,10 +332,10 @@ vlan_vlanid_body_common()
 	atf_check -s not-exit:0 -e ignore\
 	rump.ifconfig vlan0 vlan -1 vlanif shmif0
 
-	$config_and_ping 0 # reserved vlan id
+	# $config_and_ping 0 # reserved vlan id
 	$config_and_ping 1
 	$config_and_ping 4094
-	$config_and_ping 4095 #reserved vlan id
+	# $config_and_ping 4095 #reserved vlan id
 
 	export RUMP_SERVER=$SOCK_LOCAL
 	atf_check -s not-exit:0 -e ignore \



CVS commit: src/tests/lib

2017-11-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Nov 23 02:40:01 UTC 2017

Modified Files:
src/tests/lib: Makefile

Log Message:
PR lib/52007

Move libevent from being a test playing sub-directory, to a groupy,
just hanging around, hoping someone will notice it, and throw it
a bone...  (mixed metaphors?)


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/tests/lib/Makefile

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/Makefile
diff -u src/tests/lib/Makefile:1.29 src/tests/lib/Makefile:1.30
--- src/tests/lib/Makefile:1.29	Sun May 21 15:28:42 2017
+++ src/tests/lib/Makefile	Thu Nov 23 02:40:01 2017
@@ -1,12 +1,14 @@
-# $NetBSD: Makefile,v 1.29 2017/05/21 15:28:42 riastradh Exp $
+# $NetBSD: Makefile,v 1.30 2017/11/23 02:40:01 kre Exp $
 
 .include 
 
-TESTS_SUBDIRS=	csu libbluetooth libc libcrypt libcurses libevent libexecinfo \
+TESTS_SUBDIRS=	csu libbluetooth libc libcrypt libcurses libexecinfo \
 		libm libobjc libposix libppath libprop libpthread \
 		librefuse librt libtre libusbhid libutil \
 		semaphore
 
+TESTS_SUBDIR_INSTALL_ONLY=	libevent
+
 .if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE)
 TESTS_SUBDIRS+= librumpclient librumphijack
 .endif



CVS commit: src/share/mk

2017-11-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Nov 23 02:39:28 UTC 2017

Modified Files:
src/share/mk: bsd.test.mk

Log Message:
PR lib/52007

Provide a mechanism whereby a test sub-directory can be installed,
without the test being scheduled to run by default (ie: keeping
it out of the Atffile, and Kyuafile if Kyua is enabled.).

The mechanism is perhaps a bit kludgey - anyone with a better idea
how to make it happen, feel free to improve this (the one user as
of about the time of this commit is (or will be) src/tests/lib/Makefile)


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/share/mk/bsd.test.mk

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

Modified files:

Index: src/share/mk/bsd.test.mk
diff -u src/share/mk/bsd.test.mk:1.24 src/share/mk/bsd.test.mk:1.25
--- src/share/mk/bsd.test.mk:1.24	Sat Feb 23 22:01:51 2013
+++ src/share/mk/bsd.test.mk	Thu Nov 23 02:39:28 2017
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.test.mk,v 1.24 2013/02/23 22:01:51 jmmv Exp $
+# $NetBSD: bsd.test.mk,v 1.25 2017/11/23 02:39:28 kre Exp $
 #
 
 .include 
@@ -8,6 +8,9 @@ _TESTS:=	# empty
 .if defined(TESTS_SUBDIRS)
 SUBDIR+=	${TESTS_SUBDIRS}
 .endif
+.if defined(TESTS_SUBDIR_INSTALL_ONLY)
+SUBDIR+=	${TESTS_SUBDIR_INSTALL_ONLY}
+.endif
 
 .include 
 



CVS commit: [netbsd-8] src/doc

2017-11-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Nov 23 02:18:52 UTC 2017

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

Log Message:
382


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.80 -r1.1.2.81 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.80 src/doc/CHANGES-8.0:1.1.2.81
--- src/doc/CHANGES-8.0:1.1.2.80	Wed Nov 22 16:47:21 2017
+++ src/doc/CHANGES-8.0	Thu Nov 23 02:18:51 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.80 2017/11/22 16:47:21 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.81 2017/11/23 02:18:51 snj Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -7079,3 +7079,9 @@ tests/net/if_vlan/t_vlan.sh			1.2-1.5
 	Add some test cases for vlan(4).
 	[msaitoh, ticket #380]
 
+sys/net/if_bridge.c1.139
+sys/net/if_loop.c1.97
+
+	Remove unnecessary KERNEL_LOCK if NET_MPSAFE.
+	[ozaki-r, ticket #382]
+



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

2017-11-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Nov 23 02:13:31 UTC 2017

Modified Files:
src/sys/net [netbsd-8]: if_bridge.c if_loop.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #382):
sys/net/if_bridge.c: revision 1.139
sys/net/if_loop.c: revision 1.97
Don't take KERNEL_LOCK in looutput if NET_MPSAFE
We can perhaps get rid of KERNEL_LOCK from looutput, but for now
keep it for safe.
--
Mark callouts of bridge CALLOUT_MPSAFE


To generate a diff of this commit:
cvs rdiff -u -r1.134.6.1 -r1.134.6.2 src/sys/net/if_bridge.c
cvs rdiff -u -r1.94.6.1 -r1.94.6.2 src/sys/net/if_loop.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/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.134.6.1 src/sys/net/if_bridge.c:1.134.6.2
--- src/sys/net/if_bridge.c:1.134.6.1	Mon Oct  2 13:33:41 2017
+++ src/sys/net/if_bridge.c	Thu Nov 23 02:13:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.134.6.1 2017/10/02 13:33:41 martin Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.134.6.2 2017/11/23 02:13:31 snj Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.134.6.1 2017/10/02 13:33:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.134.6.2 2017/11/23 02:13:31 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -415,8 +415,8 @@ bridge_clone_create(struct if_clone *ifc
 	if (error)
 		panic("%s: workqueue_create %d\n", __func__, error);
 
-	callout_init(>sc_brcallout, 0);
-	callout_init(>sc_bstpcallout, 0);
+	callout_init(>sc_brcallout, CALLOUT_MPSAFE);
+	callout_init(>sc_bstpcallout, CALLOUT_MPSAFE);
 
 	mutex_init(>sc_iflist_psref.bip_lock, MUTEX_DEFAULT, IPL_NONE);
 	PSLIST_INIT(>sc_iflist_psref.bip_iflist);

Index: src/sys/net/if_loop.c
diff -u src/sys/net/if_loop.c:1.94.6.1 src/sys/net/if_loop.c:1.94.6.2
--- src/sys/net/if_loop.c:1.94.6.1	Tue Oct 24 08:50:44 2017
+++ src/sys/net/if_loop.c	Thu Nov 23 02:13:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_loop.c,v 1.94.6.1 2017/10/24 08:50:44 snj Exp $	*/
+/*	$NetBSD: if_loop.c,v 1.94.6.2 2017/11/23 02:13:31 snj Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.94.6.1 2017/10/24 08:50:44 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.94.6.2 2017/11/23 02:13:31 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -242,7 +242,9 @@ looutput(struct ifnet *ifp, struct mbuf 
 
 	MCLAIM(m, ifp->if_mowner);
 
+#ifndef NET_MPSAFE
 	KERNEL_LOCK(1, NULL);
+#endif
 
 	if ((m->m_flags & M_PKTHDR) == 0)
 		panic("looutput: no header mbuf");
@@ -368,7 +370,9 @@ looutput(struct ifnet *ifp, struct mbuf 
 	schednetisr(isr);
 	splx(s);
 out:
+#ifndef NET_MPSAFE
 	KERNEL_UNLOCK_ONE(NULL);
+#endif
 	return error;
 }
 



CVS commit: src/distrib/sets

2017-11-22 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Nov 22 23:14:01 UTC 2017

Modified Files:
src/distrib/sets: sets.subr

Log Message:
Ignore MAKEFLAGS for snippet makefiles.
(more important than MAKEVERBOSE probably.)


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/distrib/sets/sets.subr

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/sets.subr
diff -u src/distrib/sets/sets.subr:1.180 src/distrib/sets/sets.subr:1.181
--- src/distrib/sets/sets.subr:1.180	Wed Nov 22 21:31:20 2017
+++ src/distrib/sets/sets.subr	Wed Nov 22 23:14:01 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: sets.subr,v 1.180 2017/11/22 21:31:20 christos Exp $
+#	$NetBSD: sets.subr,v 1.181 2017/11/22 23:14:01 kre Exp $
 #
 
 #
@@ -179,7 +179,7 @@ SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g
 # In each file, a record consists of a path and a System Package name,
 # separated by whitespace. E.g.,
 #
-# 	# $NetBSD: sets.subr,v 1.180 2017/11/22 21:31:20 christos Exp $
+# 	# $NetBSD: sets.subr,v 1.181 2017/11/22 23:14:01 kre Exp $
 # 	.			base-sys-root	[keyword[,...]]
 # 	./altroot		base-sys-root
 # 	./bin			base-sys-root
@@ -605,7 +605,7 @@ print_set_lists()
 #
 arch_to_cpu()
 {
-	MAKEVERBOSE= MACHINE_ARCH=${1} ${MAKE} -B -f- all <
 all:
 	@echo \${MACHINE_CPU}
@@ -619,7 +619,7 @@ EOMAKE
 #
 arch_to_endian()
 {
-	MAKEVERBOSE= MACHINE_ARCH=${1} ${MAKE} -B -f- all <
 all:
 	@echo \${TARGET_ENDIANNESS}



CVS commit: src/distrib/sets

2017-11-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov 22 21:31:20 UTC 2017

Modified Files:
src/distrib/sets: sets.subr

Log Message:
Ignore MAKEVERBOSE for snippet makefiles.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/distrib/sets/sets.subr

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/sets.subr
diff -u src/distrib/sets/sets.subr:1.179 src/distrib/sets/sets.subr:1.180
--- src/distrib/sets/sets.subr:1.179	Wed Feb  8 13:21:23 2017
+++ src/distrib/sets/sets.subr	Wed Nov 22 16:31:20 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: sets.subr,v 1.179 2017/02/08 18:21:23 christos Exp $
+#	$NetBSD: sets.subr,v 1.180 2017/11/22 21:31:20 christos Exp $
 #
 
 #
@@ -120,13 +120,13 @@ oIFS=$IFS
 IFS="
 "
 
-for x in $( ${MAKE} -B -f ${rundir}/mkvars.mk mkvars ); do
+for x in $( MAKEVERBOSE= ${MAKE} -B -f ${rundir}/mkvars.mk mkvars ); do
 	eval export $x
 done
 
 IFS=$oIFS
 
-MKVARS="$( ${MAKE} -B -f ${rundir}/mkvars.mk mkvars | ${SED} -e 's,=.*,,' | ${XARGS} )"
+MKVARS="$( MAKEVERBOSE= ${MAKE} -B -f ${rundir}/mkvars.mk mkvars | ${SED} -e 's,=.*,,' | ${XARGS} )"
 
 #
 
@@ -179,7 +179,7 @@ SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g
 # In each file, a record consists of a path and a System Package name,
 # separated by whitespace. E.g.,
 #
-# 	# $NetBSD: sets.subr,v 1.179 2017/02/08 18:21:23 christos Exp $
+# 	# $NetBSD: sets.subr,v 1.180 2017/11/22 21:31:20 christos Exp $
 # 	.			base-sys-root	[keyword[,...]]
 # 	./altroot		base-sys-root
 # 	./bin			base-sys-root
@@ -605,7 +605,7 @@ print_set_lists()
 #
 arch_to_cpu()
 {
-	MACHINE_ARCH=${1} ${MAKE} -B -f- all <
 all:
 	@echo \${MACHINE_CPU}
@@ -619,7 +619,7 @@ EOMAKE
 #
 arch_to_endian()
 {
-	MACHINE_ARCH=${1} ${MAKE} -B -f- all <
 all:
 	@echo \${TARGET_ENDIANNESS}



CVS commit: src/sys/arch/x86/x86

2017-11-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov 22 21:26:01 UTC 2017

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

Log Message:
Avoid NPE.


To generate a diff of this commit:
cvs rdiff -u -r1.266 -r1.267 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.266 src/sys/arch/x86/x86/pmap.c:1.267
--- src/sys/arch/x86/x86/pmap.c:1.266	Mon Nov 20 15:57:58 2017
+++ src/sys/arch/x86/x86/pmap.c	Wed Nov 22 16:26:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.266 2017/11/20 20:57:58 chs Exp $	*/
+/*	$NetBSD: pmap.c,v 1.267 2017/11/22 21:26:01 christos Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -170,7 +170,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.266 2017/11/20 20:57:58 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.267 2017/11/22 21:26:01 christos Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1800,8 +1800,8 @@ pmap_pp_needs_pve(struct pmap_page *pp)
 	 * since the first pv entry is stored in the pmap_page.
 	 */
 
-	return (pp->pp_flags & PP_EMBEDDED) != 0 ||
-		!LIST_EMPTY(>pp_head.pvh_list);
+	return pp && ((pp->pp_flags & PP_EMBEDDED) != 0 ||
+	!LIST_EMPTY(>pp_head.pvh_list));
 }
 
 /*
@@ -4181,7 +4181,7 @@ pmap_enter_ma(struct pmap *pmap, vaddr_t
 	 */
 
 	bool needpves = pmap_pp_needs_pve(new_pp);
-	if (new_pp && needpves) {
+	if (needpves) {
 		new_pve = pool_cache_get(_pv_cache, PR_NOWAIT);
 		new_sparepve = pool_cache_get(_pv_cache, PR_NOWAIT);
 	} else {



CVS commit: src/sys/net

2017-11-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov 22 17:11:51 UTC 2017

Modified Files:
src/sys/net: if_spppsubr.c

Log Message:
fix non-diagnostic compilation


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/sys/net/if_spppsubr.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/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.174 src/sys/net/if_spppsubr.c:1.175
--- src/sys/net/if_spppsubr.c:1.174	Wed Nov 22 03:28:56 2017
+++ src/sys/net/if_spppsubr.c	Wed Nov 22 12:11:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.174 2017/11/22 08:28:56 ozaki-r Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.175 2017/11/22 17:11:51 christos Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.174 2017/11/22 08:28:56 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.175 2017/11/22 17:11:51 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -4046,7 +4046,7 @@ sppp_ipv6cp_close(struct sppp *sp)
 static void
 sppp_ipv6cp_TO(void *cookie)
 {
-	struct sppp *sp = cookie;
+	struct sppp *sp __diagused = cookie;
 
 	KASSERT(SPPP_WLOCKED(sp));
 }



CVS commit: [netbsd-8] src/doc

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 16:47:21 UTC 2017

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

Log Message:
Note tickets #368 - #380


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.79 -r1.1.2.80 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.79 src/doc/CHANGES-8.0:1.1.2.80
--- src/doc/CHANGES-8.0:1.1.2.79	Tue Nov 21 15:13:36 2017
+++ src/doc/CHANGES-8.0	Wed Nov 22 16:47:21 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.79 2017/11/21 15:13:36 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.80 2017/11/22 16:47:21 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -6929,3 +6929,153 @@ sys/arch/x86/x86/procfs_machdep.c		1.17-
 	Fix the location of AMD's smca(Scalable MCA) bit.
 	[msaitoh, ticket #367]
 
+sys/net/if_vlan.c1.101-1.102
+
+	Check if VLAN ID isn't duplicated on a same parent interface and
+	return EEXIST if it failed.
+	[msaitoh, ticket #368]
+
+sys/dev/ic/spdmem.c1.25-1.28
+
+	A part number field of DDR3 and DDR4 is not NUL terminated.
+	All unused chars are filled by 0x20. Print it correctly.
+	Print "ECC" or "no ECC" for DDR4.
+	[msaitoh, ticket #369]
+
+sys/net/if_media.c1.33-1.34
+
+	Clear ifm_cur and ifm_media after removing all ifmedia entries
+	(IFM_INST_ANY) in ifmedia_delete_instance() like if_media.c
+	rev. 1.32. 
+	Simplify & KNF.
+	[msaitoh, ticket #370]
+
+sys/dev/pci/pci_subr.c1.195-1.196
+
+	Print Error Source Identification register correctly.
+	Whitespace fix.
+	[msaitoh, ticket #371]
+
+sys/dev/mii/miidevs1.126
+sys/dev/mii/miidevs.h(regen)
+sys/dev/mii/miidevs_data.h			(regen)
+
+	Add X550 and X557.
+	[msaitoh, ticket #372]
+
+sys/dev/isa/itesio_isa.c			1.26-1.27
+sys/dev/isa/itesio_isavar.h			1.10-1.11
+
+	Enable the IT8628E shipped with my gigabyte GA-N3150N-D3V board.
+	Add IT8728F and IT877[12]E.
+	[msaitoh, ticket #373]
+
+share/man/man4/lm.41.33-1.34
+share/man/man4/wbsio.41.4-1.6
+sys/dev/i2c/lm_i2c.c1.3-1.4
+sys/dev/ic/nslm7x.c1.65-1.70
+sys/dev/ic/nslm7xvar.h1.30-1.33
+sys/dev/isa/lm_isa_common.c			1.5-1.6
+sys/dev/isa/wbsio.c1.11-1.15
+sys/dev/isa/wbsioreg.h1.1-1.5
+
+	wbsio(4): Add Winbond W83627DHG-P, W83627SF, W83627UHG,
+	W83667HGB, W83687THF, W83697UG, Nuvoton NCT5104D, NCT610[246]D,
+	NCT6775, NCT6779, NCT6791, NCT6792, NCT6793 and NCT6795D.
+	lm(4): Add support for NCT5104D, NCT610[246]D, NCT6775F, NCT6779D and
+	NCT679[1235]D.
+	Sprinkle static and const. Use uint8_t instead of int.
+	Print chip ID in hexadecimal instead of octal in def_match().
+	WBSIO_ID_W83627DHG and newer devices have 12bit device ID. Change
+	sioid from 8bit to 16bit and check with it strictly.
+	rename the lm_match function into nslm_match
+	split {wb,lm,def}_match() to XXX_match and XXX_attach().
+	Rename lm_probe with lm_match and call {wb,nslm,def}_match()
+	at the end of the function to check strictly.
+	NCT610[246]D is different from others, so add new
+	nct6102d_sensors[] table.
+	Register offsets of vendor ID and chip id of NCT610[246]D are
+	different from others. When it failed reading vendor ID or chip ID,
+	fallback to NCT610[246]D's register offsets.
+	Add debug messages.
+	[msaitoh, ticket #374]
+
+common/dist/zlib/inflate.c			1.6
+
+	Restore a local change (in rev1.4) that was lost on zlib 1.12.10 merge.
+	[tsutsui, ticket #375]
+
+sys/arch/luna68k/stand/boot/Makefile		1.14
+
+	Explicitly set NOPIE. GOT seems problematic on elf2aout(1) conversion.
+	Fixes silent hang of luna68k boot.
+	[tsutsui, ticket #376]
+
+usr.sbin/acpitools/acpidump/acpi_user.c		1.3
+
+	On UEFI environment, ACPI table is not at low address.
+	Get ACPI root pointer from hw.acpi.root first.
+	[msaitoh, ticket #377]
+
+usr.sbin/acpitools/acpidump/acpi.c		1.16-1.26,1.28
+usr.sbin/acpitools/acpidump/acpi_user.c		1.4
+usr.sbin/acpitools/acpidump/acpidump.8		1.8-1.10
+usr.sbin/acpitools/acpidump/acpidump.c		1.7
+usr.sbin/acpitools/acpidump/acpidump.h		1.6-1.7
+
+	- Decode DMAR, NFIT, DBG2, SPMI and WDDT.
+	- Decode UEFI (not fully decoded yet).
+	- Dump TCG ACPI spec table (TCPA) more.
+	- Consistently cast ACPICA 64-bit integer types when we print them.
+	- Display the 'Flags' field in the HPET Description Table.
+	- Do not crash when RSDT/XSDT contains an empty entry.
+	- Print 64-bit addresses clearly with leading zeros to avoid confusions.
+	- Create temp file safely.
+	- Add missing flags into FADT.
+	- Print some new ACPI 5.1 MADT entries.
+	- Warn and exit loop on invalid subtable length.
+	- Fix the type used to hold the value returned from getopt.
+	  On arm64 char is unsigned so will never be -1.
+	- Check DSDT signature in acpi_handle_fadt() for broken ACPI table.
+	- Add new function acpi_select_address() derived from
+	  acpi_get_fadt_revision(). On some 

CVS commit: [netbsd-8] src/tests/net/if_vlan

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 16:45:35 UTC 2017

Modified Files:
src/tests/net/if_vlan [netbsd-8]: t_vlan.sh

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #380):
tests/net/if_vlan/t_vlan.sh: revision 1.2
tests/net/if_vlan/t_vlan.sh: revision 1.3
tests/net/if_vlan/t_vlan.sh: revision 1.4
tests/net/if_vlan/t_vlan.sh: revision 1.5
Add test cases for vlan(4)
 From s-yamaguchi@IIJ
Add counter check to vlan(4) ATF. Implemented by s-yamaguchi@IIJ, thanks.
  Add a test case for duplicated VLAN ID.
  Add test case of vlan(4)'s re-configure without destroy
(see also if_vlan.c rev. 1.104). Written by s-yamaguchi@iij.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.8.1 src/tests/net/if_vlan/t_vlan.sh

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

Modified files:

Index: src/tests/net/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.1 src/tests/net/if_vlan/t_vlan.sh:1.1.8.1
--- src/tests/net/if_vlan/t_vlan.sh:1.1	Sat Nov 26 03:19:49 2016
+++ src/tests/net/if_vlan/t_vlan.sh	Wed Nov 22 16:45:35 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.1 2016/11/26 03:19:49 ozaki-r Exp $
+#	$NetBSD: t_vlan.sh,v 1.1.8.1 2017/11/22 16:45:35 martin Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -28,11 +28,56 @@
 BUS=bus
 SOCK_LOCAL=unix://commsock1
 SOCK_REMOTE=unix://commsock2
-IP_LOCAL=10.0.0.1
-IP_REMOTE=10.0.0.2
+IP_LOCAL0=10.0.0.1
+IP_LOCAL1=10.0.1.1
+IP_REMOTE0=10.0.0.2
+IP_REMOTE1=10.0.1.2
+IP6_LOCAL0=fc00:0::1
+IP6_LOCAL1=fc00:1::1
+IP6_REMOTE0=fc00:0::2
+IP6_REMOTE1=fc00:1::2
 
 DEBUG=${DEBUG:-false}
 
+vlan_create_destroy_body_common()
+{
+	export RUMP_SERVER=${SOCK_LOCAL}
+
+	atf_check -s exit:0 rump.ifconfig vlan0 create
+	atf_check -s exit:0 rump.ifconfig vlan0 up
+	atf_check -s exit:0 rump.ifconfig vlan0 down
+	atf_check -s exit:0 rump.ifconfig vlan0 destroy
+
+	atf_check -s exit:0 rump.ifconfig shmif0 create
+	atf_check -s exit:0 rump.ifconfig vlan0 create
+	atf_check -s exit:0 rump.ifconfig vlan0 vlan 1 vlanif shmif0
+	atf_check -s exit:0 rump.ifconfig vlan0 up
+	atf_check -s exit:0 rump.ifconfig vlan0 destroy
+
+	# more than one vlan interface with a same parent interface
+	atf_check -s exit:0 rump.ifconfig shmif1 create
+	atf_check -s exit:0 rump.ifconfig vlan0 create
+	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
+	atf_check -s exit:0 rump.ifconfig vlan1 create
+	atf_check -s exit:0 rump.ifconfig vlan1 vlan 11 vlanif shmif0
+
+	# more than one interface with another parent interface
+	atf_check -s exit:0 rump.ifconfig vlan2 create
+	atf_check -s exit:0 rump.ifconfig vlan2 vlan 12 vlanif shmif1
+	atf_check -s exit:0 rump.ifconfig vlan3 create
+	atf_check -s exit:0 rump.ifconfig vlan3 vlan 13 vlanif shmif1
+	atf_check -s exit:0 rump.ifconfig shmif0 destroy
+	atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig vlan0
+	atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig vlan1
+	atf_check -s exit:0 -o match:'shmif1' rump.ifconfig vlan2
+	atf_check -s exit:0 -o match:'shmif1' rump.ifconfig vlan3
+	atf_check -s exit:0 rump.ifconfig vlan0 destroy
+	atf_check -s exit:0 rump.ifconfig vlan1 destroy
+	atf_check -s exit:0 rump.ifconfig vlan2 destroy
+	atf_check -s exit:0 rump.ifconfig vlan3 destroy
+
+}
+
 atf_test_case vlan_create_destroy cleanup
 vlan_create_destroy_head()
 {
@@ -43,17 +88,12 @@ vlan_create_destroy_head()
 
 vlan_create_destroy_body()
 {
-
 	rump_server_start $SOCK_LOCAL vlan
 
-	export RUMP_SERVER=${SOCK_LOCAL}
-
-	atf_check -s exit:0 rump.ifconfig vlan0 create
-	atf_check -s exit:0 rump.ifconfig vlan0 up
-	atf_check -s exit:0 rump.ifconfig vlan0 down
-	atf_check -s exit:0 rump.ifconfig vlan0 destroy
+	vlan_create_destroy_body_common
 }
 
+
 vlan_create_destroy_cleanup()
 {
 
@@ -61,20 +101,47 @@ vlan_create_destroy_cleanup()
 	cleanup
 }
 
-atf_test_case vlan_basic cleanup
-vlan_basic_head()
+atf_test_case vlan_create_destroy6 cleanup
+vlan_create_destroy6_head()
 {
 
-	atf_set "descr" "tests of communications over vlan interfaces"
+	atf_set "descr" "tests of creation and deletion of vlan interface with IPv6"
 	atf_set "require.progs" "rump_server"
 }
 
-vlan_basic_body()
+vlan_create_destroy6_body()
 {
 
-	rump_server_start $SOCK_LOCAL vlan
+	rump_server_start $SOCK_LOCAL vlan netinet6
+
+	vlan_create_destroy_body_common
+}
+
+vlan_create_destroy6_cleanup()
+{
+
+	$DEBUG && dump
+	cleanup
+}
+
+vlan_basic_body_common()
+{
+	local outfile=./out
+	local af=inet
+	local prefix=24
+	local local0=$IP_LOCAL0
+	local remote0=$IP_REMOTE0
+	local ping_cmd="rump.ping -n -w 1 -c 1"
+
+	if [ x"$1" = x"inet6" ]; then
+		af="inet6"
+		prefix=64
+		local0=$IP6_LOCAL0
+		remote0=$IP6_REMOTE0
+		ping_cmd="rump.ping6 -n -c 1"
+	fi
+
 	rump_server_add_iface $SOCK_LOCAL shmif0 $BUS
-	rump_server_start $SOCK_REMOTE vlan
 	rump_server_add_iface $SOCK_REMOTE shmif0 

CVS commit: [netbsd-8] src/sys/dev/pci

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 16:40:42 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-8]: if_wm.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #379):
sys/dev/pci/if_wm.c: revision 1.540
  On I219, drop TARC0 bit 28 for DMA hang workaround (from Linux).


To generate a diff of this commit:
cvs rdiff -u -r1.508.4.5 -r1.508.4.6 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.508.4.5 src/sys/dev/pci/if_wm.c:1.508.4.6
--- src/sys/dev/pci/if_wm.c:1.508.4.5	Mon Nov  6 09:54:01 2017
+++ src/sys/dev/pci/if_wm.c	Wed Nov 22 16:40:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.508.4.5 2017/11/06 09:54:01 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.508.4.6 2017/11/22 16:40:42 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.5 2017/11/06 09:54:01 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.6 2017/11/22 16:40:42 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -4022,10 +4022,18 @@ wm_initialize_hardware_bits(struct wm_so
 		case WM_T_PCH_LPT:
 		case WM_T_PCH_SPT:
 			/* TARC0 */
-			if ((sc->sc_type == WM_T_ICH8)
-			|| (sc->sc_type == WM_T_PCH_SPT)) {
+			if (sc->sc_type == WM_T_ICH8) {
 /* Set TARC0 bits 29 and 28 */
 tarc0 |= __BITS(29, 28);
+			} else if (sc->sc_type == WM_T_PCH_SPT) {
+tarc0 |= __BIT(29);
+/*
+ *  Drop bit 28. From Linux.
+ * See I218/I219 spec update
+ * "5. Buffer Overrun While the I219 is
+ * Processing DMA Transactions"
+ */
+tarc0 &= ~__BIT(28);
 			}
 			/* Set TARC0 bits 23,24,26,27 */
 			tarc0 |= __BITS(27, 26) | __BITS(24, 23);



CVS commit: src/external/bsd/nvi/dist/common

2017-11-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Nov 22 16:17:30 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/common: search.c

Log Message:
Fix missing of "search wrapped" message when searching from the last char of
file, taken from nvi2:
https://github.com/lichray/nvi2/commit/a59e892d23212559eb1001e5d2a312a02e357651


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/nvi/dist/common/search.c

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

Modified files:

Index: src/external/bsd/nvi/dist/common/search.c
diff -u src/external/bsd/nvi/dist/common/search.c:1.3 src/external/bsd/nvi/dist/common/search.c:1.4
--- src/external/bsd/nvi/dist/common/search.c:1.3	Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/common/search.c	Wed Nov 22 16:17:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: search.c,v 1.3 2014/01/26 21:43:45 christos Exp $ */
+/*	$NetBSD: search.c,v 1.4 2017/11/22 16:17:30 rin Exp $ */
 /*-
  * Copyright (c) 1992, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: search.c,v 10.31 2001/06/25 15:19:12 skimo Exp  (Berkeley) Date: 2001/06/25 15:19:12 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: search.c,v 1.3 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: search.c,v 1.4 2017/11/22 16:17:30 rin Exp $");
 #endif
 
 #include 
@@ -148,7 +148,7 @@ f_search(SCR *sp, MARK *fm, MARK *rm, CH
 	db_recno_t lno;
 	regmatch_t match[1];
 	size_t coff, len;
-	int cnt, eval, rval, wrapped;
+	int cnt, eval, rval, wrapped = 0;
 	CHAR_T *l;
 
 	if (search_init(sp, FORWARD, ptrn, plen, eptrn, flags))
@@ -191,13 +191,14 @@ f_search(SCR *sp, MARK *fm, MARK *rm, CH
 	return (1);
 }
 lno = 1;
+wrapped = 1;
 			}
 		} else
 			coff = fm->cno + 1;
 	}
 
 	btype = BUSY_ON;
-	for (cnt = INTERRUPT_CHECK, rval = 1, wrapped = 0;; ++lno, coff = 0) {
+	for (cnt = INTERRUPT_CHECK, rval = 1;; ++lno, coff = 0) {
 		if (cnt-- == 0) {
 			if (INTERRUPTED(sp))
 break;



CVS commit: [netbsd-8] src/usr.sbin/acpitools/acpidump

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 15:54:09 UTC 2017

Modified Files:
src/usr.sbin/acpitools/acpidump [netbsd-8]: acpi.c acpi_user.c
acpidump.8 acpidump.c acpidump.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #378):
usr.sbin/acpitools/acpidump/acpi_user.c: revision 1.4
usr.sbin/acpitools/acpidump/acpi.c: revision 1.20
usr.sbin/acpitools/acpidump/acpidump.c: revision 1.7
usr.sbin/acpitools/acpidump/acpi.c: revision 1.21
usr.sbin/acpitools/acpidump/acpidump.8: revision 1.10
usr.sbin/acpitools/acpidump/acpi.c: revision 1.22
usr.sbin/acpitools/acpidump/acpidump.h: revision 1.6
usr.sbin/acpitools/acpidump/acpi.c: revision 1.23
usr.sbin/acpitools/acpidump/acpidump.h: revision 1.7
usr.sbin/acpitools/acpidump/acpi.c: revision 1.24
usr.sbin/acpitools/acpidump/acpidump.8: revision 1.8
usr.sbin/acpitools/acpidump/acpi.c: revision 1.25
usr.sbin/acpitools/acpidump/acpidump.8: revision 1.9
usr.sbin/acpitools/acpidump/acpi.c: revision 1.26
usr.sbin/acpitools/acpidump/acpi.c: revision 1.28
usr.sbin/acpitools/acpidump/acpi.c: revision 1.16
usr.sbin/acpitools/acpidump/acpi.c: revision 1.17
usr.sbin/acpitools/acpidump/acpi.c: revision 1.18
usr.sbin/acpitools/acpidump/acpi.c: revision 1.19
Sync with FreeBSD's r321294:
  - Dump TCG ACPI spec table (TCPA) more.
  - Dump DMA Remapping Reporting table (DMAR).
  - Consistently cast ACPICA 64-bit integer types when we print them.
  - Display the 'Flags' field in the HPET Description Table.
  - Do not crash when RSDT/XSDT contains an empty entry.
  - Print 64-bit addresses clearly with leading zeros to avoid confusions.
  - Create temp file safely.
  - Add missing flags into FADT.
  - Print some new ACPI 5.1 MADT entries.
  - Use __arraycount().
  - Warn and exit loop on invalid subtable length.
  - Fix the type used to hold the value returned from getopt. On arm64 char is
unsigned so will never be -1.
  Check DSDT signature in acpi_handle_fadt() for broken ACPI table.
  Add new function acpi_select_address() derived from acpi_get_fadt_revision().
On some systems, 32bit address is used for (X)Dsdt even if (X)Facs uses 64bit.
Don't assume an address size from FADT revision.
- Decode ACPI_HEST_GENERIC_V2.
- Decode ACPI_MADT_GENERIC_MSI_FRAME.
- Add NMI, CMCI, MCE, GPIO-Signal, ARMv8 SEA, ARMv8 SEI and GSIV
   in acpi_print_hest_notify().
- Add ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS and ACPI_EINJ_GET_EXECUTE_TIMINGS
   in acpi_print_einj_action().
- Add ACPI_ERST_EXECUTE_TIMINGS in acpi_print_erst_action().
- Decode NFIT (NVDIMM Firmware Interface Table) from FreeBSD.
Part of FreeBSD r323045:
  - Print Valid Field in ACPI_NFIT_CONTROL_REGION with 0x%02x.
  - Fix Flags of ACPI_NFIT_CONTROL_REGION.
- Add "Performance Server" and "Tablet" for Preferred_PM_Profile.
- Don't print FADT_RESET_REG if FADT version is 1.
- Print FADT ArmBootFlags, MinorRevision, SleepControl, SleepStatus and
   HypervisorId.
- Print "{}" even if any flags aren't set.
  Decode the following entries:
  - DBG2 (Debug Port Table 2)
  - SPMI (Server Platform Management Interface Table)
  - WDDT (Watchdog Timer Description Table)
  - UEFI (UEFI, not fully decoded yet)
  Fix calculation the offset of the Action Table in WDAT to print each
entries correctly.
- Calculate offset of a sub header correctly in acpi_handle_hest() to print
   all of sub entries in HEST correctly.
- Print a SpaceID number for unknown ID in acpi_print_gas().
- Use PRINTFLAG() in acpi_print_hest_notify().
- Use %u instead of %d for unsigned values in acpi_print_hest_generic().
- Space, tab and newline change for consistency output.
- Print a type number for unknown HEST sub entry ID.
  Don't define GAS address ID constants in acpidump.h and use actypes.h's
definitions. No functional change.
  Cosmetic change (tab and newline).


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.8.1 src/usr.sbin/acpitools/acpidump/acpi.c
cvs rdiff -u -r1.2.38.1 -r1.2.38.2 \
src/usr.sbin/acpitools/acpidump/acpi_user.c
cvs rdiff -u -r1.7 -r1.7.18.1 src/usr.sbin/acpitools/acpidump/acpidump.8
cvs rdiff -u -r1.6 -r1.6.8.1 src/usr.sbin/acpitools/acpidump/acpidump.c
cvs rdiff -u -r1.5 -r1.5.36.1 src/usr.sbin/acpitools/acpidump/acpidump.h

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/acpitools/acpidump/acpi.c
diff -u src/usr.sbin/acpitools/acpidump/acpi.c:1.15 src/usr.sbin/acpitools/acpidump/acpi.c:1.15.8.1
--- src/usr.sbin/acpitools/acpidump/acpi.c:1.15	Sat Feb 27 16:40:22 2016
+++ src/usr.sbin/acpitools/acpidump/acpi.c	Wed Nov 22 15:54:09 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.15 2016/02/27 16:40:22 christos Exp $ */
+/* $NetBSD: acpi.c,v 1.15.8.1 2017/11/22 15:54:09 martin Exp $ */
 
 /*-
  * Copyright (c) 

CVS commit: [netbsd-8] src/usr.sbin/acpitools/acpidump

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 15:35:52 UTC 2017

Modified Files:
src/usr.sbin/acpitools/acpidump [netbsd-8]: acpi_user.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #377):
usr.sbin/acpitools/acpidump/acpi_user.c: revision 1.3
  On UEFI environment, ACPI table is not at low address. Get ACPI root pointer
from hw.acpi.root first. Same as FreeBSD. This change fixes a problem that
acpidump(8) showed "acpidump: Can't find ACPI information".
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.38.1 src/usr.sbin/acpitools/acpidump/acpi_user.c

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

Modified files:

Index: src/usr.sbin/acpitools/acpidump/acpi_user.c
diff -u src/usr.sbin/acpitools/acpidump/acpi_user.c:1.2 src/usr.sbin/acpitools/acpidump/acpi_user.c:1.2.38.1
--- src/usr.sbin/acpitools/acpidump/acpi_user.c:1.2	Tue Dec 22 08:44:03 2009
+++ src/usr.sbin/acpitools/acpidump/acpi_user.c	Wed Nov 22 15:35:52 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_user.c,v 1.2 2009/12/22 08:44:03 cegger Exp $ */
+/* $NetBSD: acpi_user.c,v 1.2.38.1 2017/11/22 15:35:52 martin Exp $ */
 
 /*-
  * Copyright (c) 1999 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: acpi_user.c,v 1.2 2009/12/22 08:44:03 cegger Exp $");
+__RCSID("$NetBSD: acpi_user.c,v 1.2.38.1 2017/11/22 15:35:52 martin Exp $");
 
 #include 
 #include 
@@ -46,6 +46,7 @@ __RCSID("$NetBSD: acpi_user.c,v 1.2 2009
 
 #include "acpidump.h"
 
+static char	machdep_acpi_root[] = "hw.acpi.root";
 static int  acpi_mem_fd = -1;
 
 struct acpi_user_mapping {
@@ -164,22 +165,16 @@ acpi_scan_rsd_ptr(void)
 ACPI_TABLE_RSDP *
 acpi_find_rsd_ptr(void)
 {
-	int i;
-	uint8_t		buf[sizeof(ACPI_TABLE_RSDP)];
+	ACPI_TABLE_RSDP	*rsdp;
+	u_long		addr = 0;
+	size_t		len = sizeof(addr);
 
 	acpi_user_init();
-	for (i = 0; i < 1024 * 1024; i += 16) {
-		read(acpi_mem_fd, buf, 16);
-		if (!memcmp(buf, "RSD PTR ", 8)) {
-			/* Read the rest of the structure */
-			read(acpi_mem_fd, buf + 16, sizeof(ACPI_TABLE_RSDP) - 16);
-
-			/* Verify checksum before accepting it. */
-			if (acpi_checksum(buf, sizeof(ACPI_TABLE_RSDP)))
-continue;
-			return (acpi_map_physical(i, sizeof(ACPI_TABLE_RSDP)));
-		}
-	}
+
+	if (sysctlbyname(machdep_acpi_root, , , NULL, 0) != 0)
+		addr = 0;
+	if (addr != 0 && (rsdp = acpi_get_rsdp(addr)) != NULL)
+		return rsdp;
 
 	return acpi_scan_rsd_ptr();
 }



CVS commit: src/sys/compat/common

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 15:25:34 UTC 2017

Modified Files:
src/sys/compat/common: uipc_syscalls_40.c

Log Message:
#idef the label next_ifa: just like the only goto using it.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/compat/common/uipc_syscalls_40.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/compat/common/uipc_syscalls_40.c
diff -u src/sys/compat/common/uipc_syscalls_40.c:1.14 src/sys/compat/common/uipc_syscalls_40.c:1.15
--- src/sys/compat/common/uipc_syscalls_40.c:1.14	Wed Nov 22 10:19:14 2017
+++ src/sys/compat/common/uipc_syscalls_40.c	Wed Nov 22 15:25:34 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: uipc_syscalls_40.c,v 1.14 2017/11/22 10:19:14 ozaki-r Exp $	*/
+/*	$NetBSD: uipc_syscalls_40.c,v 1.15 2017/11/22 15:25:34 martin Exp $	*/
 
 /* written by Pavel Cahyna, 2006. Public domain. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.14 2017/11/22 10:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.15 2017/11/22 15:25:34 martin Exp $");
 
 /*
  * System call interface to the socket abstraction.
@@ -124,7 +124,9 @@ compat_ifconf(u_long cmd, void *data)
 			}
 			space -= sz;
 
+#ifdef COMPAT_OSOCK
 		next_ifa:
+#endif
 			s = pserialize_read_enter();
 			ifa_release(ifa, _ifa);
 		}



CVS commit: [netbsd-8] src/sys/arch/luna68k/stand/boot

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 15:20:15 UTC 2017

Modified Files:
src/sys/arch/luna68k/stand/boot [netbsd-8]: Makefile

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #376):
sys/arch/luna68k/stand/boot/Makefile: revision 1.14
Explicitly set NOPIE.  GOT seems problematic on elf2aout(1) conversion.
Fixes silent hangup of luna68k boot.
Should be pulled up to netbsd-8.
Current bsd.own.mk sets NOPIE in case of BINDIR=/usr/mdec for standalone
programs and in luna68k case it's defined in ../Makefile.inc.
However, many bootloader Makefiles include bsd.own.mk first to override
CFLAGS etc. and Makefile.inc is not included (so BINDIR is not set) yet
at the point.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.6.1 src/sys/arch/luna68k/stand/boot/Makefile

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/luna68k/stand/boot/Makefile
diff -u src/sys/arch/luna68k/stand/boot/Makefile:1.13 src/sys/arch/luna68k/stand/boot/Makefile:1.13.6.1
--- src/sys/arch/luna68k/stand/boot/Makefile:1.13	Sat Apr  8 19:53:21 2017
+++ src/sys/arch/luna68k/stand/boot/Makefile	Wed Nov 22 15:20:15 2017
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile,v 1.13 2017/04/08 19:53:21 christos Exp $
+#	$NetBSD: Makefile,v 1.13.6.1 2017/11/22 15:20:15 martin Exp $
 #	@(#)Makefile	8.2 (Berkeley) 8/15/93
 
 NOMAN= # defined
+NOPIE= # defined
 
 .include 
 



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

2017-11-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 22 15:15:09 UTC 2017

Modified Files:
src/sys/dev/pci/ixgbe: if_bypass.c ixgbe.c ixgbe.h

Log Message:
Fix a bug that bypass adapter's sysctls aren't set. Tested with non-genuine
X550-T2 bypass adapter:
- Call ixgbe_sysctl_instance() in ixgbe_bypass_init() to get sysctl's top node
  correctly.
- ixgbe_init_device_features() refers adapter->hw.bus.func for bypass adapter.
  Call set_lan_id() to set adapter->hw.bus.func before calling
  ixgbe_init_device_features(). Without this, bypass sysctl's are added to
  both the first and second port.
- Initalize node.sysctl_data before calling sysctl_lookup() to read correct
  value.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/ixgbe/if_bypass.c
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/ixgbe/ixgbe.h

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

Modified files:

Index: src/sys/dev/pci/ixgbe/if_bypass.c
diff -u src/sys/dev/pci/ixgbe/if_bypass.c:1.1 src/sys/dev/pci/ixgbe/if_bypass.c:1.2
--- src/sys/dev/pci/ixgbe/if_bypass.c:1.1	Wed Aug 30 08:49:18 2017
+++ src/sys/dev/pci/ixgbe/if_bypass.c	Wed Nov 22 15:15:09 2017
@@ -134,6 +134,7 @@ ixgbe_bp_version(SYSCTLFN_ARGS)
 		goto err;
 	ixgbe_bypass_mutex_clear(adapter);
 	featversion &= BYPASS_CTL2_DATA_M;
+	node.sysctl_data = 
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	return (error);
 err:
@@ -171,6 +172,7 @@ ixgbe_bp_set_state(SYSCTLFN_ARGS)
 		return (error);
 	state = (state >> BYPASS_STATUS_OFF_SHIFT) & 0x3;
 
+	node.sysctl_data = 
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if ((error) || (newp == NULL))
 		return (error);
@@ -233,6 +235,7 @@ ixgbe_bp_timeout(SYSCTLFN_ARGS)
 		return (error);
 	timeout = (timeout >> BYPASS_WDTIMEOUT_SHIFT) & 0x3;
 
+	node.sysctl_data = 
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if ((error) || (newp == NULL))
 		return (error);
@@ -276,6 +279,7 @@ ixgbe_bp_main_on(SYSCTLFN_ARGS)
 	if (error)
 		return (error);
 
+	node.sysctl_data = _on;
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if ((error) || (newp == NULL))
 		return (error);
@@ -319,6 +323,7 @@ ixgbe_bp_main_off(SYSCTLFN_ARGS)
 		return (error);
 	main_off = (main_off >> BYPASS_MAIN_OFF_SHIFT) & 0x3;
 
+	node.sysctl_data = _off;
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if ((error) || (newp == NULL))
 		return (error);
@@ -362,6 +367,7 @@ ixgbe_bp_aux_on(SYSCTLFN_ARGS)
 		return (error);
 	aux_on = (aux_on >> BYPASS_AUX_ON_SHIFT) & 0x3;
 
+	node.sysctl_data = _on;
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if ((error) || (newp == NULL))
 		return (error);
@@ -405,6 +411,7 @@ ixgbe_bp_aux_off(SYSCTLFN_ARGS)
 		return (error);
 	aux_off = (aux_off >> BYPASS_AUX_OFF_SHIFT) & 0x3;
 
+	node.sysctl_data = _off;
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if ((error) || (newp == NULL))
 		return (error);
@@ -460,6 +467,7 @@ ixgbe_bp_wd_set(SYSCTLFN_ARGS)
 	if ((tmp & (0x1 << BYPASS_WDT_ENABLE_SHIFT)) == 0)
 		timeout = 0;
 
+	node.sysctl_data = 
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if ((error) || (newp == NULL))
 		return (error);
@@ -529,6 +537,7 @@ ixgbe_bp_wd_reset(SYSCTLFN_ARGS)
 	int cmd, count = 0, error = 0;
 	int reset_wd = 0;
 
+	node.sysctl_data = _wd;
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if ((error) || (newp == NULL))
 		return (error);
@@ -579,6 +588,7 @@ ixgbe_bp_log(SYSCTLFN_ARGS)
 	struct ixgbe_bypass_eeprom eeprom[BYPASS_MAX_LOGS];
 	inti, error = 0;
 
+	node.sysctl_data = 
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if ((error) || (newp == NULL))
 		return (error);
@@ -759,7 +769,7 @@ ixgbe_bypass_init(struct adapter *adapte
 
 	/* Now set up the SYSCTL infrastructure */
 	log = >sysctllog;
-	if ((rnode = adapter->sysctltop) == NULL) {
+	if ((rnode = ixgbe_sysctl_instance(adapter)) == NULL) {
 		aprint_error_dev(dev, "could not create sysctl root\n");
 		return;
 	}

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.112 src/sys/dev/pci/ixgbe/ixgbe.c:1.113
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.112	Thu Nov 16 03:07:18 2017
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Nov 22 15:15:09 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.112 2017/11/16 03:07:18 ozaki-r Exp $ */
+/* $NetBSD: ixgbe.c,v 1.113 2017/11/22 15:15:09 msaitoh Exp $ */
 
 /**
 
@@ -257,7 +257,6 @@ static void	ixgbe_handle_msf(void *);
 static void	ixgbe_handle_mod(void *);
 static void	ixgbe_handle_phy(void *);
 
-const struct sysctlnode *ixgbe_sysctl_instance(struct adapter *);
 static ixgbe_vendor_info_t *ixgbe_lookup(const struct pci_attach_args *);
 
 /
@@ -853,6 +852,7 @@ ixgbe_attach(device_t parent, device_t d
 	} else
 		adapter->num_segs = IXGBE_82598_SCATTER;
 
+	

CVS commit: [netbsd-8] src/common/dist/zlib

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 15:11:26 UTC 2017

Modified Files:
src/common/dist/zlib [netbsd-8]: inflate.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #375):
common/dist/zlib/inflate.c: revision 1.6
Restore a local change (in rev1.4) that was lost on zlib 1.12.10 merge.
The rev 1.4 changelog:
Disable a sanity check output buffer != NULL in _STANDALONE case.
Some kernels are loaded at address 0x0 by bootloaders and
output buffer address could be zero in such case.
Fixes "read text" errors on loading install floppy of NetBSD/news68k 4.0,
reported by KIYOHARA Takashi on port-news68k.
This problem may also affect other m68k ports which use a gzipped install
kernel and kernel text address located at PA 0x0.
Should be pulled up to netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.6.1 src/common/dist/zlib/inflate.c

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

Modified files:

Index: src/common/dist/zlib/inflate.c
diff -u src/common/dist/zlib/inflate.c:1.5 src/common/dist/zlib/inflate.c:1.5.6.1
--- src/common/dist/zlib/inflate.c:1.5	Tue Jan 10 01:27:41 2017
+++ src/common/dist/zlib/inflate.c	Wed Nov 22 15:11:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: inflate.c,v 1.5 2017/01/10 01:27:41 christos Exp $	*/
+/*	$NetBSD: inflate.c,v 1.5.6.1 2017/11/22 15:11:26 martin Exp $	*/
 
 /* inflate.c -- zlib decompression
  * Copyright (C) 1995-2016 Mark Adler
@@ -644,9 +644,16 @@ int flush;
 static const unsigned short order[19] = /* permutation of code lengths */
 {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
 
+#if defined(__NetBSD__) && defined(_STANDALONE)
+/* Some kernels are loaded at address 0x0 so strm->next_out could be NULL */
+if (inflateStateCheck(strm) ||
+(strm->next_in == Z_NULL && strm->avail_in != 0))
+return Z_STREAM_ERROR;
+#else
 if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
 (strm->next_in == Z_NULL && strm->avail_in != 0))
 return Z_STREAM_ERROR;
+#endif
 
 state = (struct inflate_state FAR *)strm->state;
 if (state->mode == TYPE) state->mode = TYPEDO;  /* skip check */



CVS commit: [netbsd-8] src

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 14:56:30 UTC 2017

Modified Files:
src/share/man/man4 [netbsd-8]: lm.4 wbsio.4
src/sys/dev/i2c [netbsd-8]: lm_i2c.c
src/sys/dev/ic [netbsd-8]: nslm7x.c nslm7xvar.h
src/sys/dev/isa [netbsd-8]: lm_isa_common.c wbsio.c
Added Files:
src/sys/dev/isa [netbsd-8]: wbsioreg.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #374):
share/man/man4/lm.4: revision 1.33
share/man/man4/lm.4: revision 1.34
sys/dev/ic/nslm7x.c: revision 1.70
sys/dev/isa/lm_isa_common.c: revision 1.5
sys/dev/isa/lm_isa_common.c: revision 1.6
sys/dev/isa/wbsio.c: revision 1.11
sys/dev/i2c/lm_i2c.c: revision 1.3
sys/dev/isa/wbsio.c: revision 1.12
sys/dev/i2c/lm_i2c.c: revision 1.4
sys/dev/isa/wbsioreg.h: revision 1.1
sys/dev/isa/wbsio.c: revision 1.13
sys/dev/isa/wbsioreg.h: revision 1.2
sys/dev/isa/wbsio.c: revision 1.14
sys/dev/isa/wbsioreg.h: revision 1.3
sys/dev/isa/wbsio.c: revision 1.15
sys/dev/isa/wbsioreg.h: revision 1.4
sys/dev/isa/wbsioreg.h: revision 1.5
share/man/man4/wbsio.4: revision 1.4
share/man/man4/wbsio.4: revision 1.5
sys/dev/ic/nslm7xvar.h: revision 1.30
sys/dev/ic/nslm7x.c: revision 1.65
share/man/man4/wbsio.4: revision 1.6
sys/dev/ic/nslm7xvar.h: revision 1.31
sys/dev/ic/nslm7x.c: revision 1.66
sys/dev/ic/nslm7xvar.h: revision 1.32
sys/dev/ic/nslm7x.c: revision 1.67
sys/dev/ic/nslm7xvar.h: revision 1.33
sys/dev/ic/nslm7x.c: revision 1.68
sys/dev/ic/nslm7x.c: revision 1.69
  Add Winbond W83627DHG-P, W83627SF, W83627UHG, W83667HGB, W83687THF, W83697UG,
Nuvoton NCT5104D, NCT610[246]D, NCT6775, NCT6779, NCT6791, NCT6792 and NCT6793.
lm(4): Add support for NCT5104D, NCT610[246]D, NCT6775F, NCT6779D and 
NCT679[1235]D.
wbsio(4): Add support for NCT6795D.
Add note about Nuvoton.
- Add new Nuvoton devices.
- Add CAVEATS section from OpenBSD.
Add space before left-paren
Remove superfluous Pp.
Whitespace.
  Fix a bug that fan RPM wasn't printed correctly. 0xbX is not RPM but counter.
Use 0xcX.
  Fix typo.
- Sprinkle static and const. No functional change.
- Print chip ID in hexadecimal instead of octal in def_match().
  Use uint8_t instead of int. No functional change.
  Print chip name correctly.
- WBSIO_ID_W83627DHG and newer devices have 12bit device ID. So, change sioid
   from 8bit to 16bit and check with it strictly.
- s/lm_match/nslm_match/
- split {wb,lm,def}_match() to XXX_match and XXX_attach().
- Rename lm_probe with lm_match and call {wb,nslm,def}_match() at the end of
   the function to check strictly.
- NCT610[246]D is different from others, so add new nct6102d_sensors[] table.
- Register offsets of vendor ID and chip id of NCT610[246]D are different
   from others. When it failed reading vendor ID or chip ID, fallback to
   NCT610[246]D's register offsets.
- Add debug messages.
  Restore NetBSD RCS Id which was accidentally removed in rev. 1.2.
  s/Id/NetBSD/. Pointed out by wiz!


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.40.1 src/share/man/man4/lm.4
cvs rdiff -u -r1.3 -r1.3.18.1 src/share/man/man4/wbsio.4
cvs rdiff -u -r1.2 -r1.2.80.1 src/sys/dev/i2c/lm_i2c.c
cvs rdiff -u -r1.64 -r1.64.10.1 src/sys/dev/ic/nslm7x.c
cvs rdiff -u -r1.29 -r1.29.10.1 src/sys/dev/ic/nslm7xvar.h
cvs rdiff -u -r1.4 -r1.4.10.1 src/sys/dev/isa/lm_isa_common.c
cvs rdiff -u -r1.10 -r1.10.10.1 src/sys/dev/isa/wbsio.c
cvs rdiff -u -r0 -r1.5.2.2 src/sys/dev/isa/wbsioreg.h

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

Modified files:

Index: src/share/man/man4/lm.4
diff -u src/share/man/man4/lm.4:1.32 src/share/man/man4/lm.4:1.32.40.1
--- src/share/man/man4/lm.4:1.32	Sun Feb 21 05:16:29 2010
+++ src/share/man/man4/lm.4	Wed Nov 22 14:56:30 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: lm.4,v 1.32 2010/02/21 05:16:29 cnst Exp $
+.\"	$NetBSD: lm.4,v 1.32.40.1 2017/11/22 14:56:30 martin 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 February 16, 2010
+.Dd July 12, 2017
 .Dt LM 4
 .Os
 .Sh NAME
@@ -51,7 +51,7 @@ the
 .Xr envsys 4
 API.
 .Pp
-Most supported devices possess 11 sensors:
+The original LM78 hardware monitor supports 11 sensors:
 .Bl -column "Sensor" "Units" "Typical" -offset indent
 .It Sy "Sensor" Ta Sy "Units" Ta Sy "Typical Use"
 .It Li "IN0" Ta "uV DC" Ta "Core voltage"
@@ -66,8 +66,7 @@ Most supported devices possess 11 sensor
 .It Li "Fan1" Ta "RPM" Ta "Chassis Fan"
 .It Li "Fan2" Ta "RPM" Ta "Fan"
 .El
-for some devices (most Winbond devices) sensor names and numbers will be
-different.
+For other devices, sensors' 

CVS commit: [netbsd-8] src/sys/dev/mii

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 14:47:40 UTC 2017

Modified Files:
src/sys/dev/mii [netbsd-8]: miidevs.h miidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.128.6.1 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.116 -r1.116.6.1 src/sys/dev/mii/miidevs_data.h

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

Modified files:

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.128 src/sys/dev/mii/miidevs.h:1.128.6.1
--- src/sys/dev/mii/miidevs.h:1.128	Wed Feb  1 05:46:41 2017
+++ src/sys/dev/mii/miidevs.h	Wed Nov 22 14:47:40 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.128 2017/02/01 05:46:41 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.128.6.1 2017/11/22 14:47:40 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.125 2017/02/01 05:46:21 msaitoh Exp
+ *	NetBSD: miidevs,v 1.125.6.1 2017/11/22 14:46:49 martin Exp
  */
 
 /*-
@@ -332,6 +332,10 @@
 #define	MII_STR_INTEL_I82579	"i82579 10/100/1000 media interface"
 #define	MII_MODEL_INTEL_I217	0x000a
 #define	MII_STR_INTEL_I217	"i217 10/100/1000 media interface"
+#define	MII_MODEL_INTEL_X550	0x0022
+#define	MII_STR_INTEL_X550	"X550 100M/1G/10G media interface"
+#define	MII_MODEL_INTEL_X557	0x0024
+#define	MII_STR_INTEL_X557	"X557 100M/1G/10G media interface"
 #define	MII_MODEL_INTEL_I82580	0x003a
 #define	MII_STR_INTEL_I82580	"82580 10/100/1000 media interface"
 #define	MII_MODEL_INTEL_I350	0x003b

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.116 src/sys/dev/mii/miidevs_data.h:1.116.6.1
--- src/sys/dev/mii/miidevs_data.h:1.116	Wed Feb  1 05:46:41 2017
+++ src/sys/dev/mii/miidevs_data.h	Wed Nov 22 14:47:40 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.116 2017/02/01 05:46:41 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.116.6.1 2017/11/22 14:47:40 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.125 2017/02/01 05:46:21 msaitoh Exp
+ *	NetBSD: miidevs,v 1.125.6.1 2017/11/22 14:46:49 martin Exp
  */
 
 /*-
@@ -130,6 +130,8 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_INTEL, MII_MODEL_INTEL_I82577, MII_STR_INTEL_I82577 },
  { MII_OUI_INTEL, MII_MODEL_INTEL_I82579, MII_STR_INTEL_I82579 },
  { MII_OUI_INTEL, MII_MODEL_INTEL_I217, MII_STR_INTEL_I217 },
+ { MII_OUI_INTEL, MII_MODEL_INTEL_X550, MII_STR_INTEL_X550 },
+ { MII_OUI_INTEL, MII_MODEL_INTEL_X557, MII_STR_INTEL_X557 },
  { MII_OUI_INTEL, MII_MODEL_INTEL_I82580, MII_STR_INTEL_I82580 },
  { MII_OUI_INTEL, MII_MODEL_INTEL_I350, MII_STR_INTEL_I350 },
  { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_I210, MII_STR_xxMARVELL_I210 },



CVS commit: [netbsd-8] src/sys/dev/mii

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 14:46:49 UTC 2017

Modified Files:
src/sys/dev/mii [netbsd-8]: miidevs

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #372):
sys/dev/mii/miidevs: revision 1.126
  Add X550 and X557.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.125.6.1 src/sys/dev/mii/miidevs

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/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.125 src/sys/dev/mii/miidevs:1.125.6.1
--- src/sys/dev/mii/miidevs:1.125	Wed Feb  1 05:46:21 2017
+++ src/sys/dev/mii/miidevs	Wed Nov 22 14:46:49 2017
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.125 2017/02/01 05:46:21 msaitoh Exp $
+$NetBSD: miidevs,v 1.125.6.1 2017/11/22 14:46:49 martin Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -232,6 +232,8 @@ model yyINTEL I82566		0x0039 i82566 10/1
 model INTEL I82577		0x0005 i82577 10/100/1000 media interface
 model INTEL I82579		0x0009 i82579 10/100/1000 media interface
 model INTEL I217		0x000a i217 10/100/1000 media interface
+model INTEL X550		0x0022 X550 100M/1G/10G media interface
+model INTEL X557		0x0024 X557 100M/1G/10G media interface
 model INTEL I82580		0x003a 82580 10/100/1000 media interface
 model INTEL I350		0x003b I350 10/100/1000 media interface
 model xxMARVELL I210		0x I210 10/100/1000 media interface



CVS commit: [netbsd-8] src/sys/dev/pci

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 14:38:47 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-8]: pci_subr.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #371):
sys/dev/pci/pci_subr.c: revision 1.195
sys/dev/pci/pci_subr.c: revision 1.196
  Print Error Source Identification register correctly.
  Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.183.2.2 -r1.183.2.3 src/sys/dev/pci/pci_subr.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/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.183.2.2 src/sys/dev/pci/pci_subr.c:1.183.2.3
--- src/sys/dev/pci/pci_subr.c:1.183.2.2	Tue Nov 21 14:16:38 2017
+++ src/sys/dev/pci/pci_subr.c	Wed Nov 22 14:38:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.183.2.2 2017/11/21 14:16:38 martin Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.183.2.3 2017/11/22 14:38:47 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.183.2.2 2017/11/21 14:16:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.183.2.3 2017/11/22 14:38:47 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -2692,7 +2692,8 @@ pci_conf_print_aer_cap(const pcireg_t *r
 		pci_conf_print_aer_cap_rooterr_status(reg);
 
 		reg = regs[o2i(extcapoff + PCI_AER_ERRSRC_ID)];
-		printf("Error Source Identification: 0x%04x\n", reg);
+		printf("Error Source Identification register: 0x%08x\n",
+		reg);
 		pci_conf_print_aer_cap_errsrc_id(reg);
 		break;
 	}
@@ -4348,9 +4349,9 @@ pci_conf_print_type1(
 	}
 	if (base < limit) {
 		if (use_upper == 1)
-			printf("  range:  0x%08x-0x%08x\n", base, limit);
+			printf("  range: 0x%08x-0x%08x\n", base, limit);
 		else
-			printf("  range:  0x%04x-0x%04x\n", base, limit);
+			printf("  range: 0x%04x-0x%04x\n", base, limit);
 	} else
 		printf("  range:  not set\n");
 
@@ -4366,9 +4367,9 @@ pci_conf_print_type1(
 	limit = (((rval >> PCI_BRIDGE_MEMORY_LIMIT_SHIFT)
 		& PCI_BRIDGE_MEMORY_LIMIT_MASK) << 20) | 0x000f;
 	if (base < limit)
-		printf("  range:  0x%08x-0x%08x\n", base, limit);
+		printf("  range: 0x%08x-0x%08x\n", base, limit);
 	else
-		printf("  range:  not set\n");
+		printf("  range: not set\n");
 
 	/* Prefetchable memory region */
 	rval = regs[o2i(PCI_BRIDGE_PREFETCHMEM_REG)];
@@ -4398,13 +4399,13 @@ pci_conf_print_type1(
 	}
 	if (pbase < plimit) {
 		if (use_upper == 1)
-			printf("  range:  0x%016" PRIx64 "-0x%016" PRIx64
+			printf("  range: 0x%016" PRIx64 "-0x%016" PRIx64
 			"\n", pbase, plimit);
 		else
-			printf("  range:  0x%08x-0x%08x\n",
+			printf("  range: 0x%08x-0x%08x\n",
 			(uint32_t)pbase, (uint32_t)plimit);
 	} else
-		printf("  range:  not set\n");
+		printf("  range: not set\n");
 
 	if (regs[o2i(PCI_COMMAND_STATUS_REG)] & PCI_STATUS_CAPLIST_SUPPORT)
 		printf("Capability list pointer: 0x%02x\n",



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

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 14:36:55 UTC 2017

Modified Files:
src/sys/net [netbsd-8]: if_media.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #370):
sys/net/if_media.c: revision 1.33
sys/net/if_media.c: revision 1.34
No functional change:
  - Simplify ifmedia_removeall using with ifmedia_delete_instance(IFM_INST_ANY).
  - KNF.
  Clear ifm_cur and ifm_media after removing all ifmedia entries(IFM_INST_ANY)
in ifmedia_delete_instance() like if_media.c rev. 1.32.
Now if_media_delete_instance(IFM_INST_ANY) is the same as ifmedia_removeall().


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.6.1 src/sys/net/if_media.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/if_media.c
diff -u src/sys/net/if_media.c:1.32 src/sys/net/if_media.c:1.32.6.1
--- src/sys/net/if_media.c:1.32	Wed Jan 25 07:19:24 2017
+++ src/sys/net/if_media.c	Wed Nov 22 14:36:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_media.c,v 1.32 2017/01/25 07:19:24 msaitoh Exp $	*/
+/*	$NetBSD: if_media.c,v 1.32.6.1 2017/11/22 14:36:55 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_media.c,v 1.32 2017/01/25 07:19:24 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_media.c,v 1.32.6.1 2017/11/22 14:36:55 martin Exp $");
 
 #include 
 #include 
@@ -206,9 +206,8 @@ ifmedia_set(struct ifmedia *ifm, int tar
 		if (match == NULL) {
 			ifmedia_add(ifm, target, 0, NULL);
 			match = ifmedia_match(ifm, target, ifm->ifm_mask);
-			if (match == NULL) {
+			if (match == NULL)
 panic("ifmedia_set failed");
-			}
 		}
 	}
 	ifm->ifm_cur = match;
@@ -265,7 +264,7 @@ ifmedia_ioctl(struct ifnet *ifp, struct 
 newmedia);
 			}
 #endif
-			return (EINVAL);
+			return EINVAL;
 		}
 
 		/*
@@ -355,10 +354,10 @@ ifmedia_ioctl(struct ifnet *ifp, struct 
 	}
 
 	default:
-		return (EINVAL);
+		return EINVAL;
 	}
 
-	return (error);
+	return error;
 }
 
 /*
@@ -398,8 +397,7 @@ ifmedia_delete_instance(struct ifmedia *
 {
 	struct ifmedia_entry *ife, *nife;
 
-	for (ife = TAILQ_FIRST(>ifm_list); ife != NULL;
-	 ife = nife) {
+	for (ife = TAILQ_FIRST(>ifm_list); ife != NULL; ife = nife) {
 		nife = TAILQ_NEXT(ife, ifm_list);
 		if (inst == IFM_INST_ANY ||
 		inst == IFM_INST(ife->ifm_media)) {
@@ -407,20 +405,17 @@ ifmedia_delete_instance(struct ifmedia *
 			free(ife, M_IFMEDIA);
 		}
 	}
+	if (inst == IFM_INST_ANY) {
+		ifm->ifm_cur = NULL;
+		ifm->ifm_media = IFM_NONE;
+	}
 }
 
 void
 ifmedia_removeall(struct ifmedia *ifm)
 {
-	struct ifmedia_entry *ife, *nife;
 
-	for (ife = TAILQ_FIRST(>ifm_list); ife != NULL; ife = nife) {
-		nife = TAILQ_NEXT(ife, ifm_list);
-		TAILQ_REMOVE(>ifm_list, ife, ifm_list);
-		free(ife, M_IFMEDIA);
-	}
-	ifm->ifm_cur = NULL;
-	ifm->ifm_media = IFM_NONE;
+	ifmedia_delete_instance(ifm, IFM_INST_ANY);
 }
 
 
@@ -443,7 +438,7 @@ ifmedia_baudrate(int mword)
 	}
 
 	/* Not known. */
-	return (0);
+	return 0;
 }
 
 #ifdef IFMEDIA_DEBUG



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

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 14:33:23 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: spdmem.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #369):
sys/dev/ic/spdmem.c: revision 1.25
sys/dev/ic/spdmem.c: revision 1.26
sys/dev/ic/spdmem.c: revision 1.27
sys/dev/ic/spdmem.c: revision 1.28
  A part number field of DDR3 and DDR4 is not NUL terminated. All unused chars
are filled by 0x20. Print it correctly.
Before:
spdmem0 at iic0 addr 0x50: 8KTF51264AZ-1G6E1 E1M^@,DPAFEQZ021
spdmem1 at iic0 addr 0x51: ACR256X64D3U1333C9BA^AM^X
spdmem2 at iic0 addr 0x52: KP223C-ELDBA^BM-~
After:
spdmem0 at iic0 addr 0x50: 8KTF51264AZ-1G6E1
spdmem1 at iic0 addr 0x51: ACR256X64D3U1333C9
spdmem2 at iic0 addr 0x52: KP223C-ELD
dedup
simplify previous.
  Print "ECC" or "no ECC" for DDR4.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.6.1 src/sys/dev/ic/spdmem.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/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.24 src/sys/dev/ic/spdmem.c:1.24.6.1
--- src/sys/dev/ic/spdmem.c:1.24	Wed Jan 18 06:02:50 2017
+++ src/sys/dev/ic/spdmem.c	Wed Nov 22 14:33:23 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.24 2017/01/18 06:02:50 msaitoh Exp $ */
+/* $NetBSD: spdmem.c,v 1.24.6.1 2017/11/22 14:33:23 martin Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.24 2017/01/18 06:02:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.24.6.1 2017/11/22 14:33:23 martin Exp $");
 
 #include 
 #include 
@@ -748,12 +748,21 @@ decode_ddr2(const struct sysctlnode *nod
 }
 
 static void
+print_part(const char *part, size_t pnsize)
+{
+	const char *p = memchr(part, ' ', pnsize);
+	if (p == NULL)
+		p = part + pnsize;
+	aprint_normal(": %.*s\n", (int)(p - part), part);
+}
+
+static void
 decode_ddr3(const struct sysctlnode *node, device_t self, struct spdmem *s)
 {
 	int dimm_size, cycle_time, bits;
 
 	aprint_naive("\n");
-	aprint_normal(": %18s\n", s->sm_ddr3.ddr3_part);
+	print_part(s->sm_ddr3.ddr3_part, sizeof(s->sm_ddr3.ddr3_part));
 	aprint_normal_dev(self, "%s", spdmem_basic_types[s->sm_type]);
 
 	if (s->sm_ddr3.ddr3_mod_type ==
@@ -864,13 +873,15 @@ decode_ddr4(const struct sysctlnode *nod
 	int tAA_clocks, tRCD_clocks,tRP_clocks, tRAS_clocks;
 
 	aprint_naive("\n");
-	aprint_normal(": %20s\n", s->sm_ddr4.ddr4_part_number);
+	print_part(s->sm_ddr4.ddr4_part_number,
+	sizeof(s->sm_ddr4.ddr4_part_number));
 	aprint_normal_dev(self, "%s", spdmem_basic_types[s->sm_type]);
 	if (s->sm_ddr4.ddr4_mod_type < __arraycount(spdmem_ddr4_module_types))
 		aprint_normal(" (%s)", 
 		spdmem_ddr4_module_types[s->sm_ddr4.ddr4_mod_type]);
-	aprint_normal(", %stemp-sensor, ",
-		(s->sm_ddr4.ddr4_has_therm_sensor)?"":"no ");
+	aprint_normal(", %sECC, %stemp-sensor, ",
+		(s->sm_ddr4.ddr4_bus_width_extension) ? "" : "no ",
+		(s->sm_ddr4.ddr4_has_therm_sensor) ? "" : "no ");
 
 	/*
 	 * DDR4 size calculation from JEDEC spec



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

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 14:30:24 UTC 2017

Modified Files:
src/sys/net [netbsd-8]: if_vlan.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #368):
sys/net/if_vlan.c: revision 1.101
sys/net/if_vlan.c: revision 1.102
  Check if VLAN ID isn't duplicated on a same parent interface and return
EEXIST if it failed.
  Remove accidentally added code (for VLAN hardware filter).


To generate a diff of this commit:
cvs rdiff -u -r1.97.2.6 -r1.97.2.7 src/sys/net/if_vlan.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/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.97.2.6 src/sys/net/if_vlan.c:1.97.2.7
--- src/sys/net/if_vlan.c:1.97.2.6	Wed Nov  8 22:20:59 2017
+++ src/sys/net/if_vlan.c	Wed Nov 22 14:30:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.97.2.6 2017/11/08 22:20:59 snj Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.97.2.7 2017/11/22 14:30:23 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97.2.6 2017/11/08 22:20:59 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.97.2.7 2017/11/22 14:30:23 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -379,10 +379,12 @@ vlan_config(struct ifvlan *ifv, struct i
 	struct ifnet *ifp = >ifv_if;
 	struct ifvlan_linkmib *nmib = NULL;
 	struct ifvlan_linkmib *omib = NULL;
+	struct ifvlan_linkmib *checkmib = NULL;
 	struct psref_target *nmib_psref = NULL;
 	int error = 0;
 	int idx;
 	bool omib_cleanup = false;
+	struct psref psref;
 
 	nmib = kmem_alloc(sizeof(*nmib), KM_SLEEP);
 
@@ -394,6 +396,14 @@ vlan_config(struct ifvlan *ifv, struct i
 		goto done;
 	}
 
+	/* Duplicate check */
+	checkmib = vlan_lookup_tag_psref(p, tag, );
+	if (checkmib != NULL) {
+		vlan_putref_linkmib(checkmib, );
+		error = EEXIST;
+		goto done;
+	}
+
 	*nmib = *omib;
 	nmib_psref = >ifvm_psref;
 



CVS commit: src/external/bsd/nvi/dist/ex

2017-11-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Nov 22 13:13:18 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/ex: ex.c

Log Message:
Fix backward memcpy in :e +cmd, taken from nvi2 (and OpenBSD):
https://github.com/lichray/nvi2/commit/7ab02500a2d89bc45db383cb3dcd10f3c4301a8c
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/vi/ex/ex.c#rev1.21


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/nvi/dist/ex/ex.c

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

Modified files:

Index: src/external/bsd/nvi/dist/ex/ex.c
diff -u src/external/bsd/nvi/dist/ex/ex.c:1.6 src/external/bsd/nvi/dist/ex/ex.c:1.7
--- src/external/bsd/nvi/dist/ex/ex.c:1.6	Mon Nov 13 01:40:37 2017
+++ src/external/bsd/nvi/dist/ex/ex.c	Wed Nov 22 13:13:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ex.c,v 1.6 2017/11/13 01:40:37 rin Exp $ */
+/*	$NetBSD: ex.c,v 1.7 2017/11/22 13:13:18 rin Exp $ */
 /*-
  * Copyright (c) 1992, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: ex.c,v 10.75 2004/03/16 14:13:35 skimo Exp  (Berkeley) Date: 2004/03/16 14:13:35 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: ex.c,v 1.6 2017/11/13 01:40:37 rin Exp $");
+__RCSID("$NetBSD: ex.c,v 1.7 2017/11/22 13:13:18 rin Exp $");
 #endif
 
 #include 
@@ -1512,7 +1512,7 @@ addr_verify:
 
 		ecp->save_cmd -= arg1_len;
 		ecp->save_cmdlen += arg1_len;
-		MEMCPYW(ecp->save_cmd, arg1, arg1_len);
+		MEMMOVEW(ecp->save_cmd, arg1, arg1_len);
 
 		/*
 		 * Any commands executed from a +cmd are executed starting at



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

2017-11-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Nov 22 12:47:30 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/common: delete.c
src/external/bsd/nvi/dist/vi: v_sentence.c

Log Message:
Fix segmentation fault in corner case of backward sentence deletion,
taken from nvi2 (and Debian Bug report #193498):
https://github.com/lichray/nvi2/commit/e84d40ec20b257edad6810062204366ff0ddff58
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=193498


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/nvi/dist/common/delete.c
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/nvi/dist/vi/v_sentence.c

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

Modified files:

Index: src/external/bsd/nvi/dist/common/delete.c
diff -u src/external/bsd/nvi/dist/common/delete.c:1.3 src/external/bsd/nvi/dist/common/delete.c:1.4
--- src/external/bsd/nvi/dist/common/delete.c:1.3	Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/common/delete.c	Wed Nov 22 12:47:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: delete.c,v 1.3 2014/01/26 21:43:45 christos Exp $ */
+/*	$NetBSD: delete.c,v 1.4 2017/11/22 12:47:30 rin Exp $ */
 /*-
  * Copyright (c) 1992, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: delete.c,v 10.17 2001/06/25 15:19:09 skimo Exp  (Berkeley) Date: 2001/06/25 15:19:09 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: delete.c,v 1.3 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: delete.c,v 1.4 2017/11/22 12:47:30 rin Exp $");
 #endif
 
 #include 
@@ -95,14 +95,16 @@ del(SCR *sp, MARK *fm, MARK *tm, int lmo
 	if (tm->lno == fm->lno) {
 		if (db_get(sp, fm->lno, DBG_FATAL, , ))
 			return (1);
-		GET_SPACE_RETW(sp, bp, blen, len);
-		if (fm->cno != 0)
-			MEMCPYW(bp, p, fm->cno);
-		MEMCPYW(bp + fm->cno, p + (tm->cno + 1), 
-			len - (tm->cno + 1));
-		if (db_set(sp, fm->lno,
-		bp, len - ((tm->cno - fm->cno) + 1)))
-			goto err;
+		if (len != 0) {
+			GET_SPACE_RETW(sp, bp, blen, len);
+			if (fm->cno != 0)
+MEMCPYW(bp, p, fm->cno);
+			MEMCPYW(bp + fm->cno, p + (tm->cno + 1), 
+len - (tm->cno + 1));
+			if (db_set(sp, fm->lno,
+			bp, len - ((tm->cno - fm->cno) + 1)))
+goto err;
+		}
 		goto done;
 	}
 

Index: src/external/bsd/nvi/dist/vi/v_sentence.c
diff -u src/external/bsd/nvi/dist/vi/v_sentence.c:1.3 src/external/bsd/nvi/dist/vi/v_sentence.c:1.4
--- src/external/bsd/nvi/dist/vi/v_sentence.c:1.3	Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/vi/v_sentence.c	Wed Nov 22 12:47:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: v_sentence.c,v 1.3 2014/01/26 21:43:45 christos Exp $ */
+/*	$NetBSD: v_sentence.c,v 1.4 2017/11/22 12:47:30 rin Exp $ */
 /*-
  * Copyright (c) 1992, 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: v_sentence.c,v 10.9 2001/06/25 15:19:35 skimo Exp  (Berkeley) Date: 2001/06/25 15:19:35 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: v_sentence.c,v 1.3 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: v_sentence.c,v 1.4 2017/11/22 12:47:30 rin Exp $");
 #endif
 
 #include 
@@ -297,7 +297,7 @@ ret:			slno = cs.cs_lno;
 			 * we can end up where we started.  Fix it.
 			 */
 			if (vp->m_start.lno != cs.cs_lno ||
-			vp->m_start.cno != cs.cs_cno)
+			vp->m_start.cno > cs.cs_cno)
 goto okret;
 
 			/*



CVS commit: src/sys

2017-11-22 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov 22 10:19:14 UTC 2017

Modified Files:
src/sys/compat/common: uipc_syscalls_40.c
src/sys/compat/linux/common: linux_socket.c
src/sys/compat/linux32/common: linux32_socket.c
src/sys/net: if.c

Log Message:
Fix and make consistent of usages of psz/psref in ifconf variants


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/common/uipc_syscalls_40.c
cvs rdiff -u -r1.138 -r1.139 src/sys/compat/linux/common/linux_socket.c
cvs rdiff -u -r1.27 -r1.28 src/sys/compat/linux32/common/linux32_socket.c
cvs rdiff -u -r1.399 -r1.400 src/sys/net/if.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/compat/common/uipc_syscalls_40.c
diff -u src/sys/compat/common/uipc_syscalls_40.c:1.13 src/sys/compat/common/uipc_syscalls_40.c:1.14
--- src/sys/compat/common/uipc_syscalls_40.c:1.13	Tue Mar 14 09:03:08 2017
+++ src/sys/compat/common/uipc_syscalls_40.c	Wed Nov 22 10:19:14 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: uipc_syscalls_40.c,v 1.13 2017/03/14 09:03:08 ozaki-r Exp $	*/
+/*	$NetBSD: uipc_syscalls_40.c,v 1.14 2017/11/22 10:19:14 ozaki-r Exp $	*/
 
 /* written by Pavel Cahyna, 2006. Public domain. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.13 2017/03/14 09:03:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.14 2017/11/22 10:19:14 ozaki-r Exp $");
 
 /*
  * System call interface to the socket abstraction.
@@ -53,6 +53,7 @@ compat_ifconf(u_long cmd, void *data)
 		struct ifaddr *ifa;
 
 		if_acquire(ifp, );
+		pserialize_read_exit(s);
 
 		(void)strncpy(ifr.ifr_name, ifp->if_xname,
 		sizeof(ifr.ifr_name));
@@ -69,9 +70,10 @@ compat_ifconf(u_long cmd, void *data)
 ifrp++;
 			}
 			space -= sizeof(ifr);
-			continue;
+			goto next;
 		}
 
+		s = pserialize_read_enter();
 		IFADDR_READER_FOREACH(ifa, ifp) {
 			struct sockaddr *sa = ifa->ifa_addr;
 			struct psref psref_ifa;
@@ -85,11 +87,8 @@ compat_ifconf(u_long cmd, void *data)
 /*
  * If it does not fit, we don't bother with it
  */
-if (sa->sa_len > sizeof(*osa)) {
-	s = pserialize_read_enter();
-	ifa_release(ifa, _ifa);
-	continue;
-}
+if (sa->sa_len > sizeof(*osa))
+	goto next_ifa;
 memcpy(_addr, sa, sa->sa_len);
 osa->sa_family = sa->sa_family;
 if (space >= sz) {
@@ -119,13 +118,20 @@ compat_ifconf(u_long cmd, void *data)
 		 (char *)>ifr_addr);
 }
 			}
-			s = pserialize_read_enter();
-			ifa_release(ifa, _ifa);
-			if (error != 0)
+			if (error != 0) {
+ifa_release(ifa, _ifa);
 goto release_exit;
+			}
 			space -= sz;
+
+		next_ifa:
+			s = pserialize_read_enter();
+			ifa_release(ifa, _ifa);
 		}
+		pserialize_read_exit(s);
 
+	next:
+		s = pserialize_read_enter();
 		if_release(ifp, );
 	}
 	pserialize_read_exit(s);
@@ -138,7 +144,6 @@ compat_ifconf(u_long cmd, void *data)
 	return (0);
 
 release_exit:
-	pserialize_read_exit(s);
 	if_release(ifp, );
 	curlwp_bindx(bound);
 	return error;

Index: src/sys/compat/linux/common/linux_socket.c
diff -u src/sys/compat/linux/common/linux_socket.c:1.138 src/sys/compat/linux/common/linux_socket.c:1.139
--- src/sys/compat/linux/common/linux_socket.c:1.138	Tue Mar 14 09:03:08 2017
+++ src/sys/compat/linux/common/linux_socket.c	Wed Nov 22 10:19:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_socket.c,v 1.138 2017/03/14 09:03:08 ozaki-r Exp $	*/
+/*	$NetBSD: linux_socket.c,v 1.139 2017/11/22 10:19:14 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.138 2017/03/14 09:03:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.139 2017/11/22 10:19:14 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1144,6 +1144,7 @@ linux_getifconf(struct lwp *l, register_
 	IFNET_READER_FOREACH(ifp) {
 		struct ifaddr *ifa;
 		if_acquire(ifp, );
+		pserialize_read_exit(s);
 
 		(void)strncpy(ifr.ifr_name, ifp->if_xname,
 		sizeof(ifr.ifr_name));
@@ -1152,6 +1153,7 @@ linux_getifconf(struct lwp *l, register_
 			goto release_exit;
 		}
 
+		s = pserialize_read_enter();
 		IFADDR_READER_FOREACH(ifa, ifp) {
 			struct psref psref_ifa;
 			ifa_acquire(ifa, _ifa);
@@ -1167,7 +1169,6 @@ linux_getifconf(struct lwp *l, register_
 			if (space >= sz) {
 error = copyout(, ifrp, sz);
 if (error != 0) {
-	s = pserialize_read_enter();
 	ifa_release(ifa, _ifa);
 	goto release_exit;
 }
@@ -1179,6 +1180,7 @@ linux_getifconf(struct lwp *l, register_
 			ifa_release(ifa, _ifa);
 		}
 
+		s = pserialize_read_enter();
 		if_release(ifp, );
 	}
 	pserialize_read_exit(s);
@@ -1192,7 +1194,6 @@ linux_getifconf(struct lwp *l, register_
 	return copyout(, data, sizeof(ifc));
 
 release_exit:
-	pserialize_read_exit(s);
 	if_release(ifp, );
 	curlwp_bindx(bound);

CVS commit: src/sys/net

2017-11-22 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov 22 08:28:56 UTC 2017

Modified Files:
src/sys/net: if_spppsubr.c

Log Message:
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref (more)


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/sys/net/if_spppsubr.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/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.173 src/sys/net/if_spppsubr.c:1.174
--- src/sys/net/if_spppsubr.c:1.173	Wed Nov 22 05:42:30 2017
+++ src/sys/net/if_spppsubr.c	Wed Nov 22 08:28:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.173 2017/11/22 05:42:30 ozaki-r Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.174 2017/11/22 08:28:56 ozaki-r Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.173 2017/11/22 05:42:30 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.174 2017/11/22 08:28:56 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -5528,6 +5528,8 @@ sppp_set_ip6_addr(struct sppp *sp, const
 	STDDCL;
 	struct ifaddr *ifa;
 	struct sockaddr_in6 *sin6;
+	int s;
+	struct psref psref;
 
 	/*
 	 * Pick the first link-local AF_INET6 address from the list,
@@ -5535,15 +5537,19 @@ sppp_set_ip6_addr(struct sppp *sp, const
 	 */
 
 	sin6 = NULL;
+	s = pserialize_read_enter();
 	IFADDR_READER_FOREACH(ifa, ifp)
 	{
 		if (ifa->ifa_addr->sa_family == AF_INET6)
 		{
 			sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
-			if (sin6 && IN6_IS_ADDR_LINKLOCAL(>sin6_addr))
+			if (sin6 && IN6_IS_ADDR_LINKLOCAL(>sin6_addr)) {
+ifa_acquire(ifa, );
 break;
+			}
 		}
 	}
+	pserialize_read_exit(s);
 
 	if (ifa && sin6)
 	{
@@ -5560,6 +5566,7 @@ sppp_set_ip6_addr(struct sppp *sp, const
 		if (!error) {
 			pfil_run_addrhooks(if_pfil, SIOCAIFADDR_IN6, ifa);
 		}
+		ifa_release(ifa, );
 	}
 }
 #endif