CVS commit: src/share/man/man3lua

2018-04-29 Thread Hisashi T Fujinaka
Module Name:src
Committed By:   htodd
Date:   Mon Apr 30 05:23:08 UTC 2018

Modified Files:
src/share/man/man3lua: Makefile

Log Message:
Fix typo in Makefile to fix build.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man3lua/Makefile

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/man3lua/Makefile
diff -u src/share/man/man3lua/Makefile:1.5 src/share/man/man3lua/Makefile:1.6
--- src/share/man/man3lua/Makefile:1.5	Mon Apr 30 01:10:13 2018
+++ src/share/man/man3lua/Makefile	Mon Apr 30 05:23:08 2018
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.5 2018/04/30 01:10:13 sevan Exp $
+#	$NetBSD: Makefile,v 1.6 2018/04/30 05:23:08 htodd Exp $
 
-MAN=	gpio.3lua intro.3lua netpgp3.lua sqlite.3lua syslog.3lua
+MAN=	gpio.3lua intro.3lua netpgp.3lua sqlite.3lua syslog.3lua
 
 MLINKS+=gpio.3lua gpio.open.3lua \
 	gpio.3lua gpio.info.3lua \



CVS commit: src/sys/dev/usb

2018-04-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Apr 30 05:04:34 UTC 2018

Modified Files:
src/sys/dev/usb: usb_subr.c

Log Message:
add missing KERNEL_LOCK protection around autoconf calls.

Also replace NULL argument with curlwp for style.


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/sys/dev/usb/usb_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/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.223 src/sys/dev/usb/usb_subr.c:1.224
--- src/sys/dev/usb/usb_subr.c:1.223	Tue Dec 26 18:44:52 2017
+++ src/sys/dev/usb/usb_subr.c	Mon Apr 30 05:04:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.223 2017/12/26 18:44:52 khorben Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.224 2018/04/30 05:04:34 mlelstv Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.223 2017/12/26 18:44:52 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.224 2018/04/30 05:04:34 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -858,7 +858,9 @@ usbd_attach_roothub(device_t parent, str
 	uaa.uaa_subclass = dd->bDeviceSubClass;
 	uaa.uaa_proto = dd->bDeviceProtocol;
 
+	KERNEL_LOCK(1, curlwp);
 	dv = config_found_ia(parent, "usbroothubif", , 0);
+	KERNEL_UNLOCK_ONE(curlwp);
 	if (dv) {
 		dev->ud_subdevs = kmem_alloc(sizeof(dv), KM_SLEEP);
 		dev->ud_subdevs[0] = dv;
@@ -903,10 +905,10 @@ usbd_attachwholedevice(device_t parent, 
 	dlocs[USBDEVIFCF_CONFIGURATION] = -1;
 	dlocs[USBDEVIFCF_INTERFACE] = -1;
 
-	KERNEL_LOCK(1, NULL);
+	KERNEL_LOCK(1, curlwp);
 	dv = config_found_sm_loc(parent, "usbdevif", dlocs, , usbd_print,
  config_stdsubmatch);
-	KERNEL_UNLOCK_ONE(NULL);
+	KERNEL_UNLOCK_ONE(curlwp);
 	if (dv) {
 		dev->ud_subdevs = kmem_alloc(sizeof(dv), KM_SLEEP);
 		dev->ud_subdevs[0] = dv;
@@ -980,10 +982,10 @@ usbd_attachinterfaces(device_t parent, s
 			loc != uiaa.uiaa_ifaceno)
 continue;
 		}
-		KERNEL_LOCK(1, NULL);
+		KERNEL_LOCK(1, curlwp);
 		dv = config_found_sm_loc(parent, "usbifif", ilocs, ,
 	 usbd_ifprint, config_stdsubmatch);
-		KERNEL_UNLOCK_ONE(NULL);
+		KERNEL_UNLOCK_ONE(curlwp);
 		if (!dv)
 			continue;
 
@@ -1727,7 +1729,10 @@ usb_disconnect_port(struct usbd_port *up
 continue;
 			strlcpy(subdevname, device_xname(subdev),
 			sizeof(subdevname));
-			if ((rc = config_detach(subdev, flags)) != 0)
+			KERNEL_LOCK(1, curlwp);
+			rc = config_detach(subdev, flags);
+			KERNEL_UNLOCK_ONE(curlwp);
+			if (rc != 0)
 return rc;
 			printf("%s: at %s", subdevname, hubname);
 			if (up->up_portno != 0)



CVS commit: src/external/gpl2/gmake/dist

2018-04-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Apr 30 04:17:27 UTC 2018

Modified Files:
src/external/gpl2/gmake/dist: dir.c

Log Message:
gmake: Make this work with glibc glob interface v2

http://git.savannah.gnu.org/cgit/make.git/commit/?id=193f1e81


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl2/gmake/dist/dir.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/gpl2/gmake/dist/dir.c
diff -u src/external/gpl2/gmake/dist/dir.c:1.1.1.1 src/external/gpl2/gmake/dist/dir.c:1.2
--- src/external/gpl2/gmake/dist/dir.c:1.1.1.1	Mon Aug 18 06:46:58 2014
+++ src/external/gpl2/gmake/dist/dir.c	Mon Apr 30 04:17:27 2018
@@ -1194,6 +1194,32 @@ local_stat (const char *path, struct sta
 }
 #endif
 
+/* Similarly for lstat.  */
+#if !defined(lstat) && !defined(WINDOWS32) || defined(VMS)
+# ifndef VMS
+#  ifndef HAVE_SYS_STAT_H
+int lstat (const char *path, struct stat *sbuf);
+#  endif
+# else
+/* We are done with the fake lstat.  Go back to the real lstat */
+#   ifdef lstat
+# undef lstat
+#   endif
+# endif
+# define local_lstat lstat
+#elif defined(WINDOWS32)
+/* Windows doesn't support lstat().  */
+# define local_lstat local_stat
+#else
+static int
+local_lstat (const char *path, struct stat *buf)
+{
+  int e;
+  EINTRLOOP (e, lstat (path, buf));
+  return e;
+}
+#endif
+
 void
 dir_setup_glob (glob_t *gl)
 {
@@ -1201,9 +1227,8 @@ dir_setup_glob (glob_t *gl)
   gl->gl_opendir = open_dirstream;
   gl->gl_readdir = read_dirstream;
   gl->gl_closedir = ansi_free;
+  gl->gl_lstat = local_lstat;
   gl->gl_stat = local_stat;
-  /* We don't bother setting gl_lstat, since glob never calls it.
- The slot is only there for compatibility with 4.4 BSD.  */
 }
 
 void



CVS commit: src/sys/dev/usb

2018-04-29 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Apr 30 01:14:07 UTC 2018

Modified Files:
src/sys/dev/usb: if_zyd.c if_zydreg.h

Log Message:
Remove set but not used sc_flags.

Built tested only.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/usb/if_zyd.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/usb/if_zydreg.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/usb/if_zyd.c
diff -u src/sys/dev/usb/if_zyd.c:1.45 src/sys/dev/usb/if_zyd.c:1.46
--- src/sys/dev/usb/if_zyd.c:1.45	Sun Jan 21 13:57:12 2018
+++ src/sys/dev/usb/if_zyd.c	Mon Apr 30 01:14:07 2018
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_zyd.c,v 1.52 2007/02/11 00:08:04 jsg Exp $	*/
-/*	$NetBSD: if_zyd.c,v 1.45 2018/01/21 13:57:12 skrll Exp $	*/
+/*	$NetBSD: if_zyd.c,v 1.46 2018/04/30 01:14:07 maya Exp $	*/
 
 /*-
  * Copyright (c) 2006 by Damien Bergamini 
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.45 2018/01/21 13:57:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.46 2018/04/30 01:14:07 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -296,7 +296,6 @@ zyd_attachhook(device_t self)
 	}
 
 	firmware_free(fw, size);
-	sc->sc_flags |= ZD1211_FWLOADED;
 
 	/* complete the attach process */
 	if ((error = zyd_complete_attach(sc)) == 0)
@@ -315,7 +314,6 @@ zyd_attach(device_t parent, device_t sel
 
 	sc->sc_dev = self;
 	sc->sc_udev = uaa->uaa_device;
-	sc->sc_flags = 0;
 
 	aprint_naive("\n");
 	aprint_normal("\n");

Index: src/sys/dev/usb/if_zydreg.h
diff -u src/sys/dev/usb/if_zydreg.h:1.8 src/sys/dev/usb/if_zydreg.h:1.9
--- src/sys/dev/usb/if_zydreg.h:1.8	Sat Apr 23 10:15:32 2016
+++ src/sys/dev/usb/if_zydreg.h	Mon Apr 30 01:14:07 2018
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_zydreg.h,v 1.19 2006/11/30 19:28:07 damien Exp $	*/
-/*	$NetBSD: if_zydreg.h,v 1.8 2016/04/23 10:15:32 skrll Exp $	*/
+/*	$NetBSD: if_zydreg.h,v 1.9 2018/04/30 01:14:07 maya Exp $	*/
 
 /*-
  * Copyright (c) 2006 by Damien Bergamini 
@@ -1185,9 +1185,6 @@ struct zyd_softc {
 	struct usb_task			sc_task;
 	struct usbd_device *		sc_udev;
 	struct usbd_interface *		sc_iface;
-	intsc_flags;
-#define ZD1211_FWLOADED (1 << 0)
-
 
 	enum ieee80211_state		sc_state;
 	intsc_arg;



CVS commit: src

2018-04-29 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Mon Apr 30 01:10:14 UTC 2018

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man3lua: Makefile intro.3lua
Added Files:
src/share/man/man3lua: netpgp.3lua

Log Message:
Add a manual for netpgp(3lua)


To generate a diff of this commit:
cvs rdiff -u -r1.1577 -r1.1578 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.4 -r1.5 src/share/man/man3lua/Makefile
cvs rdiff -u -r1.7 -r1.8 src/share/man/man3lua/intro.3lua
cvs rdiff -u -r0 -r1.1 src/share/man/man3lua/netpgp.3lua

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

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1577 src/distrib/sets/lists/man/mi:1.1578
--- src/distrib/sets/lists/man/mi:1.1577	Sun Feb 25 12:53:22 2018
+++ src/distrib/sets/lists/man/mi	Mon Apr 30 01:10:13 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1577 2018/02/25 12:53:22 kamil Exp $
+# $NetBSD: mi,v 1.1578 2018/04/30 01:10:13 sevan Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6715,6 +6715,7 @@
 ./usr/share/man/man3lua/gpio.unset.3lua		man-sys-man		.man
 ./usr/share/man/man3lua/gpio.write.3lua		man-sys-man		.man
 ./usr/share/man/man3lua/intro.3lua		man-sys-man		.man
+./usr/share/man/man3lua/netpgp.3lua		man-sys-man		.man
 ./usr/share/man/man3lua/sqlite.3lua		man-sys-man		.man
 ./usr/share/man/man3lua/syslog.3lua		man-sys-man		.man
 ./usr/share/man/man4/aac.4			man-sys-man		.man

Index: src/share/man/man3lua/Makefile
diff -u src/share/man/man3lua/Makefile:1.4 src/share/man/man3lua/Makefile:1.5
--- src/share/man/man3lua/Makefile:1.4	Wed Nov 13 20:55:08 2013
+++ src/share/man/man3lua/Makefile	Mon Apr 30 01:10:13 2018
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.4 2013/11/13 20:55:08 mbalmer Exp $
+#	$NetBSD: Makefile,v 1.5 2018/04/30 01:10:13 sevan Exp $
 
-MAN=	gpio.3lua intro.3lua sqlite.3lua syslog.3lua
+MAN=	gpio.3lua intro.3lua netpgp3.lua sqlite.3lua syslog.3lua
 
 MLINKS+=gpio.3lua gpio.open.3lua \
 	gpio.3lua gpio.info.3lua \

Index: src/share/man/man3lua/intro.3lua
diff -u src/share/man/man3lua/intro.3lua:1.7 src/share/man/man3lua/intro.3lua:1.8
--- src/share/man/man3lua/intro.3lua:1.7	Sat Apr 15 23:33:52 2017
+++ src/share/man/man3lua/intro.3lua	Mon Apr 30 01:10:13 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: intro.3lua,v 1.7 2017/04/15 23:33:52 sevan Exp $
+.\"	$NetBSD: intro.3lua,v 1.8 2018/04/30 01:10:13 sevan Exp $
 .\"
 .\" Copyright (c) 2013, 2016 Marc Balmer .
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"
-.Dd April 16, 2017
+.Dd April 30, 2018
 .Dt INTRO 3lua
 .Os
 .Sh NAME
@@ -47,6 +47,10 @@ are:
 Access
 .Xr gpio 4
 pins.
+.It Em netpgp
+Access
+.Xr libnetpgp 3
+functionality.
 .It Em sqlite
 Access
 .Xr sqlite3 1
@@ -60,6 +64,7 @@ functionality.
 .Xr lua 1 ,
 .Xr luac 1 ,
 .Xr gpio 3lua ,
+.Xr netpgp 3lua ,
 .Xr sqlite 3lua ,
 .Xr syslog 3lua ,
 .Xr intro 9lua

Added files:

Index: src/share/man/man3lua/netpgp.3lua
diff -u /dev/null src/share/man/man3lua/netpgp.3lua:1.1
--- /dev/null	Mon Apr 30 01:10:14 2018
+++ src/share/man/man3lua/netpgp.3lua	Mon Apr 30 01:10:13 2018
@@ -0,0 +1,95 @@
+.\" $NetBSD: netpgp.3lua,v 1.1 2018/04/30 01:10:13 sevan Exp $
+.\"
+.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Sevan Janiyan .
+.\"
+.\" 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.
+.\"
+.\"
+.Dd April 30, 2018
+.Dt NETPGP 3lua
+.Os
+.Sh NAME
+.Nm netpgp
+.Nd provides access to
+.Xr libnetpgp 3

CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua

2018-04-29 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Apr 29 23:31:00 UTC 2018

Modified Files:
src/crypto/external/bsd/netpgp/dist/bindings/lua: netpgp.lua

Log Message:
sign_file function expects 5 parameters, include the output filename.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua
diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.4 src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.5
--- src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua:1.4	Mon Oct 19 01:07:08 2009
+++ src/crypto/external/bsd/netpgp/dist/bindings/lua/netpgp.lua	Sun Apr 29 23:30:59 2018
@@ -32,7 +32,7 @@
 -- command line args
 dofile "optparse.lua"
 
-opt = OptionParser{usage="%prog [options] file", version="20090711"}   
+opt = OptionParser{usage="%prog [options] file", version="20180428"}   
 
 opt.add_option{"-s", "--sign", action="store_true", dest="sign", help="--sign [--detached] [--armour] file"}
 opt.add_option{"-v", "--verify", action="store_true", dest="verify", help="--verify [--armour] file"}
@@ -89,7 +89,7 @@ for i = 1, #args do
 	end
 	if options.sign then
 		-- detached signature
-		netpgp.sign_file(pgp, args[1], output, armour, detached)
+		netpgp.sign_file(pgp, args[1], args[1] .. ".sig", armour, detached)
 		os.execute("ls -l " .. args[1] .. ".sig")
 	end
 	if options.verify then



CVS commit: src

2018-04-29 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Apr 29 19:47:35 UTC 2018

Modified Files:
src/crypto/external/bsd/netpgp: Makefile
src/distrib/sets/lists/base: shl.mi
Added Files:
src/crypto/external/bsd/netpgp/bindings: Makefile
src/crypto/external/bsd/netpgp/bindings/lua: Makefile

Log Message:
Hello netpgp(3lua)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/crypto/external/bsd/netpgp/Makefile
cvs rdiff -u -r0 -r1.1 src/crypto/external/bsd/netpgp/bindings/Makefile
cvs rdiff -u -r0 -r1.1 src/crypto/external/bsd/netpgp/bindings/lua/Makefile
cvs rdiff -u -r1.835 -r1.836 src/distrib/sets/lists/base/shl.mi

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

Modified files:

Index: src/crypto/external/bsd/netpgp/Makefile
diff -u src/crypto/external/bsd/netpgp/Makefile:1.9 src/crypto/external/bsd/netpgp/Makefile:1.10
--- src/crypto/external/bsd/netpgp/Makefile:1.9	Fri Dec  5 04:52:01 2014
+++ src/crypto/external/bsd/netpgp/Makefile	Sun Apr 29 19:47:34 2018
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile,v 1.9 2014/12/05 04:52:01 agc Exp $
+#	$NetBSD: Makefile,v 1.10 2018/04/29 19:47:34 sevan Exp $
 
 SUBDIR+=	libmj .WAIT
 SUBDIR+=	lib .WAIT
+SUBDIR+= 	bindings .WAIT
 SUBDIR+=	bin
 
 .include 

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.835 src/distrib/sets/lists/base/shl.mi:1.836
--- src/distrib/sets/lists/base/shl.mi:1.835	Mon Apr 16 12:25:18 2018
+++ src/distrib/sets/lists/base/shl.mi	Sun Apr 29 19:47:34 2018
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.835 2018/04/16 12:25:18 christos Exp $
+# $NetBSD: shl.mi,v 1.836 2018/04/29 19:47:34 sevan Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -875,6 +875,7 @@
 ./usr/lib/lua/5.1/sqlite.so	base-obsolete		obsolete
 ./usr/lib/lua/5.1/syslog.so	base-obsolete		obsolete
 ./usr/lib/lua/5.3/gpio.so	base-sys-shlib		compatfile
+./usr/lib/lua/5.3/netpgp.so 			base-sys-shlib		compatfile
 ./usr/lib/lua/5.3/sqlite.so	base-sys-shlib		compatfile
 ./usr/lib/lua/5.3/syslog.so	base-sys-shlib		compatfile
 ./usr/lib/npf/ext_log.so			base-obsolete		obsolete

Added files:

Index: src/crypto/external/bsd/netpgp/bindings/Makefile
diff -u /dev/null src/crypto/external/bsd/netpgp/bindings/Makefile:1.1
--- /dev/null	Sun Apr 29 19:47:35 2018
+++ src/crypto/external/bsd/netpgp/bindings/Makefile	Sun Apr 29 19:47:34 2018
@@ -0,0 +1,5 @@
+# $NetBSD: Makefile,v 1.1 2018/04/29 19:47:34 sevan Exp $
+
+SUBDIR+= 	lua .WAIT
+
+.include 

Index: src/crypto/external/bsd/netpgp/bindings/lua/Makefile
diff -u /dev/null src/crypto/external/bsd/netpgp/bindings/lua/Makefile:1.1
--- /dev/null	Sun Apr 29 19:47:35 2018
+++ src/crypto/external/bsd/netpgp/bindings/lua/Makefile	Sun Apr 29 19:47:35 2018
@@ -0,0 +1,11 @@
+# $NetBSD: Makefile,v 1.1 2018/04/29 19:47:35 sevan Exp $
+
+LUA_MODULES=netpgp
+LUA_SRCS.netpgp=glue.c
+LUA_DPLIBS+=netpgp ${.CURDIR}/../../lib/netpgp
+
+EXTDIST=${.CURDIR}/../../dist
+
+.PATH: ${EXTDIST}/bindings/lua
+
+.include 



CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua

2018-04-29 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Apr 29 19:34:57 UTC 2018

Modified Files:
src/crypto/external/bsd/netpgp/dist/bindings/lua: glue.c

Log Message:
Add support for Lua 5.3


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c
diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.4 src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.5
--- src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.4	Sun Apr 29 19:31:38 2018
+++ src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c	Sun Apr 29 19:34:57 2018
@@ -334,7 +334,7 @@ l_getvar(lua_State *L)
 	return 1;
 }
 
-const struct luaL_reg libluanetpgp[] = {
+const struct luaL_Reg libluanetpgp[] = {
 	{ "new",		l_new },
 	{ "init",		l_init },
 
@@ -358,6 +358,10 @@ const struct luaL_reg libluanetpgp[] = {
 int 
 luaopen_netpgp(lua_State *L)
 {
-	luaL_openlib(L, "netpgp", libluanetpgp, 0);
+#if LUA_VERSION_NUM >= 502
+	luaL_newlib(L, libluanetpgp);
+#else
+	luaL_register(L, "netpgp", libluanetpgp);
+#endif
 	return 1;
 }



CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua

2018-04-29 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Apr 29 19:31:38 UTC 2018

Modified Files:
src/crypto/external/bsd/netpgp/dist/bindings/lua: glue.c

Log Message:
Enable checking arguments for validity.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c
diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.3 src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.4
--- src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.3	Sun Apr 29 19:28:11 2018
+++ src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c	Sun Apr 29 19:31:38 2018
@@ -38,6 +38,7 @@
 #include 
 
 #define LUA_LIB
+#define LUA_USE_APICHECK
 #include 
 #include 
 #include 



CVS commit: src/crypto/external/bsd/netpgp/dist/bindings/lua

2018-04-29 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Apr 29 19:28:11 UTC 2018

Modified Files:
src/crypto/external/bsd/netpgp/dist/bindings/lua: glue.c

Log Message:
Utilise the passed output filename rather that using a hardcoded name


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c
diff -u src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.2 src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.3
--- src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c:1.2	Sun Oct 18 07:14:19 2009
+++ src/crypto/external/bsd/netpgp/dist/bindings/lua/glue.c	Sun Apr 29 19:28:11 2018
@@ -161,7 +161,7 @@ l_encrypt_file(lua_State *L)
 	}
 	armour = findtype(armourtypes, luaL_checkstring(L, 4));
 	ret = netpgp_encrypt_file(netpgp, netpgp_getvar(netpgp, "userid"),
-f, __UNCONST("a.gpg"), armour);
+f, __UNCONST(output), armour);
 	lua_pushnumber(L, ret);
 	return 1;
 }



CVS commit: src/sys/arch/vax/vax

2018-04-29 Thread Anders Magnusson
Module Name:src
Committed By:   ragge
Date:   Sun Apr 29 19:01:16 UTC 2018

Modified Files:
src/sys/arch/vax/vax: db_disasm.c

Log Message:
Fix bug causing small constants not to be printed out.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/vax/vax/db_disasm.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/vax/vax/db_disasm.c
diff -u src/sys/arch/vax/vax/db_disasm.c:1.22 src/sys/arch/vax/vax/db_disasm.c:1.23
--- src/sys/arch/vax/vax/db_disasm.c:1.22	Mon May 22 16:39:41 2017
+++ src/sys/arch/vax/vax/db_disasm.c	Sun Apr 29 19:01:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.22 2017/05/22 16:39:41 ragge Exp $ */
+/*	$NetBSD: db_disasm.c,v 1.23 2018/04/29 19:01:15 ragge Exp $ */
 /*
  * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.22 2017/05/22 16:39:41 ragge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.23 2018/04/29 19:01:15 ragge Exp $");
 
 #include 
 #include 
@@ -471,7 +471,7 @@ add_int(inst_buffer *ib, int i)
 {
 	char buf[32];
 	if (i < 100 && i > -100)
-		snprintf(ib->curp, sizeof(buf), "%d", i);
+		snprintf(buf, sizeof(buf), "%d", i);
 	else
 		snprintf(buf, sizeof(buf), "0x%x", i);
 	add_str(ib, buf);



CVS commit: src

2018-04-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Apr 29 18:29:29 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: ad.aarch64
src/external/bsd/llvm/include: Makefile

Log Message:
Install ARM ACLE and NEON intrinsics headers on aarch64.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/distrib/sets/lists/comp/ad.aarch64
cvs rdiff -u -r1.41 -r1.42 src/external/bsd/llvm/include/Makefile

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/comp/ad.aarch64
diff -u src/distrib/sets/lists/comp/ad.aarch64:1.18 src/distrib/sets/lists/comp/ad.aarch64:1.19
--- src/distrib/sets/lists/comp/ad.aarch64:1.18	Sun Apr  1 04:35:02 2018
+++ src/distrib/sets/lists/comp/ad.aarch64	Sun Apr 29 18:29:29 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ad.aarch64,v 1.18 2018/04/01 04:35:02 ryo Exp $
+# $NetBSD: ad.aarch64,v 1.19 2018/04/29 18:29:29 jmcneill Exp $
 ./usr/include/aarch64comp-c-include
 ./usr/include/aarch64/ansi.h			comp-c-include
 ./usr/include/aarch64/aout_machdep.h		comp-c-include
@@ -114,6 +114,8 @@
 ./usr/include/arm/vfpreg.h			comp-c-include
 ./usr/include/arm/vmparam.h			comp-c-include
 ./usr/include/arm/wchar_limits.h		comp-c-include
+./usr/include/clang-5.0/arm_acle.h		comp-c-include		llvm
+./usr/include/clang-5.0/arm_neon.h		comp-c-include		llvm
 ./usr/include/evbarmcomp-c-include
 ./usr/include/evbarm/disklabel.h		comp-c-include
 ./usr/include/evbarm/intr.h			comp-c-include

Index: src/external/bsd/llvm/include/Makefile
diff -u src/external/bsd/llvm/include/Makefile:1.41 src/external/bsd/llvm/include/Makefile:1.42
--- src/external/bsd/llvm/include/Makefile:1.41	Tue Aug  1 20:07:40 2017
+++ src/external/bsd/llvm/include/Makefile	Sun Apr 29 18:29:29 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.41 2017/08/01 20:07:40 joerg Exp $
+#	$NetBSD: Makefile,v 1.42 2018/04/29 18:29:29 jmcneill Exp $
 
 .include 
 
@@ -69,7 +69,7 @@ INCS=	__wmmintrin_aes.h \
 INCS=	altivec.h \
 	htmintrin.h \
 	htmxlintrin.h
-.elif ${MACHINE_CPU} == "arm"
+.elif ${MACHINE_CPU} == "arm" || ${MACHINE_CPU} == "aarch64"
 INCS=	arm_acle.h \
 	arm_neon.h
 .elif ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "mips64"



CVS commit: src/usr.bin/kdump

2018-04-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 29 18:00:31 UTC 2018

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
print the mprotect perm argument symbolically.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/usr.bin/kdump/kdump.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/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.129 src/usr.bin/kdump/kdump.c:1.130
--- src/usr.bin/kdump/kdump.c:1.129	Sun Sep 10 06:09:40 2017
+++ src/usr.bin/kdump/kdump.c	Sun Apr 29 14:00:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.129 2017/09/10 10:09:40 wiz Exp $	*/
+/*	$NetBSD: kdump.c,v 1.130 2018/04/29 18:00:31 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.129 2017/09/10 10:09:40 wiz Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.130 2018/04/29 18:00:31 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -516,6 +516,37 @@ ioctldecode(u_long cmd)
 }
 
 static void
+putprot(int pr)
+{
+	const char *s = "";
+
+	if (pr == PROT_NONE) {
+		fputs("PROT_NONE", stdout);
+		return;
+	}
+
+	if (pr & PROT_READ) {
+		fputs("PROT_READ", stdout);
+		s = "|";
+		pr &= ~PROT_READ;
+	}
+
+	if (pr & PROT_WRITE) {
+		printf("%sPROT_WRITE", s);
+		pr &= ~PROT_WRITE;
+		s = "|";
+	}
+	if (pr & PROT_EXEC) {
+		printf("%sPROT_EXEC", s);
+		pr &= ~PROT_EXEC;
+		s = "|";
+	}
+	if (pr) {
+		printf("%s%#lx", s, (long)pr);
+	}
+}
+
+static void
 ktrsyscall(struct ktr_syscall *ktr)
 {
 	int argcount;
@@ -602,6 +633,17 @@ ktrsyscall(struct ktr_syscall *ktr)
 			ap += 2;
 			argcount -= 2;
 			c = ',';
+		} else if (strcmp(sys_name, "mprotect") == 0 && argcount >= 3) {
+			putchar('(');
+			output_long((long)ap[0], !(decimal || small(ap[0])));
+			c = ',';
+			putchar(c);
+			output_long((long)ap[1], !(decimal || small(ap[1])));
+			putchar(c);
+			putprot(ap[2]);
+			ap += 3;
+			argcount -= 3;
+			c = ',';
 		} else if (strcmp(sys_name, "mmap") == 0 && argcount >= 6) {
 			char buf[1024];
 			putchar('(');
@@ -610,30 +652,7 @@ ktrsyscall(struct ktr_syscall *ktr)
 			putchar(c);
 			output_long((long)ap[1], !(decimal || small(ap[1])));
 			putchar(c);
-			if (ap[2] == PROT_NONE) {
-			fputs("PROT_NONE", stdout);
-			} else {
-			const char *s = "";
-			c = 0;
-			if (ap[2] & PROT_READ) {
-fputs("PROT_READ", stdout);
-s = "|";
-ap[2] &= ~PROT_READ;
-			}
-			if (ap[2] & PROT_WRITE) {
-printf("%sPROT_WRITE", s);
-ap[2] &= ~PROT_WRITE;
-s = "|";
-			}
-			if (ap[2] & PROT_EXEC) {
-printf("%sPROT_EXEC", s);
-ap[2] &= ~PROT_EXEC;
-s = "|";
-			}
-			if (ap[2]) {
-printf("%s%#lx", s, (long)ap[2]);
-			}
-			}
+			putprot(ap[2]);
 			snprintb(buf, sizeof(buf), MAP_FMT, ap[3]);
 			printf(",%s", buf);
 			ap += 4;



CVS commit: src/lib/libc/compat/arch/aarch64

2018-04-29 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Apr 29 17:47:06 UTC 2018

Modified Files:
src/lib/libc/compat/arch/aarch64: Makefile.inc
Added Files:
src/lib/libc/compat/arch/aarch64/sys: Makefile.inc compat_Ovfork.S
compat___semctl.S compat___sigreturn14.S compat_msgctl.S
compat_quotactl.S compat_shmctl.S compat_sigaction.S
compat_sigpending.S compat_sigprocmask.S compat_sigreturn.S
compat_sigsuspend.S

Log Message:
Add some compat stubs for aarch64. Not providing any actual compatibility
with old binaries (there are none), but having these symbols helps GNU
configure scripts.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/compat/arch/aarch64/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/compat/arch/aarch64/sys/Makefile.inc \
src/lib/libc/compat/arch/aarch64/sys/compat_Ovfork.S \
src/lib/libc/compat/arch/aarch64/sys/compat___semctl.S \
src/lib/libc/compat/arch/aarch64/sys/compat___sigreturn14.S \
src/lib/libc/compat/arch/aarch64/sys/compat_msgctl.S \
src/lib/libc/compat/arch/aarch64/sys/compat_quotactl.S \
src/lib/libc/compat/arch/aarch64/sys/compat_shmctl.S \
src/lib/libc/compat/arch/aarch64/sys/compat_sigaction.S \
src/lib/libc/compat/arch/aarch64/sys/compat_sigpending.S \
src/lib/libc/compat/arch/aarch64/sys/compat_sigprocmask.S \
src/lib/libc/compat/arch/aarch64/sys/compat_sigreturn.S \
src/lib/libc/compat/arch/aarch64/sys/compat_sigsuspend.S

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/compat/arch/aarch64/Makefile.inc
diff -u src/lib/libc/compat/arch/aarch64/Makefile.inc:1.1 src/lib/libc/compat/arch/aarch64/Makefile.inc:1.2
--- src/lib/libc/compat/arch/aarch64/Makefile.inc:1.1	Sun Aug 10 05:47:37 2014
+++ src/lib/libc/compat/arch/aarch64/Makefile.inc	Sun Apr 29 17:47:06 2018
@@ -1 +1,3 @@
-# $NetBSD: Makefile.inc,v 1.1 2014/08/10 05:47:37 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.2 2018/04/29 17:47:06 jmcneill Exp $
+
+.include "${COMPATARCHDIR}/sys/Makefile.inc"

Added files:

Index: src/lib/libc/compat/arch/aarch64/sys/Makefile.inc
diff -u /dev/null src/lib/libc/compat/arch/aarch64/sys/Makefile.inc:1.1
--- /dev/null	Sun Apr 29 17:47:06 2018
+++ src/lib/libc/compat/arch/aarch64/sys/Makefile.inc	Sun Apr 29 17:47:06 2018
@@ -0,0 +1,8 @@
+#	$NetBSD: Makefile.inc,v 1.1 2018/04/29 17:47:06 jmcneill Exp $
+
+SRCS+=compat_Ovfork.S compat___semctl.S compat___sigreturn14.S \
+compat_msgctl.S compat_shmctl.S compat_sigaction.S \
+compat_sigpending.S compat_sigprocmask.S compat_sigreturn.S \
+compat_sigsuspend.S compat_quotactl.S
+
+#SRCS+=compat___sigtramp1.S
Index: src/lib/libc/compat/arch/aarch64/sys/compat_Ovfork.S
diff -u /dev/null src/lib/libc/compat/arch/aarch64/sys/compat_Ovfork.S:1.1
--- /dev/null	Sun Apr 29 17:47:06 2018
+++ src/lib/libc/compat/arch/aarch64/sys/compat_Ovfork.S	Sun Apr 29 17:47:06 2018
@@ -0,0 +1,40 @@
+/*	$NetBSD: compat_Ovfork.S,v 1.1 2018/04/29 17:47:06 jmcneill Exp $	*/
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ *	from: @(#)Ovfork.s	5.1 (Berkeley) 4/23/90
+ */
+
+#include "SYS.h"
+
+WARN_REFERENCES(vfork, \
+"warning: reference to compatibility vfork(); include  for correct reference")
+
+PSEUDO(vfork,__vfork14)
+
Index: 

CVS commit: src/external/bsd/ipf/dist/ipsend

2018-04-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 29 15:59:07 UTC 2018

Modified Files:
src/external/bsd/ipf/dist/ipsend: ipsend.h

Log Message:
fix the build: tcpiphdr is now defined in tcp_var.h and tcp_var.h needs
tcp_timer.h. This struct move is more trouble than its worth. It breaks
header compatibility with other BSD's and can't be really removed because
it is an installed header that will break other 3rd party software. I
suggest that it gets reverted!


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/external/bsd/ipf/dist/ipsend/ipsend.h

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/ipf/dist/ipsend/ipsend.h
diff -u src/external/bsd/ipf/dist/ipsend/ipsend.h:1.1.1.2 src/external/bsd/ipf/dist/ipsend/ipsend.h:1.2
--- src/external/bsd/ipf/dist/ipsend/ipsend.h:1.1.1.2	Sun Jul 22 09:44:36 2012
+++ src/external/bsd/ipf/dist/ipsend/ipsend.h	Sun Apr 29 11:59:07 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsend.h,v 1.1.1.2 2012/07/22 13:44:36 darrenr Exp $	*/
+/*	$NetBSD: ipsend.h,v 1.2 2018/04/29 15:59:07 christos Exp $	*/
 
 /*
  * ipsend.h (C) 1997-1998 Darren Reed
@@ -29,7 +29,9 @@
 #ifdef	linux
 #include 
 #endif
-#include "netinet/tcpip.h"
+#include 
+#include 
+#include 
 #include "ipt.h"
 
 extern	int	resolve __P((char *, char *));



CVS commit: src/external/gpl2/xcvs/dist/src

2018-04-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 29 15:47:01 UTC 2018

Modified Files:
src/external/gpl2/xcvs/dist/src: create_adm.c

Log Message:
keep going if there is a CVS directory already, but warn


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/gpl2/xcvs/dist/src/create_adm.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/gpl2/xcvs/dist/src/create_adm.c
diff -u src/external/gpl2/xcvs/dist/src/create_adm.c:1.2 src/external/gpl2/xcvs/dist/src/create_adm.c:1.3
--- src/external/gpl2/xcvs/dist/src/create_adm.c:1.2	Tue May 17 10:00:09 2016
+++ src/external/gpl2/xcvs/dist/src/create_adm.c	Sun Apr 29 11:47:01 2018
@@ -16,7 +16,7 @@
  * "Entries" file is prefilled from the "initrecord" argument.
  */
 #include 
-__RCSID("$NetBSD: create_adm.c,v 1.2 2016/05/17 14:00:09 christos Exp $");
+__RCSID("$NetBSD: create_adm.c,v 1.3 2018/04/29 15:47:01 christos Exp $");
 
 #include "cvs.h"
 
@@ -49,7 +49,9 @@ Create_Admin (const char *dir, const cha
 
 tmp = Xasprintf ("%s/%s", dir, CVSADM);
 if (isfile (tmp))
-	error (1, 0, "there is a version in %s already", update_dir);
+{
+	error (0, 0, "there is a version in %s already", update_dir);
+}
 
 if (CVS_MKDIR (tmp, 0777) < 0)
 {



CVS commit: src/sys/netipsec

2018-04-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 29 14:54:09 UTC 2018

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

Log Message:
Remove useless icmp6.h include, remove manual externs and include in6.h
to get proper definitions, and remove duplicate logic in
ipsec6_common_input_cb.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/netipsec/ipsec_input.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_input.c
diff -u src/sys/netipsec/ipsec_input.c:1.68 src/sys/netipsec/ipsec_input.c:1.69
--- src/sys/netipsec/ipsec_input.c:1.68	Sun Apr 29 14:35:35 2018
+++ src/sys/netipsec/ipsec_input.c	Sun Apr 29 14:54:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_input.c,v 1.68 2018/04/29 14:35:35 maxv Exp $	*/
+/*	$NetBSD: ipsec_input.c,v 1.69 2018/04/29 14:54:09 maxv Exp $	*/
 /*	$FreeBSD: ipsec_input.c,v 1.2.4.2 2003/03/28 20:32:53 sam Exp $	*/
 /*	$OpenBSD: ipsec_input.c,v 1.63 2003/02/20 18:35:43 deraadt Exp $	*/
 
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.68 2018/04/29 14:35:35 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.69 2018/04/29 14:54:09 maxv Exp $");
 
 /*
  * IPsec input processing.
@@ -72,14 +72,12 @@ __KERNEL_RCSID(0, "$NetBSD: ipsec_input.
 
 #include 
 #ifdef INET6
+#include 
 #include 
 #include 
 #include 
 #endif
 #include 
-#ifdef INET6
-#include 
-#endif
 
 #include 
 #include 
@@ -377,7 +375,7 @@ cantpull:
 
 	M_VERIFY_PACKET(m);
 
-	key_sa_recordxfer(sav, m);		/* record data transfer */
+	key_sa_recordxfer(sav, m);
 
 	if ((inetsw[ip_protox[prot]].pr_flags & PR_LASTHDR) != 0 &&
 	ipsec_in_reject(m, NULL)) {
@@ -446,9 +444,6 @@ ipsec6_common_input(struct mbuf **mp, in
 	return IPPROTO_DONE;
 }
 
-extern const struct ip6protosw inet6sw[];
-extern u_char ip6_protox[];
-
 /*
  * IPsec input callback, called by the transform callback. Takes care of
  * filtering and other sanity checks on the processed packet.
@@ -461,7 +456,7 @@ ipsec6_common_input_cb(struct mbuf *m, s
 	struct ip6_hdr *ip6;
 	struct secasindex *saidx;
 	int nxt;
-	u_int8_t prot, nxt8;
+	u_int8_t prot;
 	int error, nest;
 
 	if (__predict_false(m == NULL)) {
@@ -493,20 +488,16 @@ ipsec6_common_input_cb(struct mbuf *m, s
 	ip6 = mtod(m, struct ip6_hdr *);
 	ip6->ip6_plen = htons(m->m_pkthdr.len - sizeof(struct ip6_hdr));
 
-	/* Save protocol */
-	m_copydata(m, protoff, 1, );
+	m_copydata(m, protoff, sizeof(prot), );
 
 	key_sa_recordxfer(sav, m);
 
-	/* Retrieve new protocol */
-	m_copydata(m, protoff, sizeof(u_int8_t), );
-
 	/*
 	 * See the end of ip6_input for this logic.
 	 * IPPROTO_IPV[46] case will be processed just like other ones
 	 */
 	nest = 0;
-	nxt = nxt8;
+	nxt = prot;
 	while (nxt != IPPROTO_DONE) {
 		if (ip6_hdrnestlimit && (++nest > ip6_hdrnestlimit)) {
 			IP6_STATINC(IP6_STAT_TOOMANYHDR);



CVS commit: src/sys/netipsec

2018-04-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 29 14:35:36 UTC 2018

Modified Files:
src/sys/netipsec: ipsec_input.c xform_ipip.c

Log Message:
Remove obsolete/dead code, the IP-in-IP encapsulation doesn't work this
way anymore (XF_IP4 partly dropped by FAST_IPSEC).


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/netipsec/ipsec_input.c
cvs rdiff -u -r1.69 -r1.70 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_input.c
diff -u src/sys/netipsec/ipsec_input.c:1.67 src/sys/netipsec/ipsec_input.c:1.68
--- src/sys/netipsec/ipsec_input.c:1.67	Sat Apr 28 15:45:16 2018
+++ src/sys/netipsec/ipsec_input.c	Sun Apr 29 14:35:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_input.c,v 1.67 2018/04/28 15:45:16 maxv Exp $	*/
+/*	$NetBSD: ipsec_input.c,v 1.68 2018/04/29 14:35:35 maxv Exp $	*/
 /*	$FreeBSD: ipsec_input.c,v 1.2.4.2 2003/03/28 20:32:53 sam Exp $	*/
 /*	$OpenBSD: ipsec_input.c,v 1.63 2003/02/20 18:35:43 deraadt Exp $	*/
 
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.67 2018/04/28 15:45:16 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.68 2018/04/29 14:35:35 maxv Exp $");
 
 /*
  * IPsec input processing.
@@ -375,84 +375,6 @@ cantpull:
 
 	prot = ip->ip_p;
 
-#ifdef notyet
-	/* IP-in-IP encapsulation */
-	if (prot == IPPROTO_IPIP) {
-		struct ip ipn;
-
-		/* ipn will now contain the inner IPv4 header */
-		/* XXX: check m_pkthdr.len */
-		m_copydata(m, ip->ip_hl << 2, sizeof(struct ip), );
-
-		/* XXX PROXY address isn't recorded in SAH */
-		/*
-		 * Check that the inner source address is the same as
-		 * the proxy address, if available.
-		 */
-		if ((saidx->proxy.sa.sa_family == AF_INET &&
-		saidx->proxy.sin.sin_addr.s_addr !=
-		INADDR_ANY &&
-		ipn.ip_src.s_addr !=
-		saidx->proxy.sin.sin_addr.s_addr) ||
-		(saidx->proxy.sa.sa_family != AF_INET &&
-			saidx->proxy.sa.sa_family != 0)) {
-
-			char ipbuf[INET_ADDRSTRLEN];
-			IPSECLOG(LOG_DEBUG,
-			"inner source address %s doesn't correspond to "
-			"expected proxy source %s, SA %s/%08lx\n",
-			IN_PRINT(ipbuf, ipn.ip_src),
-			ipsp_address(saidx->proxy),
-			ipsp_address(saidx->dst),
-			(u_long) ntohl(sav->spi));
-
-			IPSEC_ISTAT(sproto, ESP_STAT_PDROPS,
-			AH_STAT_PDROPS,
-			IPCOMP_STAT_PDROPS);
-			error = EACCES;
-			goto bad;
-		}
-	}
-#if INET6
-	/* IPv6-in-IP encapsulation. */
-	if (prot == IPPROTO_IPV6) {
-		struct ip6_hdr ip6n;
-
-		/* ip6n will now contain the inner IPv6 header. */
-		/* XXX: check m_pkthdr.len */
-		m_copydata(m, ip->ip_hl << 2, sizeof(struct ip6_hdr), );
-
-		/*
-		 * Check that the inner source address is the same as
-		 * the proxy address, if available.
-		 */
-		if ((saidx->proxy.sa.sa_family == AF_INET6 &&
-		!IN6_IS_ADDR_UNSPECIFIED(>proxy.sin6.sin6_addr) &&
-		!IN6_ARE_ADDR_EQUAL(_src,
-			>proxy.sin6.sin6_addr)) ||
-		(saidx->proxy.sa.sa_family != AF_INET6 &&
-			saidx->proxy.sa.sa_family != 0)) {
-
-			char ip6buf[INET6_ADDRSTRLEN];
-			char pbuf[IPSEC_ADDRSTRLEN], dbuf[IPSEC_ADDRSTRLEN];
-			IPSECLOG(LOG_DEBUG,
-			"inner source address %s doesn't correspond to "
-			"expected proxy source %s, SA %s/%08lx\n",
-			ip6_sprintf(ip6buf, _src),
-			ipsec_address(>proxy, pbuf, sizeof(pbuf)),
-			ipsec_address(>dst, dbuf, sizeof(dbuf)),
-			(u_long) ntohl(sav->spi));
-
-			IPSEC_ISTAT(sproto, ESP_STAT_PDROPS,
-			AH_STAT_PDROPS,
-			IPCOMP_STAT_PDROPS);
-			error = EACCES;
-			goto bad;
-		}
-	}
-#endif /* INET6 */
-#endif /* notyet */
-
 	M_VERIFY_PACKET(m);
 
 	key_sa_recordxfer(sav, m);		/* record data transfer */
@@ -574,80 +496,6 @@ ipsec6_common_input_cb(struct mbuf *m, s
 	/* Save protocol */
 	m_copydata(m, protoff, 1, );
 
-#ifdef notyet
-#ifdef INET
-	/* IP-in-IP encapsulation */
-	if (prot == IPPROTO_IPIP) {
-		struct ip ipn;
-
-		/* ipn will now contain the inner IPv4 header */
-		/* XXX: check m_pkthdr.len */
-		m_copydata(m, skip, sizeof(struct ip), );
-
-		/*
-		 * Check that the inner source address is the same as
-		 * the proxy address, if available.
-		 */
-		if ((saidx->proxy.sa.sa_family == AF_INET &&
-		saidx->proxy.sin.sin_addr.s_addr != INADDR_ANY &&
-		ipn.ip_src.s_addr != saidx->proxy.sin.sin_addr.s_addr) ||
-		(saidx->proxy.sa.sa_family != AF_INET &&
-			saidx->proxy.sa.sa_family != 0)) {
-
-			char ipbuf[INET_ADDRSTRLEN];
-			char pbuf[IPSEC_ADDRSTRLEN], dbuf[IPSEC_ADDRSTRLEN];
-			IPSECLOG(LOG_DEBUG,
-			"inner source address %s doesn't correspond to "
-			"expected proxy source %s, SA %s/%08lx\n",
-			IN_PRINT(ipbuf, ipn.ip_src),
-			ipsec_address(>proxy, pbuf, sizeof(pbuf)),
-			ipsec_address(>dst, dbuf, sizeof(dbuf)),
-			(u_long) ntohl(sav->spi));
-
-			IPSEC_ISTAT(sproto, ESP_STAT_PDROPS,
-			AH_STAT_PDROPS, 

CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2018-04-29 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Apr 29 14:21:16 UTC 2018

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: libnetpgp.3

Log Message:
Add the following functions to the list (TODO - add descriptions)
netpgp_unsetvar
netpgp_list_keys_json
netpgp_match_keys
netpgp_match_keys_json
netpgp_match_pubkeys
netpgp_validate_sigs
netpgp_format_json

Remove netpgp_match_list_keys() as function does not exist

Add missing output file to netpgp_verify_file() argument list

Sprinkle const to arguments


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 \
src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.22 src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.23
--- src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3:1.22	Mon Apr 16 08:17:18 2018
+++ src/crypto/external/bsd/netpgp/dist/src/lib/libnetpgp.3	Sun Apr 29 14:21:16 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: libnetpgp.3,v 1.22 2018/04/16 08:17:18 wiz Exp $
+.\" $NetBSD: libnetpgp.3,v 1.23 2018/04/29 14:21:16 sevan Exp $
 .\"
 .\" Copyright (c) 2009,2010 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 April 15, 2018
+.Dd April 29, 2018
 .Dt LIBNETPGP 3
 .Os
 .Sh NAME
@@ -79,6 +79,10 @@ The following functions are for variable
 .Fo netpgp_incvar
 .Fa "netpgp_t *netpgp" "const char *name" "const int delta"
 .Fc
+.Ft int
+.Fo netpgp_unsetvar
+.Fa "netpgp_t *netpgp" "const char *name"
+.Fc
 .Pp
 The following function sets the home directory:
 .Ft int
@@ -92,8 +96,20 @@ The following functions are used for key
 .Fa "netpgp_t *netpgp" "const int printsigs"
 .Fc
 .Ft int
-.Fo netpgp_match_list_keys
-.Fa "netpgp_t *netpgp" "char *pattern"
+.Fo netpgp_list_keys_json
+.Fa "netpgp_t *netpgp" "char **json" "const int psigs"
+.Fc
+.Ft int
+.Fo netpgp_match_keys
+.Fa "netpgp_t *netpgp" "char *name" "const char *fmt" "void *vp" "const int psigs"
+.Fc
+.Ft int
+.Fo netpgp_match_keys_json
+.Fa "netpgp_t *netpgp" "char **json" "char *name" "const char *fmt" "const int psigs"
+.Fc
+.Ft int
+.Fo netpgp_match_pubkeys
+.Fa "netpgp_t *netpgp" "char *name" "void *vp"
 .Fc
 .Ft int
 .Fo netpgp_find_key
@@ -101,7 +117,7 @@ The following functions are used for key
 .Fc
 .Ft char *
 .Fo netpgp_get_key
-.Fa "netpgp_t *netpgp" "const char *id"
+.Fa "netpgp_t *netpgp" "const char *name" "const char *fmt"
 .Fc
 .Ft int
 .Fo netpgp_export_key
@@ -115,31 +131,39 @@ The following functions are used for key
 .Fo netpgp_generate_key
 .Fa "netpgp_t *netpgp" "char *userid" "int numbits"
 .Fc
+.Ft int
+.Fo netpgp_validate_sigs
+.Fa "netpgp_t *netpgp"
+.Fc
+.Ft int
+.Fo netpgp_format_json
+.Fa "void *vp" "const char *json" "const int psigs"
+.Fc
 .Pp
 The following functions are used for file management:
 .Ft int
 .Fo netpgp_encrypt_file
-.Fa "netpgp_t *netpgp" "char *userid" "char *filename" "char *out"
+.Fa "netpgp_t *netpgp" "const char *userid" "const char *filename" "char *out"
 .Fa "int armored"
 .Fc
 .Ft int
 .Fo netpgp_decrypt_file
-.Fa "netpgp_t *netpgp" "char *filename" "char *out" "int armored"
+.Fa "netpgp_t *netpgp" "const char *filename" "char *out" "int armored"
 .Fc
 .Ft int
 .Fo netpgp_sign_file
-.Fa "netpgp_t *netpgp" "char *userid" "char *filename" "char *out"
+.Fa "netpgp_t *netpgp" "const char *userid" "const char *filename" "char *out"
 .Fa "int armored" "int cleartext" "int detached"
 .Fc
 .Ft int
 .Fo netpgp_verify_file
-.Fa "netpgp_t *netpgp" "char *f" "int armored"
+.Fa "netpgp_t *netpgp" "const char *in" "const char *out" "int armored"
 .Fc
 .Pp
 The following functions are used for memory signing and encryption:
 .Ft int
 .Fo netpgp_encrypt_memory
-.Fa "netpgp_t *netpgp" "char *userid" "void *in" "const size_t insize"
+.Fa "netpgp_t *netpgp" "const char *userid" "void *in" "const size_t insize"
 .Fa "char *out" "size_t outsize" "int armored"
 .Fc
 .Ft int
@@ -206,13 +230,6 @@ To list all the keys in a keyring, the
 function is used.
 The signature subkey fields can also be displayed
 using this function.
-The
-.Fn netpgp_match_list_keys
-function is used to match (via regular expression)
-a subset of the keys in the keyring.
-If the expression to match is NULL,
-the search will degenerate into a
-listing of all keys in the keyring.
 .Pp
 The home directory is specified as an internal variable,
 and its existence is checked using the



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

2018-04-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Apr 29 13:56:01 UTC 2018

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

Log Message:
Add two new ptrace(2) ATF tests

Added:

 - traceme_pid1_parent
   Assert that a process cannot mark its parent a debugger twice

 - traceme_twice
   Verify that PT_TRACE_ME is not allowed when our parent is PID1

All tests pass.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_ptrace.c
cvs rdiff -u -r1.36 -r1.37 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace.c
diff -u src/tests/lib/libc/sys/t_ptrace.c:1.1 src/tests/lib/libc/sys/t_ptrace.c:1.2
--- src/tests/lib/libc/sys/t_ptrace.c:1.1	Sun Apr  2 21:44:00 2017
+++ src/tests/lib/libc/sys/t_ptrace.c	Sun Apr 29 13:56:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace.c,v 1.1 2017/04/02 21:44:00 kamil Exp $	*/
+/*	$NetBSD: t_ptrace.c,v 1.2 2018/04/29 13:56:00 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace.c,v 1.1 2017/04/02 21:44:00 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace.c,v 1.2 2018/04/29 13:56:00 kamil Exp $");
 
 #include 
 #include 
@@ -194,6 +194,25 @@ ATF_TC_BODY(attach_chroot, tc)
 ATF_REQUIRE(close(fds_toparent[0]) == 0);
 }
 
+ATF_TC(traceme_twice);
+ATF_TC_HEAD(traceme_twice, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Assert that a process cannot mark its parent a debugger twice");
+}
+
+ATF_TC_BODY(traceme_twice, tc)
+{
+
+	printf("Mark the parent process (PID %d) a debugger of PID %d",
+	   getppid(), getpid());
+	ATF_REQUIRE(ptrace(PT_TRACE_ME, 0, NULL, 0) == 0);
+
+	printf("Mark the parent process (PID %d) a debugger of PID %d again",
+	   getppid(), getpid());
+	ATF_REQUIRE_ERRNO(EBUSY, ptrace(PT_TRACE_ME, 0, NULL, 0) == -1);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 	setvbuf(stdout, NULL, _IONBF, 0);
@@ -203,6 +222,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, attach_pid1_securelevel);
 	ATF_TP_ADD_TC(tp, attach_self);
 	ATF_TP_ADD_TC(tp, attach_chroot);
+	ATF_TP_ADD_TC(tp, traceme_twice);
 
 	return atf_no_error();
 }

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.36 src/tests/lib/libc/sys/t_ptrace_wait.c:1.37
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.36	Sat Apr 28 19:00:25 2018
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Sun Apr 29 13:56:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.36 2018/04/28 19:00:25 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.37 2018/04/29 13:56:00 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.36 2018/04/28 19:00:25 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.37 2018/04/29 13:56:00 kamil Exp $");
 
 #include 
 #include 
@@ -319,6 +319,65 @@ TRACEME_SIGNAL_NOHANDLER(traceme_signal_
 
 /// 
 
+ATF_TC(traceme_pid1_parent);
+ATF_TC_HEAD(traceme_pid1_parent, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Verify that PT_TRACE_ME is not allowed when our parent is PID1");
+}
+
+ATF_TC_BODY(traceme_pid1_parent, tc)
+{
+	struct msg_fds parent_child;
+	int exitval_child1 = 1, exitval_child2 = 2;
+	pid_t child1, child2, wpid;
+	uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */
+#if defined(TWAIT_HAVE_STATUS)
+	int status;
+#endif
+
+	SYSCALL_REQUIRE(msg_open(_child) == 0);
+
+	DPRINTF("Before forking process PID=%d\n", getpid());
+	SYSCALL_REQUIRE((child1 = fork()) != -1);
+	if (child1 == 0) {
+		DPRINTF("Before forking process PID=%d\n", getpid());
+		SYSCALL_REQUIRE((child2 = fork()) != -1);
+		if (child2 != 0) {
+			DPRINTF("Parent process PID=%d, child2's PID=%d\n",
+			getpid(), child2);
+			_exit(exitval_child1);
+		}
+		CHILD_FROM_PARENT("exit child1", parent_child, msg);
+
+		DPRINTF("Assert that our parent is PID1 (initproc)\n");
+		FORKEE_ASSERT_EQ(getppid(), 1);
+
+		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
+		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) == -1);
+		SYSCALL_REQUIRE_ERRNO(errno, EPERM);
+
+		CHILD_TO_PARENT("child2 exiting", parent_child, msg);
+
+		_exit(exitval_child2);
+	}
+	DPRINTF("Parent process PID=%d, child1's PID=%d\n", getpid(), child1);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child1, , WEXITED),
+	  child1);
+
+	validate_status_exited(status, exitval_child1);
+
+	DPRINTF("Notify that child1 is dead\n");
+	PARENT_TO_CHILD("exit child1", parent_child, msg);
+
+	DPRINTF("Wait for exiting of child2\n");
+	PARENT_FROM_CHILD("child2 exiting", parent_child, msg);
+}
+
+/// 

CVS commit: src/sys/netinet

2018-04-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 29 12:12:42 UTC 2018

Modified Files:
src/sys/netinet: tcp_var.h tcpip.h

Log Message:
Move struct tcpiphdr from tcpip.h to tcp_var.h, to match UDP (udpiphdr in
udp_var.h).

tcpip.h is now empty, and can be removed.


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 src/sys/netinet/tcp_var.h
cvs rdiff -u -r1.11 -r1.12 src/sys/netinet/tcpip.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/tcp_var.h
diff -u src/sys/netinet/tcp_var.h:1.185 src/sys/netinet/tcp_var.h:1.186
--- src/sys/netinet/tcp_var.h:1.185	Wed Mar 28 14:22:16 2018
+++ src/sys/netinet/tcp_var.h	Sun Apr 29 12:12:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_var.h,v 1.185 2018/03/28 14:22:16 maxv Exp $	*/
+/*	$NetBSD: tcp_var.h,v 1.186 2018/04/29 12:12:42 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -142,7 +142,7 @@
 #endif
 
 /*
- * Kernel variables for tcp.
+ * TCP kernel structures and variables.
  */
 
 #include 
@@ -163,6 +163,29 @@
 #endif /* TCP_SIGNATURE */
 
 /*
+ * Tcp+ip header, after ip options removed.
+ */
+struct tcpiphdr {
+	struct ipovly ti_i;		/* overlaid ip structure */
+	struct tcphdr ti_t;		/* tcp header */
+} __packed;
+#define	ti_x1		ti_i.ih_x1
+#define	ti_pr		ti_i.ih_pr
+#define	ti_len		ti_i.ih_len
+#define	ti_src		ti_i.ih_src
+#define	ti_dst		ti_i.ih_dst
+#define	ti_sport	ti_t.th_sport
+#define	ti_dport	ti_t.th_dport
+#define	ti_seq		ti_t.th_seq
+#define	ti_ack		ti_t.th_ack
+#define	ti_x2		ti_t.th_x2
+#define	ti_off		ti_t.th_off
+#define	ti_flags	ti_t.th_flags
+#define	ti_win		ti_t.th_win
+#define	ti_sum		ti_t.th_sum
+#define	ti_urp		ti_t.th_urp
+
+/*
  * SACK option block.
  */
 struct sackblk {

Index: src/sys/netinet/tcpip.h
diff -u src/sys/netinet/tcpip.h:1.11 src/sys/netinet/tcpip.h:1.12
--- src/sys/netinet/tcpip.h:1.11	Tue Dec 25 18:33:47 2007
+++ src/sys/netinet/tcpip.h	Sun Apr 29 12:12:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcpip.h,v 1.11 2007/12/25 18:33:47 perry Exp $	*/
+/*	$NetBSD: tcpip.h,v 1.12 2018/04/29 12:12:42 maxv Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -34,27 +34,5 @@
 #ifndef _NETINET_TCPIP_H_
 #define _NETINET_TCPIP_H_
 
-/*
- * Tcp+ip header, after ip options removed.
- */
-struct tcpiphdr {
-	struct 	ipovly ti_i;		/* overlaid ip structure */
-	struct	tcphdr ti_t;		/* tcp header */
-} __packed;
-#define	ti_x1		ti_i.ih_x1
-#define	ti_pr		ti_i.ih_pr
-#define	ti_len		ti_i.ih_len
-#define	ti_src		ti_i.ih_src
-#define	ti_dst		ti_i.ih_dst
-#define	ti_sport	ti_t.th_sport
-#define	ti_dport	ti_t.th_dport
-#define	ti_seq		ti_t.th_seq
-#define	ti_ack		ti_t.th_ack
-#define	ti_x2		ti_t.th_x2
-#define	ti_off		ti_t.th_off
-#define	ti_flags	ti_t.th_flags
-#define	ti_win		ti_t.th_win
-#define	ti_sum		ti_t.th_sum
-#define	ti_urp		ti_t.th_urp
 
 #endif /* !_NETINET_TCPIP_H_ */



CVS commit: src/sys/arch/aarch64/aarch64

2018-04-29 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sun Apr 29 12:07:05 UTC 2018

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

Log Message:
fix KASSERT panic. pv_entry may not be exists in pvlist when pmap_remove().


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/aarch64/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/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.4 src/sys/arch/aarch64/aarch64/pmap.c:1.5
--- src/sys/arch/aarch64/aarch64/pmap.c:1.4	Sun Apr 29 12:05:39 2018
+++ src/sys/arch/aarch64/aarch64/pmap.c	Sun Apr 29 12:07:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.4 2018/04/29 12:05:39 ryo Exp $	*/
+/*	$NetBSD: pmap.c,v 1.5 2018/04/29 12:07:05 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.4 2018/04/29 12:05:39 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.5 2018/04/29 12:07:05 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -91,6 +91,7 @@ PMAP_COUNTER(pdp_free, "page table page 
 
 PMAP_COUNTER(pv_enter, "pv_entry allocate and link");
 PMAP_COUNTER(pv_remove, "pv_entry free and unlink");
+PMAP_COUNTER(pv_remove_nopv, "no pv_entry found when removing pv");
 
 PMAP_COUNTER(activate, "pmap_activate call");
 PMAP_COUNTER(deactivate, "pmap_deactivate call");
@@ -867,16 +868,18 @@ _pmap_remove_pv(struct vm_page *pg, stru
 
 	pmap_pv_lock(md);
 
-	/* find pv */
 	TAILQ_FOREACH(pv, >mdpg_pvhead, pv_link) {
 		if ((pm == pv->pv_pmap) && (va == pv->pv_va)) {
+			TAILQ_REMOVE(>mdpg_pvhead, pv, pv_link);
+			PMAP_COUNT(pv_remove);
 			break;
 		}
 	}
-	KASSERT(pv != NULL);
-
-	TAILQ_REMOVE(>mdpg_pvhead, pv, pv_link);
-	PMAP_COUNT(pv_remove);
+#ifdef PMAPCOUNTERS
+	if (pv == NULL) {
+		PMAP_COUNT(pv_remove_nopv);
+	}
+#endif
 
 	pmap_pv_unlock(md);
 



CVS commit: src/sys/arch/aarch64/aarch64

2018-04-29 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sun Apr 29 12:05:39 UTC 2018

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

Log Message:
delete unused code


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/aarch64/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/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.3 src/sys/arch/aarch64/aarch64/pmap.c:1.4
--- src/sys/arch/aarch64/aarch64/pmap.c:1.3	Fri Apr 27 08:07:08 2018
+++ src/sys/arch/aarch64/aarch64/pmap.c	Sun Apr 29 12:05:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.3 2018/04/27 08:07:08 ryo Exp $	*/
+/*	$NetBSD: pmap.c,v 1.4 2018/04/29 12:05:39 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3 2018/04/27 08:07:08 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.4 2018/04/29 12:05:39 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -878,13 +878,6 @@ _pmap_remove_pv(struct vm_page *pg, stru
 	TAILQ_REMOVE(>mdpg_pvhead, pv, pv_link);
 	PMAP_COUNT(pv_remove);
 
-#if 0
-	if ((md->mdpg_kenter == 0) && TAILQ_EMPTY(>mdpg_pvhead)){
-		/* remove last mapping */
-		cpu_dcache_wbinv_range(va, PAGE_SIZE);
-	}
-#endif
-
 	pmap_pv_unlock(md);
 
 	pool_cache_put(&_pmap_pv_pool, pv);



CVS commit: src/sys

2018-04-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 29 11:51:09 UTC 2018

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

Log Message:
Remove unused and misleading argument from ipsec_set_policy.


To generate a diff of this commit:
cvs rdiff -u -r1.303 -r1.304 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.206 -r1.207 src/sys/netinet6/ip6_output.c
cvs rdiff -u -r1.160 -r1.161 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.78 -r1.79 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.303 src/sys/netinet/ip_output.c:1.304
--- src/sys/netinet/ip_output.c:1.303	Sat Apr 21 13:22:06 2018
+++ src/sys/netinet/ip_output.c	Sun Apr 29 11:51:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.303 2018/04/21 13:22:06 maxv Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.304 2018/04/29 11:51:08 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.303 2018/04/21 13:22:06 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.304 2018/04/29 11:51:08 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1262,7 +1262,7 @@ ip_ctloutput(int op, struct socket *so, 
 #if defined(IPSEC)
 		case IP_IPSEC_POLICY:
 			if (ipsec_enabled) {
-error = ipsec_set_policy(inp, sopt->sopt_name,
+error = ipsec_set_policy(inp,
 sopt->sopt_data, sopt->sopt_size,
 curlwp->l_cred);
 break;

Index: src/sys/netinet6/ip6_output.c
diff -u src/sys/netinet6/ip6_output.c:1.206 src/sys/netinet6/ip6_output.c:1.207
--- src/sys/netinet6/ip6_output.c:1.206	Thu Apr 26 19:50:09 2018
+++ src/sys/netinet6/ip6_output.c	Sun Apr 29 11:51:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_output.c,v 1.206 2018/04/26 19:50:09 maxv Exp $	*/
+/*	$NetBSD: ip6_output.c,v 1.207 2018/04/29 11:51:08 maxv Exp $	*/
 /*	$KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.206 2018/04/26 19:50:09 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.207 2018/04/29 11:51:08 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1749,7 +1749,7 @@ else 	\
 #if defined(IPSEC)
 		case IPV6_IPSEC_POLICY:
 			if (ipsec_enabled) {
-error = ipsec_set_policy(in6p, optname,
+error = ipsec_set_policy(in6p,
 sopt->sopt_data, sopt->sopt_size,
 kauth_cred_get());
 break;

Index: src/sys/netipsec/ipsec.c
diff -u src/sys/netipsec/ipsec.c:1.160 src/sys/netipsec/ipsec.c:1.161
--- src/sys/netipsec/ipsec.c:1.160	Sat Apr 28 15:45:16 2018
+++ src/sys/netipsec/ipsec.c	Sun Apr 29 11:51:08 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.160 2018/04/28 15:45:16 maxv Exp $ */
+/* $NetBSD: ipsec.c,v 1.161 2018/04/29 11:51:08 maxv Exp $ */
 /* $FreeBSD: ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */
 /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.160 2018/04/28 15:45:16 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.161 2018/04/29 11:51:08 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -1151,7 +1151,7 @@ ipsec_destroy_policy(struct secpolicy *s
 }
 
 int
-ipsec_set_policy(void *inp, int optname, const void *request, size_t len,
+ipsec_set_policy(void *inp, const void *request, size_t len,
 kauth_cred_t cred)
 {
 	struct inpcb_hdr *inph = (struct inpcb_hdr *)inp;

Index: src/sys/netipsec/ipsec.h
diff -u src/sys/netipsec/ipsec.h:1.78 src/sys/netipsec/ipsec.h:1.79
--- src/sys/netipsec/ipsec.h:1.78	Sun Apr 29 07:24:38 2018
+++ src/sys/netipsec/ipsec.h	Sun Apr 29 11:51:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.h,v 1.78 2018/04/29 07:24:38 maxv Exp $	*/
+/*	$NetBSD: ipsec.h,v 1.79 2018/04/29 11:51:08 maxv Exp $	*/
 /*	$FreeBSD: 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 $	*/
 
@@ -270,7 +270,7 @@ int ipsec_init_pcbpolicy(struct socket *
 int ipsec_copy_policy(const struct inpcbpolicy *, struct inpcbpolicy *);
 u_int ipsec_get_reqlevel(const struct ipsecrequest *);
 
-int ipsec_set_policy(void *, int, const void *, size_t, kauth_cred_t);
+int ipsec_set_policy(void *, const void *, size_t, kauth_cred_t);
 int ipsec_get_policy(void *, const void *, size_t, struct mbuf **);
 int ipsec_delete_pcbpolicy(void *);
 int ipsec_in_reject(struct mbuf *, void *);



CVS commit: src/sys/sys

2018-04-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 29 11:42:09 UTC 2018

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

Log Message:
Remove unused function.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/sys/cprng.h

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

Modified files:

Index: src/sys/sys/cprng.h
diff -u src/sys/sys/cprng.h:1.13 src/sys/sys/cprng.h:1.14
--- src/sys/sys/cprng.h:1.13	Thu Apr 19 21:19:07 2018
+++ src/sys/sys/cprng.h	Sun Apr 29 11:42:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cprng.h,v 1.13 2018/04/19 21:19:07 christos Exp $ */
+/*	$NetBSD: cprng.h,v 1.14 2018/04/29 11:42:09 maxv Exp $ */
 
 /*-
  * Copyright (c) 2011-2013 The NetBSD Foundation, Inc.
@@ -87,10 +87,4 @@ cprng_strong64(void)
 	return r;
 }
 
-static __inline unsigned int
-cprng_strong_strength(cprng_strong_t *c)
-{
-	return NIST_BLOCK_KEYLEN_BYTES;
-}
-
 #endif	/* _CPRNG_H */



CVS commit: src/sys/netipsec

2018-04-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 29 07:24:39 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.h

Log Message:
Remove duplicate prototype.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 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/netipsec/ipsec.h
diff -u src/sys/netipsec/ipsec.h:1.77 src/sys/netipsec/ipsec.h:1.78
--- src/sys/netipsec/ipsec.h:1.77	Sat Apr 28 14:25:56 2018
+++ src/sys/netipsec/ipsec.h	Sun Apr 29 07:24:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.h,v 1.77 2018/04/28 14:25:56 maxv Exp $	*/
+/*	$NetBSD: ipsec.h,v 1.78 2018/04/29 07:24:38 maxv Exp $	*/
 /*	$FreeBSD: 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 $	*/
 
@@ -327,7 +327,6 @@ void ah_attach(void);
 void esp_attach(void);
 void ipcomp_attach(void);
 void ipe4_attach(void);
-void ipe4_attach(void);
 void tcpsignature_attach(void);
 
 void ipsec_attach(void);



CVS commit: src/sys/net

2018-04-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 29 07:16:29 UTC 2018

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

Log Message:
Add missing pserialize_read_exit in error branch, spotted during my
previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/net/if_fddisubr.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_fddisubr.c
diff -u src/sys/net/if_fddisubr.c:1.107 src/sys/net/if_fddisubr.c:1.108
--- src/sys/net/if_fddisubr.c:1.107	Sun Apr 29 07:13:10 2018
+++ src/sys/net/if_fddisubr.c	Sun Apr 29 07:16:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_fddisubr.c,v 1.107 2018/04/29 07:13:10 maxv Exp $	*/
+/*	$NetBSD: if_fddisubr.c,v 1.108 2018/04/29 07:16:28 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_fddisubr.c,v 1.107 2018/04/29 07:13:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_fddisubr.c,v 1.108 2018/04/29 07:16:28 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -330,8 +330,10 @@ fddi_output(struct ifnet *ifp0, struct m
 			struct llc llc;
 
 			M_PREPEND(m, sizeof(struct llc), M_NOWAIT);
-			if (m == 0)
+			if (m == NULL) {
+pserialize_read_exit(s);
 senderr(ENOBUFS);
+			}
 			llc.llc_dsap = llc.llc_ssap = LLC_SNAP_LSAP;
 			llc.llc_control = LLC_UI;
 			memcpy(llc.llc_snap_org_code, at_org_code,



CVS commit: src/sys

2018-04-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 29 07:13:10 UTC 2018

Modified Files:
src/sys/kern: uipc_mbuf2.c uipc_socket2.c
src/sys/net: if_ethersubr.c if_fddisubr.c
src/sys/sys: mbuf.h

Log Message:
Remove references to m_copy in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/kern/uipc_mbuf2.c
cvs rdiff -u -r1.128 -r1.129 src/sys/kern/uipc_socket2.c
cvs rdiff -u -r1.264 -r1.265 src/sys/net/if_ethersubr.c
cvs rdiff -u -r1.106 -r1.107 src/sys/net/if_fddisubr.c
cvs rdiff -u -r1.199 -r1.200 src/sys/sys/mbuf.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/kern/uipc_mbuf2.c
diff -u src/sys/kern/uipc_mbuf2.c:1.31 src/sys/kern/uipc_mbuf2.c:1.32
--- src/sys/kern/uipc_mbuf2.c:1.31	Sat Apr 14 08:13:58 2018
+++ src/sys/kern/uipc_mbuf2.c	Sun Apr 29 07:13:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf2.c,v 1.31 2018/04/14 08:13:58 maxv Exp $	*/
+/*	$NetBSD: uipc_mbuf2.c,v 1.32 2018/04/29 07:13:10 maxv Exp $	*/
 /*	$KAME: uipc_mbuf2.c,v 1.29 2001/02/14 13:42:10 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf2.c,v 1.31 2018/04/14 08:13:58 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf2.c,v 1.32 2018/04/29 07:13:10 maxv Exp $");
 
 #include 
 #include 
@@ -191,7 +191,7 @@ m_pulldown(struct mbuf *m, int off, int 
 	}
 
 	/*
-	 * Now, we need to do the hard way. Don't m_copy as there's no room
+	 * Now, we need to do the hard way. Don't copy as there's no room
 	 * on both ends.
 	 */
 	o = m_get(M_DONTWAIT, m->m_type);

Index: src/sys/kern/uipc_socket2.c
diff -u src/sys/kern/uipc_socket2.c:1.128 src/sys/kern/uipc_socket2.c:1.129
--- src/sys/kern/uipc_socket2.c:1.128	Mon Mar 19 16:26:26 2018
+++ src/sys/kern/uipc_socket2.c	Sun Apr 29 07:13:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket2.c,v 1.128 2018/03/19 16:26:26 roy Exp $	*/
+/*	$NetBSD: uipc_socket2.c,v 1.129 2018/04/29 07:13:10 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.128 2018/03/19 16:26:26 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.129 2018/04/29 07:13:10 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -725,7 +725,7 @@ sbrelease(struct sockbuf *sb, struct soc
  *
  * Reliable protocols may use the socket send buffer to hold data
  * awaiting acknowledgement.  Data is normally copied from a socket
- * send buffer in a protocol with m_copy for output to a peer,
+ * send buffer in a protocol with m_copym for output to a peer,
  * and then removing the data from the socket buffer with sbdrop()
  * or sbdroprecord() when the data is acknowledged by the peer.
  */

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.264 src/sys/net/if_ethersubr.c:1.265
--- src/sys/net/if_ethersubr.c:1.264	Thu Apr 26 19:56:55 2018
+++ src/sys/net/if_ethersubr.c	Sun Apr 29 07:13:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.264 2018/04/26 19:56:55 maxv Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.265 2018/04/29 07:13:10 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.264 2018/04/26 19:56:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.265 2018/04/29 07:13:10 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -328,9 +328,9 @@ ether_output(struct ifnet * const ifp0, 
 
 		/*
 		 * In the phase 2 case, we need to prepend an mbuf for the
-		 * llc header.  Since we must preserve the value of m,
-		 * which is passed to us by value, we m_copy() the first
-		 * mbuf, and use it for our llc header.
+		 * llc header.
+		 *
+		 * XXX XXX: Do we need to preserve the value of m?
 		 */
 		if (aa->aa_flags & AFA_PHASE2) {
 			struct llc llc;

Index: src/sys/net/if_fddisubr.c
diff -u src/sys/net/if_fddisubr.c:1.106 src/sys/net/if_fddisubr.c:1.107
--- src/sys/net/if_fddisubr.c:1.106	Thu Apr 26 19:56:55 2018
+++ src/sys/net/if_fddisubr.c	Sun Apr 29 07:13:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_fddisubr.c,v 1.106 2018/04/26 19:56:55 maxv Exp $	*/
+/*	$NetBSD: if_fddisubr.c,v 1.107 2018/04/29 07:13:10 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_fddisubr.c,v 1.106 2018/04/26 19:56:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_fddisubr.c,v 1.107 2018/04/29 07:13:10 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -322,9 +322,9 @@ fddi_output(struct ifnet *ifp0, struct m
 
 		/*
 		 * In the phase 2 case, we need to prepend an mbuf for the llc
-		 * header. Since we must preserve the value of m, which is
-		 * passed to us by value, we m_copy() the first mbuf, and use
-		 * it for our llc header.
+		 * header.
+		 *
+		 * XXX XXX: Do we need to 

CVS commit: src/sys/netinet6

2018-04-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 29 07:05:13 UTC 2018

Modified Files:
src/sys/netinet6: icmp6.c ip6_mroute.c raw_ip6.c

Log Message:
Replace
m_copym(m, 0, M_COPYALL, M_DONTWAIT)
by
m_copypacket(m, M_DONTWAIT)
when it is obvious that 'm' has M_PKTHDR set.


To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.125 -r1.126 src/sys/netinet6/ip6_mroute.c
cvs rdiff -u -r1.170 -r1.171 src/sys/netinet6/raw_ip6.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/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.234 src/sys/netinet6/icmp6.c:1.235
--- src/sys/netinet6/icmp6.c:1.234	Sat Apr 28 13:26:57 2018
+++ src/sys/netinet6/icmp6.c	Sun Apr 29 07:05:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: icmp6.c,v 1.234 2018/04/28 13:26:57 maxv Exp $	*/
+/*	$NetBSD: icmp6.c,v 1.235 2018/04/29 07:05:13 maxv Exp $	*/
 /*	$KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.234 2018/04/28 13:26:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.235 2018/04/29 07:05:13 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -637,7 +637,7 @@ _icmp6_input(struct mbuf *m, int off, in
 		 * copy the first part of the data into a fresh mbuf.
 		 * Otherwise, we will wrongly overwrite both copies.
 		 */
-		if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+		if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
 			/* Give up local */
 			n = m;
 			m = NULL;
@@ -686,7 +686,7 @@ _icmp6_input(struct mbuf *m, int off, in
 			icmp6_ifstat_inc(rcvif, ifs6_in_mldquery);
 		else
 			icmp6_ifstat_inc(rcvif, ifs6_in_mldreport);
-		if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+		if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
 			/* give up local */
 			mld_input(m, off);
 			m = NULL;
@@ -723,7 +723,7 @@ _icmp6_input(struct mbuf *m, int off, in
 			goto badlen;
 
 		if (mode == FQDN) {
-			n = m_copym(m, 0, M_COPYALL, M_DONTWAIT);
+			n = m_copypacket(m, M_DONTWAIT);
 			if (n)
 n = ni6_input(n, off);
 		} else {
@@ -795,7 +795,7 @@ _icmp6_input(struct mbuf *m, int off, in
 			goto badcode;
 		if (icmp6len < sizeof(struct nd_router_solicit))
 			goto badlen;
-		if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+		if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
 			/* give up local */
 			nd6_rs_input(m, off, icmp6len);
 			m = NULL;
@@ -811,7 +811,7 @@ _icmp6_input(struct mbuf *m, int off, in
 			goto badcode;
 		if (icmp6len < sizeof(struct nd_router_advert))
 			goto badlen;
-		if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+		if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
 			/* give up local */
 			nd6_ra_input(m, off, icmp6len);
 			m = NULL;
@@ -827,7 +827,7 @@ _icmp6_input(struct mbuf *m, int off, in
 			goto badcode;
 		if (icmp6len < sizeof(struct nd_neighbor_solicit))
 			goto badlen;
-		if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+		if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
 			/* give up local */
 			nd6_ns_input(m, off, icmp6len);
 			m = NULL;
@@ -843,7 +843,7 @@ _icmp6_input(struct mbuf *m, int off, in
 			goto badcode;
 		if (icmp6len < sizeof(struct nd_neighbor_advert))
 			goto badlen;
-		if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+		if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
 			/* give up local */
 			nd6_na_input(m, off, icmp6len);
 			m = NULL;
@@ -859,7 +859,7 @@ _icmp6_input(struct mbuf *m, int off, in
 			goto badcode;
 		if (icmp6len < sizeof(struct nd_redirect))
 			goto badlen;
-		if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
+		if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
 			/* give up local */
 			icmp6_redirect_input(m, off);
 			m = NULL;
@@ -1966,7 +1966,7 @@ icmp6_rip6_input(struct mbuf **mp, int o
 			/* do not inject data into pcb */
 		}
 #endif
-		else if ((n = m_copym(m, 0, (int)M_COPYALL, M_DONTWAIT)) != NULL) {
+		else if ((n = m_copypacket(m, M_DONTWAIT)) != NULL) {
 			if (last->in6p_flags & IN6P_CONTROLOPTS)
 ip6_savecontrol(last, , ip6, n);
 			/* strip intermediate headers */

Index: src/sys/netinet6/ip6_mroute.c
diff -u src/sys/netinet6/ip6_mroute.c:1.125 src/sys/netinet6/ip6_mroute.c:1.126
--- src/sys/netinet6/ip6_mroute.c:1.125	Thu Apr 26 19:50:09 2018
+++ src/sys/netinet6/ip6_mroute.c	Sun Apr 29 07:05:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_mroute.c,v 1.125 2018/04/26 19:50:09 maxv Exp $	*/
+/*	$NetBSD: ip6_mroute.c,v 1.126 2018/04/29 07:05:13 maxv Exp $	*/
 /*	$KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $	*/
 
 /*
@@ -117,7 +117,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.125 2018/04/26 19:50:09 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.126 2018/04/29 07:05:13 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1125,7 

CVS commit: src/sys/sys

2018-04-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 29 06:52:55 UTC 2018

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

Log Message:
Add KASSERTs in the rcvif functions.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/sys/mbuf.h

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

Modified files:

Index: src/sys/sys/mbuf.h
diff -u src/sys/sys/mbuf.h:1.198 src/sys/sys/mbuf.h:1.199
--- src/sys/sys/mbuf.h:1.198	Fri Apr 27 19:06:48 2018
+++ src/sys/sys/mbuf.h	Sun Apr 29 06:52:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbuf.h,v 1.198 2018/04/27 19:06:48 maxv Exp $	*/
+/*	$NetBSD: mbuf.h,v 1.199 2018/04/29 06:52:55 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
@@ -860,14 +860,14 @@ m_length(const struct mbuf *m)
 static __inline void
 m_set_rcvif(struct mbuf *m, const struct ifnet *ifp)
 {
-
+	KASSERT(m->m_flags & M_PKTHDR);
 	m->m_pkthdr.rcvif_index = ifp->if_index;
 }
 
 static __inline void
 m_reset_rcvif(struct mbuf *m)
 {
-
+	KASSERT(m->m_flags & M_PKTHDR);
 	/* A caller may expect whole _rcvif union is zeroed */
 	/* m->m_pkthdr.rcvif_index = 0; */
 	m->m_pkthdr._rcvif.ctx = NULL;
@@ -876,7 +876,8 @@ m_reset_rcvif(struct mbuf *m)
 static __inline void
 m_copy_rcvif(struct mbuf *m, const struct mbuf *n)
 {
-
+	KASSERT(m->m_flags & M_PKTHDR);
+	KASSERT(n->m_flags & M_PKTHDR);
 	m->m_pkthdr.rcvif_index = n->m_pkthdr.rcvif_index;
 }
 
@@ -898,6 +899,7 @@ m_get_rcvif(const struct mbuf *m, int *s
 {
 	struct ifnet *ifp;
 
+	KASSERT(m->m_flags & M_PKTHDR);
 	*s = pserialize_read_enter();
 	ifp = if_byindex(m->m_pkthdr.rcvif_index);
 	if (__predict_false(ifp == NULL))
@@ -924,7 +926,7 @@ m_put_rcvif(struct ifnet *ifp, int *s)
 static __inline struct ifnet *
 m_get_rcvif_psref(const struct mbuf *m, struct psref *psref)
 {
-
+	KASSERT(m->m_flags & M_PKTHDR);
 	return if_get_byindex(m->m_pkthdr.rcvif_index, psref);
 }
 
@@ -945,7 +947,7 @@ m_put_rcvif_psref(struct ifnet *ifp, str
 static __inline struct ifnet *
 m_get_rcvif_NOMPSAFE(const struct mbuf *m)
 {
-
+	KASSERT(m->m_flags & M_PKTHDR);
 	return if_byindex(m->m_pkthdr.rcvif_index);
 }