CVS commit: src

2019-09-29 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Mon Sep 30 00:37:12 UTC 2019

Modified Files:
src/lib/libnpf: libnpf.3 npf.c npf.h
src/sys/net/npf: npf_ctl.c
src/usr.sbin/npf/npfctl: npf.conf.5 npf_build.c npf_parse.y npf_scan.l
npfctl.c npfctl.h
src/usr.sbin/npf/npftest: npftest.conf

Log Message:
libnpf/npfctl: support dynamic NAT rulesets using a name prefix.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libnpf/libnpf.3
cvs rdiff -u -r1.47 -r1.48 src/lib/libnpf/npf.c
cvs rdiff -u -r1.37 -r1.38 src/lib/libnpf/npf.h
cvs rdiff -u -r1.58 -r1.59 src/sys/net/npf/npf_ctl.c
cvs rdiff -u -r1.88 -r1.89 src/usr.sbin/npf/npfctl/npf.conf.5
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/npf/npfctl/npf_build.c
cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/npf/npfctl/npf_parse.y
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/npf/npfctl/npf_scan.l
cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/npf/npfctl/npfctl.c
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/npf/npfctl/npfctl.h
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/npf/npftest/npftest.conf

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

Modified files:

Index: src/lib/libnpf/libnpf.3
diff -u src/lib/libnpf/libnpf.3:1.10 src/lib/libnpf/libnpf.3:1.11
--- src/lib/libnpf/libnpf.3:1.10	Wed Aug 21 21:45:47 2019
+++ src/lib/libnpf/libnpf.3	Mon Sep 30 00:37:11 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: libnpf.3,v 1.10 2019/08/21 21:45:47 rmind Exp $
+.\"	$NetBSD: libnpf.3,v 1.11 2019/09/30 00:37:11 rmind Exp $
 .\"
 .\" Copyright (c) 2011-2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 21, 2019
+.Dd August 25, 2019
 .Dt LIBNPF 3
 .Os
 .Sh NAME
@@ -108,6 +108,15 @@
 .Fn npf_table_replace "int fd" "nl_table_t *tl" "npf_error_t *errinfo"
 .Ft void
 .Fn npf_table_destroy "nl_table_t *tl"
+.\" ---
+.Ft int
+.Fn npf_ruleset_add "int fd" "const char *name" "nl_rule_t *rl" "uint64_t *id"
+.Ft int
+.Fn npf_ruleset_remove "int fd" "const char *name" "uint64_t id"
+.Ft int
+.Fn npf_ruleset_remkey "int fd" "const char *name" "const void *key" "size_t len"
+.Ft int
+.Fn npf_ruleset_flush "int fd" "const char *name"
 .\" -
 .Sh DESCRIPTION
 The
@@ -352,7 +361,9 @@ Additionally,
 may be specified to indicate the translation network;
 otherwise, it should be set to
 .Dv NPF_NO_NETMASK .
-In such case, a custom algorithm may need to be specified using the
+.Pp
+In order to use the translation network, a custom algorithm may need to
+be specified using the
 .Fn npf_nat_setalgo
 function.
 .\" ---
@@ -368,6 +379,9 @@ Currently, the following algorithms are 
 Hash of the source and destination addresses.
 .It Dv NPF_ALGO_RR
 Round-robin for the translation addresses.
+.It Dv NPF_ALGO_NETMAP
+Network-to-network map as described below, but with state tracking.
+It is used when it is necessary to translate the ports.
 .El
 .Pp
 The following are support with static NAT:
@@ -450,6 +464,39 @@ specified by
 Destroy the specified table.
 .El
 .\" -
+.Ss Ruleset interface
+.Bl -tag -width 4n
+.It Fn npf_ruleset_add "fd" "name" "rl" "id"
+Add a given rule, specified by
+.Fa rl ,
+into the dynamic ruleset named
+.Fa name .
+On success, return 0 and a unique rule ID in the
+.Fa id
+parameter.
+.It Fn npf_ruleset_remove "fd" "name" "id"
+Remove a rule from the dynamic ruleset, specified by
+.Fa name .
+The rule is specified by its unique ID in the
+.Fa id
+parameter.
+.It Fn npf_ruleset_remkey "fd" "name" "key" "len"
+Remove a rule from the dynamic ruleset, specified by
+.Fa name .
+The rule is specified by its key, in the
+.Fa key
+and
+.Fa len
+parameters.
+The key for the rule must have been set during its construction, using the
+.Fn npf_rule_setkey
+routine.
+.It Fn npf_ruleset_flush "fd" "name"
+Clear the dynamic ruleset, specified by
+.Fa name ,
+by removing all its rules.
+.El
+.\" -
 .Sh SEE ALSO
 .Xr bpf 4 ,
 .Xr npf 7 ,

Index: src/lib/libnpf/npf.c
diff -u src/lib/libnpf/npf.c:1.47 src/lib/libnpf/npf.c:1.48
--- src/lib/libnpf/npf.c:1.47	Wed Aug 21 21:45:47 2019
+++ src/lib/libnpf/npf.c	Mon Sep 30 00:37:11 2019
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.47 2019/08/21 21:45:47 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.48 2019/09/30 00:37:11 rmind Exp $");
 
 #include 
 #include 
@@ -401,14 +401,31 @@ npf_param_set(nl_config_t *ncf, const ch
  * DYNAMIC RULESET INTERFACE.
  */
 
+static inline bool
+_npf_nat_ruleset_p(const char *name)
+{
+	return strncmp(name, NPF_RULESET_MAP_PREF,
+	sizeof(NPF_RULESET_MAP_PREF) - 1) == 0;
+}
+
 int
 npf_ruleset_add(int fd, const char *rname, nl_rule_t *rl, uint64_t *id)
 {
+	const bool natset = _npf_nat_ruleset_p(rname);
 	nvlist_t *rule_dict = rl->rule_dict;
 	nvlist_t *ret_dict;
 
+	nvlist_add_number(rule_dict, "attr",
+	NPF_RULE_DYNAMIC | 

CVS commit: src

2019-09-29 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Mon Sep 30 00:37:12 UTC 2019

Modified Files:
src/lib/libnpf: libnpf.3 npf.c npf.h
src/sys/net/npf: npf_ctl.c
src/usr.sbin/npf/npfctl: npf.conf.5 npf_build.c npf_parse.y npf_scan.l
npfctl.c npfctl.h
src/usr.sbin/npf/npftest: npftest.conf

Log Message:
libnpf/npfctl: support dynamic NAT rulesets using a name prefix.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libnpf/libnpf.3
cvs rdiff -u -r1.47 -r1.48 src/lib/libnpf/npf.c
cvs rdiff -u -r1.37 -r1.38 src/lib/libnpf/npf.h
cvs rdiff -u -r1.58 -r1.59 src/sys/net/npf/npf_ctl.c
cvs rdiff -u -r1.88 -r1.89 src/usr.sbin/npf/npfctl/npf.conf.5
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/npf/npfctl/npf_build.c
cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/npf/npfctl/npf_parse.y
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/npf/npfctl/npf_scan.l
cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/npf/npfctl/npfctl.c
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/npf/npfctl/npfctl.h
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/npf/npftest/npftest.conf

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



CVS commit: src

2019-09-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Sep 30 00:06:03 UTC 2019

Modified Files:
src/external/bsd/libpcap/lib: Makefile
src/sys/conf: copts.mk
src/sys/external/bsd/drm2/i915drm: files.i915drmkms
src/sys/external/bsd/drm2/nouveau: files.nouveau
src/sys/external/bsd/drm2/radeon: files.radeon
src/sys/external/bsd/drm2/ttm: files.ttm
src/sys/external/isc/atheros_hal/conf: files.ath_hal

Log Message:
convert HAVE_GCC == 7 to HAVE_GCC >= 7.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/libpcap/lib/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sys/conf/copts.mk
cvs rdiff -u -r1.37 -r1.38 src/sys/external/bsd/drm2/i915drm/files.i915drmkms
cvs rdiff -u -r1.27 -r1.28 src/sys/external/bsd/drm2/nouveau/files.nouveau
cvs rdiff -u -r1.26 -r1.27 src/sys/external/bsd/drm2/radeon/files.radeon
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/ttm/files.ttm
cvs rdiff -u -r1.7 -r1.8 src/sys/external/isc/atheros_hal/conf/files.ath_hal

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

Modified files:

Index: src/external/bsd/libpcap/lib/Makefile
diff -u src/external/bsd/libpcap/lib/Makefile:1.23 src/external/bsd/libpcap/lib/Makefile:1.24
--- src/external/bsd/libpcap/lib/Makefile:1.23	Tue Feb  5 07:45:35 2019
+++ src/external/bsd/libpcap/lib/Makefile	Mon Sep 30 00:06:02 2019
@@ -1,16 +1,9 @@
-# $NetBSD: Makefile,v 1.23 2019/02/05 07:45:35 mrg Exp $	
+# $NetBSD: Makefile,v 1.24 2019/09/30 00:06:02 mrg Exp $	
 
 USE_SHLIBDIR=yes
 .include 
 USE_FORT?= yes	# network protocol library
 
-CWARNFLAGS.clang+=	-Wno-format-extra-args \
-			-Wno-unneeded-internal-declaration
-
-.if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc"
-COPTS.gencode.c+=	-Wno-error=implicit-fallthrough
-.endif
-
 CPPFLAGS+= -DPCAP_DONT_INCLUDE_PCAP_BPF_H -DHAVE_CONFIG_H -I${.OBJDIR}
 
 .SUFFIXES: .3 .3pcap
@@ -173,10 +166,15 @@ tokdefs.h: grammar.h
 	cp $? $@
 
 CLEANFILES+=	tokdefs.h scanner.h
-COPTS.bpf_image.c = -Wno-format-nonliteral
 
-.if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc"
-COPTS.pcap.c+=	-Wno-error=format-truncation
+COPTS.bpf_image.c+=	-Wno-format-nonliteral
+
+.if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc"
+COPTS.pcap.c+=		-Wno-error=format-truncation
+COPTS.gencode.c+=	-Wno-error=implicit-fallthrough
 .endif
 
+CWARNFLAGS.clang+=	-Wno-format-extra-args \
+			-Wno-unneeded-internal-declaration
+
 .include 

Index: src/sys/conf/copts.mk
diff -u src/sys/conf/copts.mk:1.3 src/sys/conf/copts.mk:1.4
--- src/sys/conf/copts.mk:1.3	Sun Feb 10 05:01:59 2019
+++ src/sys/conf/copts.mk	Mon Sep 30 00:06:02 2019
@@ -1,11 +1,11 @@
-#	$NetBSD: copts.mk,v 1.3 2019/02/10 05:01:59 mrg Exp $
+#	$NetBSD: copts.mk,v 1.4 2019/09/30 00:06:02 mrg Exp $
 
 # MI per-file compiler options required.
 
 .ifndef _SYS_CONF_COPTS_MK_
 _SYS_CONF_COPTS_MK_=1
 
-.if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc"
+.if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc"
 COPTS.zlib.c+=		-Wno-error=implicit-fallthrough
 COPTS.pf.c+=		-Wno-error=implicit-fallthrough
 COPTS.radeon_cs.c+=	-Wno-error=implicit-fallthrough

Index: src/sys/external/bsd/drm2/i915drm/files.i915drmkms
diff -u src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.37 src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.38
--- src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.37	Mon Feb  4 08:18:07 2019
+++ src/sys/external/bsd/drm2/i915drm/files.i915drmkms	Mon Sep 30 00:06:02 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i915drmkms,v 1.37 2019/02/04 08:18:07 mrg Exp $
+#	$NetBSD: files.i915drmkms,v 1.38 2019/09/30 00:06:02 mrg Exp $
 
 version	20180827
 
@@ -24,9 +24,9 @@ makeoptions 	i915drmkms 	"CWARNFLAGS.i91
 
 makeoptions 	i915drmkms 	"CWARNFLAGS.intel_sprite.c"+="${${ACTIVE_CC} == gcc:? -Wno-maybe-uninitialized :}"
 
-makeoptions 	i915drmkms 	"CWARNFLAGS.intel_ddi.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} == 7:? -Wno-error=implicit-fallthrough :}"
-makeoptions 	i915drmkms 	"CWARNFLAGS.intel_display.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} == 7:? -Wno-error=implicit-fallthrough :}"
-makeoptions 	i915drmkms 	"CWARNFLAGS.intel_sdvo.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} == 7:? -Wno-error=implicit-fallthrough :}"
+makeoptions 	i915drmkms 	"CWARNFLAGS.intel_ddi.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
+makeoptions 	i915drmkms 	"CWARNFLAGS.intel_display.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
+makeoptions 	i915drmkms 	"CWARNFLAGS.intel_sdvo.c"+="${${ACTIVE_CC} == gcc && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}"
 
 file	external/bsd/drm2/i915drm/i915_module.c		i915drmkms
 file	external/bsd/drm2/i915drm/i915_pci.c		i915drmkms

Index: src/sys/external/bsd/drm2/nouveau/files.nouveau
diff -u src/sys/external/bsd/drm2/nouveau/files.nouveau:1.27 

CVS commit: src

2019-09-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Sep 30 00:06:03 UTC 2019

Modified Files:
src/external/bsd/libpcap/lib: Makefile
src/sys/conf: copts.mk
src/sys/external/bsd/drm2/i915drm: files.i915drmkms
src/sys/external/bsd/drm2/nouveau: files.nouveau
src/sys/external/bsd/drm2/radeon: files.radeon
src/sys/external/bsd/drm2/ttm: files.ttm
src/sys/external/isc/atheros_hal/conf: files.ath_hal

Log Message:
convert HAVE_GCC == 7 to HAVE_GCC >= 7.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/libpcap/lib/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sys/conf/copts.mk
cvs rdiff -u -r1.37 -r1.38 src/sys/external/bsd/drm2/i915drm/files.i915drmkms
cvs rdiff -u -r1.27 -r1.28 src/sys/external/bsd/drm2/nouveau/files.nouveau
cvs rdiff -u -r1.26 -r1.27 src/sys/external/bsd/drm2/radeon/files.radeon
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/ttm/files.ttm
cvs rdiff -u -r1.7 -r1.8 src/sys/external/isc/atheros_hal/conf/files.ath_hal

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



CVS commit: src

2019-09-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Sep 29 23:45:02 UTC 2019

Modified Files:
src/bin/ksh: Makefile
src/crypto/external/bsd/netpgp/bin/netpgpverify: Makefile
src/crypto/external/bsd/netpgp/lib/verify: Makefile
src/crypto/external/bsd/openssh/bin/sftp: Makefile
src/distrib/utils/zcat: Makefile
src/external/bsd/atf/lib/tools: Makefile
src/external/bsd/flex/bin: Makefile
src/external/bsd/ipf/bin/ipf: Makefile
src/external/bsd/ipf/bin/ipftest: Makefile
src/external/bsd/ntp: Makefile.inc
src/external/bsd/pdisk/bin: Makefile
src/external/bsd/pkg_install: Makefile.inc
src/games/backgammon/common_source: Makefile
src/games/hunt/huntd: Makefile
src/lib/libbz2: Makefile
src/lib/libz: Makefile
src/sys/lib/libkern: Makefile.compiler-rt
src/sys/modules/ath_hal: Makefile
src/sys/modules/i915drmkms: Makefile
src/sys/modules/pf: Makefile
src/sys/modules/radeondrm: Makefile
src/sys/modules/savagedrm: Makefile
src/sys/modules/viadrmums: Makefile
src/sys/modules/zlib: Makefile
src/sys/rump/kern/lib/libz: Makefile
src/tests/kernel: Makefile
src/tests/lib/libc/misc: Makefile
src/tests/lib/libc/ssp: Makefile
src/usr.bin/make: Makefile
src/usr.bin/newsyslog: Makefile
src/usr.bin/rdist: Makefile
src/usr.bin/stat: Makefile
src/usr.bin/systat: Makefile
src/usr.bin/telnet: Makefile
src/usr.sbin/quotacheck: Makefile
src/usr.sbin/sysinst: Makefile.inc
src/usr.sbin/syslogd: Makefile

Log Message:
convert HAVE_GCC == 7 to HAVE_GCC >= 7.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/bin/ksh/Makefile
cvs rdiff -u -r1.16 -r1.17 \
src/crypto/external/bsd/netpgp/bin/netpgpverify/Makefile
cvs rdiff -u -r1.10 -r1.11 src/crypto/external/bsd/netpgp/lib/verify/Makefile
cvs rdiff -u -r1.6 -r1.7 src/crypto/external/bsd/openssh/bin/sftp/Makefile
cvs rdiff -u -r1.18 -r1.19 src/distrib/utils/zcat/Makefile
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/atf/lib/tools/Makefile
cvs rdiff -u -r1.13 -r1.14 src/external/bsd/flex/bin/Makefile
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/ipf/bin/ipf/Makefile
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/ipf/bin/ipftest/Makefile
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/ntp/Makefile.inc
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pdisk/bin/Makefile
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/pkg_install/Makefile.inc
cvs rdiff -u -r1.10 -r1.11 src/games/backgammon/common_source/Makefile
cvs rdiff -u -r1.7 -r1.8 src/games/hunt/huntd/Makefile
cvs rdiff -u -r1.19 -r1.20 src/lib/libbz2/Makefile
cvs rdiff -u -r1.24 -r1.25 src/lib/libz/Makefile
cvs rdiff -u -r1.9 -r1.10 src/sys/lib/libkern/Makefile.compiler-rt
cvs rdiff -u -r1.5 -r1.6 src/sys/modules/ath_hal/Makefile
cvs rdiff -u -r1.13 -r1.14 src/sys/modules/i915drmkms/Makefile
cvs rdiff -u -r1.11 -r1.12 src/sys/modules/pf/Makefile
cvs rdiff -u -r1.12 -r1.13 src/sys/modules/radeondrm/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/savagedrm/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/viadrmums/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/zlib/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sys/rump/kern/lib/libz/Makefile
cvs rdiff -u -r1.63 -r1.64 src/tests/kernel/Makefile
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/misc/Makefile
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libc/ssp/Makefile
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/make/Makefile
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/newsyslog/Makefile
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/rdist/Makefile
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/stat/Makefile
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/systat/Makefile
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/telnet/Makefile
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/quotacheck/Makefile
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/sysinst/Makefile.inc
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/syslogd/Makefile

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

Modified files:

Index: src/bin/ksh/Makefile
diff -u src/bin/ksh/Makefile:1.35 src/bin/ksh/Makefile:1.36
--- src/bin/ksh/Makefile:1.35	Mon Feb  4 04:05:15 2019
+++ src/bin/ksh/Makefile	Sun Sep 29 23:44:58 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.35 2019/02/04 04:05:15 mrg Exp $
+#	$NetBSD: Makefile,v 1.36 2019/09/29 23:44:58 mrg Exp $
 
 WARNS=3
 CWARNFLAGS.clang+=	-Wno-error=cast-qual
@@ -48,7 +48,7 @@ ksh.1: ksh.Man mkman
 	${HOST_SH} $(.CURDIR)/mkman ksh $(.CURDIR)/ksh.Man >ksh.1.tmp \
 	&& mv ksh.1.tmp ksh.1
 
-.if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc"
+.if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc"
 COPTS+=	-Wno-error=implicit-fallthrough
 .endif
 

Index: src/crypto/external/bsd/netpgp/bin/netpgpverify/Makefile
diff -u src/crypto/external/bsd/netpgp/bin/netpgpverify/Makefile:1.16 

CVS commit: src

2019-09-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Sep 29 23:45:02 UTC 2019

Modified Files:
src/bin/ksh: Makefile
src/crypto/external/bsd/netpgp/bin/netpgpverify: Makefile
src/crypto/external/bsd/netpgp/lib/verify: Makefile
src/crypto/external/bsd/openssh/bin/sftp: Makefile
src/distrib/utils/zcat: Makefile
src/external/bsd/atf/lib/tools: Makefile
src/external/bsd/flex/bin: Makefile
src/external/bsd/ipf/bin/ipf: Makefile
src/external/bsd/ipf/bin/ipftest: Makefile
src/external/bsd/ntp: Makefile.inc
src/external/bsd/pdisk/bin: Makefile
src/external/bsd/pkg_install: Makefile.inc
src/games/backgammon/common_source: Makefile
src/games/hunt/huntd: Makefile
src/lib/libbz2: Makefile
src/lib/libz: Makefile
src/sys/lib/libkern: Makefile.compiler-rt
src/sys/modules/ath_hal: Makefile
src/sys/modules/i915drmkms: Makefile
src/sys/modules/pf: Makefile
src/sys/modules/radeondrm: Makefile
src/sys/modules/savagedrm: Makefile
src/sys/modules/viadrmums: Makefile
src/sys/modules/zlib: Makefile
src/sys/rump/kern/lib/libz: Makefile
src/tests/kernel: Makefile
src/tests/lib/libc/misc: Makefile
src/tests/lib/libc/ssp: Makefile
src/usr.bin/make: Makefile
src/usr.bin/newsyslog: Makefile
src/usr.bin/rdist: Makefile
src/usr.bin/stat: Makefile
src/usr.bin/systat: Makefile
src/usr.bin/telnet: Makefile
src/usr.sbin/quotacheck: Makefile
src/usr.sbin/sysinst: Makefile.inc
src/usr.sbin/syslogd: Makefile

Log Message:
convert HAVE_GCC == 7 to HAVE_GCC >= 7.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/bin/ksh/Makefile
cvs rdiff -u -r1.16 -r1.17 \
src/crypto/external/bsd/netpgp/bin/netpgpverify/Makefile
cvs rdiff -u -r1.10 -r1.11 src/crypto/external/bsd/netpgp/lib/verify/Makefile
cvs rdiff -u -r1.6 -r1.7 src/crypto/external/bsd/openssh/bin/sftp/Makefile
cvs rdiff -u -r1.18 -r1.19 src/distrib/utils/zcat/Makefile
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/atf/lib/tools/Makefile
cvs rdiff -u -r1.13 -r1.14 src/external/bsd/flex/bin/Makefile
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/ipf/bin/ipf/Makefile
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/ipf/bin/ipftest/Makefile
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/ntp/Makefile.inc
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pdisk/bin/Makefile
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/pkg_install/Makefile.inc
cvs rdiff -u -r1.10 -r1.11 src/games/backgammon/common_source/Makefile
cvs rdiff -u -r1.7 -r1.8 src/games/hunt/huntd/Makefile
cvs rdiff -u -r1.19 -r1.20 src/lib/libbz2/Makefile
cvs rdiff -u -r1.24 -r1.25 src/lib/libz/Makefile
cvs rdiff -u -r1.9 -r1.10 src/sys/lib/libkern/Makefile.compiler-rt
cvs rdiff -u -r1.5 -r1.6 src/sys/modules/ath_hal/Makefile
cvs rdiff -u -r1.13 -r1.14 src/sys/modules/i915drmkms/Makefile
cvs rdiff -u -r1.11 -r1.12 src/sys/modules/pf/Makefile
cvs rdiff -u -r1.12 -r1.13 src/sys/modules/radeondrm/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/savagedrm/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/viadrmums/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/zlib/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sys/rump/kern/lib/libz/Makefile
cvs rdiff -u -r1.63 -r1.64 src/tests/kernel/Makefile
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/misc/Makefile
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libc/ssp/Makefile
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/make/Makefile
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/newsyslog/Makefile
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/rdist/Makefile
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/stat/Makefile
cvs rdiff -u -r1.41 -r1.42 src/usr.bin/systat/Makefile
cvs rdiff -u -r1.57 -r1.58 src/usr.bin/telnet/Makefile
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/quotacheck/Makefile
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/sysinst/Makefile.inc
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/syslogd/Makefile

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



CVS commit: src/share/mk

2019-09-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Sep 29 22:10:55 UTC 2019

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

Log Message:
gcc 7 can now be found in gcc.old.


To generate a diff of this commit:
cvs rdiff -u -r1.1152 -r1.1153 src/share/mk/bsd.own.mk

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



CVS commit: src/share/mk

2019-09-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Sep 29 22:10:55 UTC 2019

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

Log Message:
gcc 7 can now be found in gcc.old.


To generate a diff of this commit:
cvs rdiff -u -r1.1152 -r1.1153 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1152 src/share/mk/bsd.own.mk:1.1153
--- src/share/mk/bsd.own.mk:1.1152	Sun Sep 15 21:17:08 2019
+++ src/share/mk/bsd.own.mk	Sun Sep 29 22:10:55 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1152 2019/09/15 21:17:08 bad Exp $
+#	$NetBSD: bsd.own.mk,v 1.1153 2019/09/29 22:10:55 mrg Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -70,9 +70,9 @@ MKGCCCMDS?=	no
 # We import the old gcc as "gcc.old" when upgrading.  EXTERNAL_GCC_SUBDIR is
 # set to the relevant subdirectory in src/external/gpl3 for his HAVE_GCC.
 #
-.if ${HAVE_GCC} == 6
+.if ${HAVE_GCC} == 7
 EXTERNAL_GCC_SUBDIR?=	gcc.old
-.elif ${HAVE_GCC} == 7
+.elif ${HAVE_GCC} == 8
 EXTERNAL_GCC_SUBDIR?=	gcc
 .else
 EXTERNAL_GCC_SUBDIR=?	/does/not/exist



CVS commit: src/sys/dev/ic

2019-09-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Sep 29 21:28:20 UTC 2019

Modified Files:
src/sys/dev/ic: ahcisata_core.c

Log Message:
Use AHCI_RFIS_SYNC in ahci_cmd_complete() AT_READREG case.

Ensures CPU sees the current device to host FIS before parsing.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/ic/ahcisata_core.c

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

Modified files:

Index: src/sys/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.77 src/sys/dev/ic/ahcisata_core.c:1.78
--- src/sys/dev/ic/ahcisata_core.c:1.77	Sun Sep 29 21:25:08 2019
+++ src/sys/dev/ic/ahcisata_core.c	Sun Sep 29 21:28:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.77 2019/09/29 21:25:08 jakllsch Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.78 2019/09/29 21:28:20 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.77 2019/09/29 21:25:08 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.78 2019/09/29 21:28:20 jakllsch Exp $");
 
 #include 
 #include 
@@ -1265,6 +1265,7 @@ ahci_cmd_complete(struct ata_channel *ch
 {
 	struct ata_command *ata_c = >c_ata_c;
 	struct ahci_channel *achp = (struct ahci_channel *)chp;
+	struct ahci_softc *sc = AHCI_CH2SC(chp);
 
 	AHCIDEBUG_PRINT(("ahci_cmd_complete port %d CMD 0x%x CI 0x%x\n",
 	chp->ch_channel,
@@ -1286,8 +1287,10 @@ ahci_cmd_complete(struct ata_channel *ch
 		ata_c->flags |= AT_ERROR;
 	}
 
-	if (ata_c->flags & AT_READREG)
+	if (ata_c->flags & AT_READREG) {
+		AHCI_RFIS_SYNC(sc, achp, BUS_DMASYNC_POSTREAD);
 		satafis_rdh_cmd_readreg(ata_c, achp->ahcic_rfis->rfis_rfis);
+	}
 
 	ahci_cmd_done(chp, xfer);
 



CVS commit: src/sys/dev/ic

2019-09-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Sep 29 21:28:20 UTC 2019

Modified Files:
src/sys/dev/ic: ahcisata_core.c

Log Message:
Use AHCI_RFIS_SYNC in ahci_cmd_complete() AT_READREG case.

Ensures CPU sees the current device to host FIS before parsing.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/ic/ahcisata_core.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/ic

2019-09-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Sep 29 21:25:08 UTC 2019

Modified Files:
src/sys/dev/ic: ahcisata_core.c

Log Message:
Use AHCI_CMDTBL_SYNC in ahci_exec_fis() to ensure hardware sees the
command FIS.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/ic/ahcisata_core.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/ic

2019-09-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Sep 29 21:25:08 UTC 2019

Modified Files:
src/sys/dev/ic: ahcisata_core.c

Log Message:
Use AHCI_CMDTBL_SYNC in ahci_exec_fis() to ensure hardware sees the
command FIS.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/ic/ahcisata_core.c

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

Modified files:

Index: src/sys/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.76 src/sys/dev/ic/ahcisata_core.c:1.77
--- src/sys/dev/ic/ahcisata_core.c:1.76	Sun Sep 29 21:21:41 2019
+++ src/sys/dev/ic/ahcisata_core.c	Sun Sep 29 21:25:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.76 2019/09/29 21:21:41 jakllsch Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.77 2019/09/29 21:25:08 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.76 2019/09/29 21:21:41 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.77 2019/09/29 21:25:08 jakllsch Exp $");
 
 #include 
 #include 
@@ -765,6 +765,7 @@ ahci_exec_fis(struct ata_channel *chp, i
 	else
 		timeout = timeout / 10;
 
+	AHCI_CMDTBL_SYNC(sc, achp, slot, BUS_DMASYNC_PREWRITE);
 	AHCI_CMDH_SYNC(sc, achp, slot,
 	BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	/* start command */



CVS commit: src/sys/dev/ic

2019-09-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Sep 29 21:21:41 UTC 2019

Modified Files:
src/sys/dev/ic: ahcisata_core.c

Log Message:
Ensure cmdh_prdtl is 0 in ahci_do_reset_drive().

(I'm probably just being paranoid here.)


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/ic/ahcisata_core.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/ic

2019-09-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Sep 29 21:21:41 UTC 2019

Modified Files:
src/sys/dev/ic: ahcisata_core.c

Log Message:
Ensure cmdh_prdtl is 0 in ahci_do_reset_drive().

(I'm probably just being paranoid here.)


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/ic/ahcisata_core.c

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

Modified files:

Index: src/sys/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.75 src/sys/dev/ic/ahcisata_core.c:1.76
--- src/sys/dev/ic/ahcisata_core.c:1.75	Sun Apr  7 17:46:49 2019
+++ src/sys/dev/ic/ahcisata_core.c	Sun Sep 29 21:21:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.75 2019/04/07 17:46:49 bouyer Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.76 2019/09/29 21:21:41 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.75 2019/04/07 17:46:49 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.76 2019/09/29 21:21:41 jakllsch Exp $");
 
 #include 
 #include 
@@ -842,6 +842,7 @@ again:
 	cmd_tbl = achp->ahcic_cmd_tbl[c_slot];
 	cmd_h->cmdh_flags = htole16(AHCI_CMDH_F_RST | AHCI_CMDH_F_CBSY |
 	RHD_FISLEN / 4 | (drive << AHCI_CMDH_F_PMP_SHIFT));
+	cmd_h->cmdh_prdtl = 0;
 	cmd_h->cmdh_prdbc = 0;
 	memset(cmd_tbl->cmdt_cfis, 0, 64);
 	cmd_tbl->cmdt_cfis[fis_type] = RHD_FISTYPE;



CVS commit: src/sys/dev/ic

2019-09-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Sep 29 21:16:14 UTC 2019

Modified Files:
src/sys/dev/ic: ahcisatavar.h

Log Message:
Make AHCI_RFIS_SYNC macro (currently unused) compile.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/ic/ahcisatavar.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/ic

2019-09-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Sep 29 21:16:14 UTC 2019

Modified Files:
src/sys/dev/ic: ahcisatavar.h

Log Message:
Make AHCI_RFIS_SYNC macro (currently unused) compile.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/ic/ahcisatavar.h

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

Modified files:

Index: src/sys/dev/ic/ahcisatavar.h
diff -u src/sys/dev/ic/ahcisatavar.h:1.22 src/sys/dev/ic/ahcisatavar.h:1.23
--- src/sys/dev/ic/ahcisatavar.h:1.22	Mon Jan 14 21:29:56 2019
+++ src/sys/dev/ic/ahcisatavar.h	Sun Sep 29 21:16:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisatavar.h,v 1.22 2019/01/14 21:29:56 jdolecek Exp $	*/
+/*	$NetBSD: ahcisatavar.h,v 1.23 2019/09/29 21:16:14 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -103,7 +103,8 @@ struct ahci_softc {
 (char *)(&(achp)->ahcic_cmdh[(cmd)]) - (char *)(sc)->sc_cmd_hdr, \
 sizeof(struct ahci_cmd_header), (op))
 #define AHCI_RFIS_SYNC(sc, achp, op) bus_dmamap_sync((sc)->sc_dmat, \
-(sc)->sc_cmd_hdrd, (void *)(achp)->ahcic_rfis - (sc)->sc_cmd_hdr, \
+(sc)->sc_cmd_hdrd, \
+(char *)(achp)->ahcic_rfis - (char *)(sc)->sc_cmd_hdr, \
 AHCI_RFIS_SIZE, (op))
 #define AHCI_CMDTBL_SYNC(sc, achp, cmd, op) bus_dmamap_sync((sc)->sc_dmat, \
 (achp)->ahcic_cmd_tbld, AHCI_CMDTBL_SIZE * (cmd), \



CVS commit: src/usr.sbin/npf/npfctl

2019-09-29 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Sep 29 18:51:08 UTC 2019

Modified Files:
src/usr.sbin/npf/npfctl: npf_build.c

Log Message:
npfctl: implement table replace subcommand.
Contributed by Timshel Knoll-Miller.

(missed a file in previous commit; cvs is so helpful..)


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/npf/npfctl/npf_build.c

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



CVS commit: src/usr.sbin/npf/npfctl

2019-09-29 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Sep 29 18:51:08 UTC 2019

Modified Files:
src/usr.sbin/npf/npfctl: npf_build.c

Log Message:
npfctl: implement table replace subcommand.
Contributed by Timshel Knoll-Miller.

(missed a file in previous commit; cvs is so helpful..)


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/npf/npfctl/npf_build.c

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf_build.c
diff -u src/usr.sbin/npf/npfctl/npf_build.c:1.51 src/usr.sbin/npf/npfctl/npf_build.c:1.52
--- src/usr.sbin/npf/npfctl/npf_build.c:1.51	Thu Aug  8 21:29:15 2019
+++ src/usr.sbin/npf/npfctl/npf_build.c	Sun Sep 29 18:51:08 2019
@@ -32,7 +32,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: npf_build.c,v 1.51 2019/08/08 21:29:15 rmind Exp $");
+__RCSID("$NetBSD: npf_build.c,v 1.52 2019/09/29 18:51:08 rmind Exp $");
 
 #include 
 #define	__FAVOR_BSD
@@ -151,25 +151,32 @@ npfctl_debug_addif(const char *ifname)
 	return 0;
 }
 
-unsigned
-npfctl_table_getid(const char *name)
+nl_table_t *
+npfctl_table_getbyname(nl_config_t *ncf, const char *name)
 {
-	unsigned tid = (unsigned)-1;
 	nl_iter_t i = NPF_ITER_BEGIN;
 	nl_table_t *tl;
 
 	/* XXX dynamic ruleset */
-	if (!npf_conf) {
-		return (unsigned)-1;
+	if (!ncf) {
+		return NULL;
 	}
-	while ((tl = npf_table_iterate(npf_conf, )) != NULL) {
+	while ((tl = npf_table_iterate(ncf, )) != NULL) {
 		const char *tname = npf_table_getname(tl);
 		if (strcmp(tname, name) == 0) {
-			tid = npf_table_getid(tl);
 			break;
 		}
 	}
-	return tid;
+	return tl;
+}
+
+unsigned
+npfctl_table_getid(const char *name)
+{
+	nl_table_t *tl;
+
+	tl = npfctl_table_getbyname(npf_conf, name);
+	return tl ? npf_table_getid(tl) : (unsigned)-1;
 }
 
 const char *
@@ -873,15 +880,13 @@ npfctl_build_natseg(int sd, int type, un
  * npfctl_fill_table: fill NPF table with entries from a specified file.
  */
 static void
-npfctl_fill_table(nl_table_t *tl, u_int type, const char *fname)
+npfctl_fill_table(nl_table_t *tl, u_int type, const char *fname, FILE *fp)
 {
 	char *buf = NULL;
 	int l = 0;
-	FILE *fp;
 	size_t n;
 
-	fp = fopen(fname, "r");
-	if (fp == NULL) {
+	if (fp == NULL && (fp = fopen(fname, "r")) == NULL) {
 		err(EXIT_FAILURE, "open '%s'", fname);
 	}
 	while (l++, getline(, , fp) != -1) {
@@ -908,6 +913,23 @@ npfctl_fill_table(nl_table_t *tl, u_int 
 }
 
 /*
+ * npfctl_load_table: create an NPF table and fill with contents from a file.
+ */
+nl_table_t *
+npfctl_load_table(const char *tname, int tid, u_int type,
+const char *fname, FILE *fp)
+{
+	nl_table_t *tl;
+
+	tl = npf_table_create(tname, tid, type);
+	if (tl && fname) {
+		npfctl_fill_table(tl, type, fname, fp);
+	}
+
+	return tl;
+}
+
+/*
  * npfctl_build_table: create an NPF table, add to the configuration and,
  * if required, fill with contents from a file.
  */
@@ -916,15 +938,13 @@ npfctl_build_table(const char *tname, u_
 {
 	nl_table_t *tl;
 
-	tl = npf_table_create(tname, npfctl_tid_counter++, type);
-	assert(tl != NULL);
-
-	if (fname) {
-		npfctl_fill_table(tl, type, fname);
-	} else if (type == NPF_TABLE_CONST) {
+	if (type == NPF_TABLE_CONST && !fname) {
 		yyerror("table type 'const' must be loaded from a file");
 	}
 
+	tl = npfctl_load_table(tname, npfctl_tid_counter++, type, fname, NULL);
+	assert(tl != NULL);
+
 	if (npf_table_insert(npf_conf, tl)) {
 		yyerror("table '%s' is already defined", tname);
 	}



CVS commit: src/sys/net/npf

2019-09-29 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Sep 29 17:00:29 UTC 2019

Modified Files:
src/sys/net/npf: npf_conn.c npf_if.c npf_impl.h npf_ruleset.c

Log Message:
NPF ifmap: rework and fix a few small bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/net/npf/npf_conn.c
cvs rdiff -u -r1.10 -r1.11 src/sys/net/npf/npf_if.c
cvs rdiff -u -r1.79 -r1.80 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.48 -r1.49 src/sys/net/npf/npf_ruleset.c

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



CVS commit: src/sys/net/npf

2019-09-29 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Sep 29 17:00:29 UTC 2019

Modified Files:
src/sys/net/npf: npf_conn.c npf_if.c npf_impl.h npf_ruleset.c

Log Message:
NPF ifmap: rework and fix a few small bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/net/npf/npf_conn.c
cvs rdiff -u -r1.10 -r1.11 src/sys/net/npf/npf_if.c
cvs rdiff -u -r1.79 -r1.80 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.48 -r1.49 src/sys/net/npf/npf_ruleset.c

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

Modified files:

Index: src/sys/net/npf/npf_conn.c
diff -u src/sys/net/npf/npf_conn.c:1.29 src/sys/net/npf/npf_conn.c:1.30
--- src/sys/net/npf/npf_conn.c:1.29	Tue Aug  6 11:40:15 2019
+++ src/sys/net/npf/npf_conn.c	Sun Sep 29 17:00:29 2019
@@ -107,7 +107,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_conn.c,v 1.29 2019/08/06 11:40:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_conn.c,v 1.30 2019/09/29 17:00:29 rmind Exp $");
 
 #include 
 #include 
@@ -782,7 +782,8 @@ npf_conn_export(npf_t *npf, npf_conn_t *
 	nvlist_add_number(cdict, "flags", con->c_flags);
 	nvlist_add_number(cdict, "proto", con->c_proto);
 	if (con->c_ifid) {
-		const char *ifname = npf_ifmap_getname(npf, con->c_ifid);
+		char ifname[IFNAMSIZ];
+		npf_ifmap_copyname(npf, con->c_ifid, ifname, sizeof(ifname));
 		nvlist_add_string(cdict, "ifname", ifname);
 	}
 	nvlist_add_binary(cdict, "state", >c_state, sizeof(npf_state_t));

Index: src/sys/net/npf/npf_if.c
diff -u src/sys/net/npf/npf_if.c:1.10 src/sys/net/npf/npf_if.c:1.11
--- src/sys/net/npf/npf_if.c:1.10	Sun Aug 11 20:26:33 2019
+++ src/sys/net/npf/npf_if.c	Sun Sep 29 17:00:29 2019
@@ -1,4 +1,5 @@
 /*-
+ * Copyright (c) 2019 Mindaugas Rasiukevicius 
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -28,23 +29,34 @@
  */
 
 /*
- * NPF network interface handling module.
+ * NPF network interface handling.
  *
- * NPF uses its own interface IDs (npf-if-id).  When NPF configuration is
- * (re)loaded, each required interface name is registered and a matching
- * network interface gets an ID assigned.  If an interface is not present,
- * it gets an ID on attach.
+ * NPF uses its own interface IDs (npf-if-id).  These IDs start from 1.
+ * Zero is reserved to indicate "no interface" case or an interface of
+ * no interest (i.e. not registered).
  *
- * IDs start from 1.  Zero is reserved to indicate "no interface" case or
- * an interface of no interest (i.e. not registered).
+ * This module provides an interface to primarily handle the following:
  *
- * The IDs are mapped synchronously based on interface events which are
- * monitored using pfil(9) hooks.
+ * - Bind a symbolic interface name to NPF interface ID.
+ * - Associate NPF interface ID when the network interface is attached.
+ *
+ * When NPF configuration is (re)loaded, each referenced network interface
+ * name is registered with a unique ID.  If the network interface is already
+ * attached, then the ID is associated with it immediately; otherwise, IDs
+ * are associated/disassociated on interface events which are monitored
+ * using pfil(9) hooks.
+ *
+ * To avoid race conditions when an active NPF configuration is updated or
+ * interfaces are detached/attached, the interface names are never removed
+ * and therefore IDs are never re-assigned.  The only point when interface
+ * names and IDs are cleared is when the configuration is flushed.
+ *
+ * A linear counter is used for IDs.
  */
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_if.c,v 1.10 2019/08/11 20:26:33 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_if.c,v 1.11 2019/09/29 17:00:29 rmind Exp $");
 
 #include 
 #include 
@@ -55,9 +67,13 @@ __KERNEL_RCSID(0, "$NetBSD: npf_if.c,v 1
 #include "npf_impl.h"
 
 typedef struct npf_ifmap {
-	char		n_ifname[IFNAMSIZ];
+	char		ifname[IFNAMSIZ + 1];
 } npf_ifmap_t;
 
+#define	NPF_IFMAP_NOID			(0U)
+#define	NPF_IFMAP_SLOT2ID(npf, slot)	((npf)->ifmap_off + (slot) + 1)
+#define	NPF_IFMAP_ID2SLOT(npf, id)	((id) - (npf)->ifmap_off - 1)
+
 void
 npf_ifmap_init(npf_t *npf, const npf_ifops_t *ifops)
 {
@@ -66,8 +82,10 @@ npf_ifmap_init(npf_t *npf, const npf_ifo
 	KASSERT(ifops != NULL);
 	ifops->flush((void *)(uintptr_t)0);
 
+	mutex_init(>ifmap_lock, MUTEX_DEFAULT, IPL_SOFTNET);
 	npf->ifmap = kmem_zalloc(nbytes, KM_SLEEP);
 	npf->ifmap_cnt = 0;
+	npf->ifmap_off = 0;
 	npf->ifops = ifops;
 }
 
@@ -75,82 +93,101 @@ void
 npf_ifmap_fini(npf_t *npf)
 {
 	const size_t nbytes = sizeof(npf_ifmap_t) * NPF_MAX_IFMAP;
+	mutex_destroy(>ifmap_lock);
 	kmem_free(npf->ifmap, nbytes);
 }
 
-static u_int
-npf_ifmap_new(npf_t *npf)
-{
-	KASSERT(npf_config_locked_p(npf));
-
-	for (u_int i = 0; i < npf->ifmap_cnt; i++)
-		if (npf->ifmap[i].n_ifname[0] == '\0')
-			return i + 1;
-
-	if (npf->ifmap_cnt == NPF_MAX_IFMAP) {
-		printf("npf_ifmap_new: out of slots; bump NPF_MAX_IFMAP\n");
-		

CVS commit: src/usr.sbin/npf/npfctl

2019-09-29 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Sep 29 16:58:35 UTC 2019

Modified Files:
src/usr.sbin/npf/npfctl: npfctl.8 npfctl.c npfctl.h

Log Message:
npfctl: implement table replace subcommand.
Contributed by Timshel Knoll-Miller.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/npf/npfctl/npfctl.8
cvs rdiff -u -r1.61 -r1.62 src/usr.sbin/npf/npfctl/npfctl.c
cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/npf/npfctl/npfctl.h

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npfctl.8
diff -u src/usr.sbin/npf/npfctl/npfctl.8:1.21 src/usr.sbin/npf/npfctl/npfctl.8:1.22
--- src/usr.sbin/npf/npfctl/npfctl.8:1.21	Sat Jan 19 21:19:32 2019
+++ src/usr.sbin/npf/npfctl/npfctl.8	Sun Sep 29 16:58:35 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: npfctl.8,v 1.21 2019/01/19 21:19:32 rmind Exp $
+.\"	$NetBSD: npfctl.8,v 1.22 2019/09/29 16:58:35 rmind Exp $
 .\"
 .\" Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 10, 2017
+.Dd August 26, 2019
 .Dt NPFCTL 8
 .Os
 .Sh NAME
@@ -114,28 +114,50 @@ List all rules in the dynamic ruleset sp
 Remove all rules from the dynamic ruleset specified by
 .Ar name .
 .\" ---
-.It Ic table Ar tid Ic add Aq Ar addr/mask
+.It Ic table Ar name Ic add Aq Ar addr/mask
 In table
-.Ar tid ,
+.Ar name ,
 add the IP address and optionally netmask, specified by
 .Aq Ar addr/mask .
 Only the tables of type "lpm" support masks.
-.It Ic table Ar tid Ic rem Aq Ar addr/mask
+.It Ic table Ar name Ic rem Aq Ar addr/mask
 In table
-.Ar tid ,
+.Ar name ,
 remove the IP address and optionally netmask, specified by
 .Aq Ar addr/mask .
 Only the tables of type "lpm" support masks.
-.It Ic table Ar tid Ic test Aq Ar addr
+.It Ic table Ar name Ic test Aq Ar addr
 Query the table
-.Ar tid
+.Ar name
 for a specific IP address, specified by
 .Ar addr .
 If no mask is specified, a single host is assumed.
-.It Ic table Ar tid Ic list
+.It Ic table Ar name Ic list
 List all entries in the currently loaded table specified by
-.Ar tid .
+.Ar name .
 This operation is expensive and should be used with caution.
+.It Ic table Ar name Ic replace Oo Fl n Ar newname Oc Oo Fl t Ar type Oc Aq Ar path
+Replace the existing table specified by
+.Ar name
+with a new table built from the file specified by
+.Ar path .
+Optionally, the new table will:
+.Bl -tag -width xx -compact -offset 3n
+.It Fl n Ar newname
+be named
+.Ar newname ,
+effectively renaming the table.
+If not specified, the name of the table being replaced will be used.
+.It Fl n Ar type
+be of type
+.Ar type ;
+currently supported types are
+.Cm ipset ,
+.Cm lpm ,
+or
+.Cm const .
+If not specified, the type of the table being replaced will be used.
+.El
 .\" ---
 .It Ic save
 Save the active configuration and a snapshot of the current connections.
@@ -201,6 +223,13 @@ Addition and removal of entries in the t
 # npfctl table "vip" add 10.0.0.1
 # npfctl table "vip" rem 182.168.0.0/24
 .Ed
+.Pp
+Replacing the existing table which has ID "svr"
+with a new const table populated from file "/tmp/npf_vps_new",
+and renamed to "vps":
+.Bd -literal -offset indent
+# npfctl table "svr" replace -n "vps" -t const "/tmp/npf_vps_new"
+.Ed
 .\" -
 .Sh SEE ALSO
 .Xr bpf 4 ,

Index: src/usr.sbin/npf/npfctl/npfctl.c
diff -u src/usr.sbin/npf/npfctl/npfctl.c:1.61 src/usr.sbin/npf/npfctl/npfctl.c:1.62
--- src/usr.sbin/npf/npfctl/npfctl.c:1.61	Wed Aug 21 21:41:53 2019
+++ src/usr.sbin/npf/npfctl/npfctl.c	Sun Sep 29 16:58:35 2019
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: npfctl.c,v 1.61 2019/08/21 21:41:53 rmind Exp $");
+__RCSID("$NetBSD: npfctl.c,v 1.62 2019/09/29 16:58:35 rmind Exp $");
 
 #include 
 #include 
@@ -142,10 +142,14 @@ usage(void)
 	"\t%s rule \"rule-name\" { list | flush }\n",
 	progname);
 	fprintf(stderr,
-	"\t%s table  { add | rem | test } \n",
+	"\t%s table \"table-name\" { add | rem | test } \n",
 	progname);
 	fprintf(stderr,
-	"\t%s table  { list | flush }\n",
+	"\t%s table \"table-name\" { list | flush }\n",
+	progname);
+	fprintf(stderr,
+	"\t%s table \"table-name\" replace [-n \"name\"]"
+	" [-t ] \n",
 	progname);
 	fprintf(stderr,
 	"\t%s save | load\n",
@@ -275,7 +279,101 @@ npfctl_print_addrmask(int alen, const ch
 	return buf;
 }
 
-__dead static void
+static int
+npfctl_table_type(const char *typename)
+{
+	int i;
+
+	static const struct tbltype_s {
+		const char *name;
+		u_int type;
+	} tbltypes[] = {
+		{ "ipset",	NPF_TABLE_IPSET	},
+		{ "lpm",	NPF_TABLE_LPM	},
+		{ "const",	NPF_TABLE_CONST	},
+		{ NULL,		0		}
+	};
+
+	for (i = 0; tbltypes[i].name != NULL; i++) {
+		if (strcmp(typename, tbltypes[i].name) == 0) {
+			return tbltypes[i].type;
+		}
+	}
+
+	return 

CVS commit: src/usr.sbin/npf/npfctl

2019-09-29 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Sep 29 16:58:35 UTC 2019

Modified Files:
src/usr.sbin/npf/npfctl: npfctl.8 npfctl.c npfctl.h

Log Message:
npfctl: implement table replace subcommand.
Contributed by Timshel Knoll-Miller.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/npf/npfctl/npfctl.8
cvs rdiff -u -r1.61 -r1.62 src/usr.sbin/npf/npfctl/npfctl.c
cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/npf/npfctl/npfctl.h

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



CVS commit: src/sys/kern

2019-09-29 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Sun Sep 29 12:07:52 UTC 2019

Modified Files:
src/sys/kern: kern_rndq.c

Log Message:
Do all delta calculations strictly using uint32_t.  Avoid integer
overflows in calculating absolute deltas by subtracting the right way
around.

Reported-by: syzbot+68c37d09c833f8ec1...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/kern/kern_rndq.c

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

Modified files:

Index: src/sys/kern/kern_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.94 src/sys/kern/kern_rndq.c:1.95
--- src/sys/kern/kern_rndq.c:1.94	Wed Jul 31 02:21:31 2019
+++ src/sys/kern/kern_rndq.c	Sun Sep 29 12:07:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rndq.c,v 1.94 2019/07/31 02:21:31 msaitoh Exp $	*/
+/*	$NetBSD: kern_rndq.c,v 1.95 2019/09/29 12:07:52 rhialto Exp $	*/
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.94 2019/07/31 02:21:31 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.95 2019/09/29 12:07:52 rhialto Exp $");
 
 #include 
 #include 
@@ -324,22 +324,24 @@ rnd_getmore(size_t byteswanted)
  * non-zero.  If any of these are zero, return zero.
  */
 static inline uint32_t
-rnd_delta_estimate(rnd_delta_t *d, uint32_t v, int32_t delta)
+rnd_delta_estimate(rnd_delta_t *d, uint32_t v, uint32_t delta)
 {
-	int32_t delta2, delta3;
+	uint32_t delta2, delta3;
 
 	d->insamples++;
 
 	/*
 	 * Calculate the second and third order differentials
 	 */
-	delta2 = d->dx - delta;
-	if (delta2 < 0)
-		delta2 = -delta2;
-
-	delta3 = d->d2x - delta2;
-	if (delta3 < 0)
-		delta3 = -delta3;
+	if (delta > (uint32_t)d->dx)
+	delta2 = delta - (uint32_t)d->dx;
+	else
+	delta2 = (uint32_t)d->dx - delta;
+
+	if (delta2 > (uint32_t)d->d2x)
+	delta3 = delta2 - (uint32_t)d->d2x;
+	else
+	delta3 = (uint32_t)d->d2x - delta2;
 
 	d->x = v;
 	d->dx = delta;
@@ -357,23 +359,21 @@ rnd_delta_estimate(rnd_delta_t *d, uint3
 }
 
 /*
- * Delta estimator for 32-bit timeestamps.  Must handle wrap.
+ * Delta estimator for 32-bit timestamps.
+ * Timestaps generally increase, but may wrap around to 0.
+ * If t decreases, it is assumed that wrap-around occurred (once).
  */
 static inline uint32_t
 rnd_dt_estimate(krndsource_t *rs, uint32_t t)
 {
-	int32_t delta;
+	uint32_t delta;
 	uint32_t ret;
 	rnd_delta_t *d = >time_delta;
 
-	if (t < d->x) {
-		delta = UINT32_MAX - d->x + t;
+	if (t < (uint32_t)d->x) {
+		delta = UINT32_MAX - (uint32_t)d->x + t;
 	} else {
-		delta = d->x - t;
-	}
-
-	if (delta < 0) {
-		delta = -delta;
+		delta = t - (uint32_t)d->x;
 	}
 
 	ret = rnd_delta_estimate(d, t, delta);
@@ -391,21 +391,22 @@ rnd_dt_estimate(krndsource_t *rs, uint32
 }
 
 /*
- * Delta estimator for 32 or bit values.  "Wrap" isn't.
+ * Delta estimator for arbitrary unsigned 32 bit values.
  */
 static inline uint32_t
 rnd_dv_estimate(krndsource_t *rs, uint32_t v)
 {
-	int32_t delta;
+	uint32_t delta;
 	uint32_t ret;
 	rnd_delta_t *d = >value_delta;
 
-	delta = d->x - v;
-
-	if (delta < 0) {
-		delta = -delta;
+	if (v >= (uint32_t)d->x) {
+		delta = v - (uint32_t)d->x;
+	} else {
+		delta = (uint32_t)d->x - v;
 	}
-	ret = rnd_delta_estimate(d, v, (uint32_t)delta);
+
+	ret = rnd_delta_estimate(d, v, delta);
 
 	KASSERT(d->x == v);
 	KASSERT(d->dx == delta);



CVS commit: src/sys/kern

2019-09-29 Thread Olaf Seibert
Module Name:src
Committed By:   rhialto
Date:   Sun Sep 29 12:07:52 UTC 2019

Modified Files:
src/sys/kern: kern_rndq.c

Log Message:
Do all delta calculations strictly using uint32_t.  Avoid integer
overflows in calculating absolute deltas by subtracting the right way
around.

Reported-by: syzbot+68c37d09c833f8ec1...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/kern/kern_rndq.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/aarch64/aarch64

2019-09-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 29 08:33:20 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: locore.S

Log Message:
Typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/aarch64/aarch64/locore.S

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



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

2019-09-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 29 08:33:20 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: locore.S

Log Message:
Typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/aarch64/aarch64/locore.S

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.40 src/sys/arch/aarch64/aarch64/locore.S:1.41
--- src/sys/arch/aarch64/aarch64/locore.S:1.40	Sun Sep  8 12:17:23 2019
+++ src/sys/arch/aarch64/aarch64/locore.S	Sun Sep 29 08:33:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.40 2019/09/08 12:17:23 jmcneill Exp $	*/
+/*	$NetBSD: locore.S,v 1.41 2019/09/29 08:33:20 skrll Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -38,7 +38,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.40 2019/09/08 12:17:23 jmcneill Exp $")
+RCSID("$NetBSD: locore.S,v 1.41 2019/09/29 08:33:20 skrll Exp $")
 
 
 /*#define DEBUG_LOCORE			/* debug print */
@@ -799,7 +799,7 @@ init_mmutable:
 	adr	x0, start			/* va = start */
 	ADDR	x2, _end
 	sub	x2, x2, x0			/* size = _end - start */
-	add	x2, x2, #BOOTPAGE_ALLOC_MAX	/* for boopage_alloc() */
+	add	x2, x2, #BOOTPAGE_ALLOC_MAX	/* for bootpage_alloc() */
 	mov	x1, x0/* pa */
 	bl	pmapboot_enter
 	cbnz	x0, init_mmutable_error



CVS commit: [netbsd-9] src/doc

2019-09-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 29 07:35:15 UTC 2019

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
Tickets #266 and #267


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.66 -r1.1.2.67 src/doc/CHANGES-9.0

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



CVS commit: [netbsd-9] src/doc

2019-09-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 29 07:35:15 UTC 2019

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
Tickets #266 and #267


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.66 -r1.1.2.67 src/doc/CHANGES-9.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-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.66 src/doc/CHANGES-9.0:1.1.2.67
--- src/doc/CHANGES-9.0:1.1.2.66	Sat Sep 28 12:40:33 2019
+++ src/doc/CHANGES-9.0	Sun Sep 29 07:35:15 2019
@@ -1,5 +1,5 @@
 
-# $NetBSD: CHANGES-9.0,v 1.1.2.66 2019/09/28 12:40:33 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.67 2019/09/29 07:35:15 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -4168,3 +4168,16 @@ sys/dev/acpi/acpi_i2c.c1.5
 	PR kern/54493: acpi_i2c uses incorrect arguments for _DSM call.
 	[bouyer, ticket #265]
 
+sys/dev/pci/if_mcx.c1.3,1.4
+
+	mcx(4): fix rx mbuf DMA overrun.
+	[tnn, ticket #266]
+
+usr.bin/audiocfg/audiodev.c			1.12
+usr.bin/audiocfg/dtmf.c1.4
+usr.bin/audiocfg/main.c1.14 (patch)
+
+	Use err(3)/warn(3) instead of perror(3)/fprintf(stderr,...).
+	Use getprogname(3) for usage().
+	[isaki, ticket #267]
+



CVS commit: [netbsd-9] src/usr.bin/audiocfg

2019-09-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 29 07:34:10 UTC 2019

Modified Files:
src/usr.bin/audiocfg [netbsd-9]: audiodev.c dtmf.c main.c

Log Message:
Pull up following revision(s) (requested by isaki in ticket #267):

usr.bin/audiocfg/dtmf.c: revision 1.4
usr.bin/audiocfg/main.c: revision 1.14 (via patch)
usr.bin/audiocfg/audiodev.c: revision 1.12

Use err(3)/warn(3) instead of perror(3)/fprintf(stderr,...).
Use getprogname(3) for usage().


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/usr.bin/audiocfg/audiodev.c
cvs rdiff -u -r1.3 -r1.3.28.1 src/usr.bin/audiocfg/dtmf.c
cvs rdiff -u -r1.8.2.2 -r1.8.2.3 src/usr.bin/audiocfg/main.c

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



CVS commit: [netbsd-9] src/usr.bin/audiocfg

2019-09-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 29 07:34:10 UTC 2019

Modified Files:
src/usr.bin/audiocfg [netbsd-9]: audiodev.c dtmf.c main.c

Log Message:
Pull up following revision(s) (requested by isaki in ticket #267):

usr.bin/audiocfg/dtmf.c: revision 1.4
usr.bin/audiocfg/main.c: revision 1.14 (via patch)
usr.bin/audiocfg/audiodev.c: revision 1.12

Use err(3)/warn(3) instead of perror(3)/fprintf(stderr,...).
Use getprogname(3) for usage().


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/usr.bin/audiocfg/audiodev.c
cvs rdiff -u -r1.3 -r1.3.28.1 src/usr.bin/audiocfg/dtmf.c
cvs rdiff -u -r1.8.2.2 -r1.8.2.3 src/usr.bin/audiocfg/main.c

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

Modified files:

Index: src/usr.bin/audiocfg/audiodev.c
diff -u src/usr.bin/audiocfg/audiodev.c:1.7.2.1 src/usr.bin/audiocfg/audiodev.c:1.7.2.2
--- src/usr.bin/audiocfg/audiodev.c:1.7.2.1	Sat Sep 28 07:41:18 2019
+++ src/usr.bin/audiocfg/audiodev.c	Sun Sep 29 07:34:09 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: audiodev.c,v 1.7.2.1 2019/09/28 07:41:18 martin Exp $ */
+/* $NetBSD: audiodev.c,v 1.7.2.2 2019/09/29 07:34:09 martin Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill 
@@ -31,6 +31,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -155,7 +156,7 @@ audiodev_refresh(void)
 
 	fd = open(DRVCTLDEV, O_RDONLY);
 	if (fd == -1) {
-		perror("open " DRVCTLDEV);
+		warn("open %s", DRVCTLDEV);
 		return -1;
 	}
 
@@ -169,7 +170,7 @@ audiodev_refresh(void)
 
 	error = drvctl_foreach(fd, "audio", audiodev_cb, NULL);
 	if (error == -1) {
-		perror("drvctl");
+		warnx("drvctl failed");
 		return -1;
 	}
 
@@ -230,19 +231,19 @@ audiodev_set_default(struct audiodev *ad
 	unlink(_PATH_MIXER);
 
 	if (symlink(audiopath, _PATH_AUDIO) == -1) {
-		perror("symlink " _PATH_AUDIO);
+		warn("symlink %s", _PATH_AUDIO);
 		return -1;
 	}
 	if (symlink(soundpath, _PATH_SOUND) == -1) {
-		perror("symlink " _PATH_SOUND);
+		warn("symlink %s", _PATH_SOUND);
 		return -1;
 	}
 	if (symlink(audioctlpath, _PATH_AUDIOCTL) == -1) {
-		perror("symlink " _PATH_AUDIOCTL);
+		warn("symlink %s", _PATH_AUDIOCTL);
 		return -1;
 	}
 	if (symlink(mixerpath, _PATH_MIXER) == -1) {
-		perror("symlink " _PATH_MIXER);
+		warn("symlink %s", _PATH_MIXER);
 		return -1;
 	}
 
@@ -265,8 +266,7 @@ audiodev_set_param(struct audiodev *adev
 			break;
 	}
 	if (enc >= encoding_max) {
-		fprintf(stderr, "unknown encoding name: %s\n", encname);
-		errno = EINVAL;
+		warnx("unknown encoding name: %s", encname);
 		return -1;
 	}
 
@@ -294,7 +294,7 @@ audiodev_set_param(struct audiodev *adev
 	printf("setting %s to %s:%u, %uch, %uHz\n",
 	adev->xname, encname, prec, ch, freq);
 	if (ioctl(adev->ctlfd, AUDIO_SETFORMAT, ) == -1) {
-		perror("ioctl AUDIO_SETFORMAT");
+		warn("ioctl AUDIO_SETFORMAT");
 		return -1;
 	}
 	return 0;
@@ -311,7 +311,7 @@ audiodev_test(struct audiodev *adev)
 
 	adev->fd = open(adev->path, O_WRONLY);
 	if (adev->fd == -1) {
-		perror("open");
+		warn("open %s", adev->path);
 		return -1;
 	}
 
@@ -322,11 +322,11 @@ audiodev_test(struct audiodev *adev)
 	info.play.encoding = AUDIO_ENCODING_SLINEAR_LE;
 	info.mode = AUMODE_PLAY;
 	if (ioctl(adev->fd, AUDIO_SETINFO, ) == -1) {
-		perror("ioctl AUDIO_SETINFO");
+		warn("ioctl AUDIO_SETINFO");
 		goto done;
 	}
 	if (ioctl(adev->fd, AUDIO_GETINFO, ) == -1) {
-		perror("ioctl AUDIO_GETINFO");
+		warn("ioctl AUDIO_GETINFO");
 		goto done;
 	}
 
@@ -371,7 +371,7 @@ audiodev_test_chmask(struct audiodev *ad
 			wlen = buflen;
 		ret = write(adev->fd, (char *)buf + off, wlen);
 		if (ret == -1) {
-			perror("write");
+			warn("write");
 			goto done;
 		}
 		wlen = ret;
@@ -380,7 +380,7 @@ audiodev_test_chmask(struct audiodev *ad
 	}
 
 	if (ioctl(adev->fd, AUDIO_DRAIN) == -1) {
-		perror("ioctl AUDIO_DRAIN");
+		warn("ioctl AUDIO_DRAIN");
 		goto done;
 	}
 

Index: src/usr.bin/audiocfg/dtmf.c
diff -u src/usr.bin/audiocfg/dtmf.c:1.3 src/usr.bin/audiocfg/dtmf.c:1.3.28.1
--- src/usr.bin/audiocfg/dtmf.c:1.3	Sun Aug 11 06:31:00 2013
+++ src/usr.bin/audiocfg/dtmf.c	Sun Sep 29 07:34:09 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dtmf.c,v 1.3 2013/08/11 06:31:00 dholland Exp $ */
+/* $NetBSD: dtmf.c,v 1.3.28.1 2019/09/29 07:34:09 martin Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill 
@@ -28,6 +28,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -70,7 +71,7 @@ dtmf_new(int16_t **buf, size_t *buflen, 
 	*buflen = sample_rate * sizeof(int16_t) * sample_length * channels;
 	*buf = calloc(1, *buflen);
 	if (*buf == NULL) {
-		perror("calloc");
+		warn("calloc");
 		return;
 	}
 

Index: src/usr.bin/audiocfg/main.c
diff -u src/usr.bin/audiocfg/main.c:1.8.2.2 src/usr.bin/audiocfg/main.c:1.8.2.3
--- src/usr.bin/audiocfg/main.c:1.8.2.2	Sat Sep 28 07:41:18 2019
+++ src/usr.bin/audiocfg/main.c	Sun Sep 29 07:34:09 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: 

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

2019-09-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 29 07:26:23 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_mcx.c

Log Message:
Pull up following revision(s) (requested by tnn in ticket #266):

sys/dev/pci/if_mcx.c: revision 1.3
sys/dev/pci/if_mcx.c: revision 1.4

mcx(4): fix rx mbuf DMA overrun
pullup-9

 -

len -> m_len


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/dev/pci/if_mcx.c

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



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

2019-09-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 29 07:26:23 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_mcx.c

Log Message:
Pull up following revision(s) (requested by tnn in ticket #266):

sys/dev/pci/if_mcx.c: revision 1.3
sys/dev/pci/if_mcx.c: revision 1.4

mcx(4): fix rx mbuf DMA overrun
pullup-9

 -

len -> m_len


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/dev/pci/if_mcx.c

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

Modified files:

Index: src/sys/dev/pci/if_mcx.c
diff -u src/sys/dev/pci/if_mcx.c:1.1.2.3 src/sys/dev/pci/if_mcx.c:1.1.2.4
--- src/sys/dev/pci/if_mcx.c:1.1.2.3	Thu Sep 26 19:09:57 2019
+++ src/sys/dev/pci/if_mcx.c	Sun Sep 29 07:26:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.1.2.3 2019/09/26 19:09:57 martin Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.1.2.4 2019/09/29 07:26:23 martin Exp $ */
 /*	$OpenBSD: if_mcx.c,v 1.33 2019/09/12 04:23:59 jmatthew Exp $ */
 
 /*
@@ -5620,15 +5620,16 @@ mcx_rx_fill_slots(struct mcx_softc *sc, 
 #endif
 
 		m->m_data += ETHER_ALIGN;
-		m->m_len = m->m_pkthdr.len = bufsize;
+		m->m_len = m->m_pkthdr.len = m->m_ext.ext_size - ETHER_ALIGN;
 		if (bus_dmamap_load_mbuf(sc->sc_dmat, ms->ms_map, m,
 		BUS_DMA_NOWAIT) != 0) {
 			m_freem(m);
 			break;
 		}
+		bus_dmamap_sync(sc->sc_dmat, ms->ms_map, 0, ms->ms_map->dm_mapsize, BUS_DMASYNC_PREREAD);
 		ms->ms_m = m;
 
-		rqe[slot].rqe_byte_count = htobe32(bufsize);
+		rqe[slot].rqe_byte_count = htobe32(m->m_len);
 		rqe[slot].rqe_addr = htobe64(ms->ms_map->dm_segs[0].ds_addr);
 		rqe[slot].rqe_lkey = htobe32(sc->sc_lkey);
 



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

2019-09-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 29 06:51:45 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
aprint_debug_dev output alignment


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/arm/arm32/cpu.c

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

Modified files:

Index: src/sys/arch/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.131 src/sys/arch/arm/arm32/cpu.c:1.132
--- src/sys/arch/arm/arm32/cpu.c:1.131	Sun Sep  8 07:59:43 2019
+++ src/sys/arch/arm/arm32/cpu.c	Sun Sep 29 06:51:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.131 2019/09/08 07:59:43 tnn Exp $	*/
+/*	$NetBSD: cpu.c,v 1.132 2019/09/29 06:51:45 skrll Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.131 2019/09/08 07:59:43 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.132 2019/09/29 06:51:45 skrll Exp $");
 
 #include 
 #include 
@@ -689,6 +689,8 @@ identify_arm_cpu(device_t dv, struct cpu
 		aprint_normal(": %s\n", model);
 	}
 
+	aprint_debug_dev(dv, "midr:   %#x\n", arm_cpuid);
+
 	aprint_normal("%s:", xname);
 
 	switch (cpu_class) {
@@ -856,11 +858,11 @@ identify_features(device_t dv)
 	cpu_processor_features[0] = armreg_pfr0_read();
 	cpu_processor_features[1] = armreg_pfr1_read();
 
-	aprint_debug_dev(dv, "sctlr: %#x\n", armreg_sctlr_read());
-	aprint_debug_dev(dv, "actlr: %#x\n", armreg_auxctl_read());
+	aprint_debug_dev(dv, "sctlr:  %#x\n", armreg_sctlr_read());
+	aprint_debug_dev(dv, "actlr:  %#x\n", armreg_auxctl_read());
 	aprint_debug_dev(dv, "revidr: %#x\n", armreg_revidr_read());
 #ifdef MULTIPROCESSOR
-	aprint_debug_dev(dv, "mpidr: %#x\n", armreg_mpidr_read());
+	aprint_debug_dev(dv, "mpidr:  %#x\n", armreg_mpidr_read());
 #endif
 	aprint_debug_dev(dv,
 	"isar: [0]=%#x [1]=%#x [2]=%#x [3]=%#x, [4]=%#x, [5]=%#x\n",



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

2019-09-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 29 06:51:45 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
aprint_debug_dev output alignment


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/arm/arm32/cpu.c

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