CVS commit: src/share/misc

2017-05-10 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Thu May 11 06:46:45 UTC 2017

Modified Files:
src/share/misc: airport

Log Message:
fix TIA entry


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/share/misc/airport

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

Modified files:

Index: src/share/misc/airport
diff -u src/share/misc/airport:1.64 src/share/misc/airport:1.65
--- src/share/misc/airport:1.64	Thu Apr  6 19:53:36 2017
+++ src/share/misc/airport	Thu May 11 06:46:45 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: airport,v 1.64 2017/04/06 19:53:36 mbalmer Exp $
+#	$NetBSD: airport,v 1.65 2017/05/11 06:46:45 mbalmer Exp $
 #	@(#)airport	8.1 (Berkeley) 6/8/93
 #
 # Some of this information is from http://www.mapping.com/airportcodes.html.
@@ -7601,7 +7601,7 @@ THV:York Airport, PA, USA
 THX:Turukhansk, Krasnoyarsk Krai, Russia
 THY:Thohoyandou, Venda, South Africa
 THZ:Tahoua, Niger
-TIA:Tirana, Albania
+TIA:Tirana International Airport, Albania
 TIB:Tibu, Colombia
 TIC:Tinak Airport, Marshall Islands
 TID:Tiaret (Bou Chekif), Algeria



CVS commit: src/sys/netipsec

2017-05-10 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu May 11 05:55:14 UTC 2017

Modified Files:
src/sys/netipsec: ipsec.c ipsec.h ipsec_input.c ipsec_output.c
xform_ah.c xform_esp.c xform_ipcomp.c xform_ipip.c

Log Message:
Make ipsec_address() and ipsec_logsastr() mpsafe.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.46 -r1.47 src/sys/netipsec/ipsec.h \
src/sys/netipsec/ipsec_output.c
cvs rdiff -u -r1.41 -r1.42 src/sys/netipsec/ipsec_input.c
cvs rdiff -u -r1.53 -r1.54 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.54 -r1.55 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.37 -r1.38 src/sys/netipsec/xform_ipcomp.c
cvs rdiff -u -r1.48 -r1.49 src/sys/netipsec/xform_ipip.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/netipsec/ipsec.c
diff -u src/sys/netipsec/ipsec.c:1.87 src/sys/netipsec/ipsec.c:1.88
--- src/sys/netipsec/ipsec.c:1.87	Wed May 10 09:34:52 2017
+++ src/sys/netipsec/ipsec.c	Thu May 11 05:55:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.87 2017/05/10 09:34:52 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.88 2017/05/11 05:55:14 ryo Exp $	*/
 /*	$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $	*/
 /*	$KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.87 2017/05/10 09:34:52 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.88 2017/05/11 05:55:14 ryo Exp $");
 
 /*
  * IPsec controller part.
@@ -2101,6 +2101,7 @@ ipsec_updatereplay(u_int32_t seq, const 
 	int fr;
 	u_int32_t wsizeb;	/* constant: bits of window size */
 	int frlast;		/* constant: last frame */
+	char buf[INET6_ADDRSTRLEN];
 
 	IPSEC_SPLASSERT_SOFTNET(__func__);
 
@@ -2177,7 +2178,7 @@ ok:
 			return 1;
 
 		ipseclog((LOG_WARNING, "replay counter made %d cycle. %s\n",
-		replay->overflow, ipsec_logsastr(sav)));
+		replay->overflow, ipsec_logsastr(sav, buf, sizeof(buf;
 	}
 
 	replay->count++;
@@ -2210,37 +2211,21 @@ vshiftl(unsigned char *bitmap, int nbit,
 	return;
 }
 
-/* Return a printable string for the IPv4 address. */
-static char *
-inet_ntoa4(struct in_addr ina)
-{
-	static char buf[4][4 * sizeof "123" + 4];
-	unsigned char *ucp = (unsigned char *) &ina;
-	static int i = 3;
-
-	i = (i + 1) % 4;
-	snprintf(buf[i], sizeof(buf[i]), "%d.%d.%d.%d",
-		ucp[0] & 0xff, ucp[1] & 0xff, ucp[2] & 0xff, ucp[3] & 0xff);
-	return (buf[i]);
-}
-
 /* Return a printable string for the address. */
 const char *
-ipsec_address(const union sockaddr_union *sa)
+ipsec_address(const union sockaddr_union *sa, char *buf, size_t size)
 {
-#if INET6
-	static char ip6buf[INET6_ADDRSTRLEN];	/* XXX: NOMPSAFE */
-#endif
-
 	switch (sa->sa.sa_family) {
 #if INET
 	case AF_INET:
-		return inet_ntoa4(sa->sin.sin_addr);
+		in_print(buf, size, &sa->sin.sin_addr);
+		return buf;
 #endif /* INET */
 
 #if INET6
 	case AF_INET6:
-		return IN6_PRINT(ip6buf, &sa->sin6.sin6_addr);
+		in6_print(buf, size, &sa->sin6.sin6_addr);
+		return buf;
 #endif /* INET6 */
 
 	default:
@@ -2249,27 +2234,19 @@ ipsec_address(const union sockaddr_union
 }
 
 const char *
-ipsec_logsastr(const struct secasvar *sav)
+ipsec_logsastr(const struct secasvar *sav, char *buf, size_t size)
 {
-	static char buf[256];
-	char *p;
 	const struct secasindex *saidx = &sav->sah->saidx;
+	char sbuf[IPSEC_ADDRSTRLEN], dbuf[IPSEC_ADDRSTRLEN];
 
 	KASSERTMSG(saidx->src.sa.sa_family == saidx->dst.sa.sa_family,
 	"af family mismatch, src %u, dst %u",
 	saidx->src.sa.sa_family, saidx->dst.sa.sa_family);
 
-	p = buf;
-	snprintf(buf, sizeof(buf), "SA(SPI=%u ", (u_int32_t)ntohl(sav->spi));
-	while (p && *p)
-		p++;
-	/* NB: only use ipsec_address on one address at a time */
-	snprintf(p, sizeof (buf) - (p - buf), "src=%s ",
-		ipsec_address(&saidx->src));
-	while (p && *p)
-		p++;
-	snprintf(p, sizeof (buf) - (p - buf), "dst=%s)",
-		ipsec_address(&saidx->dst));
+	snprintf(buf, size, "SA(SPI=%u src=%s dst=%s)",
+	(u_int32_t)ntohl(sav->spi),
+	ipsec_address(&saidx->src, sbuf, sizeof(sbuf)),
+	ipsec_address(&saidx->dst, dbuf, sizeof(dbuf)));
 
 	return buf;
 }

Index: src/sys/netipsec/ipsec.h
diff -u src/sys/netipsec/ipsec.h:1.46 src/sys/netipsec/ipsec.h:1.47
--- src/sys/netipsec/ipsec.h:1.46	Wed May 10 09:34:52 2017
+++ src/sys/netipsec/ipsec.h	Thu May 11 05:55:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.h,v 1.46 2017/05/10 09:34:52 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec.h,v 1.47 2017/05/11 05:55:14 ryo Exp $	*/
 /*	$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.h,v 1.2.4.2 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: ipsec.h,v 1.53 2001/11/20 08:32:38 itojun Exp $	*/
 
@@ -149,6 +149,11 @@ struct secspacq {
 };
 #endif /* _KERNEL */
 
+/* buffer size for formatted output of ipsec address (addr + '%' + scope_id?) */
+#define	IPSEC_ADDRSTRL

CVS commit: src

2017-05-10 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu May 11 04:33:14 UTC 2017

Modified Files:
src/lib/librumpclient: Makefile
src/lib/librumphijack: Makefile
src/lib/librumpuser: Makefile
src/usr.bin/rump_allserver: Makefile
src/usr.bin/rump_server: Makefile

Log Message:
With the removal of HAVE_REGISTER_T from rumpuser_port.h, _KERNTYPES does not
need to be defined. This allows register_t to be typedef'd to RUMP_REGISTER_T
without conflict, as highlighted in PR kern/52206.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/librumpclient/Makefile
cvs rdiff -u -r1.19 -r1.20 src/lib/librumphijack/Makefile
cvs rdiff -u -r1.26 -r1.27 src/lib/librumpuser/Makefile
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/rump_allserver/Makefile
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/rump_server/Makefile

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

Modified files:

Index: src/lib/librumpclient/Makefile
diff -u src/lib/librumpclient/Makefile:1.13 src/lib/librumpclient/Makefile:1.14
--- src/lib/librumpclient/Makefile:1.13	Wed May 10 08:48:46 2017
+++ src/lib/librumpclient/Makefile	Thu May 11 04:33:14 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2017/05/10 08:48:46 sevan Exp $
+#	$NetBSD: Makefile,v 1.14 2017/05/11 04:33:14 sevan Exp $
 #
 
 .PATH:	${.CURDIR}/../../sys/rump/librump/rumpkern
@@ -17,7 +17,7 @@ LIBDO.${lib}=	_external
 LIBDPLIBS+=	${lib} lib
 .endfor
 
-CPPFLAGS+=	-DRUMP_CLIENT -D_KERNTYPES
+CPPFLAGS+=	-DRUMP_CLIENT
 CPPFLAGS+=	-I${.OBJDIR} -I${.CURDIR}
 CPPFLAGS+=	-I${.CURDIR}/../librumpuser
 SRCS=		rumpclient.c

Index: src/lib/librumphijack/Makefile
diff -u src/lib/librumphijack/Makefile:1.19 src/lib/librumphijack/Makefile:1.20
--- src/lib/librumphijack/Makefile:1.19	Wed May 10 08:48:46 2017
+++ src/lib/librumphijack/Makefile	Thu May 11 04:33:14 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.19 2017/05/10 08:48:46 sevan Exp $
+#	$NetBSD: Makefile,v 1.20 2017/05/11 04:33:14 sevan Exp $
 #
 
 LIB=		rumphijack
@@ -10,7 +10,7 @@ MAN=		rumphijack.3
 
 SRCS=		hijack.c hijackdlsym.c
 
-CPPFLAGS+=	-D_DIAGNOSTIC -D_REENTRANT -D_KERNTYPES
+CPPFLAGS+=	-D_DIAGNOSTIC -D_REENTRANT
 
 WARNS?=		5
 

Index: src/lib/librumpuser/Makefile
diff -u src/lib/librumpuser/Makefile:1.26 src/lib/librumpuser/Makefile:1.27
--- src/lib/librumpuser/Makefile:1.26	Wed May 10 08:48:46 2017
+++ src/lib/librumpuser/Makefile	Thu May 11 04:33:14 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.26 2017/05/10 08:48:46 sevan Exp $
+#	$NetBSD: Makefile,v 1.27 2017/05/11 04:33:14 sevan Exp $
 #
 
 .include 
@@ -19,7 +19,7 @@ LIBDPLIBS+=	pthread ${.CURDIR}/../libpth
 LIBDO.${lib}=	_external
 LIBDPLIBS+=	${lib} lib
 .endfor
-CPPFLAGS+=	-DLIBRUMPUSER -D_KERNTYPES
+CPPFLAGS+=	-DLIBRUMPUSER
 #CPPFLAGS+=	-D_DIAGNOSTIC
 
 

Index: src/usr.bin/rump_allserver/Makefile
diff -u src/usr.bin/rump_allserver/Makefile:1.10 src/usr.bin/rump_allserver/Makefile:1.11
--- src/usr.bin/rump_allserver/Makefile:1.10	Wed May 10 08:48:46 2017
+++ src/usr.bin/rump_allserver/Makefile	Thu May 11 04:33:14 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2017/05/10 08:48:46 sevan Exp $
+#	$NetBSD: Makefile,v 1.11 2017/05/11 04:33:14 sevan Exp $
 #
 
 PROG=	rump_allserver
@@ -13,6 +13,5 @@ RUMPTOP=${.CURDIR}/../../sys/rump
 
 LDADD+=	${RUMPDEVLDADD} ${RUMPFSLDADD} ${RUMPKERNLDADD} ${RUMPNETLDADD}
 LDADD+= -lrumpdev -lrumpvfs -lrumpnet -lrump -lrumpuser -lpthread
-CPPFLAGS+= 	-D_KERNTYPES
 
 .include 

Index: src/usr.bin/rump_server/Makefile
diff -u src/usr.bin/rump_server/Makefile:1.11 src/usr.bin/rump_server/Makefile:1.12
--- src/usr.bin/rump_server/Makefile:1.11	Wed May 10 08:48:46 2017
+++ src/usr.bin/rump_server/Makefile	Thu May 11 04:33:14 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.11 2017/05/10 08:48:46 sevan Exp $
+#	$NetBSD: Makefile,v 1.12 2017/05/11 04:33:14 sevan Exp $
 #
 
 .PATH: ${.CURDIR}/../rump_allserver
@@ -7,7 +7,6 @@ PROG=		rump_server
 SRCS=		rump_allserver.c
 NOMAN=		installed by ../rump_allserver
 
-CPPFLAGS+= 	-D_KERNTYPES
 LDADD+=		-Wl,--whole-archive -lrumpkern_sysproxy -lrump \
 		-lrumpuser -Wl,--no-whole-archive -lpthread
 



CVS commit: src/lib/librumpuser

2017-05-10 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu May 11 04:27:27 UTC 2017

Modified Files:
src/lib/librumpuser: rumpuser_port.h

Log Message:
Update NetBSD values obtained from running configure as instructed in comment.
This paves the way to resolve rump build process using buildrump.sh, where the 
definition of
HAVE_REGISTER_T caused conflicting definitions of register_t.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/lib/librumpuser/rumpuser_port.h

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

Modified files:

Index: src/lib/librumpuser/rumpuser_port.h
diff -u src/lib/librumpuser/rumpuser_port.h:1.48 src/lib/librumpuser/rumpuser_port.h:1.49
--- src/lib/librumpuser/rumpuser_port.h:1.48	Thu Jan 12 18:23:04 2017
+++ src/lib/librumpuser/rumpuser_port.h	Thu May 11 04:27:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser_port.h,v 1.48 2017/01/12 18:23:04 christos Exp $	*/
+/*	$NetBSD: rumpuser_port.h,v 1.49 2017/05/11 04:27:27 sevan Exp $	*/
 
 #ifndef _LIB_LIBRUMPUSER_RUMPUSER_PORT_H_
 #define _LIB_LIBRUMPUSER_RUMPUSER_PORT_H_
@@ -29,7 +29,6 @@
 #define HAVE_PATHS_H 1
 #define HAVE_POSIX_MEMALIGN 1
 #define HAVE_PTHREAD_SETNAME3 1
-#define HAVE_REGISTER_T 1
 #define HAVE_SETPROGNAME 1
 #define HAVE_STDINT_H 1
 #define HAVE_STDLIB_H 1
@@ -47,8 +46,8 @@
 #define HAVE_SYS_SYSCTL_H 1
 #define HAVE_SYS_TYPES_H 1
 #define HAVE_UNISTD_H 1
-#define HAVE___QUOTACTL 1
 #define HAVE_UTIMENSAT 1
+#define HAVE___QUOTACTL 1
 #define PACKAGE_BUGREPORT "http://rumpkernel.org/";
 #define PACKAGE_NAME "rumpuser-posix"
 #define PACKAGE_STRING "rumpuser-posix 999"



CVS commit: [prg-localcount2] src

2017-05-10 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu May 11 02:58:44 UTC 2017

Modified Files:
src/bin/ksh [prg-localcount2]: misc.c
src/bin/sh [prg-localcount2]: eval.c input.c input.h jobs.c mktokens
nodetypes parser.c sh.1 show.c trap.c var.c
src/distrib/sets/lists/base [prg-localcount2]: shl.mi
src/distrib/sets/lists/comp [prg-localcount2]: mi
src/distrib/sets/lists/debug [prg-localcount2]: md.amd64 shl.mi
src/distrib/sets/lists/tests [prg-localcount2]: mi
src/distrib/utils/x_ifconfig [prg-localcount2]: Makefile
src/doc [prg-localcount2]: 3RDPARTY CHANGES
src/external/bsd/dhcpcd/dist [prg-localcount2]: Makefile configure
src/external/bsd/dhcpcd/dist/src [prg-localcount2]: Makefile defs.h
dhcp6.c dhcpcd-definitions-small.conf dhcpcd.8.in dhcpcd.c
dhcpcd.conf.5.in dhcpcd.h if-bsd.c if-linux.c if-options.c
if-options.h if-sun.c if.c if.h ipv4.c ipv6.c ipv6.h route.c
src/external/bsd/openpam/dist [prg-localcount2]: CREDITS HISTORY
LICENSE Makefile.am Makefile.in README RELNOTES TODO aclocal.m4
autogen.sh compile config.h.in configure configure.ac depcomp
install-sh ltmain.sh missing mkpkgng.in test-driver
src/external/bsd/openpam/dist/bin [prg-localcount2]: Makefile.am
Makefile.in
src/external/bsd/openpam/dist/bin/openpam_dump_policy [prg-localcount2]:
Makefile.am Makefile.in openpam_dump_policy.c
src/external/bsd/openpam/dist/bin/pamtest [prg-localcount2]:
Makefile.am Makefile.in pamtest.1 pamtest.c
src/external/bsd/openpam/dist/bin/su [prg-localcount2]: Makefile.am
Makefile.in su.1 su.c
src/external/bsd/openpam/dist/doc [prg-localcount2]: Makefile.am
Makefile.in
src/external/bsd/openpam/dist/doc/man [prg-localcount2]: Makefile.am
Makefile.in openpam.3 openpam.man openpam_borrow_cred.3
openpam_free_data.3 openpam_free_envlist.3 openpam_get_feature.3
openpam_get_option.3 openpam_log.3 openpam_nullconv.3
openpam_readline.3 openpam_readlinev.3 openpam_readword.3
openpam_restore_cred.3 openpam_set_feature.3 openpam_set_option.3
openpam_straddch.3 openpam_subst.3 openpam_ttyconv.3 pam.3
pam.conf.5 pam.man pam_acct_mgmt.3 pam_authenticate.3
pam_chauthtok.3 pam_close_session.3 pam_conv.3 pam_end.3
pam_error.3 pam_get_authtok.3 pam_get_data.3 pam_get_item.3
pam_get_user.3 pam_getenv.3 pam_getenvlist.3 pam_info.3
pam_open_session.3 pam_prompt.3 pam_putenv.3 pam_set_data.3
pam_set_item.3 pam_setcred.3 pam_setenv.3 pam_sm_acct_mgmt.3
pam_sm_authenticate.3 pam_sm_chauthtok.3 pam_sm_close_session.3
pam_sm_open_session.3 pam_sm_setcred.3 pam_start.3 pam_strerror.3
pam_verror.3 pam_vinfo.3 pam_vprompt.3
src/external/bsd/openpam/dist/include [prg-localcount2]: Makefile.am
Makefile.in
src/external/bsd/openpam/dist/include/security [prg-localcount2]:
Makefile.am Makefile.in openpam.h openpam_attr.h openpam_version.h
pam_appl.h pam_constants.h pam_modules.h pam_types.h
src/external/bsd/openpam/dist/lib [prg-localcount2]: Makefile.am
Makefile.in
src/external/bsd/openpam/dist/lib/libpam [prg-localcount2]: Makefile.am
Makefile.in openpam_asprintf.c openpam_asprintf.h
openpam_borrow_cred.c openpam_check_owner_perms.c
openpam_configure.c openpam_constants.c openpam_constants.h
openpam_cred.h openpam_ctype.h openpam_debug.h openpam_dispatch.c
openpam_dlfunc.h openpam_dynamic.c openpam_features.c
openpam_features.h openpam_findenv.c openpam_free_data.c
openpam_free_envlist.c openpam_get_feature.c openpam_get_option.c
openpam_impl.h openpam_load.c openpam_log.c openpam_nullconv.c
openpam_readline.c openpam_readlinev.c openpam_readword.c
openpam_restore_cred.c openpam_set_feature.c openpam_set_option.c
openpam_static.c openpam_straddch.c openpam_strlcat.c
openpam_strlcat.h openpam_strlcmp.h openpam_strlcpy.c
openpam_strlcpy.h openpam_strlset.c openpam_strlset.h
openpam_subst.c openpam_ttyconv.c openpam_vasprintf.c
openpam_vasprintf.h pam_acct_mgmt.c pam_authenticate.c
pam_authenticate_secondary.c pam_chauthtok.c pam_close_session.c
pam_end.c pam_error.c pam_get_authtok.c pam_get_data.c
pam_get_item.c pam_get_mapped_authtok.c pam_get_mapped_username.c
pam_get_user.c pam_getenv.c pam_getenvlist.c pam_info.c
pam_open_session.c pam_prompt.c pam_putenv.c pam_set_data.c
pam_set_item.c pam_set_mapped_authtok.c pam_set_mapped_username.c
pam

CVS commit: src/usr.bin/make

2017-05-10 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Wed May 10 22:26:14 UTC 2017

Modified Files:
src/usr.bin/make: main.c

Log Message:
Main_SetObjdir: ensure buf2 is in scope


To generate a diff of this commit:
cvs rdiff -u -r1.264 -r1.265 src/usr.bin/make/main.c

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.264 src/usr.bin/make/main.c:1.265
--- src/usr.bin/make/main.c:1.264	Thu Apr 20 03:57:27 2017
+++ src/usr.bin/make/main.c	Wed May 10 22:26:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.264 2017/04/20 03:57:27 sjg Exp $	*/
+/*	$NetBSD: main.c,v 1.265 2017/05/10 22:26:14 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.264 2017/04/20 03:57:27 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.265 2017/05/10 22:26:14 sjg Exp $";
 #else
 #include 
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.264 2017/04/20 03:57:27 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.265 2017/05/10 22:26:14 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -720,6 +720,7 @@ Main_SetObjdir(const char *fmt, ...)
 	struct stat sb;
 	char *path;
 	char buf[MAXPATHLEN + 1];
+	char buf2[MAXPATHLEN + 1];
 	Boolean rc = FALSE;
 	va_list ap;
 
@@ -728,8 +729,6 @@ Main_SetObjdir(const char *fmt, ...)
 	va_end(ap);
 
 	if (path[0] != '/') {
-		char buf2[MAXPATHLEN + 1];
-		
 		snprintf(buf2, MAXPATHLEN, "%s/%s", curdir, path);
 		path = buf2;
 	}



CVS commit: src/sys/arch/mips/mips

2017-05-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed May 10 22:23:13 UTC 2017

Modified Files:
src/sys/arch/mips/mips: vm_machdep.c

Log Message:
Add a KASSERT


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/arch/mips/mips/vm_machdep.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/mips/mips/vm_machdep.c
diff -u src/sys/arch/mips/mips/vm_machdep.c:1.156 src/sys/arch/mips/mips/vm_machdep.c:1.157
--- src/sys/arch/mips/mips/vm_machdep.c:1.156	Wed May 10 22:19:31 2017
+++ src/sys/arch/mips/mips/vm_machdep.c	Wed May 10 22:23:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.156 2017/05/10 22:19:31 skrll Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.157 2017/05/10 22:23:13 skrll Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.156 2017/05/10 22:19:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.157 2017/05/10 22:23:13 skrll Exp $");
 
 #include "opt_ddb.h"
 #include "opt_coredump.h"
@@ -129,6 +129,7 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 
 		for (u_int i = 0; i < UPAGES; i++) {
 			KASSERT(pte_valid_p(pte[i]));
+			KASSERT(pte_global_p(pte[i]));
 			l2->l_md.md_upte[i] = pte[i] & ~x;
 		}
 	}



CVS commit: src/sys/arch/mips/mips

2017-05-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed May 10 22:19:31 UTC 2017

Modified Files:
src/sys/arch/mips/mips: vm_machdep.c

Log Message:
Make cpu_uarea_{alloc,free} conditional on PMAP_{,UN}MAP_POOLPAGE and
use PMAP_{,UN}_POOLPAGE to ensure cache aliases are handled correctly
and for all the pages used.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/arch/mips/mips/vm_machdep.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/mips/mips/vm_machdep.c
diff -u src/sys/arch/mips/mips/vm_machdep.c:1.155 src/sys/arch/mips/mips/vm_machdep.c:1.156
--- src/sys/arch/mips/mips/vm_machdep.c:1.155	Wed May 10 12:12:21 2017
+++ src/sys/arch/mips/mips/vm_machdep.c	Wed May 10 22:19:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.155 2017/05/10 12:12:21 skrll Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.156 2017/05/10 22:19:31 skrll Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.155 2017/05/10 12:12:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.156 2017/05/10 22:19:31 skrll Exp $");
 
 #include "opt_ddb.h"
 #include "opt_coredump.h"
@@ -172,6 +172,8 @@ cpu_proc_fork(struct proc *p1, struct pr
 void *
 cpu_uarea_alloc(bool system)
 {
+#ifdef PMAP_MAP_POOLPAGE
+
 	struct pglist pglist;
 #ifdef _LP64
 	const paddr_t high = pmap_limits.avail_end;
@@ -212,15 +214,25 @@ cpu_uarea_alloc(bool system)
 	 pa, pmap_limits.avail_end);
 
 	/*
-	 * we need to return a direct-mapped VA for the pa.
+	 * we need to return a direct-mapped VA for the pa of the first (maybe
+	 * only) page and call PMAP_MAP_POOLPAGE on all pages in the list, so
+	 * that cache aliases are handled correctly.
 	 */
-#ifdef _LP64
-	const vaddr_t va = MIPS_PHYS_TO_XKPHYS_CACHED(pa);
-#else
-	const vaddr_t va = MIPS_PHYS_TO_KSEG0(pa);
-#endif
+
+	/* Initialise to unexpected result */
+	vaddr_t va = MIPS_KSEG2_START;
+	const struct vm_page *pglv;
+	TAILQ_FOREACH_REVERSE(pglv, &pglist, pglist, pageq.queue) {
+		const paddr_t palv = VM_PAGE_TO_PHYS(pglv);
+		va = PMAP_MAP_POOLPAGE(palv);
+	}
+
+	KASSERT(va != MIPS_KSEG2_START);
 
 	return (void *)va;
+#else
+	return NULL;
+#endif
 }
 
 /*
@@ -229,27 +241,28 @@ cpu_uarea_alloc(bool system)
 bool
 cpu_uarea_free(void *va)
 {
+#ifdef PMAP_UNMAP_POOLPAGE
 #ifdef _LP64
 	if (!MIPS_XKPHYS_P(va))
 		return false;
-	paddr_t pa = MIPS_XKPHYS_TO_PHYS(va);
 #else
 	if (!MIPS_KSEG0_P(va))
 		return false;
-	paddr_t pa = MIPS_KSEG0_TO_PHYS(va);
-#endif
-
-#ifdef MIPS3_PLUS
-	if (MIPS_CACHE_VIRTUAL_ALIAS)
-		mips_dcache_inv_range((intptr_t)va, USPACE);
 #endif
 
-	for (const paddr_t epa = pa + USPACE; pa < epa; pa += PAGE_SIZE) {
-		struct vm_page * const pg = PHYS_TO_VM_PAGE(pa);
+	vaddr_t valv = (vaddr_t)va;
+	for (size_t i = 0; i < UPAGES; i++, valv += NBPG) {
+		const paddr_t pa = PMAP_UNMAP_POOLPAGE(valv);
+		struct vm_page * const pg = PHYS_TO_VM_PAGE(pa);
 		KASSERT(pg != NULL);
 		uvm_pagefree(pg);
 	}
+
 	return true;
+#else
+	return false;
+#endif
+
 }
 
 void



CVS commit: src/sbin/mount_portal

2017-05-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 10 16:35:18 UTC 2017

Modified Files:
src/sbin/mount_portal: puffs_portal.c

Log Message:
We need to provide a size for getattr for the cp example to work, so cheat
and use fstat() to do it instead of libpuffs.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sbin/mount_portal/puffs_portal.c

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

Modified files:

Index: src/sbin/mount_portal/puffs_portal.c
diff -u src/sbin/mount_portal/puffs_portal.c:1.8 src/sbin/mount_portal/puffs_portal.c:1.9
--- src/sbin/mount_portal/puffs_portal.c:1.8	Tue May  9 17:17:54 2017
+++ src/sbin/mount_portal/puffs_portal.c	Wed May 10 12:35:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_portal.c,v 1.8 2017/05/09 21:17:54 christos Exp $	*/
+/*	$NetBSD: puffs_portal.c,v 1.9 2017/05/10 16:35:18 christos Exp $	*/
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: puffs_portal.c,v 1.8 2017/05/09 21:17:54 christos Exp $");
+__RCSID("$NetBSD: puffs_portal.c,v 1.9 2017/05/10 16:35:18 christos Exp $");
 #endif /* !lint */
 
 #include 
@@ -550,21 +550,48 @@ portal_node_getattr(struct puffs_usermou
 		va->va_type = VDIR;
 		va->va_mode = 0777;
 		va->va_nlink = 2;
+		va->va_uid = va->va_gid = 0;
+		va->va_fileid = fakeid++;
+		va->va_size = va->va_bytes = 0;
+		va->va_gen = 0;
+		va->va_rdev = PUFFS_VNOVAL;
+		va->va_blocksize = DEV_BSIZE;
+
+		gettimeofday(&tv, NULL);
+		TIMEVAL_TO_TIMESPEC(&tv, &ts);
+		va->va_atime = va->va_ctime = va->va_mtime =
+		va->va_birthtime = ts;
 	} else {
-		va->va_type = VREG;
-		va->va_mode = 0666;
-		va->va_nlink = 1;
-	}
-	va->va_uid = va->va_gid = 0;
-	va->va_fileid = fakeid++;
-	va->va_size = va->va_bytes = 0;
-	va->va_gen = 0;
-	va->va_rdev = PUFFS_VNOVAL;
-	va->va_blocksize = DEV_BSIZE;
-
-	gettimeofday(&tv, NULL);
-	TIMEVAL_TO_TIMESPEC(&tv, &ts);
-	va->va_atime = va->va_ctime = va->va_mtime = va->va_birthtime = ts;
+		/* cheat for now */
+		int error;
+		struct stat st;
+		struct portal_node *portn = opc;
+		struct portal_cred portc;
+		char **v = conf_match(&q, portn->path);
+		if (v == NULL)
+			return ENOENT;
+		credtr(&portc, pcr, 0777);
+		error = provide(pu, portn, &portc, v);
+		if (error)
+			return error;
+		if (fstat(portn->fd, &st) == -1)
+			return errno;
+		va->va_type = S_ISDIR(st.st_mode) ? VDIR : VREG; /* XXX */
+		va->va_mode = st.st_mode;
+		va->va_nlink = st.st_nlink;
+		va->va_uid = st.st_uid;
+		va->va_gid = st.st_gid;
+		va->va_fileid = st.st_ino;
+		va->va_size = va->va_bytes = st.st_size;
+		va->va_gen = 0;
+		va->va_rdev = st.st_rdev;
+		va->va_blocksize = st.st_blksize;
+		va->va_atime = st.st_atim;
+		va->va_ctime = st.st_ctim;
+		va->va_mtime = st.st_mtim;
+		va->va_birthtime = st.st_birthtim;
+		portal_node_reclaim(pu, opc);
+	}
 
 	return 0;
 }



CVS commit: src/sbin/mount_portal

2017-05-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 10 13:58:26 UTC 2017

Modified Files:
src/sbin/mount_portal: pt_file.c

Log Message:
set only the effective user id to the user id of the requesting user so that
we can go back to the original uid later.


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

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

Modified files:

Index: src/sbin/mount_portal/pt_file.c
diff -u src/sbin/mount_portal/pt_file.c:1.18 src/sbin/mount_portal/pt_file.c:1.19
--- src/sbin/mount_portal/pt_file.c:1.18	Fri Oct 18 21:09:59 2013
+++ src/sbin/mount_portal/pt_file.c	Wed May 10 09:58:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pt_file.c,v 1.18 2013/10/19 01:09:59 christos Exp $	*/
+/*	$NetBSD: pt_file.c,v 1.19 2017/05/10 13:58:25 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: pt_file.c,v 1.18 2013/10/19 01:09:59 christos Exp $");
+__RCSID("$NetBSD: pt_file.c,v 1.19 2017/05/10 13:58:25 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -84,10 +84,10 @@ lose_credentials(struct portal_cred *pcr
 pcr->pcr_gid);
 		}
 		/*
-		 * ... and now do the setuid() where we lose all special
-		 * powers (both real and effective userid).
+		 * ... and now do the seteuid() where we temporarily give
+		 * away our root privileges. 
 		 */
-		if (setuid(pcr->pcr_uid) < 0) {
+		if (seteuid(pcr->pcr_uid) < 0) {
 			syslog(LOG_WARNING,
 "lose_credentials: setuid(%d) failed (%m)",
 pcr->pcr_uid);



CVS commit: src/sys/arch/mips/mips

2017-05-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed May 10 12:12:21 UTC 2017

Modified Files:
src/sys/arch/mips/mips: vm_machdep.c

Log Message:
Allow cpu_uarea_alloc to return NULL for non-system LWPs in the non-_LP64
case.  That way TLB mapped KVA can be found by uarea_poolpage_alloc.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/arch/mips/mips/vm_machdep.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/mips/mips/vm_machdep.c
diff -u src/sys/arch/mips/mips/vm_machdep.c:1.154 src/sys/arch/mips/mips/vm_machdep.c:1.155
--- src/sys/arch/mips/mips/vm_machdep.c:1.154	Wed May 10 11:27:14 2017
+++ src/sys/arch/mips/mips/vm_machdep.c	Wed May 10 12:12:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.154 2017/05/10 11:27:14 skrll Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.155 2017/05/10 12:12:21 skrll Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.154 2017/05/10 11:27:14 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.155 2017/05/10 12:12:21 skrll Exp $");
 
 #include "opt_ddb.h"
 #include "opt_coredump.h"
@@ -193,10 +193,8 @@ cpu_uarea_alloc(bool system)
 	error = uvm_pglistalloc(USPACE, pmap_limits.avail_start, high,
 	USPACE_ALIGN, 0, &pglist, 1, 1);
 	if (error) {
-#ifdef _LP64
 		if (!system)
 			return NULL;
-#endif
 		panic("%s: uvm_pglistalloc failed: %d", __func__, error);
 	}
 



CVS commit: src/usr.sbin/makemandb

2017-05-10 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Wed May 10 12:09:52 UTC 2017

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

Log Message:
Get rid of unnecessary variable.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/makemandb/makemandb.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/makemandb/makemandb.c
diff -u src/usr.sbin/makemandb/makemandb.c:1.54 src/usr.sbin/makemandb/makemandb.c:1.55
--- src/usr.sbin/makemandb/makemandb.c:1.54	Tue May  2 13:54:08 2017
+++ src/usr.sbin/makemandb/makemandb.c	Wed May 10 12:09:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: makemandb.c,v 1.54 2017/05/02 13:54:08 abhinav Exp $	*/
+/*	$NetBSD: makemandb.c,v 1.55 2017/05/10 12:09:52 abhinav Exp $	*/
 /*
  * Copyright (c) 2011 Abhinav Upadhyay 
  * Copyright (c) 2011 Kristaps Dzonsons 
@@ -17,7 +17,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: makemandb.c,v 1.54 2017/05/02 13:54:08 abhinav Exp $");
+__RCSID("$NetBSD: makemandb.c,v 1.55 2017/05/10 12:09:52 abhinav Exp $");
 
 #include 
 #include 
@@ -944,8 +944,7 @@ set_section(const struct roff_man *rm, m
 {
 	if (!rm)
 		return;
-	const struct roff_meta *rm_meta = &rm->meta;
-	const char *s = rm_meta->msec == NULL ? "?" : rm_meta->msec;
+	const char *s = rm->meta.msec == NULL ? "?" : rm->meta.msec;
 	easprintf(&rec->section, "%s", s);
 	if (rec->section[0] == '?' && mflags.verbosity == 2)
 		warnx("%s: Missing section number", rec->file_path);
@@ -960,9 +959,8 @@ set_machine(const struct roff_man *rm, m
 {
 	if (rm == NULL)
 		return;
-	const struct roff_meta *rm_meta = &rm->meta;
-	if (rm_meta->arch)
-		rec->machine = estrdup(rm_meta->arch);
+	if (rm->meta.arch)
+		rec->machine = estrdup(rm->meta.arch);
 }
 
 /*



CVS commit: src/sys/arch/mips/mips

2017-05-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed May 10 11:27:14 UTC 2017

Modified Files:
src/sys/arch/mips/mips: vm_machdep.c

Log Message:
Improve comment wording.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/arch/mips/mips/vm_machdep.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/mips/mips/vm_machdep.c
diff -u src/sys/arch/mips/mips/vm_machdep.c:1.153 src/sys/arch/mips/mips/vm_machdep.c:1.154
--- src/sys/arch/mips/mips/vm_machdep.c:1.153	Tue Aug  9 16:38:24 2016
+++ src/sys/arch/mips/mips/vm_machdep.c	Wed May 10 11:27:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.153 2016/08/09 16:38:24 skrll Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.154 2017/05/10 11:27:14 skrll Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.153 2016/08/09 16:38:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.154 2017/05/10 11:27:14 skrll Exp $");
 
 #include "opt_ddb.h"
 #include "opt_coredump.h"
@@ -178,7 +178,7 @@ cpu_uarea_alloc(bool system)
 #else
 	const paddr_t high = MIPS_KSEG1_START - MIPS_KSEG0_START;
 	/*
-	 * Don't allocate a direct mapped uarea if aren't allocating for a
+	 * Don't allocate a direct mapped uarea if we aren't allocating for a
 	 * system lwp and we have memory that can't be mapped via KSEG0.
 	 */
 	if (!system && high < pmap_limits.avail_end)



CVS commit: src/bin/sh

2017-05-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed May 10 11:06:48 UTC 2017

Modified Files:
src/bin/sh: parser.c

Log Message:
NFC: Whitespace, KNF, and (some) consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/bin/sh/parser.c

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

Modified files:

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.125 src/bin/sh/parser.c:1.126
--- src/bin/sh/parser.c:1.125	Tue May  9 05:14:03 2017
+++ src/bin/sh/parser.c	Wed May 10 11:06:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.125 2017/05/09 05:14:03 kre Exp $	*/
+/*	$NetBSD: parser.c,v 1.126 2017/05/10 11:06:47 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.125 2017/05/09 05:14:03 kre Exp $");
+__RCSID("$NetBSD: parser.c,v 1.126 2017/05/10 11:06:47 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -162,6 +162,7 @@ list(int nlflag, int erflag)
 {
 	union node *n1, *n2, *n3;
 	int tok;
+
 	TRACE(("list(%d,%d): entered\n", nlflag, erflag));
 
 	checkkwd = 2;
@@ -230,6 +231,7 @@ andor(void)
 	int t;
 
 	TRACE(("andor: entered\n"));
+
 	n1 = pipeline();
 	for (;;) {
 		if ((t = readtoken()) == TAND) {
@@ -356,6 +358,7 @@ command(void)
 	case TWHILE:
 	case TUNTIL: {
 		int got;
+
 		n1 = stalloc(sizeof(struct nbinary));
 		n1->type = (lasttoken == TWHILE)? NWHILE : NUNTIL;
 		n1->nbinary.ch1 = list(0, 0);
@@ -375,7 +378,7 @@ TRACE(("expecting DO got %s %s\n", tokna
 		n1 = stalloc(sizeof(struct nfor));
 		n1->type = NFOR;
 		n1->nfor.var = wordtext;
-		if (readtoken() == TWORD && ! quoteflag && equal(wordtext, "in")) {
+		if (readtoken()==TWORD && !quoteflag && equal(wordtext,"in")) {
 			app = ≈
 			while (readtoken() == TWORD) {
 n2 = stalloc(sizeof(struct narg));
@@ -393,6 +396,7 @@ TRACE(("expecting DO got %s %s\n", tokna
 			static char argvars[5] = {
 			CTLVAR, VSNORMAL|VSQUOTE, '@', '=', '\0'
 			};
+
 			n2 = stalloc(sizeof(struct narg));
 			n2->type = NARG;
 			n2->narg.text = argvars;
@@ -563,7 +567,7 @@ TRACE(("expecting DO got %s %s\n", tokna
 		n1->nredir.redirect = redir;
 	}
 
-checkneg:
+ checkneg:
 	if (negate) {
 		TRACE(("%snegate command\n", (negate&1) ? "" : "double "));
 		n2 = stalloc(sizeof(struct nnot));
@@ -638,7 +642,7 @@ simplecmd(union node **rpp, union node *
 	n->ncmd.args = args;
 	n->ncmd.redirect = redir;
 
-checkneg:
+ checkneg:
 	if (negate) {
 		TRACE(("%snegate simplecmd\n", (negate&1) ? "" : "double "));
 		n2 = stalloc(sizeof(struct nnot));
@@ -666,6 +670,7 @@ makename(void)
 void
 fixredir(union node *n, const char *text, int err)
 {
+
 	TRACE(("Fix redir %s %d\n", text, err));
 	if (!err)
 		n->ndup.vname = NULL;
@@ -714,7 +719,7 @@ parsefname(void)
 		 * the parser is, at the minute, is impossible to prevent.
 		 * So, leave it like this until the rest of the parser is fixed.
 		 */
-		if (! noexpand(wordtext))
+		if (!noexpand(wordtext))
 			synerror("Illegal eof marker for << redirection");
 
 		rmescapes(wordtext);
@@ -744,6 +749,7 @@ parsefname(void)
 static int
 checkend(int c, char * const eofmark, const int striptabs)
 {
+
 	if (striptabs) {
 		while (c == '\t')
 			c = pgetc();
@@ -941,7 +947,8 @@ readtoken(void)
 if (**pp == *wordtext && equal(*pp, wordtext)) {
 	lasttoken = t = pp -
 	parsekwd + KWDOFFSET;
-	TRACE(("keyword %s recognized\n", tokname[t]));
+	TRACE(("keyword %s recognized\n",
+	tokname[t]));
 	goto out;
 }
 			}
@@ -952,10 +959,11 @@ readtoken(void)
 goto top;
 			}
 		}
-out:
+ out:
 		checkkwd = (t == TNOT) ? savecheckkwd : 0;
 	}
-	TRACE(("%stoken %s %s\n", alreadyseen ? "reread " : "", tokname[t], t == TWORD ? wordtext : ""));
+	TRACE(("%stoken %s %s\n", alreadyseen ? "reread " : "",
+	tokname[t], t == TWORD ? wordtext : ""));
 	return (t);
 }
 
@@ -1275,20 +1283,20 @@ parsebackq(VSS *const stack, char * cons
 	}
 	handler = &jmploc;
 	INTON;
-if (oldstyle) {
-/* We must read until the closing backquote, giving special
-   treatment to some slashes, and then push the string and
-   reread it as input, interpreting it normally.  */
-int pc;
-int psavelen;
-char *pstr;
+	if (oldstyle) {
+		/* We must read until the closing backquote, giving special
+		   treatment to some slashes, and then push the string and
+		   reread it as input, interpreting it normally.  */
+		int pc;
+		int psavelen;
+		char *pstr;
 
 		/*
 		 * Because the entire `...` is read here, we don't
 		 * need to bother the state stack.  That will be used
 		 * (as appropriate) when the processed string is re-read.
 		 */
-STARTSTACKSTR(out);
+		STARTSTACKSTR(out);
 		for (;;) {
 			if (needprompt) {
 setprompt(2);
@@ -1299,7 +1307,7 @@ parsebackq(VSS *const stack,

CVS commit: src/doc

2017-05-10 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed May 10 11:05:17 UTC 2017

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note import of dhcpcd-7.0.0-rc1


To generate a diff of this commit:
cvs rdiff -u -r1.1441 -r1.1442 src/doc/3RDPARTY
cvs rdiff -u -r1.2280 -r1.2281 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/3RDPARTY
diff -u src/doc/3RDPARTY:1.1441 src/doc/3RDPARTY:1.1442
--- src/doc/3RDPARTY:1.1441	Sat May  6 19:56:41 2017
+++ src/doc/3RDPARTY	Wed May 10 11:05:17 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1441 2017/05/06 19:56:41 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1442 2017/05/10 11:05:17 roy Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -334,8 +334,8 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	7.0.0-beta3
-Current Vers:	7.0.0-beta3
+Version:	7.0.0-rc1
+Current Vers:	7.0.0-rc1
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2280 src/doc/CHANGES:1.2281
--- src/doc/CHANGES:1.2280	Sat May  6 19:56:41 2017
+++ src/doc/CHANGES	Wed May 10 11:05:17 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2280 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2281 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -506,3 +506,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	lua: Updated to Lua 5.3.4. [mbalmer 20170426]
 	acpi(4): Updated ACPICA to 20170303. [christos 20170430]
 	openpam(3): update to 20170430 (resedacea) [christos 20170506]
+	dhcpcd: Import dhcpcd 7.0.0-rc1 [roy 20170510]



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

2017-05-10 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed May 10 11:03:44 UTC 2017

Modified Files:
src/external/bsd/dhcpcd/dist/src: dhcpcd.c if-options.c

Log Message:
Sync


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/dhcpcd/dist/src/dhcpcd.c \
src/external/bsd/dhcpcd/dist/src/if-options.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/dhcpcd/dist/src/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.3 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.4
--- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.3	Fri Apr 14 09:56:32 2017
+++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c	Wed May 10 11:03:44 2017
@@ -477,6 +477,10 @@ configure_interface1(struct interface *i
 		 * between reboots without persitent storage,
 		 * generating the IAID from the MAC address is the only
 		 * logical default.
+		 * Saying that, if a VLANID has been specified then we
+		 * can use that. It's possible that different interfaces
+		 * can have the same VLANID, but this is no worse than
+		 * generating the IAID from the duplicate MAC address.
 		 *
 		 * dhclient uses the last 4 bytes of the MAC address.
 		 * dibbler uses an increamenting counter.
@@ -487,11 +491,18 @@ configure_interface1(struct interface *i
 		 * dhcpcd-6.1.0 and earlier used the interface name,
 		 * falling back to interface index if name > 4.
 		 */
-		if (ifp->hwlen >= sizeof(ifo->iaid))
+		if (ifp->vlanid != 0) {
+			uint32_t vlanid;
+
+			/* Maximal VLANID is 4095, so prefix with 0xff
+			 * so we don't conflict with an interface index. */
+			vlanid = htonl(ifp->vlanid | 0xff00);
+			memcpy(ifo->iaid, &vlanid, sizeof(vlanid));
+		} else if (ifp->hwlen >= sizeof(ifo->iaid)) {
 			memcpy(ifo->iaid,
 			ifp->hwaddr + ifp->hwlen - sizeof(ifo->iaid),
 			sizeof(ifo->iaid));
-		else {
+		} else {
 			uint32_t len;
 
 			len = (uint32_t)strlen(ifp->name);
@@ -503,7 +514,7 @@ configure_interface1(struct interface *i
 			} else {
 /* IAID is the same size as a uint32_t */
 len = htonl(ifp->index);
-memcpy(ifo->iaid, &len, sizeof(len));
+memcpy(ifo->iaid, &len, sizeof(ifo->iaid));
 			}
 		}
 		ifo->options |= DHCPCD_IAID;
@@ -775,7 +786,7 @@ warn_iaid_conflict(struct interface *ifp
 
 	/* This is only a problem if the interfaces are on the same network. */
 	if (ifn)
-		logerr("%s: IAID conflicts with one assigned to %s",
+		logerrx("%s: IAID conflicts with one assigned to %s",
 		ifp->name, ifn->name);
 }
 
@@ -1510,6 +1521,7 @@ main(int argc, char **argv)
 #endif
 		case 'P':
 			ctx.options |= DHCPCD_PRINT_PIDFILE;
+			logopts &= ~(LOGERR_LOG | LOGERR_ERR);
 			break;
 		case 'T':
 			i = 1;
@@ -1603,10 +1615,12 @@ printpidfile:
 		 *  instance for that interface. */
 		if (optind == argc - 1 && !(ctx.options & DHCPCD_MASTER)) {
 			const char *per;
+			const char *ifname;
 
-			if (strlen(argv[optind]) > IF_NAMESIZE) {
-logerrx("%s: interface name too long",
-argv[optind]);
+			ifname = *ctx.ifv;
+			if (ifname == NULL || strlen(ifname) > IF_NAMESIZE) {
+errno = ifname == NULL ? EINVAL : E2BIG;
+logerr("%s: ", ifname);
 goto exit_failure;
 			}
 			/* Allow a dhcpcd interface per address family */
@@ -1621,7 +1635,7 @@ printpidfile:
 per = "";
 			}
 			snprintf(ctx.pidfile, sizeof(ctx.pidfile),
-			PIDFILE, "-", argv[optind], per);
+			PIDFILE, "-", ifname, per);
 		} else {
 			snprintf(ctx.pidfile, sizeof(ctx.pidfile),
 			PIDFILE, "", "", "");
@@ -1643,20 +1657,13 @@ printpidfile:
 		goto exit_failure;
 	}
 
-	/* Open our persistent sockets.
-	 * This is needed early for dumping leases on valid interfaces. */
-#ifdef USE_SIGNALS
-	if (sig == 0) {
-#endif
+	if (ctx.options & DHCPCD_DUMPLEASE) {
+		/* Open sockets so we can dump something about
+		 * valid interfaces. */
 		if (if_opensockets(&ctx) == -1) {
 			logerr("%s: if_opensockets", __func__);
 			goto exit_failure;
 		}
-#ifdef USE_SIGNALS
-	}
-#endif
-
-	if (ctx.options & DHCPCD_DUMPLEASE) {
 		if (optind != argc) {
 			/* We need to try and find the interface so we can load
 			 * the hardware address to compare automated IAID */
@@ -1803,6 +1810,12 @@ printpidfile:
 
 	logdebugx(PACKAGE "-" VERSION " starting");
 	ctx.options |= DHCPCD_STARTED;
+
+	if (if_opensockets(&ctx) == -1) {
+		logerr("%s: if_opensockets", __func__);
+		goto exit_failure;
+	}
+
 #ifdef USE_SIGNALS
 	if (eloop_signal_set_cb(ctx.eloop,
 	dhcpcd_signals, dhcpcd_signals_len,
Index: src/external/bsd/dhcpcd/dist/src/if-options.c
diff -u src/external/bsd/dhcpcd/dist/src/if-options.c:1.3 src/external/bsd/dhcpcd/dist/src/if-options.c:1.4
--- src/external/bsd/dhcpcd/dist/src/if-options.c:1.3	Fri Apr 14 09:56:32 2017
+++ src/external/bsd/dhcpcd/dist/src/if-options.c	Wed May 10 11:03:44 2017
@@ -93,7 +93,7 @@
 #define O_IPV6			O_BASE + 33
 #define O_CONTROLGRP		O_BASE + 34
 #define O_SLAAC			O_BASE + 35

CVS import: src/external/bsd/dhcpcd/dist

2017-05-10 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed May 10 11:00:38 UTC 2017

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv7062

Log Message:
Import dhcpcd-7.0.0-rc1 with the following changes:
  *  Default to use VLANID>0 for IAID instead of MAC address
  *  Stop sharing the DHCPv6 port in master mode with other processes
  *  Fix some prefix delegation issues when the carrier drops or
 addresses become stale
  *  Fix a crash when starting dhcpcd with -n
  *  Fix test for preferring a fake lease over a real one
  *  Show to real address lifetimes being added when adding IPv6
 addresses
  *  Restore the -G, --nogateway option

Status:

Vendor Tag: roy
Release Tags:   dhcpcd-7-0-0-rc1

U src/external/bsd/dhcpcd/dist/.arcconfig
U src/external/bsd/dhcpcd/dist/.gitignore
U src/external/bsd/dhcpcd/dist/BUILDING.md
U src/external/bsd/dhcpcd/dist/LICENSE
U src/external/bsd/dhcpcd/dist/Makefile
U src/external/bsd/dhcpcd/dist/Makefile.inc
U src/external/bsd/dhcpcd/dist/README.md
U src/external/bsd/dhcpcd/dist/config-null.mk
U src/external/bsd/dhcpcd/dist/configure
U src/external/bsd/dhcpcd/dist/iconfig.mk
U src/external/bsd/dhcpcd/dist/compat/_strtoi.h
U src/external/bsd/dhcpcd/dist/compat/arc4random.c
U src/external/bsd/dhcpcd/dist/compat/arc4random.h
U src/external/bsd/dhcpcd/dist/compat/bitops.h
U src/external/bsd/dhcpcd/dist/compat/queue.h
U src/external/bsd/dhcpcd/dist/compat/arc4random_uniform.c
U src/external/bsd/dhcpcd/dist/compat/arc4random_uniform.h
U src/external/bsd/dhcpcd/dist/compat/reallocarray.c
U src/external/bsd/dhcpcd/dist/compat/dprintf.c
U src/external/bsd/dhcpcd/dist/compat/dprintf.h
U src/external/bsd/dhcpcd/dist/compat/endian.h
U src/external/bsd/dhcpcd/dist/compat/pidfile.c
U src/external/bsd/dhcpcd/dist/compat/pidfile.h
U src/external/bsd/dhcpcd/dist/compat/reallocarray.h
U src/external/bsd/dhcpcd/dist/compat/strtoi.c
U src/external/bsd/dhcpcd/dist/compat/strtoi.h
U src/external/bsd/dhcpcd/dist/compat/strtou.c
U src/external/bsd/dhcpcd/dist/compat/crypt/md5.c
U src/external/bsd/dhcpcd/dist/compat/crypt/md5.h
U src/external/bsd/dhcpcd/dist/compat/crypt/sha256.c
U src/external/bsd/dhcpcd/dist/compat/crypt/sha256.h
U src/external/bsd/dhcpcd/dist/src/GNUmakefile
U src/external/bsd/dhcpcd/dist/src/Makefile
U src/external/bsd/dhcpcd/dist/src/arp.c
U src/external/bsd/dhcpcd/dist/src/arp.h
U src/external/bsd/dhcpcd/dist/src/auth.c
U src/external/bsd/dhcpcd/dist/src/auth.h
U src/external/bsd/dhcpcd/dist/src/bpf.c
U src/external/bsd/dhcpcd/dist/src/bpf.h
U src/external/bsd/dhcpcd/dist/src/common.c
U src/external/bsd/dhcpcd/dist/src/common.h
U src/external/bsd/dhcpcd/dist/src/control.c
U src/external/bsd/dhcpcd/dist/src/control.h
U src/external/bsd/dhcpcd/dist/src/dhcp-common.c
U src/external/bsd/dhcpcd/dist/src/defs.h
U src/external/bsd/dhcpcd/dist/src/dev.c
U src/external/bsd/dhcpcd/dist/src/dev.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd-definitions.conf
U src/external/bsd/dhcpcd/dist/src/dhcp-common.h
U src/external/bsd/dhcpcd/dist/src/dhcp.c
U src/external/bsd/dhcpcd/dist/src/dhcp.h
U src/external/bsd/dhcpcd/dist/src/dhcp6.c
U src/external/bsd/dhcpcd/dist/src/dhcp6.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd-definitions-small.conf
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h.in
C src/external/bsd/dhcpcd/dist/src/dhcpcd.c
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf
U src/external/bsd/dhcpcd/dist/src/genembedc
U src/external/bsd/dhcpcd/dist/src/dhcpcd.h
U src/external/bsd/dhcpcd/dist/src/duid.c
U src/external/bsd/dhcpcd/dist/src/duid.h
U src/external/bsd/dhcpcd/dist/src/eloop.c
U src/external/bsd/dhcpcd/dist/src/eloop.h
U src/external/bsd/dhcpcd/dist/src/if-linux-wext.c
U src/external/bsd/dhcpcd/dist/src/genembedh
U src/external/bsd/dhcpcd/dist/src/if-bsd.c
U src/external/bsd/dhcpcd/dist/src/if-linux.c
C src/external/bsd/dhcpcd/dist/src/if-options.c
U src/external/bsd/dhcpcd/dist/src/if-options.h
U src/external/bsd/dhcpcd/dist/src/if-sun.c
U src/external/bsd/dhcpcd/dist/src/if.c
U src/external/bsd/dhcpcd/dist/src/if.h
U src/external/bsd/dhcpcd/dist/src/ipv4.c
U src/external/bsd/dhcpcd/dist/src/ipv4.h
U src/external/bsd/dhcpcd/dist/src/ipv4ll.c
U src/external/bsd/dhcpcd/dist/src/ipv4ll.h
U src/external/bsd/dhcpcd/dist/src/ipv6.c
U src/external/bsd/dhcpcd/dist/src/ipv6.h
U src/external/bsd/dhcpcd/dist/src/ipv6nd.c
U src/external/bsd/dhcpcd/dist/src/ipv6nd.h
U src/external/bsd/dhcpcd/dist/src/logerr.c
U src/external/bsd/dhcpcd/dist/src/logerr.h
U src/external/bsd/dhcpcd/dist/src/route.c
U src/external/bsd/dhcpcd/dist/src/route.h
U src/external/bsd/dhcpcd/dist/src/sa.c
U src/external/bsd/dhcpcd/dist/src/sa.h
U src/external/bsd/dhcpcd/dist/src/script.c
U src/external/bsd/dhcpcd/dist/src/script.h
U src/external/bsd/dhcpcd/dist/src/crypt/hmac_md5.c
U src/exte

CVS commit: src/lib/libc/time

2017-05-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed May 10 10:34:30 UTC 2017

Modified Files:
src/lib/libc/time: localtime.c

Log Message:
Turns out that the previous fix is incorrect, we were not doing ++hit
to change the boolean hit from false to true, but to change it from 1 to 2
which in a sense should have been obvious from the context:
if (hit)
/* more tests */
++hit;
The real problem was that hit was (in the imported tzcode) incorrectly
changed from int to bool in a previous update.

Not that it matters, this code is never actually executed - it was there
to deal with the mythical double leapseconds, which simply never exist
(hit counted the number of leapseconds in an adjustment) and it will all
be gone in the next tzcode update.

For now, just turn hit back into an int, which should satisfy gcc 8,
I hope.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/lib/libc/time/localtime.c

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

Modified files:

Index: src/lib/libc/time/localtime.c
diff -u src/lib/libc/time/localtime.c:1.107 src/lib/libc/time/localtime.c:1.108
--- src/lib/libc/time/localtime.c:1.107	Tue May  9 02:30:49 2017
+++ src/lib/libc/time/localtime.c	Wed May 10 10:34:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.107 2017/05/09 02:30:49 maya Exp $	*/
+/*	$NetBSD: localtime.c,v 1.108 2017/05/10 10:34:30 kre Exp $	*/
 
 /*
 ** This file is in the public domain, so clarified as of
@@ -10,7 +10,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.107 2017/05/09 02:30:49 maya Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.108 2017/05/10 10:34:30 kre Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -1698,7 +1698,7 @@ timesub(const time_t *timep, int_fast32_
 	int			y;
 	const int *		ip;
 	int_fast64_t		corr;
-	bool			hit;
+	int			hit;
 	int			i;
 
 	corr = 0;
@@ -1716,7 +1716,7 @@ timesub(const time_t *timep, int_fast32_
 		sp->lsis[i - 1].ls_trans + 1 &&
 		sp->lsis[i].ls_corr ==
 		sp->lsis[i - 1].ls_corr + 1) {
-			hit = true;
+			++hit;
 			--i;
 	}
 			}



CVS commit: src/sys/opencrypto

2017-05-10 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed May 10 09:45:51 UTC 2017

Modified Files:
src/sys/opencrypto: crypto.c

Log Message:
fix: crypto_drivers[hid].cc_process() could be called even if it was null.

If a crypto driver is unregistered before calling cyrptointr(),
the crypto_drivers[hid].cc_process is null in spite of the hid
is less than crypto_drivers_num.

reffered to FreeBSD code.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/opencrypto/crypto.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/opencrypto/crypto.c
diff -u src/sys/opencrypto/crypto.c:1.62 src/sys/opencrypto/crypto.c:1.63
--- src/sys/opencrypto/crypto.c:1.62	Wed May 10 03:26:33 2017
+++ src/sys/opencrypto/crypto.c	Wed May 10 09:45:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypto.c,v 1.62 2017/05/10 03:26:33 knakahara Exp $ */
+/*	$NetBSD: crypto.c,v 1.63 2017/05/10 09:45:51 knakahara Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $	*/
 /*	$OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $	*/
 
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.62 2017/05/10 03:26:33 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.63 2017/05/10 09:45:51 knakahara Exp $");
 
 #include 
 #include 
@@ -970,12 +970,10 @@ crypto_invoke(struct cryptop *crp, int h
 
 	hid = CRYPTO_SESID2HID(crp->crp_sid);
 
-	if (hid < crypto_drivers_num) {
+	if ((crypto_drivers[hid].cc_flags & CRYPTOCAP_F_CLEANUP) == 0) {
 		int (*process)(void *, struct cryptop *, int);
 		void *arg;
 
-		if (crypto_drivers[hid].cc_flags & CRYPTOCAP_F_CLEANUP)
-			crypto_freesession(crp->crp_sid);
 		process = crypto_drivers[hid].cc_process;
 		arg = crypto_drivers[hid].cc_arg;
 
@@ -992,6 +990,8 @@ crypto_invoke(struct cryptop *crp, int h
 		 * Driver has unregistered; migrate the session and return
 		 * an error to the caller so they'll resubmit the op.
 		 */
+		crypto_freesession(crp->crp_sid);
+
 		for (crd = crp->crp_desc; crd->crd_next; crd = crd->crd_next)
 			crd->CRD_INI.cri_next = &(crd->crd_next->CRD_INI);
 



CVS commit: src/sys

2017-05-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed May 10 09:34:52 UTC 2017

Modified Files:
src/sys/netinet: ip_output.c
src/sys/netipsec: ipsec.c ipsec.h

Log Message:
Stop ipsec4_output returning SP to the caller

SP isn't used by the caller (ip_output) and also holding its
reference looks unnecessary.


To generate a diff of this commit:
cvs rdiff -u -r1.277 -r1.278 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.86 -r1.87 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.45 -r1.46 src/sys/netipsec/ipsec.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/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.277 src/sys/netinet/ip_output.c:1.278
--- src/sys/netinet/ip_output.c:1.277	Sun May  7 16:41:22 2017
+++ src/sys/netinet/ip_output.c	Wed May 10 09:34:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.277 2017/05/07 16:41:22 christos Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.278 2017/05/10 09:34:51 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.277 2017/05/07 16:41:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.278 2017/05/10 09:34:51 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -239,9 +239,6 @@ ip_output(struct mbuf *m0, struct mbuf *
 	int isbroadcast;
 	int sw_csum;
 	u_long mtu;
-#ifdef IPSEC
-	struct secpolicy *sp = NULL;
-#endif
 	bool natt_frag = false;
 	bool rtmtu_nolock;
 	union {
@@ -588,7 +585,7 @@ sendit:
 		bool ipsec_done = false;
 
 		/* Perform IPsec processing, if any. */
-		error = ipsec4_output(m, inp, flags, &sp, &mtu, &natt_frag,
+		error = ipsec4_output(m, inp, flags, &mtu, &natt_frag,
 		&ipsec_done);
 		if (error || ipsec_done)
 			goto done;
@@ -770,11 +767,6 @@ done:
 	if (ro == &iproute) {
 		rtcache_free(&iproute);
 	}
-#ifdef IPSEC
-	if (sp) {
-		KEY_FREESP(&sp);
-	}
-#endif
 	if (mifp != NULL) {
 		if_put(mifp, &psref);
 	}

Index: src/sys/netipsec/ipsec.c
diff -u src/sys/netipsec/ipsec.c:1.86 src/sys/netipsec/ipsec.c:1.87
--- src/sys/netipsec/ipsec.c:1.86	Mon May  8 06:39:23 2017
+++ src/sys/netipsec/ipsec.c	Wed May 10 09:34:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.86 2017/05/08 06:39:23 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.87 2017/05/10 09:34:52 ozaki-r Exp $	*/
 /*	$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $	*/
 /*	$KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.86 2017/05/08 06:39:23 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.87 2017/05/10 09:34:52 ozaki-r Exp $");
 
 /*
  * IPsec controller part.
@@ -658,7 +658,7 @@ ipsec4_checkpolicy(struct mbuf *m, u_int
 
 int
 ipsec4_output(struct mbuf *m, struct inpcb *inp, int flags,
-struct secpolicy **sp_out, u_long *mtu, bool *natt_frag, bool *done)
+u_long *mtu, bool *natt_frag, bool *done)
 {
 	const struct ip *ip = mtod(m, const struct ip *);
 	struct secpolicy *sp = NULL;
@@ -707,7 +707,6 @@ ipsec4_output(struct mbuf *m, struct inp
 		/* No IPsec processing for this packet. */
 		return 0;
 	}
-	*sp_out = sp;
 
 	/*
 	 * NAT-T ESP fragmentation: do not do IPSec processing now,
@@ -718,6 +717,7 @@ ipsec4_output(struct mbuf *m, struct inp
 		if (ntohs(ip->ip_len) > sp->req->sav->esp_frag) {
 			*mtu = sp->req->sav->esp_frag;
 			*natt_frag = true;
+			KEY_FREESP(&sp);
 			splx(s);
 			return 0;
 		}
@@ -743,6 +743,7 @@ ipsec4_output(struct mbuf *m, struct inp
 	 */
 	if (error == ENOENT)
 		error = 0;
+	KEY_FREESP(&sp);
 	splx(s);
 	*done = true;
 	return error;

Index: src/sys/netipsec/ipsec.h
diff -u src/sys/netipsec/ipsec.h:1.45 src/sys/netipsec/ipsec.h:1.46
--- src/sys/netipsec/ipsec.h:1.45	Mon May  8 06:39:23 2017
+++ src/sys/netipsec/ipsec.h	Wed May 10 09:34:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.h,v 1.45 2017/05/08 06:39:23 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec.h,v 1.46 2017/05/10 09:34:52 ozaki-r Exp $	*/
 /*	$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.h,v 1.2.4.2 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: ipsec.h,v 1.53 2001/11/20 08:32:38 itojun Exp $	*/
 
@@ -255,7 +255,7 @@ struct secpolicy *ipsec4_checkpolicy (st
 struct secpolicy * ipsec_getpolicybyaddr(struct mbuf *, u_int,
 	int, int *);
 int ipsec4_output(struct mbuf *, struct inpcb *, int,
-	struct secpolicy **, u_long *, bool *, bool *);
+	u_long *, bool *, bool *);
 int ipsec4_input(struct mbuf *, int);
 int ipsec4_forward(struct mbuf *, int *);
 #ifdef INET6



CVS commit: src

2017-05-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed May 10 09:08:25 UTC 2017

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/net/ipsec: Makefile
Added Files:
src/tests/net/ipsec: t_ipsec_tunnel_odd.sh

Log Message:
Test tunnel mode with IPv4 over IPv6 and IPv6 over IPv4


To generate a diff of this commit:
cvs rdiff -u -r1.737 -r1.738 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.4 -r1.5 src/tests/net/ipsec/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/net/ipsec/t_ipsec_tunnel_odd.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.737 src/distrib/sets/lists/tests/mi:1.738
--- src/distrib/sets/lists/tests/mi:1.737	Thu Apr 27 06:53:44 2017
+++ src/distrib/sets/lists/tests/mi	Wed May 10 09:08:25 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.737 2017/04/27 06:53:44 ozaki-r Exp $
+# $NetBSD: mi,v 1.738 2017/05/10 09:08:25 ozaki-r Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3303,6 +3303,7 @@
 ./usr/tests/net/ipsec/t_ipsec_sysctl		tests-net-tests		atf,rump
 ./usr/tests/net/ipsec/t_ipsec_transport		tests-net-tests		atf,rump
 ./usr/tests/net/ipsec/t_ipsec_tunnel		tests-net-tests		atf,rump
+./usr/tests/net/ipsec/t_ipsec_tunnel_odd	tests-net-tests		atf,rump
 ./usr/tests/net/ipsec/t_ipsec_gif		tests-net-tests		atf,rump
 ./usr/tests/net/ipsec/t_ipsec_l2tp		tests-net-tests		atf,rump
 ./usr/tests/net/mcasttests-net-tests		compattestfile,atf

Index: src/tests/net/ipsec/Makefile
diff -u src/tests/net/ipsec/Makefile:1.4 src/tests/net/ipsec/Makefile:1.5
--- src/tests/net/ipsec/Makefile:1.4	Tue May  9 04:25:28 2017
+++ src/tests/net/ipsec/Makefile	Wed May 10 09:08:25 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2017/05/09 04:25:28 ozaki-r Exp $
+# $NetBSD: Makefile,v 1.5 2017/05/10 09:08:25 ozaki-r Exp $
 #
 
 .include 
@@ -6,7 +6,7 @@
 TESTSDIR=	${TESTSBASE}/net/ipsec
 
 .for name in ipsec_ah_keys ipsec_esp_keys ipsec_gif ipsec_l2tp ipsec_sysctl \
-ipsec_transport ipsec_tunnel
+ipsec_transport ipsec_tunnel ipsec_tunnel_odd
 TESTS_SH+=		t_${name}
 TESTS_SH_SRC_t_${name}=	../net_common.sh ./common.sh ./algorithms.sh \
 t_${name}.sh

Added files:

Index: src/tests/net/ipsec/t_ipsec_tunnel_odd.sh
diff -u /dev/null src/tests/net/ipsec/t_ipsec_tunnel_odd.sh:1.1
--- /dev/null	Wed May 10 09:08:25 2017
+++ src/tests/net/ipsec/t_ipsec_tunnel_odd.sh	Wed May 10 09:08:25 2017
@@ -0,0 +1,354 @@
+#	$NetBSD: t_ipsec_tunnel_odd.sh,v 1.1 2017/05/10 09:08:25 ozaki-r Exp $
+#
+# Copyright (c) 2017 Internet Initiative Japan Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+SOCK_LOCAL=unix://ipsec_local
+SOCK_TUNNEL_LOCAL=unix://ipsec_tunel_local
+SOCK_TUNNEL_REMOTE=unix://ipsec_tunnel_remote
+SOCK_REMOTE=unix://ipsec_remote
+BUS_LOCAL=./bus_ipsec_local
+BUS_TUNNEL=./bus_ipsec_tunnel
+BUS_REMOTE=./bus_ipsec_remote
+
+DEBUG=${DEBUG:-false}
+
+setup_servers()
+{
+
+	# See https://www.netbsd.org/docs/network/ipsec/#sample_vpn
+	rump_server_crypto_start $SOCK_LOCAL netinet6
+	rump_server_crypto_start $SOCK_TUNNEL_LOCAL netipsec netinet6
+	rump_server_crypto_start $SOCK_TUNNEL_REMOTE netipsec netinet6
+	rump_server_crypto_start $SOCK_REMOTE netinet6
+	rump_server_add_iface $SOCK_LOCAL shmif0 $BUS_LOCAL
+	rump_server_add_iface $SOCK_TUNNEL_LOCAL shmif0 $BUS_LOCAL
+	rump_server_add_iface $SOCK_TUNNEL_LOCAL shmif1 $BUS_TUNNEL
+	rump_server_add_iface $SOCK_TUNNEL_REMOTE shmif0 $BUS_REMOTE
+	rump_server_add_iface $SOCK_TUNNEL_REMOTE shmif1 $BUS_TUNNEL
+	rump_server_add_iface $SOCK_REMOTE shmif0 $BUS_REMOTE
+}
+
+check_tunne

CVS commit: src/tests/net/ipsec

2017-05-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed May 10 09:00:29 UTC 2017

Modified Files:
src/tests/net/ipsec: t_ipsec_tunnel.sh

Log Message:
Disable DAD rather than waiting its completion every time


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/ipsec/t_ipsec_tunnel.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/ipsec/t_ipsec_tunnel.sh
diff -u src/tests/net/ipsec/t_ipsec_tunnel.sh:1.6 src/tests/net/ipsec/t_ipsec_tunnel.sh:1.7
--- src/tests/net/ipsec/t_ipsec_tunnel.sh:1.6	Wed May 10 08:59:40 2017
+++ src/tests/net/ipsec/t_ipsec_tunnel.sh	Wed May 10 09:00:29 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ipsec_tunnel.sh,v 1.6 2017/05/10 08:59:40 ozaki-r Exp $
+#	$NetBSD: t_ipsec_tunnel.sh,v 1.7 2017/05/10 09:00:29 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -91,11 +91,13 @@ test_ipsec4_tunnel()
 	setup_servers
 
 	export RUMP_SERVER=$SOCK_LOCAL
+	atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.dad_count=0
 	atf_check -s exit:0 rump.ifconfig shmif0 $ip_local/24
 	atf_check -s exit:0 -o ignore \
 	rump.route -n add -net $subnet_remote $ip_gw_local
 
 	export RUMP_SERVER=$SOCK_TUNNEL_LOCAL
+	atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.dad_count=0
 	atf_check -s exit:0 rump.ifconfig shmif0 $ip_gw_local/24
 	atf_check -s exit:0 rump.ifconfig shmif1 $ip_gw_local_tunnel/24
 	atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.forwarding=1
@@ -103,6 +105,7 @@ test_ipsec4_tunnel()
 	rump.route -n add -net $subnet_remote $ip_gw_remote_tunnel
 
 	export RUMP_SERVER=$SOCK_TUNNEL_REMOTE
+	atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.dad_count=0
 	atf_check -s exit:0 rump.ifconfig shmif0 $ip_gw_remote/24
 	atf_check -s exit:0 rump.ifconfig shmif1 $ip_gw_remote_tunnel/24
 	atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.forwarding=1
@@ -110,9 +113,8 @@ test_ipsec4_tunnel()
 	rump.route -n add -net $subnet_local $ip_gw_local_tunnel
 
 	export RUMP_SERVER=$SOCK_REMOTE
+	atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.dad_count=0
 	atf_check -s exit:0 rump.ifconfig shmif0 $ip_remote/24
-	# Run ifconfig -w 10 just once for optimization
-	atf_check -s exit:0 rump.ifconfig -w 10
 	atf_check -s exit:0 -o ignore \
 	rump.route -n add -net $subnet_local $ip_gw_remote
 
@@ -198,11 +200,13 @@ test_ipsec6_tunnel()
 	setup_servers
 
 	export RUMP_SERVER=$SOCK_LOCAL
+	atf_check -s exit:0 rump.sysctl -q -w net.inet6.ip6.dad_count=0
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip_local/64
 	atf_check -s exit:0 -o ignore \
 	rump.route -n add -inet6 -net $subnet_remote/64 $ip_gw_local
 
 	export RUMP_SERVER=$SOCK_TUNNEL_LOCAL
+	atf_check -s exit:0 rump.sysctl -q -w net.inet6.ip6.dad_count=0
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip_gw_local/64
 	atf_check -s exit:0 rump.ifconfig shmif1 inet6 $ip_gw_local_tunnel/64
 	atf_check -s exit:0 rump.sysctl -q -w net.inet6.ip6.forwarding=1
@@ -210,6 +214,7 @@ test_ipsec6_tunnel()
 	rump.route -n add -inet6 -net $subnet_remote/64 $ip_gw_remote_tunnel
 
 	export RUMP_SERVER=$SOCK_TUNNEL_REMOTE
+	atf_check -s exit:0 rump.sysctl -q -w net.inet6.ip6.dad_count=0
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip_gw_remote/64
 	atf_check -s exit:0 rump.ifconfig shmif1 inet6 $ip_gw_remote_tunnel/64
 	atf_check -s exit:0 rump.sysctl -q -w net.inet6.ip6.forwarding=1
@@ -217,9 +222,8 @@ test_ipsec6_tunnel()
 	rump.route -n add -inet6 -net $subnet_local/64 $ip_gw_local_tunnel
 
 	export RUMP_SERVER=$SOCK_REMOTE
+	atf_check -s exit:0 rump.sysctl -q -w net.inet6.ip6.dad_count=0
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip_remote
-	# Run ifconfig -w 10 just once for optimization
-	atf_check -s exit:0 rump.ifconfig -w 10
 	atf_check -s exit:0 -o ignore \
 	rump.route -n add -inet6 -net $subnet_local/64 $ip_gw_remote
 



CVS commit: src/tests/net/ipsec

2017-05-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed May 10 08:59:40 UTC 2017

Modified Files:
src/tests/net/ipsec: t_ipsec_tunnel.sh

Log Message:
Dedup some routines


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/net/ipsec/t_ipsec_tunnel.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/ipsec/t_ipsec_tunnel.sh
diff -u src/tests/net/ipsec/t_ipsec_tunnel.sh:1.5 src/tests/net/ipsec/t_ipsec_tunnel.sh:1.6
--- src/tests/net/ipsec/t_ipsec_tunnel.sh:1.5	Wed May 10 04:46:13 2017
+++ src/tests/net/ipsec/t_ipsec_tunnel.sh	Wed May 10 08:59:40 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ipsec_tunnel.sh,v 1.5 2017/05/10 04:46:13 ozaki-r Exp $
+#	$NetBSD: t_ipsec_tunnel.sh,v 1.6 2017/05/10 08:59:40 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -35,6 +35,33 @@ BUS_REMOTE=./bus_ipsec_remote
 
 DEBUG=${DEBUG:-false}
 
+setup_servers()
+{
+
+	# See https://www.netbsd.org/docs/network/ipsec/#sample_vpn
+	rump_server_crypto_start $SOCK_LOCAL netinet6
+	rump_server_crypto_start $SOCK_TUNNEL_LOCAL netipsec netinet6
+	rump_server_crypto_start $SOCK_TUNNEL_REMOTE netipsec netinet6
+	rump_server_crypto_start $SOCK_REMOTE netinet6
+	rump_server_add_iface $SOCK_LOCAL shmif0 $BUS_LOCAL
+	rump_server_add_iface $SOCK_TUNNEL_LOCAL shmif0 $BUS_LOCAL
+	rump_server_add_iface $SOCK_TUNNEL_LOCAL shmif1 $BUS_TUNNEL
+	rump_server_add_iface $SOCK_TUNNEL_REMOTE shmif0 $BUS_REMOTE
+	rump_server_add_iface $SOCK_TUNNEL_REMOTE shmif1 $BUS_TUNNEL
+	rump_server_add_iface $SOCK_REMOTE shmif0 $BUS_REMOTE
+}
+
+check_tunnel_packets()
+{
+	local outfile=$1
+	local src=$2
+	local dst=$3
+	local proto=$4
+
+	atf_check -s exit:0 -o match:"$src > $dst: $proto" cat $outfile
+	atf_check -s exit:0 -o match:"$dst > $src: $proto" cat $outfile
+}
+
 test_ipsec4_tunnel()
 {
 	local proto=$1
@@ -61,17 +88,7 @@ test_ipsec4_tunnel()
 		proto_cap=AH
 	fi
 
-	# See https://www.netbsd.org/docs/network/ipsec/#sample_vpn
-	rump_server_crypto_start $SOCK_LOCAL
-	rump_server_crypto_start $SOCK_TUNNEL_LOCAL netipsec
-	rump_server_crypto_start $SOCK_TUNNEL_REMOTE netipsec
-	rump_server_crypto_start $SOCK_REMOTE
-	rump_server_add_iface $SOCK_LOCAL shmif0 $BUS_LOCAL
-	rump_server_add_iface $SOCK_TUNNEL_LOCAL shmif0 $BUS_LOCAL
-	rump_server_add_iface $SOCK_TUNNEL_LOCAL shmif1 $BUS_TUNNEL
-	rump_server_add_iface $SOCK_TUNNEL_REMOTE shmif0 $BUS_REMOTE
-	rump_server_add_iface $SOCK_TUNNEL_REMOTE shmif1 $BUS_TUNNEL
-	rump_server_add_iface $SOCK_REMOTE shmif0 $BUS_REMOTE
+	setup_servers
 
 	export RUMP_SERVER=$SOCK_LOCAL
 	atf_check -s exit:0 rump.ifconfig shmif0 $ip_local/24
@@ -145,12 +162,8 @@ test_ipsec4_tunnel()
 	atf_check -s exit:0 -o ignore rump.ping -c 1 -n -w 3 $ip_remote
 
 	extract_new_packets $BUS_TUNNEL > $outfile
-	atf_check -s exit:0 \
-	-o match:"$ip_gw_local_tunnel > $ip_gw_remote_tunnel: $proto_cap" \
-	cat $outfile
-	atf_check -s exit:0 \
-	-o match:"$ip_gw_remote_tunnel > $ip_gw_local_tunnel: $proto_cap" \
-	cat $outfile
+	check_tunnel_packets $outfile $ip_gw_local_tunnel $ip_gw_remote_tunnel \
+	$proto_cap
 
 	test_flush_entries $SOCK_TUNNEL_LOCAL
 	test_flush_entries $SOCK_TUNNEL_REMOTE
@@ -182,16 +195,7 @@ test_ipsec6_tunnel()
 		proto_cap=AH
 	fi
 
-	rump_server_crypto_start $SOCK_LOCAL netinet6
-	rump_server_crypto_start $SOCK_TUNNEL_LOCAL netipsec netinet6
-	rump_server_crypto_start $SOCK_TUNNEL_REMOTE netipsec netinet6
-	rump_server_crypto_start $SOCK_REMOTE netinet6
-	rump_server_add_iface $SOCK_LOCAL shmif0 $BUS_LOCAL
-	rump_server_add_iface $SOCK_TUNNEL_LOCAL shmif0 $BUS_LOCAL
-	rump_server_add_iface $SOCK_TUNNEL_LOCAL shmif1 $BUS_TUNNEL
-	rump_server_add_iface $SOCK_TUNNEL_REMOTE shmif0 $BUS_REMOTE
-	rump_server_add_iface $SOCK_TUNNEL_REMOTE shmif1 $BUS_TUNNEL
-	rump_server_add_iface $SOCK_REMOTE shmif0 $BUS_REMOTE
+	setup_servers
 
 	export RUMP_SERVER=$SOCK_LOCAL
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip_local/64
@@ -265,12 +269,8 @@ test_ipsec6_tunnel()
 	atf_check -s exit:0 -o ignore rump.ping6 -c 1 -n -X 3 $ip_remote
 
 	extract_new_packets $BUS_TUNNEL > $outfile
-	atf_check -s exit:0 \
-	-o match:"$ip_gw_local_tunnel > $ip_gw_remote_tunnel: $proto_cap" \
-	cat $outfile
-	atf_check -s exit:0 \
-	-o match:"$ip_gw_remote_tunnel > $ip_gw_local_tunnel: $proto_cap" \
-	cat $outfile
+	check_tunnel_packets $outfile $ip_gw_local_tunnel $ip_gw_remote_tunnel \
+	$proto_cap
 
 	test_flush_entries $SOCK_TUNNEL_LOCAL
 	test_flush_entries $SOCK_TUNNEL_REMOTE



CVS commit: src

2017-05-10 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Wed May 10 08:48:46 UTC 2017

Modified Files:
src/lib/librumpclient: Makefile
src/lib/librumphijack: Makefile
src/lib/librumpuser: Makefile
src/usr.bin/rump_allserver: Makefile
src/usr.bin/rump_server: Makefile

Log Message:
Revert previous change so builds can resume.
_KERNTYPES needs to be defined for NetBSD builds to succeed.
_KERNTYPES must not be defined for buildrum.sh builds to succeed.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/librumpclient/Makefile
cvs rdiff -u -r1.18 -r1.19 src/lib/librumphijack/Makefile
cvs rdiff -u -r1.25 -r1.26 src/lib/librumpuser/Makefile
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/rump_allserver/Makefile
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/rump_server/Makefile

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

Modified files:

Index: src/lib/librumpclient/Makefile
diff -u src/lib/librumpclient/Makefile:1.12 src/lib/librumpclient/Makefile:1.13
--- src/lib/librumpclient/Makefile:1.12	Wed May 10 01:11:51 2017
+++ src/lib/librumpclient/Makefile	Wed May 10 08:48:46 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.12 2017/05/10 01:11:51 sevan Exp $
+#	$NetBSD: Makefile,v 1.13 2017/05/10 08:48:46 sevan Exp $
 #
 
 .PATH:	${.CURDIR}/../../sys/rump/librump/rumpkern
@@ -17,7 +17,7 @@ LIBDO.${lib}=	_external
 LIBDPLIBS+=	${lib} lib
 .endfor
 
-CPPFLAGS+=	-DRUMP_CLIENT
+CPPFLAGS+=	-DRUMP_CLIENT -D_KERNTYPES
 CPPFLAGS+=	-I${.OBJDIR} -I${.CURDIR}
 CPPFLAGS+=	-I${.CURDIR}/../librumpuser
 SRCS=		rumpclient.c

Index: src/lib/librumphijack/Makefile
diff -u src/lib/librumphijack/Makefile:1.18 src/lib/librumphijack/Makefile:1.19
--- src/lib/librumphijack/Makefile:1.18	Wed May 10 01:11:51 2017
+++ src/lib/librumphijack/Makefile	Wed May 10 08:48:46 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.18 2017/05/10 01:11:51 sevan Exp $
+#	$NetBSD: Makefile,v 1.19 2017/05/10 08:48:46 sevan Exp $
 #
 
 LIB=		rumphijack
@@ -10,7 +10,7 @@ MAN=		rumphijack.3
 
 SRCS=		hijack.c hijackdlsym.c
 
-CPPFLAGS+=	-D_DIAGNOSTIC -D_REENTRANT
+CPPFLAGS+=	-D_DIAGNOSTIC -D_REENTRANT -D_KERNTYPES
 
 WARNS?=		5
 

Index: src/lib/librumpuser/Makefile
diff -u src/lib/librumpuser/Makefile:1.25 src/lib/librumpuser/Makefile:1.26
--- src/lib/librumpuser/Makefile:1.25	Wed May 10 01:11:52 2017
+++ src/lib/librumpuser/Makefile	Wed May 10 08:48:46 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.25 2017/05/10 01:11:52 sevan Exp $
+#	$NetBSD: Makefile,v 1.26 2017/05/10 08:48:46 sevan Exp $
 #
 
 .include 
@@ -19,7 +19,7 @@ LIBDPLIBS+=	pthread ${.CURDIR}/../libpth
 LIBDO.${lib}=	_external
 LIBDPLIBS+=	${lib} lib
 .endfor
-CPPFLAGS+=	-DLIBRUMPUSER
+CPPFLAGS+=	-DLIBRUMPUSER -D_KERNTYPES
 #CPPFLAGS+=	-D_DIAGNOSTIC
 
 

Index: src/usr.bin/rump_allserver/Makefile
diff -u src/usr.bin/rump_allserver/Makefile:1.9 src/usr.bin/rump_allserver/Makefile:1.10
--- src/usr.bin/rump_allserver/Makefile:1.9	Wed May 10 01:11:52 2017
+++ src/usr.bin/rump_allserver/Makefile	Wed May 10 08:48:46 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2017/05/10 01:11:52 sevan Exp $
+#	$NetBSD: Makefile,v 1.10 2017/05/10 08:48:46 sevan Exp $
 #
 
 PROG=	rump_allserver
@@ -13,5 +13,6 @@ RUMPTOP=${.CURDIR}/../../sys/rump
 
 LDADD+=	${RUMPDEVLDADD} ${RUMPFSLDADD} ${RUMPKERNLDADD} ${RUMPNETLDADD}
 LDADD+= -lrumpdev -lrumpvfs -lrumpnet -lrump -lrumpuser -lpthread
+CPPFLAGS+= 	-D_KERNTYPES
 
 .include 

Index: src/usr.bin/rump_server/Makefile
diff -u src/usr.bin/rump_server/Makefile:1.10 src/usr.bin/rump_server/Makefile:1.11
--- src/usr.bin/rump_server/Makefile:1.10	Wed May 10 01:11:52 2017
+++ src/usr.bin/rump_server/Makefile	Wed May 10 08:48:46 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2017/05/10 01:11:52 sevan Exp $
+#	$NetBSD: Makefile,v 1.11 2017/05/10 08:48:46 sevan Exp $
 #
 
 .PATH: ${.CURDIR}/../rump_allserver
@@ -7,6 +7,7 @@ PROG=		rump_server
 SRCS=		rump_allserver.c
 NOMAN=		installed by ../rump_allserver
 
+CPPFLAGS+= 	-D_KERNTYPES
 LDADD+=		-Wl,--whole-archive -lrumpkern_sysproxy -lrump \
 		-lrumpuser -Wl,--no-whole-archive -lpthread
 



CVS commit: src/sys/dev/ata

2017-05-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 10 08:46:39 UTC 2017

Modified Files:
src/sys/dev/ata: sata_subr.c

Log Message:
 KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ata/sata_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/ata/sata_subr.c
diff -u src/sys/dev/ata/sata_subr.c:1.21 src/sys/dev/ata/sata_subr.c:1.22
--- src/sys/dev/ata/sata_subr.c:1.21	Wed Apr  3 17:15:07 2013
+++ src/sys/dev/ata/sata_subr.c	Wed May 10 08:46:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sata_subr.c,v 1.21 2013/04/03 17:15:07 bouyer Exp $	*/
+/*	$NetBSD: sata_subr.c,v 1.22 2017/05/10 08:46:39 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
  * Common functions for Serial ATA.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sata_subr.c,v 1.21 2013/04/03 17:15:07 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sata_subr.c,v 1.22 2017/05/10 08:46:39 msaitoh Exp $");
 
 #include 
 #include 
@@ -85,14 +85,15 @@ sata_reset_interface(struct ata_channel 
 	uint32_t scontrol, sstatus;
 	int i;
 
-	/* bring the PHYs online.
+	/*
+	 * bring the PHYs online.
 	 * The work-around for errata #1 of the Intel GD31244 says that we must
 	 * write 0 to the port first to be sure of correctly initializing
 	 * the device. It doesn't hurt for other devices.
 	 */
 	bus_space_write_4(sata_t, scontrol_r, 0, 0);
 	scontrol = SControl_IPM_NONE | SControl_SPD_ANY | SControl_DET_INIT;
-	bus_space_write_4 (sata_t, scontrol_r, 0, scontrol);
+	bus_space_write_4(sata_t, scontrol_r, 0, scontrol);
 
 	ata_delay(50, "sataup", flags);
 	scontrol &= ~SControl_DET_INIT;



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

2017-05-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 10 08:02:37 UTC 2017

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

Log Message:
 Print package ID, core ID and SMT ID.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/x86/x86/identcpu.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/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.53 src/sys/arch/x86/x86/identcpu.c:1.54
--- src/sys/arch/x86/x86/identcpu.c:1.53	Thu Feb 16 15:00:30 2017
+++ src/sys/arch/x86/x86/identcpu.c	Wed May 10 08:02:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.53 2017/02/16 15:00:30 tls Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.54 2017/05/10 08:02:37 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.53 2017/02/16 15:00:30 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.54 2017/05/10 08:02:37 msaitoh Exp $");
 
 #include "opt_xen.h"
 
@@ -949,7 +949,8 @@ cpu_identify(struct cpu_info *ci)
 	if (ci->ci_signature != 0)
 		aprint_normal(", id 0x%x", ci->ci_signature);
 	aprint_normal("\n");
-
+	aprint_normal_dev(ci->ci_dev, "package %lu, core %lu, smt %lu\n",
+	ci->ci_package_id, ci->ci_core_id, ci->ci_smt_id);
 	if (cpu_brand_string[0] == '\0') {
 		strlcpy(cpu_brand_string, cpu_getmodel(),
 		sizeof(cpu_brand_string));



CVS commit: src/share/examples/lua

2017-05-10 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed May 10 07:51:07 UTC 2017

Modified Files:
src/share/examples/lua: gpio.lua

Log Message:
Clarify gpio example.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/examples/lua/gpio.lua

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

Modified files:

Index: src/share/examples/lua/gpio.lua
diff -u src/share/examples/lua/gpio.lua:1.3 src/share/examples/lua/gpio.lua:1.4
--- src/share/examples/lua/gpio.lua:1.3	Sat Jul 19 18:38:34 2014
+++ src/share/examples/lua/gpio.lua	Wed May 10 07:51:07 2017
@@ -1,4 +1,8 @@
--- $NetBSD: gpio.lua,v 1.3 2014/07/19 18:38:34 lneto Exp $
+-- $NetBSD: gpio.lua,v 1.4 2017/05/10 07:51:07 mbalmer Exp $
+
+-- This example works only if all pins, starting from pin 0 up to the
+-- number returned by gpio.info() are, readable.  It does _not_ work if
+-- only part of the pins are configured.
 
 local gpio = require 'gpio'
 



CVS commit: src/share/examples/lua

2017-05-10 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed May 10 07:37:33 UTC 2017

Modified Files:
src/share/examples/lua: sqlite.lua

Log Message:
Fix flags for DB open.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/examples/lua/sqlite.lua

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

Modified files:

Index: src/share/examples/lua/sqlite.lua
diff -u src/share/examples/lua/sqlite.lua:1.3 src/share/examples/lua/sqlite.lua:1.4
--- src/share/examples/lua/sqlite.lua:1.3	Tue Dec  8 23:04:40 2015
+++ src/share/examples/lua/sqlite.lua	Wed May 10 07:37:33 2017
@@ -1,4 +1,4 @@
--- $NetBSD: sqlite.lua,v 1.3 2015/12/08 23:04:40 kamil Exp $
+-- $NetBSD: sqlite.lua,v 1.4 2017/05/10 07:37:33 mbalmer Exp $
 
 local sqlite = require 'sqlite'
 
@@ -13,7 +13,8 @@ print('this is sqlite ' .. sqlite.libver
 sqlite.libversion_number() .. ')')
 print('sourceid ' .. sqlite.sourceid())
 
-db, state = sqlite.open('/tmp/db.sqlite', sqlite.OPEN_CREATE)
+db, state = sqlite.open('/tmp/db.sqlite', sqlite.OPEN_READWRITE |
+sqlite.OPEN_CREATE)
 
 if state ~= sqlite.OK then
 	print('db open failed')



CVS commit: src/lib/lua/sqlite

2017-05-10 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed May 10 07:36:01 UTC 2017

Modified Files:
src/lib/lua/sqlite: sqlite.c

Log Message:
Guard against double freeing of objects (explicit by the Lua program, then
later by the garbage collector).
This fixes PR bin/52218.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/lua/sqlite/sqlite.c

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

Modified files:

Index: src/lib/lua/sqlite/sqlite.c
diff -u src/lib/lua/sqlite/sqlite.c:1.8 src/lib/lua/sqlite/sqlite.c:1.9
--- src/lib/lua/sqlite/sqlite.c:1.8	Mon Feb 15 15:56:33 2016
+++ src/lib/lua/sqlite/sqlite.c	Wed May 10 07:36:01 2017
@@ -1,7 +1,7 @@
-/*	$NetBSD: sqlite.c,v 1.8 2016/02/15 15:56:33 mbalmer Exp $ */
+/*	$NetBSD: sqlite.c,v 1.9 2017/05/10 07:36:01 mbalmer Exp $ */
 
 /*
- * Copyright (c) 2011, 2013, 2016 Marc Balmer 
+ * Copyright (c) 2011, 2013, 2016, 2017 Marc Balmer 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -120,7 +120,11 @@ db_close(lua_State *L)
 	sqlite3 **db;
 
 	db = luaL_checkudata(L, 1, SQLITE_DB_METATABLE);
-	lua_pushinteger(L, sqlite3_close(*db));
+	if (*db) {
+		lua_pushinteger(L, sqlite3_close(*db));
+		*db = NULL;
+	} else
+		lua_pushnil(L);
 	return 1;
 
 }
@@ -342,7 +346,10 @@ stmt_finalize(lua_State *L)
 	sqlite3_stmt **stmt;
 
 	stmt = luaL_checkudata(L, 1, SQLITE_STMT_METATABLE);
-	sqlite3_finalize(*stmt);
+	if (*stmt) {
+		sqlite3_finalize(*stmt);
+		*stmt = NULL;
+	}
 	return 0;
 }