CVS commit: src

2018-02-16 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Feb 17 03:02:04 UTC 2018

Modified Files:
src/distrib/sets/lists/etc: mi
src/etc/rc.d: Makefile

Log Message:
Actually install dhcpd6 rc script.  Organize CONFIGFILES
alphabetically again while where.

PR 53018


To generate a diff of this commit:
cvs rdiff -u -r1.250 -r1.251 src/distrib/sets/lists/etc/mi
cvs rdiff -u -r1.96 -r1.97 src/etc/rc.d/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/etc/mi
diff -u src/distrib/sets/lists/etc/mi:1.250 src/distrib/sets/lists/etc/mi:1.251
--- src/distrib/sets/lists/etc/mi:1.250	Tue Jan  9 03:31:14 2018
+++ src/distrib/sets/lists/etc/mi	Sat Feb 17 03:02:04 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.250 2018/01/09 03:31:14 christos Exp $
+# $NetBSD: mi,v 1.251 2018/02/17 03:02:04 uwe Exp $
 #
 # Note: end-user configuration files that are moved to another location
 #	should not be marked "obsolete"; they should just be removed from
@@ -205,6 +205,7 @@
 ./etc/rc.d/dhclientetc-dhclient-rc
 ./etc/rc.d/dhcpcdetc-dhcpcd-rc
 ./etc/rc.d/dhcpdetc-dhcpd-rc
+./etc/rc.d/dhcpd6etc-dhcpd-rc
 ./etc/rc.d/dhcrelayetc-dhcpd-rc
 ./etc/rc.d/dmesgetc-sys-rc
 ./etc/rc.d/downinterfaces			etc-sys-rc

Index: src/etc/rc.d/Makefile
diff -u src/etc/rc.d/Makefile:1.96 src/etc/rc.d/Makefile:1.97
--- src/etc/rc.d/Makefile:1.96	Tue Jan  9 03:31:14 2018
+++ src/etc/rc.d/Makefile	Sat Feb 17 03:02:04 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.96 2018/01/09 03:31:14 christos Exp $
+# $NetBSD: Makefile,v 1.97 2018/02/17 03:02:04 uwe Exp $
 
 .include 
 
@@ -17,8 +17,10 @@ CONFIGFILES=\
 		DAEMON DISKS LOGIN NETWORKING SERVERS \
 		accounting altqd amd apmd automount automountd autounmountd \
 		bluetooth bootconf.sh bootparams \
-		ccd cgd cleartmp cron devpubd \
-		dhclient dhcpcd dhcpd dhcrelay dmesg downinterfaces envsys \
+		ccd cgd cleartmp cron \
+		devpubd dhclient dhcpcd dhcpd dhcpd6 dhcrelay dmesg \
+		downinterfaces \
+		envsys \
 		fsck fsck_root ftp_proxy ftpd \
 		gpio \
 		hostapd httpd \



CVS commit: src

2018-02-16 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Feb 17 03:02:04 UTC 2018

Modified Files:
src/distrib/sets/lists/etc: mi
src/etc/rc.d: Makefile

Log Message:
Actually install dhcpd6 rc script.  Organize CONFIGFILES
alphabetically again while where.

PR 53018


To generate a diff of this commit:
cvs rdiff -u -r1.250 -r1.251 src/distrib/sets/lists/etc/mi
cvs rdiff -u -r1.96 -r1.97 src/etc/rc.d/Makefile

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



CVS commit: src/share/man/man4

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 02:11:00 UTC 2018

Modified Files:
src/share/man/man4: options.4

Log Message:
Remove mention of DDB_ONPANIC=2, ddb.dumpstack which is enabled by default now 
handles back traces on panic.


To generate a diff of this commit:
cvs rdiff -u -r1.482 -r1.483 src/share/man/man4/options.4

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

Modified files:

Index: src/share/man/man4/options.4
diff -u src/share/man/man4/options.4:1.482 src/share/man/man4/options.4:1.483
--- src/share/man/man4/options.4:1.482	Mon Feb  5 15:02:52 2018
+++ src/share/man/man4/options.4	Sat Feb 17 02:11:00 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: options.4,v 1.482 2018/02/05 15:02:52 maxv Exp $
+.\"	$NetBSD: options.4,v 1.483 2018/02/17 02:11:00 sevan Exp $
 .\"
 .\" Copyright (c) 1996
 .\" 	Perry E. Metzger.  All rights reserved.
@@ -30,7 +30,7 @@
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd February 5, 2018
+.Dd February 17, 2018
 .Dt OPTIONS 4
 .Os
 .Sh NAME
@@ -554,10 +554,6 @@ The default if not specified is
 .Dq 1
 - just enter into DDB.
 If set to
-.Dq 2
-the kernel will
-attempt to print out a stack trace before entering into DDB.
-If set to
 .Dq 0
 the kernel will attempt to print out a stack trace
 and reboot the system.



CVS commit: src/share/man/man4

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 02:11:00 UTC 2018

Modified Files:
src/share/man/man4: options.4

Log Message:
Remove mention of DDB_ONPANIC=2, ddb.dumpstack which is enabled by default now 
handles back traces on panic.


To generate a diff of this commit:
cvs rdiff -u -r1.482 -r1.483 src/share/man/man4/options.4

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



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

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 01:34:45 UTC 2018

Modified Files:
src/sys/arch/i386/conf: XEN3_DOM0 XEN3_DOMU

Log Message:
With the introduction of ddb.dumpstack which is enabled by default, we no longer
need to explicitly set DDB_COMMANDONENTER to run a trace.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/i386/conf/XEN3_DOMU

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/i386/conf/XEN3_DOM0
diff -u src/sys/arch/i386/conf/XEN3_DOM0:1.126 src/sys/arch/i386/conf/XEN3_DOM0:1.127
--- src/sys/arch/i386/conf/XEN3_DOM0:1.126	Mon Feb  5 11:19:55 2018
+++ src/sys/arch/i386/conf/XEN3_DOM0	Sat Feb 17 01:34:45 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3_DOM0,v 1.126 2018/02/05 11:19:55 bouyer Exp $
+#	$NetBSD: XEN3_DOM0,v 1.127 2018/02/17 01:34:45 sevan Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -75,7 +75,7 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 #options 	KGDB		# remote debugger
 #options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600
 #makeoptions	DEBUG="-g"	# compile full symbol table
-options DDB_COMMANDONENTER="trace;show registers"
+options DDB_COMMANDONENTER="show registers"
 
 # Compatibility options
 include 	"conf/compat_netbsd09.config"

Index: src/sys/arch/i386/conf/XEN3_DOMU
diff -u src/sys/arch/i386/conf/XEN3_DOMU:1.88 src/sys/arch/i386/conf/XEN3_DOMU:1.89
--- src/sys/arch/i386/conf/XEN3_DOMU:1.88	Tue Jan 23 15:08:12 2018
+++ src/sys/arch/i386/conf/XEN3_DOMU	Sat Feb 17 01:34:45 2018
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOMU,v 1.88 2018/01/23 15:08:12 sevan Exp $
+# $NetBSD: XEN3_DOMU,v 1.89 2018/02/17 01:34:45 sevan Exp $
 
 include 	"arch/xen/conf/std.xen"
 
@@ -59,7 +59,7 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 #options 	KGDB		# remote debugger
 #options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600
 #makeoptions	DEBUG="-g"	# compile full symbol table
-options DDB_COMMANDONENTER="trace;show registers"
+options DDB_COMMANDONENTER="show registers"
 
 # Compatibility options
 include 	"conf/compat_netbsd09.config"



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

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 01:34:45 UTC 2018

Modified Files:
src/sys/arch/i386/conf: XEN3_DOM0 XEN3_DOMU

Log Message:
With the introduction of ddb.dumpstack which is enabled by default, we no longer
need to explicitly set DDB_COMMANDONENTER to run a trace.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/i386/conf/XEN3_DOMU

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



CVS commit: src/sys/arch

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 01:31:02 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: XEN3_DOM0 XEN3_DOMU
src/sys/arch/evbarm/conf: MARVELL_NAS
src/sys/arch/macppc/conf: GENERIC GENERIC_601

Log Message:
With the introduction of ddb.dumpstack which is enabled by default, we no longer
need to explicitly set DDB_COMMANDONENTER to run a trace.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/amd64/conf/XEN3_DOMU
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/evbarm/conf/MARVELL_NAS
cvs rdiff -u -r1.339 -r1.340 src/sys/arch/macppc/conf/GENERIC
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/macppc/conf/GENERIC_601

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



CVS commit: src/sys/arch

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 01:31:02 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: XEN3_DOM0 XEN3_DOMU
src/sys/arch/evbarm/conf: MARVELL_NAS
src/sys/arch/macppc/conf: GENERIC GENERIC_601

Log Message:
With the introduction of ddb.dumpstack which is enabled by default, we no longer
need to explicitly set DDB_COMMANDONENTER to run a trace.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/amd64/conf/XEN3_DOMU
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/evbarm/conf/MARVELL_NAS
cvs rdiff -u -r1.339 -r1.340 src/sys/arch/macppc/conf/GENERIC
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/macppc/conf/GENERIC_601

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

Modified files:

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.148 src/sys/arch/amd64/conf/XEN3_DOM0:1.149
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.148	Mon Feb  5 11:19:55 2018
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Sat Feb 17 01:31:01 2018
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.148 2018/02/05 11:19:55 bouyer Exp $
+# $NetBSD: XEN3_DOM0,v 1.149 2018/02/17 01:31:01 sevan Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -10,7 +10,7 @@ options 	INCLUDE_CONFIG_FILE	# embed con
 #options 	UVMHIST_PRINT
 #options 	SYSCALL_DEBUG
 
-#ident		"XEN3_DOM0-$Revision: 1.148 $"
+#ident		"XEN3_DOM0-$Revision: 1.149 $"
 
 maxusers	32		# estimated number of users
 
@@ -63,7 +63,7 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 #options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600
 #makeoptions	DEBUG="-g"	# compile full symbol table
 makeoptions	COPTS="-O2 -fno-omit-frame-pointer"
-options DDB_COMMANDONENTER="trace;show registers"
+options DDB_COMMANDONENTER="show registers"
 
 # Compatibility options
 include 	"conf/compat_netbsd15.config"

Index: src/sys/arch/amd64/conf/XEN3_DOMU
diff -u src/sys/arch/amd64/conf/XEN3_DOMU:1.83 src/sys/arch/amd64/conf/XEN3_DOMU:1.84
--- src/sys/arch/amd64/conf/XEN3_DOMU:1.83	Tue Jan 23 14:47:53 2018
+++ src/sys/arch/amd64/conf/XEN3_DOMU	Sat Feb 17 01:31:01 2018
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOMU,v 1.83 2018/01/23 14:47:53 sevan Exp $
+# $NetBSD: XEN3_DOMU,v 1.84 2018/02/17 01:31:01 sevan Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -10,7 +10,7 @@ options 	INCLUDE_CONFIG_FILE	# embed con
 #options 	UVMHIST_PRINT
 #options 	SYSCALL_DEBUG
 
-#ident		"XEN3_DOMU-$Revision: 1.83 $"
+#ident		"XEN3_DOMU-$Revision: 1.84 $"
 
 maxusers	32		# estimated number of users
 
@@ -55,7 +55,7 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 #options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600
 #makeoptions	DEBUG="-g"	# compile full symbol table
 makeoptions	COPTS="-O2 -fno-omit-frame-pointer"
-options DDB_COMMANDONENTER="trace;show registers"
+options DDB_COMMANDONENTER="show registers"
 
 # Compatibility options
 include 	"conf/compat_netbsd15.config"

Index: src/sys/arch/evbarm/conf/MARVELL_NAS
diff -u src/sys/arch/evbarm/conf/MARVELL_NAS:1.28 src/sys/arch/evbarm/conf/MARVELL_NAS:1.29
--- src/sys/arch/evbarm/conf/MARVELL_NAS:1.28	Thu Sep 14 07:58:40 2017
+++ src/sys/arch/evbarm/conf/MARVELL_NAS	Sat Feb 17 01:31:02 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: MARVELL_NAS,v 1.28 2017/09/14 07:58:40 mrg Exp $
+#	$NetBSD: MARVELL_NAS,v 1.29 2018/02/17 01:31:02 sevan Exp $
 #
 #  This configuration supports for generically Marvell NAS.
 
@@ -241,7 +241,7 @@ options 	BUFQ_PRIOCSCAN
 options 	DDB		# in-kernel debugger
 options 	DDB_ONPANIC=0
 options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB
-options 	DDB_COMMANDONENTER="bt"
+#options 	DDB_COMMANDONENTER="bt"
 #options 	KGDB
 #options		SYSCALL_DEBUG
 

Index: src/sys/arch/macppc/conf/GENERIC
diff -u src/sys/arch/macppc/conf/GENERIC:1.339 src/sys/arch/macppc/conf/GENERIC:1.340
--- src/sys/arch/macppc/conf/GENERIC:1.339	Tue Jan 23 14:47:55 2018
+++ src/sys/arch/macppc/conf/GENERIC	Sat Feb 17 01:31:02 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.339 2018/01/23 14:47:55 sevan Exp $
+# $NetBSD: GENERIC,v 1.340 2018/02/17 01:31:02 sevan Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include		"arch/macppc/conf/std.macppc"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.339 $"
+#ident 		"GENERIC-$Revision: 1.340 $"
 
 maxusers	32
 
@@ -59,7 +59,7 @@ options 	DDB		# in-kernel debugger
 #options 	DDB_ONPANIC=0	# don't go into ddb on panic.
 options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 #options 	TRAP_PANICWAIT
-options		DDB_COMMANDONENTER="bt"
+#options 	DDB_COMMANDONENTER="bt"
 
 #makeoptions 	DEBUG="-g"	# compile full symbol table
 

Index: src/sys/arch/macppc/conf/GENERIC_601
diff -u src/sys/arch/macppc/conf/GENERIC_601:1.16 src/sys/arch/macppc/conf/GENERIC_601:1.17
--- src/sys/arch/macppc/conf/GENERIC_601:1.16	Tue Jan 23 14:47:55 2018
+++ 

CVS commit: src/share/man/man4

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 01:13:07 UTC 2018

Modified Files:
src/share/man/man4: ddb.4

Log Message:
document dumpstack variable.
Sort built-in variables alphabetically.


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/share/man/man4/ddb.4

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

Modified files:

Index: src/share/man/man4/ddb.4
diff -u src/share/man/man4/ddb.4:1.172 src/share/man/man4/ddb.4:1.173
--- src/share/man/man4/ddb.4:1.172	Wed Jan 24 10:04:28 2018
+++ src/share/man/man4/ddb.4	Sat Feb 17 01:13:07 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ddb.4,v 1.172 2018/01/24 10:04:28 wiz Exp $
+.\"	$NetBSD: ddb.4,v 1.173 2018/02/17 01:13:07 sevan Exp $
 .\"
 .\" Copyright (c) 1997 - 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -56,7 +56,7 @@
 .\" any improvements or extensions that they make and grant Carnegie Mellon
 .\" the rights to redistribute these changes.
 .\"
-.Dd December 28, 2017
+.Dd February 17, 2018
 .Dt DDB 4
 .Os
 .Sh NAME
@@ -1194,6 +1194,21 @@ modifier to indicate user register
 .Pp
 Built-in variables currently supported are:
 .Bl -tag -offset indent -width "maxwidth" -compact
+.It Va dumpstack
+If non-zero (the default),
+causes a stack trace to be printed when
+.Nm
+is entered on panic.
+.It Va fromconsole
+If non-zero (the default),
+the kernel allows to enter
+.Nm
+from the console (by break signal or special key sequence).
+If the kernel configuration option
+.D1 Cd options DDB_FROMCONSOLE=0
+is used,
+.Va fromconsole
+will be initialized to off.
 .It Va lines
 The number of lines.
 This is used by the
@@ -1230,20 +1245,9 @@ will be initialized to off, causing a st
 the system to be rebooted instead of
 .Nm
 being entered.
-Other useful settings are \-1, which suppresses the stack trace before
-reboot, and 2, which causes a stack trace to be printed and
-.Nm
-to be entered.
-.It Va fromconsole
-If non-zero (the default),
-the kernel allows to enter
-.Nm
-from the console (by break signal or special key sequence).
-If the kernel configuration option
-.D1 Cd options DDB_FROMCONSOLE=0
-is used,
-.Va fromconsole
-will be initialized to off.
+Setting
+.Va onpanic
+to -1 suppresses the stack trace before reboot.
 .It Va radix
 Input and output radix.
 .It Va tabstops



CVS commit: src/share/man/man4

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 01:13:07 UTC 2018

Modified Files:
src/share/man/man4: ddb.4

Log Message:
document dumpstack variable.
Sort built-in variables alphabetically.


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/share/man/man4/ddb.4

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



CVS commit: src/doc

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 00:53:54 UTC 2018

Modified Files:
src/doc: CHANGES

Log Message:
Note ddb.dumpstack sysctl


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

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



CVS commit: src/doc

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 00:53:54 UTC 2018

Modified Files:
src/doc: CHANGES

Log Message:
Note ddb.dumpstack sysctl


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2357 src/doc/CHANGES:1.2358
--- src/doc/CHANGES:1.2357	Mon Feb 12 10:37:50 2018
+++ src/doc/CHANGES	Sat Feb 17 00:53:53 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2357 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2358 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -111,3 +111,5 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	openldap: Import 2.4.45. [christos 20180205]
 	unbound: Import 1.6.8. [christos 20180205]
 	nsd: import 4.1.19 [christos 20180209]
+	ddb(4):	Introduce dumpstack sysctl for printing a stack trace on panic,
+		enable by default. [sevan 20180217]



Re: CVS commit: src/sys/ddb

2018-02-16 Thread Paul Goyette

Please make sure to update the options(4) and ddb(4) man pages...


On Sat, 17 Feb 2018, Sevan Janiyan wrote:


Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 00:41:09 UTC 2018

Modified Files:
src/sys/ddb: db_panic.c db_variables.c ddbvar.h

Log Message:
Opt to print a backtrace on panic by default with the intention of improving 
bug reports.
Instead of relying on ddb.onpanic=2, introduce a new sysctl called dumpstack to 
handle this.
via  channeled through  on tech-kern[1]

[1] https://mail-index.netbsd.org/tech-kern/2018/02/15/msg023103.html


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/ddb/db_panic.c
cvs rdiff -u -r1.45 -r1.46 src/sys/ddb/db_variables.c
cvs rdiff -u -r1.12 -r1.13 src/sys/ddb/ddbvar.h

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


!DSPAM:5a877a2b294491653810109!




+--+--++
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:  |
| (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+--+--++


CVS commit: src/sys/dev/pci

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 00:46:17 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1301 -r1.1302 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1300 -r1.1301 src/sys/dev/pci/pcidevs_data.h

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



CVS commit: src/sys/dev/pci

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 00:45:14 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
grammar


To generate a diff of this commit:
cvs rdiff -u -r1.1308 -r1.1309 src/sys/dev/pci/pcidevs

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



CVS commit: src/sys/dev/pci

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 00:45:14 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
grammar


To generate a diff of this commit:
cvs rdiff -u -r1.1308 -r1.1309 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1308 src/sys/dev/pci/pcidevs:1.1309
--- src/sys/dev/pci/pcidevs:1.1308	Fri Feb 16 01:38:24 2018
+++ src/sys/dev/pci/pcidevs	Sat Feb 17 00:45:14 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1308 2018/02/16 01:38:24 sevan Exp $
+$NetBSD: pcidevs,v 1.1309 2018/02/17 00:45:14 sevan Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -449,7 +449,7 @@ vendor MINDSHARE	0x119a	Mind Share
 vendor OMEGA		0x119b	Omega Micro
 vendor ITI		0x119c	Information Technology Institute
 vendor BUG		0x119d	Bug Sapporo
-vendor FUJITSU3		0x119e	Fujitsu (3th PCI Vendor ID)
+vendor FUJITSU3		0x119e	Fujitsu (3rd PCI Vendor ID)
 vendor BULL		0x119f	Bull Hn Information Systems
 vendor CONVEX		0x11a0	Convex Computer
 vendor HAMAMATSU	0x11a1	Hamamatsu Photonics



CVS commit: src/sys/ddb

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 00:41:09 UTC 2018

Modified Files:
src/sys/ddb: db_panic.c db_variables.c ddbvar.h

Log Message:
Opt to print a backtrace on panic by default with the intention of improving 
bug reports.
Instead of relying on ddb.onpanic=2, introduce a new sysctl called dumpstack to 
handle this.
via  channeled through  on tech-kern[1]

[1] https://mail-index.netbsd.org/tech-kern/2018/02/15/msg023103.html


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/ddb/db_panic.c
cvs rdiff -u -r1.45 -r1.46 src/sys/ddb/db_variables.c
cvs rdiff -u -r1.12 -r1.13 src/sys/ddb/ddbvar.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/ddb/db_panic.c
diff -u src/sys/ddb/db_panic.c:1.6 src/sys/ddb/db_panic.c:1.7
--- src/sys/ddb/db_panic.c:1.6	Thu Dec 28 17:51:19 2017
+++ src/sys/ddb/db_panic.c	Sat Feb 17 00:41:09 2018
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_panic.c,v 1.6 2017/12/28 17:51:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_panic.c,v 1.7 2018/02/17 00:41:09 sevan Exp $");
 
 #include 
 #include 
@@ -41,9 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_panic.c,v
 void db_panic(void)
 {
 
-	if (db_onpanic == 1)
-		Debugger();
-	else if (db_onpanic >= 0) {
+	if (db_dumpstack > 0) {
 		static int intrace = 0;
 
 		if (intrace == 0) {
@@ -58,8 +56,10 @@ void db_panic(void)
 			intrace = 0;
 		} else
 			printf("Faulted in mid-traceback; aborting...\n");
-		if (db_onpanic == 2)
-			Debugger();
 	}
+
+	if (db_onpanic > 0)
+		Debugger();
+
 	return;
 }

Index: src/sys/ddb/db_variables.c
diff -u src/sys/ddb/db_variables.c:1.45 src/sys/ddb/db_variables.c:1.46
--- src/sys/ddb/db_variables.c:1.45	Thu Dec 28 17:51:19 2017
+++ src/sys/ddb/db_variables.c	Sat Feb 17 00:41:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_variables.c,v 1.45 2017/12/28 17:51:19 christos Exp $	*/
+/*	$NetBSD: db_variables.c,v 1.46 2018/02/17 00:41:09 sevan Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_variables.c,v 1.45 2017/12/28 17:51:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_variables.c,v 1.46 2018/02/17 00:41:09 sevan Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddbparam.h"
@@ -71,6 +71,10 @@ int		db_tee_msgbuf = DDB_TEE_MSGBUF;
 #endif
 int		db_panicstackframes = DDB_PANICSTACKFRAMES;
 
+#ifndef DDB_DUMPSTACK
+#define DDB_DUMPSTACK 1
+#endif
+int 		db_dumpstack = DDB_DUMPSTACK;
 
 static int	db_rw_internal_variable(const struct db_variable *, db_expr_t *,
 		int);
@@ -115,6 +119,12 @@ const struct db_variable db_vars[] = {
 		.modif = NULL,
 	},
 	{
+		.name = "dumpstack",
+		.valuep = _dumpstack,
+		.fcn = db_rw_internal_variable,
+		.modif = NULL,
+	},
+	{
 		.name = "radix",
 		.valuep = _radix,
 		.fcn = db_rw_internal_variable,
@@ -217,6 +227,12 @@ SYSCTL_SETUP(sysctl_ddb_setup, "sysctl d
 		   SYSCTL_DESCR("Number of stack frames to print on panic"),
 		   NULL, 0, _panicstackframes, 0,
 		   CTL_DDB, CTL_CREATE, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+		   CTLTYPE_INT, "dumpstack",
+		   SYSCTL_DESCR("On panic print stack trace"),
+		   NULL, 0, _dumpstack, 0,
+		   CTL_DDB, CTL_CREATE, CTL_EOL);
 }
 #endif	/* _KERNEL */
 

Index: src/sys/ddb/ddbvar.h
diff -u src/sys/ddb/ddbvar.h:1.12 src/sys/ddb/ddbvar.h:1.13
--- src/sys/ddb/ddbvar.h:1.12	Thu Dec 28 17:51:19 2017
+++ src/sys/ddb/ddbvar.h	Sat Feb 17 00:41:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ddbvar.h,v 1.12 2017/12/28 17:51:19 christos Exp $	*/
+/*	$NetBSD: ddbvar.h,v 1.13 2018/02/17 00:41:09 sevan Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -40,6 +40,7 @@ extern	int db_onpanic;
 extern	int db_fromconsole;
 extern	int db_panicstackframes;
 extern	int db_tee_msgbuf;
+extern	int db_dumpstack;
 
 extern	void db_panic(void);
 



CVS commit: src/sys/ddb

2018-02-16 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 17 00:41:09 UTC 2018

Modified Files:
src/sys/ddb: db_panic.c db_variables.c ddbvar.h

Log Message:
Opt to print a backtrace on panic by default with the intention of improving 
bug reports.
Instead of relying on ddb.onpanic=2, introduce a new sysctl called dumpstack to 
handle this.
via  channeled through  on tech-kern[1]

[1] https://mail-index.netbsd.org/tech-kern/2018/02/15/msg023103.html


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/ddb/db_panic.c
cvs rdiff -u -r1.45 -r1.46 src/sys/ddb/db_variables.c
cvs rdiff -u -r1.12 -r1.13 src/sys/ddb/ddbvar.h

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



CVS commit: src/tests/net/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb 17 00:28:47 UTC 2018

Modified Files:
src/tests/net/net: test.h

Log Message:
remove clause 3, 4.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/net/test.h

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

Modified files:

Index: src/tests/net/net/test.h
diff -u src/tests/net/net/test.h:1.1 src/tests/net/net/test.h:1.2
--- src/tests/net/net/test.h:1.1	Fri Feb 16 11:23:15 2018
+++ src/tests/net/net/test.h	Fri Feb 16 19:28:47 2018
@@ -13,13 +13,6 @@
  * 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. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *This product includes software developed by the NetBSD
- *Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED



CVS commit: src/tests/net/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb 17 00:28:47 UTC 2018

Modified Files:
src/tests/net/net: test.h

Log Message:
remove clause 3, 4.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/net/test.h

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



re: CVS commit: src/sys/arch

2018-02-16 Thread matthew green
thanks for doing this.  it will make sanitizer_linux.cc's
port for GetPcSpBp() *much* simplier.

> Module Name:  src
> Committed By: kamil
> Date: Thu Feb 15 15:53:57 UTC 2018
> 
> Modified Files:
>   src/sys/arch/sparc/include: mcontext.h

this doesn't seem right.  at least, it does not match
the usage from libsanitizer:

  uptr *stk_ptr;
#  if defined (__arch64__)
  stk_ptr = (uptr *) (*sp + 2047);
#  else
  stk_ptr = (uptr *) *sp;
#  endif
  *bp = stk_ptr[15];

i don't understand either ofthe sparc versions you have.

+ #define   _UC_MACHINE_FP(uc)  
(((uc)->uc_mcontext.__gregs[_REG_O6])+0x80e)
+ #define   _UC_MACHINE_FP(uc)  
(((uc)->uc_mcontext.__gregs[_REG_O6])+0xf)

both of these grab something invalid and will likely
cause a run-time unaligned access fault as the result
will be aligned to 0x3.  there's an extra deref here
in the sparc case that is needed.  oh, i see where the
additional 0xf offset comes from.  you've conflated
byte and word sizes here.  the 64 bit stack pointer
is offset by -2047 from its actual value.  that's a
byte address.  the 15 is an array offset, which is
either 4 or 8 bytes.

the rest of them seem right as well as i could tell,
given ia64 is kind of a wreck..


.mrg.


CVS commit: src/tests/net/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 16 22:20:18 UTC 2018

Modified Files:
src/tests/net/net: t_tcp.c

Log Message:
Use the same variable name for the accepted socket as with the AF_LOCAL test.
Call getpeereid on the accepted socket.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/net/net/t_tcp.c

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



CVS commit: src/tests/net/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 16 22:20:18 UTC 2018

Modified Files:
src/tests/net/net: t_tcp.c

Log Message:
Use the same variable name for the accepted socket as with the AF_LOCAL test.
Call getpeereid on the accepted socket.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/net/net/t_tcp.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/net/net/t_tcp.c
diff -u src/tests/net/net/t_tcp.c:1.9 src/tests/net/net/t_tcp.c:1.10
--- src/tests/net/net/t_tcp.c:1.9	Fri Feb 16 14:24:16 2018
+++ src/tests/net/net/t_tcp.c	Fri Feb 16 17:20:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_tcp.c,v 1.9 2018/02/16 19:24:16 christos Exp $	*/
+/*	$NetBSD: t_tcp.c,v 1.10 2018/02/16 22:20:18 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$Id: t_tcp.c,v 1.9 2018/02/16 19:24:16 christos Exp $");
+__RCSID("$Id: t_tcp.c,v 1.10 2018/02/16 22:20:18 christos Exp $");
 #endif
 
 /* Example code. Should block; does with accept not paccept. */
@@ -71,7 +71,7 @@ static void 
 paccept_block(sa_family_t sfamily, sa_family_t cfamily,
 bool pacceptblock, bool fcntlblock)
 {
-	int srvr = -1, clnt = -1, as = -1;
+	int srvr = -1, clnt = -1, acpt = -1;
 	int ok, fl;
 	int count = 5;
 	ssize_t n;
@@ -154,7 +154,7 @@ paccept_block(sa_family_t sfamily, sa_fa
 	ok = connect(clnt, (struct sockaddr *) , addrlen);
 	if (ok != -1 || errno != EINPROGRESS)
 		FAIL("expected connect to fail");
-	as = paccept(srvr, NULL, NULL, NULL, pacceptblock ? 0 : SOCK_NONBLOCK);
+	acpt = paccept(srvr, NULL, NULL, NULL, pacceptblock ? 0 : SOCK_NONBLOCK);
 again:
 	ok = connect(clnt, (struct sockaddr *) , addrlen);
 	if (ok == -1 && errno != EISCONN) {
@@ -182,29 +182,30 @@ again:
 		FAIL("fnctl setfl");
 #endif
 
+	if (acpt == -1) {		/* not true under NetBSD */
+		acpt = paccept(srvr, NULL, NULL, NULL,
+		pacceptblock ? 0 : SOCK_NONBLOCK);
+		if (acpt == -1)
+			FAIL("paccept");
+	}
 	/* This is supposed to only work on Unix sockets but returns garbage */
 	if (getpeereid(clnt, , ) != -1)
 		FAIL("getpeereid(clnt)");
 	/* This is supposed to only work on Unix sockets but returns garbage */
-	if (getpeereid(srvr, , ) != -1)
+	if (getpeereid(acpt, , ) != -1)
 		FAIL("getpeereid(srvr)");
 
-	if (as == -1) {		/* not true under NetBSD */
-		as = paccept(srvr, NULL, NULL, NULL, pacceptblock ? 0 : SOCK_NONBLOCK);
-		if (as == -1)
-			FAIL("paccept");
-	}
 	if (fcntlblock) {
-		fl = fcntl(as, F_GETFL, 0);
+		fl = fcntl(acpt, F_GETFL, 0);
 		if (fl == -1)
 			FAIL("fnctl");
 		if (fl != (O_RDWR|O_NONBLOCK))
 			FAIL("fl 0x%x != 0x%x\n", fl, O_RDWR|O_NONBLOCK);
-		ok = fcntl(as, F_SETFL, fl & ~O_NONBLOCK);
+		ok = fcntl(acpt, F_SETFL, fl & ~O_NONBLOCK);
 		if (ok == -1)
 			FAIL("fnctl setfl");
 
-		fl = fcntl(as, F_GETFL, 0);
+		fl = fcntl(acpt, F_GETFL, 0);
 		if (fl & O_NONBLOCK)
 			FAIL("fl non blocking after reset");
 	}
@@ -213,7 +214,7 @@ again:
 	sigemptyset(_mask);
 	sigaction(SIGALRM, , NULL);
 	alarm(1);
-	n = read(as, buf, 10);
+	n = read(acpt, buf, 10);
 
 	if (pacceptblock || fcntlblock) {
 		if (n == -1 && errno != EINTR)
@@ -226,7 +227,7 @@ again:
 fail:
 	close(srvr);
 	close(clnt);
-	close(as);
+	close(acpt);
 }
 
 #ifndef TEST



CVS commit: src/tests/net/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 16 22:17:17 UTC 2018

Modified Files:
src/tests/net/net: t_unix.c

Log Message:
make sure we call getpeername on the accepted socket!


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/net/net/t_unix.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/net/net/t_unix.c
diff -u src/tests/net/net/t_unix.c:1.14 src/tests/net/net/t_unix.c:1.15
--- src/tests/net/net/t_unix.c:1.14	Fri Feb 16 11:30:20 2018
+++ src/tests/net/net/t_unix.c	Fri Feb 16 17:17:17 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unix.c,v 1.14 2018/02/16 16:30:20 christos Exp $	*/
+/*	$NetBSD: t_unix.c,v 1.15 2018/02/16 22:17:17 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$Id: t_unix.c,v 1.14 2018/02/16 16:30:20 christos Exp $");
+__RCSID("$Id: t_unix.c,v 1.15 2018/02/16 22:17:17 christos Exp $");
 #else
 #define getprogname() argv[0]
 #endif
@@ -135,6 +135,8 @@ test(bool closeit, size_t len)
 	gid_t egid;
 	struct sockaddr_un *sock_addr = NULL, *sun = NULL;
 	socklen_t sock_addrlen;
+	socklen_t peer_addrlen;
+	struct sockaddr_un peer_addr;
 
 	srvr = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (srvr == -1)
@@ -182,13 +184,15 @@ test(bool closeit, size_t len)
 	CHECK_EQUAL(euid, geteuid(), "client");
 	CHECK_EQUAL(egid, getegid(), "client");
 
-#if 0
-	/* This is not symmetric? It is supposed to work! */
-	if (getpeereid(srvr, , ) == -1)
-		FAIL("getpeereid(srvr)");
-	CHECK_EQUAL(euid, geteuid(), "server");
-	CHECK_EQUAL(egid, getegid(), "server");
-#endif
+
+	acpt = acc(srvr);
+
+	peer_addrlen = sizeof(peer_addr);
+	memset(_addr, 0, sizeof(peer_addr));
+	if (getpeername(acpt, (struct sockaddr *)_addr,
+	_addrlen) == -1)
+		FAIL("getpeername");
+	print("peer", _addr, peer_addrlen);
 
 	if (closeit) {
 		if (close(clnt) == -1)
@@ -196,23 +200,11 @@ test(bool closeit, size_t len)
 		clnt = -1;
 	}
 
-	acpt = acc(srvr);
-#if 0
-	/*
-	 * Both linux and NetBSD return ENOTCONN, why?
-	 */
-	if (!closeit) {
-		socklen_t peer_addrlen;
-		sockaddr_un peer_addr;
-
-		peer_addrlen = sizeof(peer_addr);
-		memset(_addr, 0, sizeof(peer_addr));
-		if (getpeername(srvr, (struct sockaddr *)_addr,
-		_addrlen) == -1)
-			FAIL("getpeername");
-		print("peer", _addr, peer_addrlen);
-	}
-#endif
+	/* This is not symmetric? It is supposed to work! */
+	if (getpeereid(acpt, , ) == -1)
+		FAIL("getpeereid(srvr)");
+	CHECK_EQUAL(euid, geteuid(), "server");
+	CHECK_EQUAL(egid, getegid(), "server");
 
 	if ((sock_addr = calloc(1, slen)) == NULL)
 		FAIL("calloc");



CVS commit: src/tests/net/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 16 22:17:17 UTC 2018

Modified Files:
src/tests/net/net: t_unix.c

Log Message:
make sure we call getpeername on the accepted socket!


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/net/net/t_unix.c

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



re: CVS commit: src/sys/modules/pf

2018-02-16 Thread matthew green
"Joerg Sonnenberger" writes:
> Module Name:  src
> Committed By: joerg
> Date: Mon Feb 12 22:18:36 UTC 2018
> 
> Modified Files:
>   src/sys/modules/pf: Makefile
> 
> Log Message:
> Simplify and make the GCC check more precise at the same time.

! .if ${HAVE_GCC:U0} == "6"

FWIW, i usually to write these as ">= 6", as these sorts of
problems tend to not disappear with a newer GCC.


.mrg.


CVS commit: src/tests/net/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 16 19:24:16 UTC 2018

Modified Files:
src/tests/net/net: t_tcp.c

Log Message:
ensure that getpeereid does not succeed on tcp sockets.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/net/net/t_tcp.c

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



CVS commit: src/tests/net/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 16 19:24:16 UTC 2018

Modified Files:
src/tests/net/net: t_tcp.c

Log Message:
ensure that getpeereid does not succeed on tcp sockets.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/net/net/t_tcp.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/net/net/t_tcp.c
diff -u src/tests/net/net/t_tcp.c:1.8 src/tests/net/net/t_tcp.c:1.9
--- src/tests/net/net/t_tcp.c:1.8	Fri Feb 16 11:30:20 2018
+++ src/tests/net/net/t_tcp.c	Fri Feb 16 14:24:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_tcp.c,v 1.8 2018/02/16 16:30:20 christos Exp $	*/
+/*	$NetBSD: t_tcp.c,v 1.9 2018/02/16 19:24:16 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$Id: t_tcp.c,v 1.8 2018/02/16 16:30:20 christos Exp $");
+__RCSID("$Id: t_tcp.c,v 1.9 2018/02/16 19:24:16 christos Exp $");
 #endif
 
 /* Example code. Should block; does with accept not paccept. */
@@ -183,17 +183,11 @@ again:
 #endif
 
 	/* This is supposed to only work on Unix sockets but returns garbage */
-	if (getpeereid(clnt, , ) == -1)
+	if (getpeereid(clnt, , ) != -1)
 		FAIL("getpeereid(clnt)");
-	CHECK_EQUAL(euid, geteuid(), "client");
-	CHECK_EQUAL(egid, getegid(), "client");
-
 	/* This is supposed to only work on Unix sockets but returns garbage */
-	if (getpeereid(srvr, , ) == -1)
+	if (getpeereid(srvr, , ) != -1)
 		FAIL("getpeereid(srvr)");
-	CHECK_EQUAL(euid, geteuid(), "server");
-	CHECK_EQUAL(egid, getegid(), "server");
-
 
 	if (as == -1) {		/* not true under NetBSD */
 		as = paccept(srvr, NULL, NULL, NULL, pacceptblock ? 0 : SOCK_NONBLOCK);



CVS commit: src/lib/libc/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 16 19:21:49 UTC 2018

Modified Files:
src/lib/libc/net: getpeereid.c

Log Message:
Enforce that getpeereid only returns success on AF_LOCAL sockets, instead
of returning garbage for other socket types.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/net/getpeereid.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/net/getpeereid.c
diff -u src/lib/libc/net/getpeereid.c:1.2 src/lib/libc/net/getpeereid.c:1.3
--- src/lib/libc/net/getpeereid.c:1.2	Tue Apr 29 02:53:01 2008
+++ src/lib/libc/net/getpeereid.c	Fri Feb 16 14:21:49 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: getpeereid.c,v 1.2 2008/04/29 06:53:01 martin Exp $ */
+/* $NetBSD: getpeereid.c,v 1.3 2018/02/16 19:21:49 christos Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -31,27 +31,38 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getpeereid.c,v 1.2 2008/04/29 06:53:01 martin Exp $");
+__RCSID("$NetBSD: getpeereid.c,v 1.3 2018/02/16 19:21:49 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
-#include 
 #include 
 #include 
+#include 
+#include 
 
 
 int
 getpeereid(int s, uid_t *euid, gid_t *egid)
 {
 	struct unpcbid cred;
-	socklen_t len = sizeof(cred);
-	if (getsockopt(s, 0, LOCAL_PEEREID, , ) < 0) {
+	struct sockaddr_storage ss;
+	socklen_t len;
+
+	len = sizeof(ss);
+	if (getsockname(s, (void *), ) == -1)
+		return -1;
+	if (ss.ss_family != AF_LOCAL) {
+		errno = EOPNOTSUPP;
 		return -1;
-	} else {
-		if (euid != NULL)
-			*euid = cred.unp_euid;
-		if (egid != NULL)
-			*egid = cred.unp_egid;
-		return 0;
 	}
+
+	len = sizeof(cred);
+	if (getsockopt(s, 0, LOCAL_PEEREID, , ) == -1)
+		return -1;
+
+	if (euid != NULL)
+		*euid = cred.unp_euid;
+	if (egid != NULL)
+		*egid = cred.unp_egid;
+	return 0;
 }



CVS commit: src/lib/libc/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 16 19:21:49 UTC 2018

Modified Files:
src/lib/libc/net: getpeereid.c

Log Message:
Enforce that getpeereid only returns success on AF_LOCAL sockets, instead
of returning garbage for other socket types.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/net/getpeereid.c

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



CVS commit: src/sys/arch/macppc/dev

2018-02-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 16 18:13:47 UTC 2018

Modified Files:
src/sys/arch/macppc/dev: valkyriefb.c

Log Message:
use _PREFETCHABLE


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/macppc/dev/valkyriefb.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/macppc/dev/valkyriefb.c
diff -u src/sys/arch/macppc/dev/valkyriefb.c:1.4 src/sys/arch/macppc/dev/valkyriefb.c:1.5
--- src/sys/arch/macppc/dev/valkyriefb.c:1.4	Wed Jul  6 13:30:42 2016
+++ src/sys/arch/macppc/dev/valkyriefb.c	Fri Feb 16 18:13:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: valkyriefb.c,v 1.4 2016/07/06 13:30:42 macallan Exp $	*/
+/*	$NetBSD: valkyriefb.c,v 1.5 2018/02/16 18:13:47 macallan Exp $	*/
 
 /*
  * Copyright (c) 2012 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: valkyriefb.c,v 1.4 2016/07/06 13:30:42 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: valkyriefb.c,v 1.5 2018/02/16 18:13:47 macallan Exp $");
 
 #include 
 #include 
@@ -43,6 +43,9 @@ __KERNEL_RCSID(0, "$NetBSD: valkyriefb.c
 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -402,6 +405,7 @@ valkyriefb_mmap(void *v, void *vs, off_t
 	/* 'regular' framebuffer mmap()ing */
 	if (offset < 0x10) {
 		pa = (paddr_t)(sc->sc_base + 0x1000 + offset);	
+		pa |= POWERPC_MMAP_FLAG_PREFETCHABLE;
 		return pa;
 	}
 	return -1;



CVS commit: src/sys/arch/macppc/dev

2018-02-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 16 18:13:47 UTC 2018

Modified Files:
src/sys/arch/macppc/dev: valkyriefb.c

Log Message:
use _PREFETCHABLE


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/macppc/dev/valkyriefb.c

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



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

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 18:13:22 UTC 2018

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

Log Message:
Ticket #1531


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.130 -r1.1.2.131 src/doc/CHANGES-6.0.7

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



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

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 18:13:22 UTC 2018

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

Log Message:
Ticket #1531


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.130 -r1.1.2.131 src/doc/CHANGES-6.0.7

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

Modified files:

Index: src/doc/CHANGES-6.0.7
diff -u src/doc/CHANGES-6.0.7:1.1.2.130 src/doc/CHANGES-6.0.7:1.1.2.131
--- src/doc/CHANGES-6.0.7:1.1.2.130	Thu Feb 15 14:52:41 2018
+++ src/doc/CHANGES-6.0.7	Fri Feb 16 18:13:22 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.7,v 1.1.2.130 2018/02/15 14:52:41 martin Exp $
+# $NetBSD: CHANGES-6.0.7,v 1.1.2.131 2018/02/16 18:13:22 martin Exp $
 
 A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7
 release:
@@ -15328,3 +15328,8 @@ sys/netipsec/xform_ipip.c			1.44 via pat
 	Fix IPv6-IPsec-AH tunnels.
 	[maxv, ticket #1529]
 
+sys/netipsec/ipsec.c1.130
+
+	Fix inverted logic that could crash the kernel.
+	[maxv, ticket #1531]
+



CVS commit: src/sys/arch/macppc/dev

2018-02-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 16 18:12:45 UTC 2018

Modified Files:
src/sys/arch/macppc/dev: valkyriefbreg.h videopllvar.h

Log Message:
remove accidential garbage


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/macppc/dev/valkyriefbreg.h \
src/sys/arch/macppc/dev/videopllvar.h

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



CVS commit: src/sys/arch/macppc/dev

2018-02-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 16 18:12:45 UTC 2018

Modified Files:
src/sys/arch/macppc/dev: valkyriefbreg.h videopllvar.h

Log Message:
remove accidential garbage


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/macppc/dev/valkyriefbreg.h \
src/sys/arch/macppc/dev/videopllvar.h

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

Modified files:

Index: src/sys/arch/macppc/dev/valkyriefbreg.h
diff -u src/sys/arch/macppc/dev/valkyriefbreg.h:1.2 src/sys/arch/macppc/dev/valkyriefbreg.h:1.3
--- src/sys/arch/macppc/dev/valkyriefbreg.h:1.2	Fri Feb 16 18:10:32 2018
+++ src/sys/arch/macppc/dev/valkyriefbreg.h	Fri Feb 16 18:12:45 2018
@@ -1,5 +1,3 @@
-/*	$NetBSD: valkyriefbreg.h,v 1.2 2018/02/16 18:10:32 macallan Exp $	*/
-
 /*
  * Copyright (c) 2012 Michael Lorenz
  * All rights reserved.
@@ -27,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: valkyriefbreg.h,v 1.2 2018/02/16 18:10:32 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: valkyriefbreg.h,v 1.3 2018/02/16 18:12:45 macallan Exp $");
 
 #ifndef VALKYRIEFBREG_H
 #define VALKYRIEFBREG_H
Index: src/sys/arch/macppc/dev/videopllvar.h
diff -u src/sys/arch/macppc/dev/videopllvar.h:1.2 src/sys/arch/macppc/dev/videopllvar.h:1.3
--- src/sys/arch/macppc/dev/videopllvar.h:1.2	Fri Feb 16 18:10:32 2018
+++ src/sys/arch/macppc/dev/videopllvar.h	Fri Feb 16 18:12:45 2018
@@ -1,5 +1,3 @@
-/*	$NetBSD: videopllvar.h,v 1.2 2018/02/16 18:10:32 macallan Exp $	*/
-
 /*
  * Copyright (c) 2012 Michael Lorenz
  * All rights reserved.
@@ -27,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: videopllvar.h,v 1.2 2018/02/16 18:10:32 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: videopllvar.h,v 1.3 2018/02/16 18:12:45 macallan Exp $");
 
 #ifndef VIDEOPLLVAR_H
 #define VIDEOPLLVAR_H



CVS commit: [netbsd-6-0] src/sys/netipsec

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 18:12:47 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-6-0]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.130

Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.12.1 src/sys/netipsec/ipsec.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.55 src/sys/netipsec/ipsec.c:1.55.12.1
--- src/sys/netipsec/ipsec.c:1.55	Thu Jun  9 19:54:18 2011
+++ src/sys/netipsec/ipsec.c	Fri Feb 16 18:12:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.55 2011/06/09 19:54:18 drochner Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.55.12.1 2018/02/16 18:12:47 martin 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.55 2011/06/09 19:54:18 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.55.12.1 2018/02/16 18:12:47 martin Exp $");
 
 /*
  * IPsec controller part.
@@ -979,7 +979,7 @@ ipsec4_get_ulp(struct mbuf *m, struct se
 			spidx->dst.sin.sin_port = uh.uh_dport;
 			return;
 		case IPPROTO_AH:
-			if (m->m_pkthdr.len > off + sizeof(ip6e))
+			if (off + sizeof(ip6e) > m->m_pkthdr.len)
 goto done;
 			/* XXX sigh, this works but is totally bogus */
 			m_copydata(m, off, sizeof(ip6e), );



CVS commit: [netbsd-6-0] src/sys/netipsec

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 18:12:47 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-6-0]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.130

Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.12.1 src/sys/netipsec/ipsec.c

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



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

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 18:12:03 UTC 2018

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

Log Message:
Ticket #1531


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.127 -r1.1.2.128 src/doc/CHANGES-6.1.6

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

Modified files:

Index: src/doc/CHANGES-6.1.6
diff -u src/doc/CHANGES-6.1.6:1.1.2.127 src/doc/CHANGES-6.1.6:1.1.2.128
--- src/doc/CHANGES-6.1.6:1.1.2.127	Thu Feb 15 14:50:57 2018
+++ src/doc/CHANGES-6.1.6	Fri Feb 16 18:12:03 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.6,v 1.1.2.127 2018/02/15 14:50:57 martin Exp $
+# $NetBSD: CHANGES-6.1.6,v 1.1.2.128 2018/02/16 18:12:03 martin Exp $
 
 A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6
 release:
@@ -15001,3 +15001,9 @@ sys/netipsec/xform_ipip.c			1.44 via pat
 	Fix IPv6-IPsec-AH tunnels.
 	[maxv, ticket #1529]
 
+sys/netipsec/ipsec.c1.130
+
+	Fix inverted logic that could crash the kernel.
+	[maxv, ticket #1531]
+
+



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

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 18:12:03 UTC 2018

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

Log Message:
Ticket #1531


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.127 -r1.1.2.128 src/doc/CHANGES-6.1.6

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



CVS commit: [netbsd-6-1] src/sys/netipsec

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 18:11:27 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-6-1]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.130

Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.14.1 src/sys/netipsec/ipsec.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.55 src/sys/netipsec/ipsec.c:1.55.14.1
--- src/sys/netipsec/ipsec.c:1.55	Thu Jun  9 19:54:18 2011
+++ src/sys/netipsec/ipsec.c	Fri Feb 16 18:11:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.55 2011/06/09 19:54:18 drochner Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.55.14.1 2018/02/16 18:11:27 martin 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.55 2011/06/09 19:54:18 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.55.14.1 2018/02/16 18:11:27 martin Exp $");
 
 /*
  * IPsec controller part.
@@ -979,7 +979,7 @@ ipsec4_get_ulp(struct mbuf *m, struct se
 			spidx->dst.sin.sin_port = uh.uh_dport;
 			return;
 		case IPPROTO_AH:
-			if (m->m_pkthdr.len > off + sizeof(ip6e))
+			if (off + sizeof(ip6e) > m->m_pkthdr.len)
 goto done;
 			/* XXX sigh, this works but is totally bogus */
 			m_copydata(m, off, sizeof(ip6e), );



CVS commit: [netbsd-6-1] src/sys/netipsec

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 18:11:27 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-6-1]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.130

Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.14.1 src/sys/netipsec/ipsec.c

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



CVS commit: src/sys/arch/macppc/dev

2018-02-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 16 18:10:32 UTC 2018

Modified Files:
src/sys/arch/macppc/dev: valkyriefbreg.h videopllvar.h

Log Message:
add $NetBSD:


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/valkyriefbreg.h \
src/sys/arch/macppc/dev/videopllvar.h

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



CVS commit: src/sys/arch/macppc/dev

2018-02-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 16 18:10:32 UTC 2018

Modified Files:
src/sys/arch/macppc/dev: valkyriefbreg.h videopllvar.h

Log Message:
add $NetBSD:


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/valkyriefbreg.h \
src/sys/arch/macppc/dev/videopllvar.h

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

Modified files:

Index: src/sys/arch/macppc/dev/valkyriefbreg.h
diff -u src/sys/arch/macppc/dev/valkyriefbreg.h:1.1 src/sys/arch/macppc/dev/valkyriefbreg.h:1.2
--- src/sys/arch/macppc/dev/valkyriefbreg.h:1.1	Tue Jan 24 04:33:11 2012
+++ src/sys/arch/macppc/dev/valkyriefbreg.h	Fri Feb 16 18:10:32 2018
@@ -1,4 +1,6 @@
-/*-
+/*	$NetBSD: valkyriefbreg.h,v 1.2 2018/02/16 18:10:32 macallan Exp $	*/
+
+/*
  * Copyright (c) 2012 Michael Lorenz
  * All rights reserved.
  *
@@ -25,16 +27,16 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: valkyriefbreg.h,v 1.1 2012/01/24 04:33:11 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: valkyriefbreg.h,v 1.2 2018/02/16 18:10:32 macallan Exp $");
 
 #ifndef VALKYRIEFBREG_H
 #define VALKYRIEFBREG_H
 
-#define VAL_FB_OFFSET		0x
-#define VAL_CMAP_OFFSET		0x00304000
+#define VAL_FB_OFFSET	0x
+#define VAL_CMAP_OFFSET	0x00304000
 #define VAL_CMAP_ADDR	0x
 #define VAL_CMAP_LUT	0x0008
-#define VAL_REGS_OFFSET		0x0030a000
+#define VAL_REGS_OFFSET	0x0030a000
 #define VAL_MODE	0x
 	#define VAL_MODE_STOP	0x80
 	#define VAL_MODE_NOSYNC	0x40
Index: src/sys/arch/macppc/dev/videopllvar.h
diff -u src/sys/arch/macppc/dev/videopllvar.h:1.1 src/sys/arch/macppc/dev/videopllvar.h:1.2
--- src/sys/arch/macppc/dev/videopllvar.h:1.1	Tue Jan 24 04:33:11 2012
+++ src/sys/arch/macppc/dev/videopllvar.h	Fri Feb 16 18:10:32 2018
@@ -1,4 +1,6 @@
-/*-
+/*	$NetBSD: videopllvar.h,v 1.2 2018/02/16 18:10:32 macallan Exp $	*/
+
+/*
  * Copyright (c) 2012 Michael Lorenz
  * All rights reserved.
  *
@@ -25,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: videopllvar.h,v 1.1 2012/01/24 04:33:11 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: videopllvar.h,v 1.2 2018/02/16 18:10:32 macallan Exp $");
 
 #ifndef VIDEOPLLVAR_H
 #define VIDEOPLLVAR_H



CVS commit: [netbsd-6] src/doc

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 18:10:40 UTC 2018

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

Log Message:
Ticket #1531


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

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



CVS commit: [netbsd-6] src/doc

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 18:10:40 UTC 2018

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

Log Message:
Ticket #1531


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

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.323 src/doc/CHANGES-6.2:1.1.2.324
--- src/doc/CHANGES-6.2:1.1.2.323	Thu Feb 15 14:49:40 2018
+++ src/doc/CHANGES-6.2	Fri Feb 16 18:10:40 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.323 2018/02/15 14:49:40 martin Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.324 2018/02/16 18:10:40 martin Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -21059,3 +21059,8 @@ sys/netipsec/xform_ipip.c			1.44 via pat
 	Fix IPv6-IPsec-AH tunnels.
 	[maxv, ticket #1529]
 
+sys/netipsec/ipsec.c1.130
+
+	Fix inverted logic that could crash the kernel.
+	[maxv, ticket #1531]
+



CVS commit: [netbsd-6] src/sys/netipsec

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 18:10:09 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-6]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.130

Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.8.1 src/sys/netipsec/ipsec.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.55 src/sys/netipsec/ipsec.c:1.55.8.1
--- src/sys/netipsec/ipsec.c:1.55	Thu Jun  9 19:54:18 2011
+++ src/sys/netipsec/ipsec.c	Fri Feb 16 18:10:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.55 2011/06/09 19:54:18 drochner Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.55.8.1 2018/02/16 18:10:09 martin 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.55 2011/06/09 19:54:18 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.55.8.1 2018/02/16 18:10:09 martin Exp $");
 
 /*
  * IPsec controller part.
@@ -979,7 +979,7 @@ ipsec4_get_ulp(struct mbuf *m, struct se
 			spidx->dst.sin.sin_port = uh.uh_dport;
 			return;
 		case IPPROTO_AH:
-			if (m->m_pkthdr.len > off + sizeof(ip6e))
+			if (off + sizeof(ip6e) > m->m_pkthdr.len)
 goto done;
 			/* XXX sigh, this works but is totally bogus */
 			m_copydata(m, off, sizeof(ip6e), );



CVS commit: [netbsd-6] src/sys/netipsec

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 18:10:09 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-6]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.130

Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.8.1 src/sys/netipsec/ipsec.c

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



CVS commit: src/sys/arch/macppc/dev

2018-02-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 16 18:07:05 UTC 2018

Modified Files:
src/sys/arch/macppc/dev: pmu.c

Log Message:
OF_getprop() retuns -1 on failure, not 0...


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/macppc/dev/pmu.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/macppc/dev/pmu.c
diff -u src/sys/arch/macppc/dev/pmu.c:1.29 src/sys/arch/macppc/dev/pmu.c:1.30
--- src/sys/arch/macppc/dev/pmu.c:1.29	Fri Sep 29 14:15:42 2017
+++ src/sys/arch/macppc/dev/pmu.c	Fri Feb 16 18:07:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmu.c,v 1.29 2017/09/29 14:15:42 macallan Exp $ */
+/*	$NetBSD: pmu.c,v 1.30 2018/02/16 18:07:05 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.29 2017/09/29 14:15:42 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.30 2018/02/16 18:07:05 macallan Exp $");
 
 #include 
 #include 
@@ -338,7 +338,7 @@ pmu_attach(device_t parent, device_t sel
 
 	while (node != 0) {
 
-		if (OF_getprop(node, "name", name, 256) == 0)
+		if (OF_getprop(node, "name", name, 256) <= 0)
 			goto next;
 
 		if (strncmp(name, "pmu-i2c", 8) == 0) {
@@ -358,12 +358,12 @@ pmu_attach(device_t parent, device_t sel
 			/* look for i2c devices */
 			devs = OF_child(node);
 			while (devs != 0) {
-if (OF_getprop(devs, "name", name, 256) == 0)
+if (OF_getprop(devs, "name", name, 256) <= 0)
 	goto skip;
 if (OF_getprop(devs, "compatible",
-compat, 256) == 0)
+compat, 256) <= 0)
 	goto skip;
-if (OF_getprop(devs, "reg", , 4) == 0)
+if (OF_getprop(devs, "reg", , 4) <= 0)
 	goto skip;
 addr = (addr & 0xff) >> 1;
 DPRINTF("-> %s@%x\n", name, addr);



CVS commit: src/sys/arch/macppc/dev

2018-02-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 16 18:07:05 UTC 2018

Modified Files:
src/sys/arch/macppc/dev: pmu.c

Log Message:
OF_getprop() retuns -1 on failure, not 0...


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/macppc/dev/pmu.c

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



CVS commit: src/sys/arch/powerpc/include/oea

2018-02-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 16 18:04:06 UTC 2018

Modified Files:
src/sys/arch/powerpc/include/oea: hid.h spr.h

Log Message:
add a few pp970-specific bits


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/include/oea/hid.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/include/oea/spr.h

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

Modified files:

Index: src/sys/arch/powerpc/include/oea/hid.h
diff -u src/sys/arch/powerpc/include/oea/hid.h:1.11 src/sys/arch/powerpc/include/oea/hid.h:1.12
--- src/sys/arch/powerpc/include/oea/hid.h:1.11	Fri Jul  7 22:13:35 2017
+++ src/sys/arch/powerpc/include/oea/hid.h	Fri Feb 16 18:04:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hid.h,v 1.11 2017/07/07 22:13:35 macallan Exp $	*/
+/*	$NetBSD: hid.h,v 1.12 2018/02/16 18:04:06 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -172,4 +172,18 @@
 #define	HID1_SYNCBE	0x0800	/* Enable sync/eieio broadcast */
 #define	HID1_ABE	0x0400	/* Enable address broadcast */
 
+/* PPC970 HID4 */
+#define HID4_RMLR0	0x0020	/* real mode limit bit 0 */
+#define HID4_RMLR1	0x4000	/* real mode limit bit 1 */
+#define HID4_RMLR2	0x2000	/* real mode limit bit 2 */
+/*
+ * real mode limit bits 012
+ * 011 - 64MB
+ * 111 - 128MB
+ * 100 - 256MB
+ * x10 - 1GB
+ * x01 - 16GB
+ * 000 - 256GB
+ */
+
 #endif /* _POWERPC_OEA_HID_H_ */

Index: src/sys/arch/powerpc/include/oea/spr.h
diff -u src/sys/arch/powerpc/include/oea/spr.h:1.3 src/sys/arch/powerpc/include/oea/spr.h:1.4
--- src/sys/arch/powerpc/include/oea/spr.h:1.3	Tue Jul  7 15:41:46 2015
+++ src/sys/arch/powerpc/include/oea/spr.h	Fri Feb 16 18:04:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spr.h,v 1.3 2015/07/07 15:41:46 macallan Exp $	*/
+/*	$NetBSD: spr.h,v 1.4 2018/02/16 18:04:06 macallan Exp $	*/
 
 #ifndef _POWERPC_OEA_SPR_H_
 #define	_POWERPC_OEA_SPR_H_
@@ -28,6 +28,15 @@
 #define	SPR_RTCL_W		0x015	/* ..6. 601 RTC Lower - Write */
 #define	SPR_SDR1		0x019	/* ..68 Page table base address register */
 #define	SPR_VRSAVE		0x100	/* ..6. AltiVec VRSAVE */
+#define SPR_SCOMC		0x114	/*  SCOM Control Register (970) */
+#define SPR_SCOMD		0x115	/*  SCOM Data Register (970) */
+#define  SCOM_PCR		  0x0aa00100	/* Power Control Register */
+#define  SCOM_PCR_BIT		  0x8000	/* Data bit */
+#define  SCOM_PSR		  0x40800100	/* Power Status Register */
+#define  PSR_RECEIVED		  (1ULL << 61)
+#define  PSR_COMPLETED		  (1ULL << 60)
+#define  SCOMC_READ		  0x8000
+#define  SCOMC_WRITE		  0x
 #define	SPR_ASR			0x118	/* ..6. Address Space Register (PPC64) */
 #define	SPR_EAR			0x11a	/* ..68 External Access Register */
 #define	  MPC601		  0x0001



CVS commit: src/sys/arch/powerpc/include/oea

2018-02-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 16 18:04:06 UTC 2018

Modified Files:
src/sys/arch/powerpc/include/oea: hid.h spr.h

Log Message:
add a few pp970-specific bits


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/include/oea/hid.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/include/oea/spr.h

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



CVS commit: src/sys/arch/powerpc/oea

2018-02-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 16 18:02:10 UTC 2018

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
use mtspr64() in bridge mode


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/powerpc/oea/cpu_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/arch/powerpc/oea/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.88 src/sys/arch/powerpc/oea/cpu_subr.c:1.89
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.88	Sun Jan 21 08:46:48 2018
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Feb 16 18:02:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.88 2018/01/21 08:46:48 mrg Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.89 2018/02/16 18:02:10 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.88 2018/01/21 08:46:48 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.89 2018/02/16 18:02:10 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -644,17 +644,7 @@ cpu_setup(device_t self, struct cpu_info
 	if ((oeacpufeat & OEACPU_64_BRIDGE) != 0) {
 #endif
 		if (hid64_0 != hid64_0_save) {
-			/* ppc970 needs extra goop around writes to HID0 */
-			__asm volatile( "sync;" \
-	"mtspr %0,%1;" \
-	"mfspr %1,%0;" \
-	"mfspr %1,%0;" \
-	"mfspr %1,%0;" \
-	"mfspr %1,%0;" \
-	"mfspr %1,%0;" \
-	"mfspr %1,%0;" \
-	 : : "K"(SPR_HID0), "r"(hid64_0));
-			__asm volatile("sync;isync");
+			mtspr64(SPR_HID0, hid64_0);
 		}
 #if defined(PPC_OEA64_BRIDGE)
 	} else {



CVS commit: src/sys/arch/powerpc/oea

2018-02-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 16 18:02:10 UTC 2018

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
use mtspr64() in bridge mode


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/powerpc/oea/cpu_subr.c

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



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

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:43:12 UTC 2018

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

Log Message:
Ticket #1570


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

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

Modified files:

Index: src/doc/CHANGES-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.83 src/doc/CHANGES-7.0.3:1.1.2.84
--- src/doc/CHANGES-7.0.3:1.1.2.83	Thu Feb 15 17:53:48 2018
+++ src/doc/CHANGES-7.0.3	Fri Feb 16 16:43:12 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.83 2018/02/15 17:53:48 martin Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.84 2018/02/16 16:43:12 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5252,4 +5252,8 @@ sys/netipsec/xform_ipip.c			1.56,1.57 vi
 	possible use-after-free (Tunnel).
 	[maxv, ticket #1569]
 
+sys/netipsec/ipsec.c1.130
+
+	Fix inverted logic that could crash the kernel.
+	[maxv, ticket #1570]
 



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

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:43:12 UTC 2018

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

Log Message:
Ticket #1570


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

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



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

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:42:18 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-7-0]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.130

Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.63.4.1 src/sys/netipsec/ipsec.c

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



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

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:42:18 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-7-0]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.130

Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.63.4.1 src/sys/netipsec/ipsec.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.63 src/sys/netipsec/ipsec.c:1.63.4.1
--- src/sys/netipsec/ipsec.c:1.63	Fri May 30 01:39:03 2014
+++ src/sys/netipsec/ipsec.c	Fri Feb 16 16:42:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.63 2014/05/30 01:39:03 christos Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.63.4.1 2018/02/16 16:42:18 martin 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.63 2014/05/30 01:39:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.63.4.1 2018/02/16 16:42:18 martin Exp $");
 
 /*
  * IPsec controller part.
@@ -1176,7 +1176,7 @@ ipsec4_get_ulp(struct mbuf *m, struct se
 			spidx->dst.sin.sin_port = uh.uh_dport;
 			return;
 		case IPPROTO_AH:
-			if (m->m_pkthdr.len > off + sizeof(ip6e))
+			if (off + sizeof(ip6e) > m->m_pkthdr.len)
 goto done;
 			/* XXX sigh, this works but is totally bogus */
 			m_copydata(m, off, sizeof(ip6e), );



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

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:41:23 UTC 2018

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

Log Message:
Ticket #1570


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/doc/CHANGES-7.1.2

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

Modified files:

Index: src/doc/CHANGES-7.1.2
diff -u src/doc/CHANGES-7.1.2:1.1.2.13 src/doc/CHANGES-7.1.2:1.1.2.14
--- src/doc/CHANGES-7.1.2:1.1.2.13	Thu Feb 15 17:52:22 2018
+++ src/doc/CHANGES-7.1.2	Fri Feb 16 16:41:23 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.2,v 1.1.2.13 2018/02/15 17:52:22 martin Exp $
+# $NetBSD: CHANGES-7.1.2,v 1.1.2.14 2018/02/16 16:41:23 martin Exp $
 
 A complete list of changes from the NetBSD 7.1.1 release to the NetBSD 7.1.2
 release:
@@ -140,3 +140,8 @@ sys/netipsec/xform_ipip.c			1.56,1.57 vi
 	possible use-after-free (Tunnel).
 	[maxv, ticket #1569]
 
+sys/netipsec/ipsec.c1.130
+
+	Fix inverted logic that could crash the kernel.
+	[maxv, ticket #1570]
+



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

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:41:23 UTC 2018

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

Log Message:
Ticket #1570


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/doc/CHANGES-7.1.2

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



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

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:40:39 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-7-1]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.130

Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.63.8.1 src/sys/netipsec/ipsec.c

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



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

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:40:39 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-7-1]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.130

Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.63.8.1 src/sys/netipsec/ipsec.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.63 src/sys/netipsec/ipsec.c:1.63.8.1
--- src/sys/netipsec/ipsec.c:1.63	Fri May 30 01:39:03 2014
+++ src/sys/netipsec/ipsec.c	Fri Feb 16 16:40:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.63 2014/05/30 01:39:03 christos Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.63.8.1 2018/02/16 16:40:39 martin 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.63 2014/05/30 01:39:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.63.8.1 2018/02/16 16:40:39 martin Exp $");
 
 /*
  * IPsec controller part.
@@ -1176,7 +1176,7 @@ ipsec4_get_ulp(struct mbuf *m, struct se
 			spidx->dst.sin.sin_port = uh.uh_dport;
 			return;
 		case IPPROTO_AH:
-			if (m->m_pkthdr.len > off + sizeof(ip6e))
+			if (off + sizeof(ip6e) > m->m_pkthdr.len)
 goto done;
 			/* XXX sigh, this works but is totally bogus */
 			m_copydata(m, off, sizeof(ip6e), );



CVS commit: [netbsd-7] src/doc

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:39:48 UTC 2018

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

Log Message:
Ticket #1570


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

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

Modified files:

Index: src/doc/CHANGES-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.69 src/doc/CHANGES-7.2:1.1.2.70
--- src/doc/CHANGES-7.2:1.1.2.69	Thu Feb 15 17:02:15 2018
+++ src/doc/CHANGES-7.2	Fri Feb 16 16:39:48 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.69 2018/02/15 17:02:15 martin Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.70 2018/02/16 16:39:48 martin Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -5129,3 +5129,8 @@ sys/netipsec/xform_ipip.c			1.56,1.57 vi
 	possible use-after-free (Tunnel).
 	[maxv, ticket #1569]
 
+sys/netipsec/ipsec.c1.130
+
+	Fix inverted logic that could crash the kernel.
+	[maxv, ticket #1570]
+



CVS commit: [netbsd-7] src/doc

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:39:48 UTC 2018

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

Log Message:
Ticket #1570


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

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



CVS commit: [netbsd-7] src/sys/netipsec

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:39:05 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-7]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.130

Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.63.2.1 src/sys/netipsec/ipsec.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.63 src/sys/netipsec/ipsec.c:1.63.2.1
--- src/sys/netipsec/ipsec.c:1.63	Fri May 30 01:39:03 2014
+++ src/sys/netipsec/ipsec.c	Fri Feb 16 16:39:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.63 2014/05/30 01:39:03 christos Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.63.2.1 2018/02/16 16:39:05 martin 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.63 2014/05/30 01:39:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.63.2.1 2018/02/16 16:39:05 martin Exp $");
 
 /*
  * IPsec controller part.
@@ -1176,7 +1176,7 @@ ipsec4_get_ulp(struct mbuf *m, struct se
 			spidx->dst.sin.sin_port = uh.uh_dport;
 			return;
 		case IPPROTO_AH:
-			if (m->m_pkthdr.len > off + sizeof(ip6e))
+			if (off + sizeof(ip6e) > m->m_pkthdr.len)
 goto done;
 			/* XXX sigh, this works but is totally bogus */
 			m_copydata(m, off, sizeof(ip6e), );



CVS commit: [netbsd-7] src/sys/netipsec

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:39:05 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-7]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.130

Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.63.2.1 src/sys/netipsec/ipsec.c

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



CVS commit: [netbsd-8] src/doc

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:36:03 UTC 2018

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

Log Message:
Ticket #559


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

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



CVS commit: [netbsd-8] src/doc

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:36:03 UTC 2018

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

Log Message:
Ticket #559


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

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.126 src/doc/CHANGES-8.0:1.1.2.127
--- src/doc/CHANGES-8.0:1.1.2.126	Thu Feb 15 14:29:45 2018
+++ src/doc/CHANGES-8.0	Fri Feb 16 16:36:03 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.126 2018/02/15 14:29:45 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.127 2018/02/16 16:36:03 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -9663,3 +9663,8 @@ sys/netipsec/xform_ipip.c			1.56-1.63
 	Sync IPsec-Tunnel with NetBSD-current, fix several bugs.
 	[maxv, ticket #551]
 
+sys/netipsec/ipsec.c1.130
+
+	Fix inverted logic that could crash the kernel.
+	[maxv, ticket #559]
+



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

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:35:18 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-8]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.130

Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.99.2.3 -r1.99.2.4 src/sys/netipsec/ipsec.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.99.2.3 src/sys/netipsec/ipsec.c:1.99.2.4
--- src/sys/netipsec/ipsec.c:1.99.2.3	Mon Feb  5 14:55:16 2018
+++ src/sys/netipsec/ipsec.c	Fri Feb 16 16:35:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.99.2.3 2018/02/05 14:55:16 martin Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.99.2.4 2018/02/16 16:35:18 martin 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.99.2.3 2018/02/05 14:55:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.99.2.4 2018/02/16 16:35:18 martin Exp $");
 
 /*
  * IPsec controller part.
@@ -1060,7 +1060,7 @@ ipsec4_get_ulp(struct mbuf *m, struct se
 			spidx->dst.sin.sin_port = uh.uh_dport;
 			return;
 		case IPPROTO_AH:
-			if (m->m_pkthdr.len > off + sizeof(ip6e))
+			if (off + sizeof(ip6e) > m->m_pkthdr.len)
 goto done;
 			/* XXX sigh, this works but is totally bogus */
 			m_copydata(m, off, sizeof(ip6e), );



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

2018-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 16 16:35:18 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-8]: ipsec.c

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

sys/netipsec/ipsec.c: revision 1.130

Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.99.2.3 -r1.99.2.4 src/sys/netipsec/ipsec.c

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



CVS commit: src/tests/net/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 16 16:30:20 UTC 2018

Modified Files:
src/tests/net/net: t_tcp.c t_unix.c

Log Message:
explain what's going on before we fix it.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/net/net/t_tcp.c
cvs rdiff -u -r1.13 -r1.14 src/tests/net/net/t_unix.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/net/net/t_tcp.c
diff -u src/tests/net/net/t_tcp.c:1.7 src/tests/net/net/t_tcp.c:1.8
--- src/tests/net/net/t_tcp.c:1.7	Fri Feb 16 11:23:15 2018
+++ src/tests/net/net/t_tcp.c	Fri Feb 16 11:30:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_tcp.c,v 1.7 2018/02/16 16:23:15 christos Exp $	*/
+/*	$NetBSD: t_tcp.c,v 1.8 2018/02/16 16:30:20 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$Id: t_tcp.c,v 1.7 2018/02/16 16:23:15 christos Exp $");
+__RCSID("$Id: t_tcp.c,v 1.8 2018/02/16 16:30:20 christos Exp $");
 #endif
 
 /* Example code. Should block; does with accept not paccept. */
@@ -182,12 +182,13 @@ again:
 		FAIL("fnctl setfl");
 #endif
 
+	/* This is supposed to only work on Unix sockets but returns garbage */
 	if (getpeereid(clnt, , ) == -1)
 		FAIL("getpeereid(clnt)");
 	CHECK_EQUAL(euid, geteuid(), "client");
 	CHECK_EQUAL(egid, getegid(), "client");
 
-	/* This is not symmetric? */
+	/* This is supposed to only work on Unix sockets but returns garbage */
 	if (getpeereid(srvr, , ) == -1)
 		FAIL("getpeereid(srvr)");
 	CHECK_EQUAL(euid, geteuid(), "server");

Index: src/tests/net/net/t_unix.c
diff -u src/tests/net/net/t_unix.c:1.13 src/tests/net/net/t_unix.c:1.14
--- src/tests/net/net/t_unix.c:1.13	Fri Feb 16 11:23:15 2018
+++ src/tests/net/net/t_unix.c	Fri Feb 16 11:30:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unix.c,v 1.13 2018/02/16 16:23:15 christos Exp $	*/
+/*	$NetBSD: t_unix.c,v 1.14 2018/02/16 16:30:20 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$Id: t_unix.c,v 1.13 2018/02/16 16:23:15 christos Exp $");
+__RCSID("$Id: t_unix.c,v 1.14 2018/02/16 16:30:20 christos Exp $");
 #else
 #define getprogname() argv[0]
 #endif
@@ -183,7 +183,7 @@ test(bool closeit, size_t len)
 	CHECK_EQUAL(egid, getegid(), "client");
 
 #if 0
-	/* This is not symmetric? */
+	/* This is not symmetric? It is supposed to work! */
 	if (getpeereid(srvr, , ) == -1)
 		FAIL("getpeereid(srvr)");
 	CHECK_EQUAL(euid, geteuid(), "server");



CVS commit: src/tests/net/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 16 16:30:20 UTC 2018

Modified Files:
src/tests/net/net: t_tcp.c t_unix.c

Log Message:
explain what's going on before we fix it.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/net/net/t_tcp.c
cvs rdiff -u -r1.13 -r1.14 src/tests/net/net/t_unix.c

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



CVS commit: src/tests/net/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 16 16:23:15 UTC 2018

Modified Files:
src/tests/net/net: t_tcp.c t_unix.c
Added Files:
src/tests/net/net: test.h

Log Message:
add getpeereid tests for non-unix sockets, returns garbage...


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/net/t_tcp.c
cvs rdiff -u -r1.12 -r1.13 src/tests/net/net/t_unix.c
cvs rdiff -u -r0 -r1.1 src/tests/net/net/test.h

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

Modified files:

Index: src/tests/net/net/t_tcp.c
diff -u src/tests/net/net/t_tcp.c:1.6 src/tests/net/net/t_tcp.c:1.7
--- src/tests/net/net/t_tcp.c:1.6	Mon Aug 28 06:19:57 2017
+++ src/tests/net/net/t_tcp.c	Fri Feb 16 11:23:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_tcp.c,v 1.6 2017/08/28 10:19:57 christos Exp $	*/
+/*	$NetBSD: t_tcp.c,v 1.7 2018/02/16 16:23:15 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$Id: t_tcp.c,v 1.6 2017/08/28 10:19:57 christos Exp $");
+__RCSID("$Id: t_tcp.c,v 1.7 2018/02/16 16:23:15 christos Exp $");
 #endif
 
 /* Example code. Should block; does with accept not paccept. */
@@ -55,20 +55,8 @@ __RCSID("$Id: t_tcp.c,v 1.6 2017/08/28 1
 #include 
 #include 
 
-#ifdef TEST
-#define FAIL(msg)  err(EXIT_FAILURE, msg)
-#define FAILX(msg, ...)  err(EXIT_FAILURE, msg, ## __VA_ARGS__)
-#else 
-#include  
-#define FAIL(msg)  do { \
-		ATF_CHECK_MSG(0, msg " (%s)", strerror(errno)); \
-		goto fail; \
-	} while (/*CONSTCOND*/0)
-#define FAILX(msg, ...)  do { \
-	ATF_CHECK_MSG(0, msg, ## __VA_ARGS__); \
-	goto fail; \
-	} while (/*CONSTCOND*/0)
-#endif
+
+#include "test.h"
 
 #ifdef __linux__
 #define paccept(a, b, c, d, e) accept4((a), (b), (c), (e))
@@ -93,6 +81,8 @@ paccept_block(sa_family_t sfamily, sa_fa
 	struct sockaddr_in6 *sin6;
 	struct sigaction sa;
 	socklen_t slen;
+	uid_t euid;
+	gid_t egid;
 
 	srvr = socket(sfamily, SOCK_STREAM | SOCK_NONBLOCK, 0);
 	if (srvr == -1)
@@ -192,6 +182,18 @@ again:
 		FAIL("fnctl setfl");
 #endif
 
+	if (getpeereid(clnt, , ) == -1)
+		FAIL("getpeereid(clnt)");
+	CHECK_EQUAL(euid, geteuid(), "client");
+	CHECK_EQUAL(egid, getegid(), "client");
+
+	/* This is not symmetric? */
+	if (getpeereid(srvr, , ) == -1)
+		FAIL("getpeereid(srvr)");
+	CHECK_EQUAL(euid, geteuid(), "server");
+	CHECK_EQUAL(egid, getegid(), "server");
+
+
 	if (as == -1) {		/* not true under NetBSD */
 		as = paccept(srvr, NULL, NULL, NULL, pacceptblock ? 0 : SOCK_NONBLOCK);
 		if (as == -1)
@@ -202,7 +204,7 @@ again:
 		if (fl == -1)
 			FAIL("fnctl");
 		if (fl != (O_RDWR|O_NONBLOCK))
-			FAILX("fl 0x%x != 0x%x\n", fl, O_RDWR|O_NONBLOCK);
+			FAIL("fl 0x%x != 0x%x\n", fl, O_RDWR|O_NONBLOCK);
 		ok = fcntl(as, F_SETFL, fl & ~O_NONBLOCK);
 		if (ok == -1)
 			FAIL("fnctl setfl");

Index: src/tests/net/net/t_unix.c
diff -u src/tests/net/net/t_unix.c:1.12 src/tests/net/net/t_unix.c:1.13
--- src/tests/net/net/t_unix.c:1.12	Fri Feb 16 11:08:22 2018
+++ src/tests/net/net/t_unix.c	Fri Feb 16 11:23:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unix.c,v 1.12 2018/02/16 16:08:22 christos Exp $	*/
+/*	$NetBSD: t_unix.c,v 1.13 2018/02/16 16:23:15 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$Id: t_unix.c,v 1.12 2018/02/16 16:08:22 christos Exp $");
+__RCSID("$Id: t_unix.c,v 1.13 2018/02/16 16:23:15 christos Exp $");
 #else
 #define getprogname() argv[0]
 #endif
@@ -60,20 +60,7 @@ __RCSID("$Id: t_unix.c,v 1.12 2018/02/16
 #include 
 #include 
 
-#ifdef TEST
-#define FAIL(msg, ...)	err(EXIT_FAILURE, msg, ## __VA_ARGS__)
-#define CHECK_EQUAL(a, b) if ((a) != (b)) \
-errx(EXIT_FAILURE, # a "(%ju) != " # b "(%ju)", (uintmax_t)(a), (uintmax_t)((b));
-#else
-
-#include 
-#define FAIL(msg, ...)	\
-	do { \
-		ATF_CHECK_MSG(0, msg, ## __VA_ARGS__); \
-		goto fail; \
-	} while (/*CONSTCOND*/0)
-#define CHECK_EQUAL(a, b) ATF_CHECK_EQ(a, b) 
-#endif
+#include "test.h"
 
 #define OF offsetof(struct sockaddr_un, sun_path)
 
@@ -192,15 +179,15 @@ test(bool closeit, size_t len)
 
 	if (getpeereid(clnt, , ) == -1)
 		FAIL("getpeereid(clnt)");
-	CHECK_EQUAL(euid, geteuid());
-	CHECK_EQUAL(egid, getegid());
+	CHECK_EQUAL(euid, geteuid(), "client");
+	CHECK_EQUAL(egid, getegid(), "client");
 
 #if 0
 	/* This is not symmetric? */
 	if (getpeereid(srvr, , ) == -1)
 		FAIL("getpeereid(srvr)");
-	CHECK_EQUAL(euid, geteuid());
-	CHECK_EQUAL(egid, getegid());
+	CHECK_EQUAL(euid, geteuid(), "server");
+	CHECK_EQUAL(egid, getegid(), "server");
 #endif
 
 	if (closeit) {

Added files:

Index: src/tests/net/net/test.h
diff -u /dev/null src/tests/net/net/test.h:1.1
--- /dev/null	Fri Feb 16 11:23:15 2018
+++ src/tests/net/net/test.h	Fri Feb 16 11:23:15 2018
@@ -0,0 +1,55 @@
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived 

CVS commit: src/tests/net/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 16 16:23:15 UTC 2018

Modified Files:
src/tests/net/net: t_tcp.c t_unix.c
Added Files:
src/tests/net/net: test.h

Log Message:
add getpeereid tests for non-unix sockets, returns garbage...


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/net/t_tcp.c
cvs rdiff -u -r1.12 -r1.13 src/tests/net/net/t_unix.c
cvs rdiff -u -r0 -r1.1 src/tests/net/net/test.h

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



CVS commit: src/tests/net/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 16 16:08:22 UTC 2018

Modified Files:
src/tests/net/net: t_unix.c

Log Message:
add a getpeeeid test.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/net/net/t_unix.c

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



CVS commit: src/tests/net/net

2018-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 16 16:08:22 UTC 2018

Modified Files:
src/tests/net/net: t_unix.c

Log Message:
add a getpeeeid test.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/net/net/t_unix.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/net/net/t_unix.c
diff -u src/tests/net/net/t_unix.c:1.11 src/tests/net/net/t_unix.c:1.12
--- src/tests/net/net/t_unix.c:1.11	Wed Nov 13 16:41:23 2013
+++ src/tests/net/net/t_unix.c	Fri Feb 16 11:08:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_unix.c,v 1.11 2013/11/13 21:41:23 christos Exp $	*/
+/*	$NetBSD: t_unix.c,v 1.12 2018/02/16 16:08:22 christos Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$Id: t_unix.c,v 1.11 2013/11/13 21:41:23 christos Exp $");
+__RCSID("$Id: t_unix.c,v 1.12 2018/02/16 16:08:22 christos Exp $");
 #else
 #define getprogname() argv[0]
 #endif
@@ -62,6 +62,8 @@ __RCSID("$Id: t_unix.c,v 1.11 2013/11/13
 
 #ifdef TEST
 #define FAIL(msg, ...)	err(EXIT_FAILURE, msg, ## __VA_ARGS__)
+#define CHECK_EQUAL(a, b) if ((a) != (b)) \
+errx(EXIT_FAILURE, # a "(%ju) != " # b "(%ju)", (uintmax_t)(a), (uintmax_t)((b));
 #else
 
 #include 
@@ -70,7 +72,7 @@ __RCSID("$Id: t_unix.c,v 1.11 2013/11/13
 		ATF_CHECK_MSG(0, msg, ## __VA_ARGS__); \
 		goto fail; \
 	} while (/*CONSTCOND*/0)
-
+#define CHECK_EQUAL(a, b) ATF_CHECK_EQ(a, b) 
 #endif
 
 #define OF offsetof(struct sockaddr_un, sun_path)
@@ -142,6 +144,8 @@ test(bool closeit, size_t len)
 	size_t slen;
 	socklen_t sl;
 	int srvr = -1, clnt = -1, acpt = -1;
+	uid_t euid;
+	gid_t egid;
 	struct sockaddr_un *sock_addr = NULL, *sun = NULL;
 	socklen_t sock_addrlen;
 
@@ -186,6 +190,19 @@ test(bool closeit, size_t len)
 	if (connect(clnt, (const struct sockaddr *)sun, sl) == -1)
 		FAIL("connect");
 
+	if (getpeereid(clnt, , ) == -1)
+		FAIL("getpeereid(clnt)");
+	CHECK_EQUAL(euid, geteuid());
+	CHECK_EQUAL(egid, getegid());
+
+#if 0
+	/* This is not symmetric? */
+	if (getpeereid(srvr, , ) == -1)
+		FAIL("getpeereid(srvr)");
+	CHECK_EQUAL(euid, geteuid());
+	CHECK_EQUAL(egid, getegid());
+#endif
+
 	if (closeit) {
 		if (close(clnt) == -1)
 			FAIL("close");



CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 15:18:41 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.c ipsec.h ipsec6.h xform.h

Log Message:
Style, remove unused and misleading macros and comments, localify, and
reduce the diff between similar functions. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.65 -r1.66 src/sys/netipsec/ipsec.h
cvs rdiff -u -r1.21 -r1.22 src/sys/netipsec/ipsec6.h
cvs rdiff -u -r1.13 -r1.14 src/sys/netipsec/xform.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.c
diff -u src/sys/netipsec/ipsec.c:1.130 src/sys/netipsec/ipsec.c:1.131
--- src/sys/netipsec/ipsec.c:1.130	Fri Feb 16 11:25:16 2018
+++ src/sys/netipsec/ipsec.c	Fri Feb 16 15:18:41 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.130 2018/02/16 11:25:16 maxv Exp $ */
+/* $NetBSD: ipsec.c,v 1.131 2018/02/16 15:18:41 maxv Exp $ */
 /* $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.130 2018/02/16 11:25:16 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.131 2018/02/16 15:18:41 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -540,7 +540,7 @@ ipsec_getpolicybysock(struct mbuf *m, u_
  *		ENOENT	: ipsec_acquire() in progress, maybe.
  *		others	: error occurred.
  */
-struct secpolicy *
+static struct secpolicy *
 ipsec_getpolicybyaddr(struct mbuf *m, u_int dir, int flag, int *error)
 {
 	struct secpolicyindex spidx;
@@ -572,7 +572,7 @@ ipsec_getpolicybyaddr(struct mbuf *m, u_
 	return sp;
 }
 
-struct secpolicy *
+static struct secpolicy *
 ipsec4_checkpolicy(struct mbuf *m, u_int dir, u_int flag, int *error,
 struct inpcb *inp)
 {
@@ -766,7 +766,7 @@ ipsec4_forward(struct mbuf *m, int *dest
 	size_t ipsechdr;
 	int error;
 
-	sp = ipsec4_getpolicybyaddr(m,
+	sp = ipsec_getpolicybyaddr(m,
 	IPSEC_DIR_OUTBOUND, IP_FORWARDING, );
 	if (sp == NULL) {
 		return EINVAL;
@@ -1687,14 +1687,10 @@ ipsec_get_reqlevel(const struct ipsecreq
 }
 
 /*
- * Check security policy requirements against the actual
- * packet contents.  Return one if the packet should be
- * reject as "invalid"; otherwiser return zero to have the
- * packet treated as "valid".
+ * Check security policy requirements against the actual packet contents.
  *
- * OUT:
- *	0: valid
- *	1: invalid
+ * If the SP requires an IPsec packet, and the packet was neither AH nor ESP,
+ * then kick it.
  */
 int
 ipsec_in_reject(const struct secpolicy *sp, const struct mbuf *m)
@@ -1740,7 +1736,7 @@ ipsec_in_reject(const struct secpolicy *
 			break;
 		case IPPROTO_IPCOMP:
 			/*
-			 * we don't really care, as IPcomp document
+			 * We don't really care, as IPcomp document
 			 * says that we shouldn't compress small
 			 * packets, IPComp policy should always be
 			 * treated as being in "use" level.
@@ -1765,12 +1761,9 @@ ipsec4_in_reject(struct mbuf *m, struct 
 
 	KASSERT(m != NULL);
 
-	/* get SP for this packet.
-	 * When we are called from ip_forward(), we call
-	 * ipsec_getpolicybyaddr() with IP_FORWARDING flag.
-	 */
 	if (inp == NULL)
-		sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, IP_FORWARDING, );
+		sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND,
+		IP_FORWARDING, );
 	else
 		sp = ipsec_getpolicybysock(m, IPSEC_DIR_INBOUND,
 		(struct inpcb_hdr *)inp, );
@@ -1781,13 +1774,11 @@ ipsec4_in_reject(struct mbuf *m, struct 
 			IPSEC_STATINC(IPSEC_STAT_IN_POLVIO);
 		KEY_SP_UNREF();
 	} else {
-		result = 0;	/* XXX should be panic ?
- * -> No, there may be error. */
+		result = 0;
 	}
 	return result;
 }
 
-
 #ifdef INET6
 /*
  * Check AH/ESP integrity.
@@ -1797,20 +1788,15 @@ ipsec4_in_reject(struct mbuf *m, struct 
 int
 ipsec6_in_reject(struct mbuf *m, struct in6pcb *in6p)
 {
-	struct secpolicy *sp = NULL;
+	struct secpolicy *sp;
 	int error;
 	int result;
 
 	KASSERT(m != NULL);
 
-	/*
-	 * Get SP for this packet.
-	 * When we are called from ip_forward(), we call
-	 * ipsec_getpolicybyaddr() with IP_FORWARDING flag.
-	 */
 	if (in6p == NULL)
-		sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, IP_FORWARDING,
-		);
+		sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND,
+		IP_FORWARDING, );
 	else
 		sp = ipsec_getpolicybysock(m, IPSEC_DIR_INBOUND,
 		(struct inpcb_hdr *)in6p, );
@@ -1904,7 +1890,6 @@ ipsec_hdrsiz(const struct secpolicy *sp,
 	return siz;
 }
 
-/* This function is called from ip_forward() and ipsec4_hdrsize_tcp(). */
 size_t
 ipsec4_hdrsiz(struct mbuf *m, u_int dir, struct inpcb *inp)
 {
@@ -1915,11 +1900,6 @@ ipsec4_hdrsiz(struct mbuf *m, u_int dir,
 	KASSERT(m != NULL);
 	KASSERTMSG(inp == NULL || inp->inp_socket != NULL, "socket w/o inpcb");
 
-	/*
-	 * Get SP for this packet.
-	 * When we are called from 

CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 15:18:41 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.c ipsec.h ipsec6.h xform.h

Log Message:
Style, remove unused and misleading macros and comments, localify, and
reduce the diff between similar functions. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.65 -r1.66 src/sys/netipsec/ipsec.h
cvs rdiff -u -r1.21 -r1.22 src/sys/netipsec/ipsec6.h
cvs rdiff -u -r1.13 -r1.14 src/sys/netipsec/xform.h

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



CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 11:25:16 UTC 2018

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

Log Message:
Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/netipsec/ipsec.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.129 src/sys/netipsec/ipsec.c:1.130
--- src/sys/netipsec/ipsec.c:1.129	Fri Feb 16 11:07:44 2018
+++ src/sys/netipsec/ipsec.c	Fri Feb 16 11:25:16 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.129 2018/02/16 11:07:44 maxv Exp $ */
+/* $NetBSD: ipsec.c,v 1.130 2018/02/16 11:25:16 maxv Exp $ */
 /* $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.129 2018/02/16 11:07:44 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.130 2018/02/16 11:25:16 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -1038,7 +1038,7 @@ ipsec4_get_ulp(struct mbuf *m, struct se
 			spidx->dst.sin.sin_port = uh.uh_dport;
 			return;
 		case IPPROTO_AH:
-			if (m->m_pkthdr.len > off + sizeof(ip6e))
+			if (off + sizeof(ip6e) > m->m_pkthdr.len)
 goto done;
 			/* XXX sigh, this works but is totally bogus */
 			m_copydata(m, off, sizeof(ip6e), );



CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 11:25:16 UTC 2018

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

Log Message:
Fix inverted logic, otherwise the kernel crashes when receiving a 1-byte
AH packet. Triggerable before authentication when IPsec and forwarding
are both enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/netipsec/ipsec.c

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



CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 11:07:44 UTC 2018

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

Log Message:
Style a bit, no functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/netipsec/ipsec.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.128 src/sys/netipsec/ipsec.c:1.129
--- src/sys/netipsec/ipsec.c:1.128	Fri Feb 16 09:07:50 2018
+++ src/sys/netipsec/ipsec.c	Fri Feb 16 11:07:44 2018
@@ -1,6 +1,6 @@
-/*	$NetBSD: ipsec.c,v 1.128 2018/02/16 09:07:50 maxv 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 $	*/
+/* $NetBSD: ipsec.c,v 1.129 2018/02/16 11:07:44 maxv Exp $ */
+/* $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 $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.128 2018/02/16 09:07:50 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.129 2018/02/16 11:07:44 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -109,13 +109,13 @@ int ipsec_enabled = 1;
 #ifdef IPSEC_DEBUG
 int ipsec_debug = 1;
 
-/*	  
+/*
  * When set to 1, IPsec will send packets with the same sequence number.
  * This allows to verify if the other side has proper replay attacks detection.
  */
 int ipsec_replay = 0;
 
-/*  
+/*
  * When set 1, IPsec will send packets with corrupted HMAC.
  * This allows to verify if the other side properly detects modified packets.
  */
@@ -125,6 +125,7 @@ int ipsec_debug = 0;
 #endif
 
 percpu_t *ipsecstat_percpu;
+
 int ip4_ah_offsetmask = 0;	/* maybe IP_DF? */
 int ip4_ipsec_dfbit = 2;	/* DF bit on encap. 0: clear 1: set 2: copy */
 int ip4_esp_trans_deflev = IPSEC_LEVEL_USE;
@@ -142,11 +143,11 @@ static struct secpolicy ipsec_dummy_sp _
 	.policy		= IPSEC_POLICY_ENTRUST,
 };
 
-static struct secpolicy *ipsec_checkpcbcache (struct mbuf *,
-	struct inpcbpolicy *, int);
-static int ipsec_fillpcbcache (struct inpcbpolicy *, struct mbuf *,
-	struct secpolicy *, int);
-static int ipsec_invalpcbcache (struct inpcbpolicy *, int);
+static struct secpolicy *ipsec_checkpcbcache(struct mbuf *,
+struct inpcbpolicy *, int);
+static int ipsec_fillpcbcache(struct inpcbpolicy *, struct mbuf *,
+struct secpolicy *, int);
+static int ipsec_invalpcbcache(struct inpcbpolicy *, int);
 
 /*
  * Crypto support requirements:
@@ -155,7 +156,7 @@ static int ipsec_invalpcbcache (struct i
  * -1	require software support
  *  0	take anything
  */
-int	crypto_support = 0;
+int crypto_support = 0;
 
 static struct secpolicy *ipsec_getpolicybysock(struct mbuf *, u_int,
 struct inpcb_hdr *, int *);
@@ -167,28 +168,28 @@ int ip6_ah_trans_deflev = IPSEC_LEVEL_US
 int ip6_ah_net_deflev = IPSEC_LEVEL_USE;
 struct secpolicy ip6_def_policy;
 int ip6_ipsec_ecn = 0;		/* ECN ignore(-1)/forbidden(0)/allowed(1) */
-#endif /* INET6 */
+#endif
 
-static int ipsec4_setspidx_inpcb (struct mbuf *, struct inpcb *);
+static int ipsec4_setspidx_inpcb(struct mbuf *, struct inpcb *);
 #ifdef INET6
-static int ipsec6_setspidx_in6pcb (struct mbuf *, struct in6pcb *);
+static int ipsec6_setspidx_in6pcb(struct mbuf *, struct in6pcb *);
 #endif
-static int ipsec_setspidx (struct mbuf *, struct secpolicyindex *, int);
-static void ipsec4_get_ulp (struct mbuf *m, struct secpolicyindex *, int);
-static int ipsec4_setspidx_ipaddr (struct mbuf *, struct secpolicyindex *);
+static int ipsec_setspidx(struct mbuf *, struct secpolicyindex *, int);
+static void ipsec4_get_ulp(struct mbuf *m, struct secpolicyindex *, int);
+static int ipsec4_setspidx_ipaddr(struct mbuf *, struct secpolicyindex *);
 #ifdef INET6
-static void ipsec6_get_ulp (struct mbuf *m, struct secpolicyindex *, int);
-static int ipsec6_setspidx_ipaddr (struct mbuf *, struct secpolicyindex *);
+static void ipsec6_get_ulp(struct mbuf *m, struct secpolicyindex *, int);
+static int ipsec6_setspidx_ipaddr(struct mbuf *, struct secpolicyindex *);
 #endif
-static void ipsec_delpcbpolicy (struct inpcbpolicy *);
+static void ipsec_delpcbpolicy(struct inpcbpolicy *);
 #if 0 /* unused */
-static struct secpolicy *ipsec_deepcopy_policy (const struct secpolicy *);
+static struct secpolicy *ipsec_deepcopy_policy(const struct secpolicy *);
 #endif
-static int ipsec_set_policy (struct secpolicy **, int, const void *, size_t,
+static int ipsec_set_policy(struct secpolicy **, int, const void *, size_t,
 kauth_cred_t);
-static int ipsec_get_policy (struct secpolicy *, struct mbuf **);
+static int ipsec_get_policy(struct secpolicy *, struct mbuf **);
 static void ipsec_destroy_policy(struct secpolicy *);
-static void vshiftl (unsigned char *, int, int);

CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 11:07:44 UTC 2018

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

Log Message:
Style a bit, no functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/netipsec/ipsec.c

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



CVS commit: src

2018-02-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Feb 16 10:19:04 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: mi
src/sys/net: Makefile

Log Message:
Currently, it is not necessary to install rss_config.h. Pointed out by 
msaitoh@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.2182 -r1.2183 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.35 -r1.36 src/sys/net/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/mi
diff -u src/distrib/sets/lists/comp/mi:1.2182 src/distrib/sets/lists/comp/mi:1.2183
--- src/distrib/sets/lists/comp/mi:1.2182	Fri Feb 16 07:05:21 2018
+++ src/distrib/sets/lists/comp/mi	Fri Feb 16 10:19:03 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2182 2018/02/16 07:05:21 knakahara Exp $
+#	$NetBSD: mi,v 1.2183 2018/02/16 10:19:03 knakahara Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -2333,7 +2333,6 @@
 ./usr/include/net/radix.h			comp-c-include
 ./usr/include/net/raw_cb.h			comp-c-include
 ./usr/include/net/route.h			comp-c-include
-./usr/include/net/rss_config.h			comp-c-include
 ./usr/include/net/slcompress.h			comp-c-include
 ./usr/include/net/slip.h			comp-c-include
 ./usr/include/net/zlib.h			comp-c-include

Index: src/sys/net/Makefile
diff -u src/sys/net/Makefile:1.35 src/sys/net/Makefile:1.36
--- src/sys/net/Makefile:1.35	Fri Feb 16 04:48:32 2018
+++ src/sys/net/Makefile	Fri Feb 16 10:19:04 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.35 2018/02/16 04:48:32 knakahara Exp $
+#	$NetBSD: Makefile,v 1.36 2018/02/16 10:19:04 knakahara Exp $
 
 INCSDIR= /usr/include/net
 
@@ -8,7 +8,7 @@ INCS=	bpf.h bpfjit.h bpfdesc.h dlt.h eth
 	if_pflog.h if_ppp.h if_pppoe.h if_l2tp.h if_sppp.h if_srt.h if_stf.h \
 	if_tap.h if_token.h if_tun.h if_types.h if_vlanvar.h net_stats.h \
 	netisr.h pfil.h pfkeyv2.h pfvar.h ppp-comp.h ppp_defs.h radix.h \
-	raw_cb.h route.h rss_config.h slcompress.h slip.h zlib.h
+	raw_cb.h route.h slcompress.h slip.h zlib.h
 
 SUBDIR=	agr npf
 



CVS commit: src

2018-02-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Feb 16 10:19:04 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: mi
src/sys/net: Makefile

Log Message:
Currently, it is not necessary to install rss_config.h. Pointed out by 
msaitoh@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.2182 -r1.2183 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.35 -r1.36 src/sys/net/Makefile

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



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

2018-02-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Feb 16 10:11:21 UTC 2018

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

Log Message:
 Fix a bug that the first call of ifflags_cb() causes linkdown. The first
call of ix(gbe|v)_ifflags_cb() refered uninitialized adapter->if_flags.
adapter->if_flags should be initialized in the end of xxx_init().

XXX pullup-[678] (ixgbe)
XXX pullup-8 (ixv)


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/pci/ixgbe/ixv.c

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



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

2018-02-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Feb 16 10:11:21 UTC 2018

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

Log Message:
 Fix a bug that the first call of ifflags_cb() causes linkdown. The first
call of ix(gbe|v)_ifflags_cb() refered uninitialized adapter->if_flags.
adapter->if_flags should be initialized in the end of xxx_init().

XXX pullup-[678] (ixgbe)
XXX pullup-8 (ixv)


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.122 src/sys/dev/pci/ixgbe/ixgbe.c:1.123
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.122	Fri Feb 16 04:50:19 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Feb 16 10:11:21 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.122 2018/02/16 04:50:19 knakahara Exp $ */
+/* $NetBSD: ixgbe.c,v 1.123 2018/02/16 10:11:21 msaitoh Exp $ */
 
 /**
 
@@ -3779,6 +3779,9 @@ ixgbe_init_locked(struct adapter *adapte
 		IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext);
 	}
 
+	/* Update saved flags. See ixgbe_ifflags_cb() */
+	adapter->if_flags = ifp->if_flags;
+
 	/* Now inform the stack we're ready */
 	ifp->if_flags |= IFF_RUNNING;
 

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.78 src/sys/dev/pci/ixgbe/ixv.c:1.79
--- src/sys/dev/pci/ixgbe/ixv.c:1.78	Fri Feb 16 04:50:19 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Fri Feb 16 10:11:21 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.78 2018/02/16 04:50:19 knakahara Exp $*/
+/*$NetBSD: ixv.c,v 1.79 2018/02/16 10:11:21 msaitoh Exp $*/
 
 /**
 
@@ -785,6 +785,9 @@ ixv_init_locked(struct adapter *adapter)
 	/* And now turn on interrupts */
 	ixv_enable_intr(adapter);
 
+	/* Update saved flags. See ixgbe_ifflags_cb() */
+	adapter->if_flags = ifp->if_flags;
+
 	/* Now inform the stack we're ready */
 	ifp->if_flags |= IFF_RUNNING;
 	ifp->if_flags &= ~IFF_OACTIVE;



CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 10:07:07 UTC 2018

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

Log Message:
Remove unused.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/netipsec/ah_var.h

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

Modified files:

Index: src/sys/netipsec/ah_var.h
diff -u src/sys/netipsec/ah_var.h:1.5 src/sys/netipsec/ah_var.h:1.6
--- src/sys/netipsec/ah_var.h:1.5	Thu Apr 13 16:38:32 2017
+++ src/sys/netipsec/ah_var.h	Fri Feb 16 10:07:07 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ah_var.h,v 1.5 2017/04/13 16:38:32 christos Exp $	*/
+/*	$NetBSD: ah_var.h,v 1.6 2018/02/16 10:07:07 maxv Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/ah_var.h,v 1.1.4.1 2003/01/24 05:11:35 sam Exp $	*/
 /*	$OpenBSD: ip_ah.h,v 1.29 2002/06/09 16:26:10 itojun Exp $	*/
 /*
@@ -68,7 +68,6 @@
 
 #ifdef _KERNEL
 extern const uint8_t ah_stats[256];
-extern	int ah_enable;
-extern	int ah_cleartos;
+extern int ah_enable;
 #endif /* _KERNEL */
 #endif /* !_NETIPSEC_AH_VAR_H_ */



CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 10:07:07 UTC 2018

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

Log Message:
Remove unused.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/netipsec/ah_var.h

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



CVS commit: src

2018-02-16 Thread Leonardo Taccari
Module Name:src
Committed By:   leot
Date:   Fri Feb 16 10:05:22 UTC 2018

Modified Files:
src: BUILDING

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/BUILDING

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



CVS commit: src/doc

2018-02-16 Thread Leonardo Taccari
Module Name:src
Committed By:   leot
Date:   Fri Feb 16 10:05:01 UTC 2018

Modified Files:
src/doc: BUILDING.mdoc

Log Message:
Fix a typo.

Pointed out by aalm in #NetBSD@Freenode.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/doc/BUILDING.mdoc

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

Modified files:

Index: src/doc/BUILDING.mdoc
diff -u src/doc/BUILDING.mdoc:1.123 src/doc/BUILDING.mdoc:1.124
--- src/doc/BUILDING.mdoc:1.123	Fri Dec 29 03:04:56 2017
+++ src/doc/BUILDING.mdoc	Fri Feb 16 10:05:01 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: BUILDING.mdoc,v 1.123 2017/12/29 03:04:56 sevan Exp $
+.\"	$NetBSD: BUILDING.mdoc,v 1.124 2018/02/16 10:05:01 leot Exp $
 .\"
 .\" Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -1630,7 +1630,7 @@ or
 options (or both) may be used to specify glob patterns
 that will be used to narrow the list of results;
 for example,
-.Dq Li build.sh -m 'evm*' -a '*arm*' list-arch
+.Dq Li build.sh -m 'evb*' -a '*arm*' list-arch
 will list all known
 .Sy MACHINE Ns No / Ns Sy MACHINE_ARCH
 values in which either



CVS commit: src/doc

2018-02-16 Thread Leonardo Taccari
Module Name:src
Committed By:   leot
Date:   Fri Feb 16 10:05:01 UTC 2018

Modified Files:
src/doc: BUILDING.mdoc

Log Message:
Fix a typo.

Pointed out by aalm in #NetBSD@Freenode.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/doc/BUILDING.mdoc

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



CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 09:24:56 UTC 2018

Modified Files:
src/sys/netipsec: ipsec_netbsd.c xform_ah.c xform_esp.c xform_ipcomp.c

Log Message:
Add [ah/esp/ipcomp]_enable sysctls, and remove the FreeBSD #ifdefs.
Discussed with ozaki-r@.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/netipsec/ipsec_netbsd.c
cvs rdiff -u -r1.85 -r1.86 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.78 -r1.79 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.58 -r1.59 src/sys/netipsec/xform_ipcomp.c

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



CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 09:24:56 UTC 2018

Modified Files:
src/sys/netipsec: ipsec_netbsd.c xform_ah.c xform_esp.c xform_ipcomp.c

Log Message:
Add [ah/esp/ipcomp]_enable sysctls, and remove the FreeBSD #ifdefs.
Discussed with ozaki-r@.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/netipsec/ipsec_netbsd.c
cvs rdiff -u -r1.85 -r1.86 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.78 -r1.79 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.58 -r1.59 src/sys/netipsec/xform_ipcomp.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_netbsd.c
diff -u src/sys/netipsec/ipsec_netbsd.c:1.45 src/sys/netipsec/ipsec_netbsd.c:1.46
--- src/sys/netipsec/ipsec_netbsd.c:1.45	Thu Aug  3 06:32:51 2017
+++ src/sys/netipsec/ipsec_netbsd.c	Fri Feb 16 09:24:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_netbsd.c,v 1.45 2017/08/03 06:32:51 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec_netbsd.c,v 1.46 2018/02/16 09:24:55 maxv Exp $	*/
 /*	$KAME: esp_input.c,v 1.60 2001/09/04 08:43:19 itojun Exp $	*/
 /*	$KAME: ah_input.c,v 1.64 2001/09/04 08:43:19 itojun Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_netbsd.c,v 1.45 2017/08/03 06:32:51 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_netbsd.c,v 1.46 2018/02/16 09:24:55 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -698,10 +698,29 @@ sysctl_net_inet_ipsec_setup(struct sysct
 		   CTL_CREATE, CTL_EOL);
 	sysctl_createv(clog, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+		   CTLTYPE_INT, "ah_enable", NULL,
+		   NULL, 0, _enable, 0,
+		   CTL_NET, PF_INET, ipproto_ipsec,
+		   CTL_CREATE, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+		   CTLTYPE_INT, "esp_enable", NULL,
+		   NULL, 0, _enable, 0,
+		   CTL_NET, PF_INET, ipproto_ipsec,
+		   CTL_CREATE, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+		   CTLTYPE_INT, "ipcomp_enable", NULL,
+		   NULL, 0, _enable, 0,
+		   CTL_NET, PF_INET, ipproto_ipsec,
+		   CTL_CREATE, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
 		   CTLTYPE_INT, "crypto_support", NULL,
 		   NULL, 0, _support, 0,
 		   CTL_NET, PF_INET, ipproto_ipsec,
 		   CTL_CREATE, CTL_EOL);
+
 #ifdef IPSEC_DEBUG
 	sysctl_createv(clog, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT|CTLFLAG_READWRITE,

Index: src/sys/netipsec/xform_ah.c
diff -u src/sys/netipsec/xform_ah.c:1.85 src/sys/netipsec/xform_ah.c:1.86
--- src/sys/netipsec/xform_ah.c:1.85	Fri Feb 16 09:07:50 2018
+++ src/sys/netipsec/xform_ah.c	Fri Feb 16 09:24:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ah.c,v 1.85 2018/02/16 09:07:50 maxv Exp $	*/
+/*	$NetBSD: xform_ah.c,v 1.86 2018/02/16 09:24:55 maxv Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
 /*
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.85 2018/02/16 09:07:50 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.86 2018/02/16 09:24:55 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -104,12 +104,6 @@ percpu_t *ahstat_percpu;
 int ah_enable = 1;			/* control flow of packets with AH */
 int ip4_ah_cleartos = 1;		/* clear ip_tos when doing AH calc */
 
-#ifdef __FreeBSD__
-SYSCTL_DECL(_net_inet_ah);
-SYSCTL_INT(_net_inet_ah, OID_AUTO,
-	ah_enable,	CTLFLAG_RW,	_enable,	0, "");
-#endif /* __FreeBSD__ */
-
 static unsigned char ipseczeroes[256];	/* larger than an ip6 extension hdr */
 
 int ah_max_authsize;			/* max authsize over all algorithms */

Index: src/sys/netipsec/xform_esp.c
diff -u src/sys/netipsec/xform_esp.c:1.78 src/sys/netipsec/xform_esp.c:1.79
--- src/sys/netipsec/xform_esp.c:1.78	Fri Feb 16 09:07:50 2018
+++ src/sys/netipsec/xform_esp.c	Fri Feb 16 09:24:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_esp.c,v 1.78 2018/02/16 09:07:50 maxv Exp $	*/
+/*	$NetBSD: xform_esp.c,v 1.79 2018/02/16 09:24:55 maxv Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */
 
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.78 2018/02/16 09:07:50 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.79 2018/02/16 09:24:55 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -89,12 +89,6 @@ percpu_t *espstat_percpu;
 
 int esp_enable = 1;
 
-#ifdef __FreeBSD__
-SYSCTL_DECL(_net_inet_esp);
-SYSCTL_INT(_net_inet_esp, OID_AUTO,
-	esp_enable,	CTLFLAG_RW,	_enable,	0, "");
-#endif /* __FreeBSD__ */
-
 static int esp_max_ivlen;		/* max iv length over all algorithms */
 
 static int esp_input_cb(struct 

CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 09:07:50 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.c xform_ah.c xform_esp.c xform_ipcomp.c

Log Message:
Remove some more FreeBSD sysctl declarations that already have NetBSD
counterparts. Discussed with ozaki-r@.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.84 -r1.85 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.77 -r1.78 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.57 -r1.58 src/sys/netipsec/xform_ipcomp.c

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



CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 09:07:50 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.c xform_ah.c xform_esp.c xform_ipcomp.c

Log Message:
Remove some more FreeBSD sysctl declarations that already have NetBSD
counterparts. Discussed with ozaki-r@.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.84 -r1.85 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.77 -r1.78 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.57 -r1.58 src/sys/netipsec/xform_ipcomp.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.127 src/sys/netipsec/ipsec.c:1.128
--- src/sys/netipsec/ipsec.c:1.127	Fri Feb 16 08:56:50 2018
+++ src/sys/netipsec/ipsec.c	Fri Feb 16 09:07:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.127 2018/02/16 08:56:50 maxv Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.128 2018/02/16 09:07:50 maxv 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.127 2018/02/16 08:56:50 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.128 2018/02/16 09:07:50 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -160,12 +160,6 @@ int	crypto_support = 0;
 static struct secpolicy *ipsec_getpolicybysock(struct mbuf *, u_int,
 struct inpcb_hdr *, int *);
 
-#ifdef __FreeBSD__
-/* net.inet.ipsec */
-SYSCTL_INT(_net_inet_ipsec, OID_AUTO,
-	crypto_support,	CTLFLAG_RW,	_support,0, "");
-#endif /* __FreeBSD__ */
-
 #ifdef INET6
 int ip6_esp_trans_deflev = IPSEC_LEVEL_USE;
 int ip6_esp_net_deflev = IPSEC_LEVEL_USE;

Index: src/sys/netipsec/xform_ah.c
diff -u src/sys/netipsec/xform_ah.c:1.84 src/sys/netipsec/xform_ah.c:1.85
--- src/sys/netipsec/xform_ah.c:1.84	Thu Feb 15 09:23:47 2018
+++ src/sys/netipsec/xform_ah.c	Fri Feb 16 09:07:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ah.c,v 1.84 2018/02/15 09:23:47 ozaki-r Exp $	*/
+/*	$NetBSD: xform_ah.c,v 1.85 2018/02/16 09:07:50 maxv Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
 /*
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.84 2018/02/15 09:23:47 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.85 2018/02/16 09:07:50 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -108,10 +108,6 @@ int ip4_ah_cleartos = 1;		/* clear ip_to
 SYSCTL_DECL(_net_inet_ah);
 SYSCTL_INT(_net_inet_ah, OID_AUTO,
 	ah_enable,	CTLFLAG_RW,	_enable,	0, "");
-SYSCTL_INT(_net_inet_ah, OID_AUTO,
-	ah_cleartos,	CTLFLAG_RW,	_ah_cleartos,	0, "");
-SYSCTL_STRUCT(_net_inet_ah, IPSECCTL_STATS,
-	stats,		CTLFLAG_RD,	,	ahstat, "");
 #endif /* __FreeBSD__ */
 
 static unsigned char ipseczeroes[256];	/* larger than an ip6 extension hdr */

Index: src/sys/netipsec/xform_esp.c
diff -u src/sys/netipsec/xform_esp.c:1.77 src/sys/netipsec/xform_esp.c:1.78
--- src/sys/netipsec/xform_esp.c:1.77	Thu Feb 15 12:40:12 2018
+++ src/sys/netipsec/xform_esp.c	Fri Feb 16 09:07:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_esp.c,v 1.77 2018/02/15 12:40:12 maxv Exp $	*/
+/*	$NetBSD: xform_esp.c,v 1.78 2018/02/16 09:07:50 maxv Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $	*/
 /*	$OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */
 
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.77 2018/02/15 12:40:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.78 2018/02/16 09:07:50 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -93,8 +93,6 @@ int esp_enable = 1;
 SYSCTL_DECL(_net_inet_esp);
 SYSCTL_INT(_net_inet_esp, OID_AUTO,
 	esp_enable,	CTLFLAG_RW,	_enable,	0, "");
-SYSCTL_STRUCT(_net_inet_esp, IPSECCTL_STATS,
-	stats,		CTLFLAG_RD,	,	espstat, "");
 #endif /* __FreeBSD__ */
 
 static int esp_max_ivlen;		/* max iv length over all algorithms */

Index: src/sys/netipsec/xform_ipcomp.c
diff -u src/sys/netipsec/xform_ipcomp.c:1.57 src/sys/netipsec/xform_ipcomp.c:1.58
--- src/sys/netipsec/xform_ipcomp.c:1.57	Thu Feb 15 13:51:32 2018
+++ src/sys/netipsec/xform_ipcomp.c	Fri Feb 16 09:07:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xform_ipcomp.c,v 1.57 2018/02/15 13:51:32 maxv Exp $	*/
+/*	$NetBSD: xform_ipcomp.c,v 1.58 2018/02/16 09:07:50 maxv Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/xform_ipcomp.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $	*/
 /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
 
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.57 2018/02/15 13:51:32 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.58 2018/02/16 09:07:50 maxv Exp $");
 
 /* IP payload compression 

CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 08:56:50 UTC 2018

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

Log Message:
Remove ipsec_replay and ipsec_integrity from this place, they are already
declared as sysctls. Discussed with ozaki-r@.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/netipsec/ipsec.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.126 src/sys/netipsec/ipsec.c:1.127
--- src/sys/netipsec/ipsec.c:1.126	Fri Feb 16 08:51:28 2018
+++ src/sys/netipsec/ipsec.c	Fri Feb 16 08:56:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.126 2018/02/16 08:51:28 maxv Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.127 2018/02/16 08:56:50 maxv 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.126 2018/02/16 08:51:28 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.127 2018/02/16 08:56:50 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -164,10 +164,6 @@ static struct secpolicy *ipsec_getpolicy
 /* net.inet.ipsec */
 SYSCTL_INT(_net_inet_ipsec, OID_AUTO,
 	crypto_support,	CTLFLAG_RW,	_support,0, "");
-SYSCTL_INT(_net_inet_ipsec, OID_AUTO, test_replay, CTLFLAG_RW, _replay, 0,
-	"Emulate replay attack");
-SYSCTL_INT(_net_inet_ipsec, OID_AUTO, test_integrity, CTLFLAG_RW,
-	_integrity, 0, "Emulate man-in-the-middle attack");
 #endif /* __FreeBSD__ */
 
 #ifdef INET6



CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 08:56:50 UTC 2018

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

Log Message:
Remove ipsec_replay and ipsec_integrity from this place, they are already
declared as sysctls. Discussed with ozaki-r@.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/netipsec/ipsec.c

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



CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 08:51:28 UTC 2018

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

Log Message:
Remove ip4_esp_randpad and ip6_esp_randpad, unused. Discussed with
ozaki-r@.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.64 -r1.65 src/sys/netipsec/ipsec.h
cvs rdiff -u -r1.20 -r1.21 src/sys/netipsec/ipsec6.h

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



CVS commit: src/sys/netipsec

2018-02-16 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 16 08:51:28 UTC 2018

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

Log Message:
Remove ip4_esp_randpad and ip6_esp_randpad, unused. Discussed with
ozaki-r@.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.64 -r1.65 src/sys/netipsec/ipsec.h
cvs rdiff -u -r1.20 -r1.21 src/sys/netipsec/ipsec6.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.c
diff -u src/sys/netipsec/ipsec.c:1.125 src/sys/netipsec/ipsec.c:1.126
--- src/sys/netipsec/ipsec.c:1.125	Thu Feb  8 20:57:41 2018
+++ src/sys/netipsec/ipsec.c	Fri Feb 16 08:51:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.125 2018/02/08 20:57:41 maxv Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.126 2018/02/16 08:51:28 maxv 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.125 2018/02/08 20:57:41 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.126 2018/02/16 08:51:28 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -133,7 +133,6 @@ int ip4_ah_trans_deflev = IPSEC_LEVEL_US
 int ip4_ah_net_deflev = IPSEC_LEVEL_USE;
 struct secpolicy ip4_def_policy;
 int ip4_ipsec_ecn = 0;		/* ECN ignore(-1)/forbidden(0)/allowed(1) */
-int ip4_esp_randpad = -1;
 
 u_int ipsec_spdgen = 1;		/* SPD generation # */
 
@@ -163,8 +162,6 @@ static struct secpolicy *ipsec_getpolicy
 
 #ifdef __FreeBSD__
 /* net.inet.ipsec */
-SYSCTL_INT(_net_inet_ipsec, IPSECCTL_ESP_RANDPAD,
-	esp_randpad, CTLFLAG_RW,	_esp_randpad,	0, "");
 SYSCTL_INT(_net_inet_ipsec, OID_AUTO,
 	crypto_support,	CTLFLAG_RW,	_support,0, "");
 SYSCTL_INT(_net_inet_ipsec, OID_AUTO, test_replay, CTLFLAG_RW, _replay, 0,
@@ -180,14 +177,6 @@ int ip6_ah_trans_deflev = IPSEC_LEVEL_US
 int ip6_ah_net_deflev = IPSEC_LEVEL_USE;
 struct secpolicy ip6_def_policy;
 int ip6_ipsec_ecn = 0;		/* ECN ignore(-1)/forbidden(0)/allowed(1) */
-int ip6_esp_randpad = -1;
-
-
-#ifdef __FreeBSD__
-/* net.inet6.ipsec6 */
-SYSCTL_INT(_net_inet6_ipsec6, IPSECCTL_ESP_RANDPAD,
-	esp_randpad, CTLFLAG_RW,	_esp_randpad,	0, "");
-#endif /* __FreeBSD__ */
 #endif /* INET6 */
 
 static int ipsec4_setspidx_inpcb (struct mbuf *, struct inpcb *);

Index: src/sys/netipsec/ipsec.h
diff -u src/sys/netipsec/ipsec.h:1.64 src/sys/netipsec/ipsec.h:1.65
--- src/sys/netipsec/ipsec.h:1.64	Wed Feb 14 14:28:40 2018
+++ src/sys/netipsec/ipsec.h	Fri Feb 16 08:51:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.h,v 1.64 2018/02/14 14:28:40 maxv Exp $	*/
+/*	$NetBSD: ipsec.h,v 1.65 2018/02/16 08:51:28 maxv 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 $	*/
 
@@ -253,7 +253,6 @@ extern int ip4_ah_cleartos;
 extern int ip4_ah_offsetmask;
 extern int ip4_ipsec_dfbit;
 extern int ip4_ipsec_ecn;
-extern int ip4_esp_randpad;
 extern int crypto_support;
 
 #include 

Index: src/sys/netipsec/ipsec6.h
diff -u src/sys/netipsec/ipsec6.h:1.20 src/sys/netipsec/ipsec6.h:1.21
--- src/sys/netipsec/ipsec6.h:1.20	Tue Oct  3 08:56:52 2017
+++ src/sys/netipsec/ipsec6.h	Fri Feb 16 08:51:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec6.h,v 1.20 2017/10/03 08:56:52 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec6.h,v 1.21 2018/02/16 08:51:28 maxv Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/ipsec6.h,v 1.1.4.1 2003/01/24 05:11:35 sam Exp $	*/
 /*	$KAME: ipsec.h,v 1.44 2001/03/23 08:08:47 itojun Exp $	*/
 
@@ -48,7 +48,6 @@ extern int ip6_esp_net_deflev;
 extern int ip6_ah_trans_deflev;
 extern int ip6_ah_net_deflev;
 extern int ip6_ipsec_ecn;
-extern int ip6_esp_randpad;
 extern struct secpolicy ip6_def_policy;
 
 struct inpcb;



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

2018-02-16 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Feb 16 08:42:45 UTC 2018

Modified Files:
src/sys/arch/arm/imx: if_enet.c

Log Message:
* avoid writing past the end of the mbuf.
* m_getptr was introduced for the IPsec Crypto code. it must not be used here.

pointed out by maxv@. thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/imx/if_enet.c

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



  1   2   >