CVS commit: src/external/gpl3/gdb/dist/gdb

2017-12-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 10 05:36:25 UTC 2017

Modified Files:
src/external/gpl3/gdb/dist/gdb: nbsd-nat.c

Log Message:
PR/52799: Martin Husemann: Correct sysctl args to find executable.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/gdb/dist/gdb/nbsd-nat.c

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

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/nbsd-nat.c
diff -u src/external/gpl3/gdb/dist/gdb/nbsd-nat.c:1.4 src/external/gpl3/gdb/dist/gdb/nbsd-nat.c:1.5
--- src/external/gpl3/gdb/dist/gdb/nbsd-nat.c:1.4	Fri Dec  1 17:22:40 2017
+++ src/external/gpl3/gdb/dist/gdb/nbsd-nat.c	Sun Dec 10 00:36:25 2017
@@ -50,9 +50,9 @@ nbsd_pid_to_exec_file (struct target_ops
   int mib[4];
 
   mib[0] = CTL_KERN;
-  mib[1] = KERN_PROC;
-  mib[2] = KERN_PROC_PATHNAME;
-  mib[3] = pid;
+  mib[1] = KERN_PROC_ARGS;
+  mib[2] = pid;
+  mib[3] = KERN_PROC_PATHNAME;
   buflen = sizeof buf;
   if (sysctl (mib, 4, buf, , NULL, 0) == 0)
 return buf;



CVS commit: src/external/gpl3/gdb/dist/gdb

2017-12-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 10 05:36:25 UTC 2017

Modified Files:
src/external/gpl3/gdb/dist/gdb: nbsd-nat.c

Log Message:
PR/52799: Martin Husemann: Correct sysctl args to find executable.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/gdb/dist/gdb/nbsd-nat.c

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



CVS commit: src/sys/kern

2017-12-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Dec 10 03:08:32 UTC 2017

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

Log Message:
Add additional duplicate-module-name check in case we have two modules
with the same internal name but no conflicting symbol definitions.

When we load a module from the file system, the filename may have no
relationship to the internal module's name.  Furthermore, comparing
the module's filename is insufficient if the file is loaded from an
absolute path.

XXX pullup to netbsd-8


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/kern/kern_module.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_module.c
diff -u src/sys/kern/kern_module.c:1.125 src/sys/kern/kern_module.c:1.126
--- src/sys/kern/kern_module.c:1.125	Thu Jun  1 02:45:13 2017
+++ src/sys/kern/kern_module.c	Sun Dec 10 03:08:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.125 2017/06/01 02:45:13 chs Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.126 2017/12/10 03:08:32 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.125 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.126 2017/12/10 03:08:32 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1039,6 +1039,23 @@ module_do_load(const char *name, bool is
 	}
 
 	/*
+	 * If we loaded a module from the filesystem, check the actual
+	 * module name (from the modinfo_t) to ensure another module
+	 * with the same name doesn't already exist.  (There's no
+	 * guarantee the filename will match the module name, and the
+	 * dup-symbols check may not be sufficient.)
+	 */
+	if (mod->mod_source == MODULE_SOURCE_FILESYS) {
+		mod2 = module_lookup(mod->mod_info->mi_name);
+		if (mod2 && mod2 != mod) {
+			module_error("module with name `%s' already loaded",
+			mod2->mod_info->mi_name);
+			error = EEXIST;
+			goto fail;
+		}
+	}
+
+	/*
 	 * Block circular dependencies.
 	 */
 	TAILQ_FOREACH(mod2, pending, mod_chain) {



CVS commit: src/sys/kern

2017-12-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Dec 10 03:08:32 UTC 2017

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

Log Message:
Add additional duplicate-module-name check in case we have two modules
with the same internal name but no conflicting symbol definitions.

When we load a module from the file system, the filename may have no
relationship to the internal module's name.  Furthermore, comparing
the module's filename is insufficient if the file is loaded from an
absolute path.

XXX pullup to netbsd-8


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/kern/kern_module.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/ia64/stand/common

2017-12-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 10 02:32:03 UTC 2017

Modified Files:
src/sys/arch/ia64/stand/common: bootstrap.h misc.c

Log Message:
comment out unused hexdump


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/ia64/stand/common/bootstrap.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/ia64/stand/common/misc.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/ia64/stand/common/bootstrap.h
diff -u src/sys/arch/ia64/stand/common/bootstrap.h:1.9 src/sys/arch/ia64/stand/common/bootstrap.h:1.10
--- src/sys/arch/ia64/stand/common/bootstrap.h:1.9	Tue Mar 25 14:35:32 2014
+++ src/sys/arch/ia64/stand/common/bootstrap.h	Sat Dec  9 21:32:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootstrap.h,v 1.9 2014/03/25 18:35:32 christos Exp $	*/
+/*	$NetBSD: bootstrap.h,v 1.10 2017/12/10 02:32:03 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998 Michael Smith 
@@ -79,7 +79,9 @@ int	getrootmount(char *rootdev);
 
 /* misc.c */
 char	*unargv(int argc, char *argv[]);
+#if 0
 void	hexdump(void *region, size_t len);
+#endif
 size_t	strlenout(vaddr_t str);
 char	*strdupout(vaddr_t str);
 void	kern_bzero(vaddr_t dest, size_t len);

Index: src/sys/arch/ia64/stand/common/misc.c
diff -u src/sys/arch/ia64/stand/common/misc.c:1.7 src/sys/arch/ia64/stand/common/misc.c:1.8
--- src/sys/arch/ia64/stand/common/misc.c:1.7	Tue Mar 25 14:35:32 2014
+++ src/sys/arch/ia64/stand/common/misc.c	Sat Dec  9 21:32:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.7 2014/03/25 18:35:32 christos Exp $	*/
+/*	$NetBSD: misc.c,v 1.8 2017/12/10 02:32:03 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998 Michael Smith 
@@ -166,6 +166,7 @@ alloc_pread(int fd, off_t off, size_t le
 	return (buf);
 }
 
+#if 0
 /*
  * Display a region in traditional hexdump format.
  */
@@ -205,6 +206,7 @@ hexdump(void *region, size_t len)
 }
 pager_close();
 }
+#endif
 
 void
 dev_cleanup(void)



CVS commit: src/sys/arch/ia64/stand/common

2017-12-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 10 02:32:03 UTC 2017

Modified Files:
src/sys/arch/ia64/stand/common: bootstrap.h misc.c

Log Message:
comment out unused hexdump


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/ia64/stand/common/bootstrap.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/ia64/stand/common/misc.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/evbarm/stand/bootimx23

2017-12-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 10 02:26:41 UTC 2017

Modified Files:
src/sys/arch/evbarm/stand/bootimx23: args_prep.c

Log Message:
use the machine link for bootconfig.h


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/stand/bootimx23/args_prep.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/evbarm/stand/bootimx23

2017-12-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 10 02:26:41 UTC 2017

Modified Files:
src/sys/arch/evbarm/stand/bootimx23: args_prep.c

Log Message:
use the machine link for bootconfig.h


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/stand/bootimx23/args_prep.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/evbarm/stand/bootimx23/args_prep.c
diff -u src/sys/arch/evbarm/stand/bootimx23/args_prep.c:1.3 src/sys/arch/evbarm/stand/bootimx23/args_prep.c:1.4
--- src/sys/arch/evbarm/stand/bootimx23/args_prep.c:1.3	Sat Jan 14 16:57:20 2017
+++ src/sys/arch/evbarm/stand/bootimx23/args_prep.c	Sat Dec  9 21:26:41 2017
@@ -1,4 +1,4 @@
-/* $Id: args_prep.c,v 1.3 2017/01/14 21:57:20 christos Exp $ */
+/* $Id: args_prep.c,v 1.4 2017/12/10 02:26:41 christos Exp $ */
 
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
 #define _LOCORE
 #include 
 #undef _LOCORE
-#include 
+#include 
 
 #include 
 #include 



CVS commit: src/sys/net/npf

2017-12-09 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Dec 10 01:18:21 UTC 2017

Modified Files:
src/sys/net/npf: npf_ctl.c npf_impl.h npf_ruleset.c npf_worker.c

Log Message:
- npf_mk_rules: enforce unique names for the dynamic rulesets.
- npf_worker_unregister: merge fix for the standalone NPF.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/net/npf/npf_ctl.c
cvs rdiff -u -r1.69 -r1.70 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.45 -r1.46 src/sys/net/npf/npf_ruleset.c
cvs rdiff -u -r1.3 -r1.4 src/sys/net/npf/npf_worker.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_ctl.c
diff -u src/sys/net/npf/npf_ctl.c:1.49 src/sys/net/npf/npf_ctl.c:1.50
--- src/sys/net/npf/npf_ctl.c:1.49	Mon Oct 30 03:02:35 2017
+++ src/sys/net/npf/npf_ctl.c	Sun Dec 10 01:18:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_ctl.c,v 1.49 2017/10/30 03:02:35 ozaki-r Exp $	*/
+/*	$NetBSD: npf_ctl.c,v 1.50 2017/12/10 01:18:21 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.49 2017/10/30 03:02:35 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.50 2017/12/10 01:18:21 rmind Exp $");
 
 #include 
 #include 
@@ -371,12 +371,18 @@ npf_mk_rules(npf_t *npf, npf_ruleset_t *
 	it = prop_array_iterator(rules);
 	while ((rldict = prop_object_iterator_next(it)) != NULL) {
 		npf_rule_t *rl = NULL;
+		const char *name;
 
-		/* Generate a single rule. */
 		error = npf_mk_singlerule(npf, rldict, rpset, , errdict);
 		if (error) {
 			break;
 		}
+		if (prop_dictionary_get_cstring_nocopy(rldict, "name", ) &&
+		npf_ruleset_lookup(rlset, name) != NULL) {
+			NPF_ERR_DEBUG(errdict);
+			npf_rule_free(rl);
+			return EEXIST;
+		}
 		npf_ruleset_insert(rlset, rl);
 	}
 	prop_object_iterator_release(it);

Index: src/sys/net/npf/npf_impl.h
diff -u src/sys/net/npf/npf_impl.h:1.69 src/sys/net/npf/npf_impl.h:1.70
--- src/sys/net/npf/npf_impl.h:1.69	Sun Feb 19 02:11:19 2017
+++ src/sys/net/npf/npf_impl.h	Sun Dec 10 01:18:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_impl.h,v 1.69 2017/02/19 02:11:19 christos Exp $	*/
+/*	$NetBSD: npf_impl.h,v 1.70 2017/12/10 01:18:21 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -330,6 +330,7 @@ npf_natpolicy_t *npf_ruleset_findnat(npf
 void		npf_ruleset_freealg(npf_ruleset_t *, npf_alg_t *);
 int		npf_ruleset_export(npf_t *, const npf_ruleset_t *, prop_array_t);
 
+npf_rule_t *	npf_ruleset_lookup(npf_ruleset_t *, const char *);
 int		npf_ruleset_add(npf_ruleset_t *, const char *, npf_rule_t *);
 int		npf_ruleset_remove(npf_ruleset_t *, const char *, uint64_t);
 int		npf_ruleset_remkey(npf_ruleset_t *, const char *,

Index: src/sys/net/npf/npf_ruleset.c
diff -u src/sys/net/npf/npf_ruleset.c:1.45 src/sys/net/npf/npf_ruleset.c:1.46
--- src/sys/net/npf/npf_ruleset.c:1.45	Sun Jan 29 00:15:54 2017
+++ src/sys/net/npf/npf_ruleset.c	Sun Dec 10 01:18:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_ruleset.c,v 1.45 2017/01/29 00:15:54 christos Exp $	*/
+/*	$NetBSD: npf_ruleset.c,v 1.46 2017/12/10 01:18:21 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2015 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_ruleset.c,v 1.45 2017/01/29 00:15:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_ruleset.c,v 1.46 2017/12/10 01:18:21 rmind Exp $");
 
 #include 
 #include 
@@ -208,7 +208,7 @@ npf_ruleset_insert(npf_ruleset_t *rlset,
 	}
 }
 
-static npf_rule_t *
+npf_rule_t *
 npf_ruleset_lookup(npf_ruleset_t *rlset, const char *name)
 {
 	npf_rule_t *rl;

Index: src/sys/net/npf/npf_worker.c
diff -u src/sys/net/npf/npf_worker.c:1.3 src/sys/net/npf/npf_worker.c:1.4
--- src/sys/net/npf/npf_worker.c:1.3	Mon Jan  2 21:49:51 2017
+++ src/sys/net/npf/npf_worker.c	Sun Dec 10 01:18:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_worker.c,v 1.3 2017/01/02 21:49:51 rmind Exp $	*/
+/*	$NetBSD: npf_worker.c,v 1.4 2017/12/10 01:18:21 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2010-2015 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_worker.c,v 1.3 2017/01/02 21:49:51 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_worker.c,v 1.4 2017/12/10 01:18:21 rmind Exp $");
 
 #include 
 #include 
@@ -148,9 +148,12 @@ void
 npf_worker_unregister(npf_t *npf, npf_workfunc_t func)
 {
 	const unsigned idx = npf->worker_id;
-	npf_worker_t *wrk = _workers[idx];
+	npf_worker_t *wrk;
 	npf_t *instance;
 
+	if (!npf_worker_count)
+		return;
+	wrk = _workers[idx];
 	mutex_enter(>worker_lock);
 	npf_worker_testset(wrk, func, NULL);
 	if ((instance = wrk->instances) == npf) {



CVS commit: src/sys/net/npf

2017-12-09 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Dec 10 01:18:21 UTC 2017

Modified Files:
src/sys/net/npf: npf_ctl.c npf_impl.h npf_ruleset.c npf_worker.c

Log Message:
- npf_mk_rules: enforce unique names for the dynamic rulesets.
- npf_worker_unregister: merge fix for the standalone NPF.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/net/npf/npf_ctl.c
cvs rdiff -u -r1.69 -r1.70 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.45 -r1.46 src/sys/net/npf/npf_ruleset.c
cvs rdiff -u -r1.3 -r1.4 src/sys/net/npf/npf_worker.c

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



CVS commit: src/sys/compat

2017-12-09 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Dec 10 00:43:05 UTC 2017

Modified Files:
src/sys/compat/linux/common: linux_mod.c
src/sys/compat/linux32/common: linux32_mod.c

Log Message:
Finally (hopefully) return completely to the state where compat_linux is
enabled by default.

While here make it possible to enable this if already enabled, or disable
if already disabled, without error.   Some minor KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/compat/linux/common/linux_mod.c
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/linux32/common/linux32_mod.c

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

Modified files:

Index: src/sys/compat/linux/common/linux_mod.c
diff -u src/sys/compat/linux/common/linux_mod.c:1.9 src/sys/compat/linux/common/linux_mod.c:1.10
--- src/sys/compat/linux/common/linux_mod.c:1.9	Fri Dec  8 15:31:13 2017
+++ src/sys/compat/linux/common/linux_mod.c	Sun Dec 10 00:43:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_mod.c,v 1.9 2017/12/08 15:31:13 kre Exp $	*/
+/*	$NetBSD: linux_mod.c,v 1.10 2017/12/10 00:43:05 kre Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_mod.c,v 1.9 2017/12/08 15:31:13 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_mod.c,v 1.10 2017/12/10 00:43:05 kre Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_execfmt.h"
@@ -136,13 +136,16 @@ linux_sysctl_enable(SYSCTLFN_ARGS)
 	if (error != 0 || newp == NULL)
 		return error;
 
-	if (val == 1) {
+	if (val == *(int *)rnode->sysctl_data)
+		return 0;
+
+	if (val == 1)
 		error = exec_add(linux_execsw, __arraycount(linux_execsw));
-	} else if (val == 0) {
+	else if (val == 0)
 		error = exec_remove(linux_execsw, __arraycount(linux_execsw));
-	} else {
+	else 
 		error = EINVAL;
-	}
+
 	if (error)
 		return error;
 
@@ -160,7 +163,10 @@ compat_linux_modcmd(modcmd_t cmd, void *
 	case MODULE_CMD_INIT:
 		linux_futex_init();
 		linux_sysctl_init();
-		return 0;
+		error = exec_add(linux_execsw, __arraycount(linux_execsw));
+		if (error != 0) 	 
+			linux_sysctl_fini();
+		return error;
 
 	case MODULE_CMD_FINI:
 		error = exec_remove(linux_execsw, __arraycount(linux_execsw));

Index: src/sys/compat/linux32/common/linux32_mod.c
diff -u src/sys/compat/linux32/common/linux32_mod.c:1.10 src/sys/compat/linux32/common/linux32_mod.c:1.11
--- src/sys/compat/linux32/common/linux32_mod.c:1.10	Fri Dec  8 15:31:13 2017
+++ src/sys/compat/linux32/common/linux32_mod.c	Sun Dec 10 00:43:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_mod.c,v 1.10 2017/12/08 15:31:13 kre Exp $	*/
+/*	$NetBSD: linux32_mod.c,v 1.11 2017/12/10 00:43:05 kre Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux32_mod.c,v 1.10 2017/12/08 15:31:13 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_mod.c,v 1.11 2017/12/10 00:43:05 kre Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_execfmt.h"
@@ -95,13 +95,17 @@ linux32_sysctl_enable(SYSCTLFN_ARGS)
 	if (error != 0 || newp == NULL)
 		return error;
 
-	if (val == 1) {
+	if (val == *(int *)rnode->sysctl_data)
+		return 0;
+
+	if (val == 1)
 		error = exec_add(linux32_execsw, __arraycount(linux32_execsw));
-	} else if (val == 0) {
-		error = exec_remove(linux32_execsw, __arraycount(linux32_execsw));
-	} else {
+	else if (val == 0)
+		error =
+		exec_remove(linux32_execsw, __arraycount(linux32_execsw));
+	else
 		error = EINVAL;
-	}
+
 	if (error)
 		return error;
 
@@ -118,10 +122,14 @@ compat_linux32_modcmd(modcmd_t cmd, void
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 		linux32_sysctl_init();
-		return 0;
+		error = exec_add(linux32_execsw, __arraycount(linux32_execsw));
+		if (error != 0) 	 
+			linux32_sysctl_fini(); 	 
+		return error;
 
 	case MODULE_CMD_FINI:
-		error = exec_remove(linux32_execsw, __arraycount(linux32_execsw));
+		error =
+		exec_remove(linux32_execsw, __arraycount(linux32_execsw));
 		if (error)
 			return error;
 		linux32_sysctl_fini();



CVS commit: src/sys/compat

2017-12-09 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Dec 10 00:43:05 UTC 2017

Modified Files:
src/sys/compat/linux/common: linux_mod.c
src/sys/compat/linux32/common: linux32_mod.c

Log Message:
Finally (hopefully) return completely to the state where compat_linux is
enabled by default.

While here make it possible to enable this if already enabled, or disable
if already disabled, without error.   Some minor KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/compat/linux/common/linux_mod.c
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/linux32/common/linux32_mod.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

2017-12-09 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Dec 10 00:07:36 UTC 2017

Modified Files:
src/sys/net/npf: npf_alg_icmp.c npf_bpf.c npf_conn.c npf_conn.h
npf_ext_normalize.c

Log Message:
- npf_cop_table: handle non-IP packets in the ether (fixes PR/52290).
- npfa_icmp_nat: do not recompute the checksum if no port translation.
- npf_normalize (MSS clamping): fix the checksum handling on PFIL_OUT.
- npflog: report the packet direction correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/net/npf/npf_alg_icmp.c
cvs rdiff -u -r1.12 -r1.13 src/sys/net/npf/npf_bpf.c \
src/sys/net/npf/npf_conn.h
cvs rdiff -u -r1.23 -r1.24 src/sys/net/npf/npf_conn.c
cvs rdiff -u -r1.5 -r1.6 src/sys/net/npf/npf_ext_normalize.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_alg_icmp.c
diff -u src/sys/net/npf/npf_alg_icmp.c:1.24 src/sys/net/npf/npf_alg_icmp.c:1.25
--- src/sys/net/npf/npf_alg_icmp.c:1.24	Mon Dec 26 23:05:06 2016
+++ src/sys/net/npf/npf_alg_icmp.c	Sun Dec 10 00:07:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_alg_icmp.c,v 1.24 2016/12/26 23:05:06 christos Exp $	*/
+/*	$NetBSD: npf_alg_icmp.c,v 1.25 2017/12/10 00:07:36 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.24 2016/12/26 23:05:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.25 2017/12/10 00:07:36 rmind Exp $");
 
 #include 
 #include 
@@ -336,31 +336,25 @@ npfa_icmp_nat(npf_cache_t *npc, npf_nat_
 	/*
 	 * Fetch the IP and port in the _embedded_ packet.  Also, fetch
 	 * the IPv4 and TCP/UDP checksums before they are rewritten.
-	 * Calculate the part of the ICMP checksum fixup.
 	 */
 	const int proto = enpc.npc_proto;
 	uint16_t ipcksum = 0, l4cksum = 0;
-	npf_addr_t *addr;
-	in_port_t port;
-
-	npf_nat_getorig(nt, , );
+	in_port_t old_port = 0;
 
 	if (npf_iscached(, NPC_IP4)) {
 		const struct ip *eip = enpc.npc_ip.v4;
 		ipcksum = eip->ip_sum;
 	}
-	cksum = npf_addr_cksum(cksum, enpc.npc_alen, enpc.npc_ips[which], addr);
-
 	switch (proto) {
 	case IPPROTO_TCP: {
 		const struct tcphdr *th = enpc.npc_l4.tcp;
-		cksum = npf_fixup16_cksum(cksum, th->th_sport, port);
+		old_port = th->th_sport;
 		l4cksum = th->th_sum;
 		break;
 	}
 	case IPPROTO_UDP: {
 		const struct udphdr *uh = enpc.npc_l4.udp;
-		cksum = npf_fixup16_cksum(cksum, uh->uh_sport, port);
+		old_port = uh->uh_sport;
 		l4cksum = uh->uh_sum;
 		break;
 	}
@@ -372,6 +366,20 @@ npfa_icmp_nat(npf_cache_t *npc, npf_nat_
 	}
 
 	/*
+	 * Get the original IP address and port.
+	 * Calculate the part of the ICMP checksum fixup.
+	 */
+	npf_addr_t *addr;
+	in_port_t port;
+
+	npf_nat_getorig(nt, , );
+
+	cksum = npf_addr_cksum(cksum, enpc.npc_alen, enpc.npc_ips[which], addr);
+	if (port) {
+		cksum = npf_fixup16_cksum(cksum, old_port, port);
+	}
+
+	/*
 	 * Translate the embedded packet.  The following changes will
 	 * be performed by npf_napt_rwr():
 	 *

Index: src/sys/net/npf/npf_bpf.c
diff -u src/sys/net/npf/npf_bpf.c:1.12 src/sys/net/npf/npf_bpf.c:1.13
--- src/sys/net/npf/npf_bpf.c:1.12	Mon Dec 26 23:05:06 2016
+++ src/sys/net/npf/npf_bpf.c	Sun Dec 10 00:07:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_bpf.c,v 1.12 2016/12/26 23:05:06 christos Exp $	*/
+/*	$NetBSD: npf_bpf.c,v 1.13 2017/12/10 00:07:36 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_bpf.c,v 1.12 2016/12/26 23:05:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_bpf.c,v 1.13 2017/12/10 00:07:36 rmind Exp $");
 
 #include 
 #include 
@@ -181,9 +181,11 @@ npf_cop_table(const bpf_ctx_t *bc, bpf_a
 	const npf_addr_t *addr;
 	npf_table_t *t;
 
-	KASSERT(npf_iscached(npc, NPC_IP46));
-
-	if ((t = npf_tableset_getbyid(tblset, tid)) == NULL) {
+	if (!npf_iscached(npc, NPC_IP46)) {
+		return 0;
+	}
+	t = npf_tableset_getbyid(tblset, tid);
+	if (__predict_false(!t)) {
 		return 0;
 	}
 	addr = npc->npc_ips[(A & SRC_FLAG_BIT) ? NPF_SRC : NPF_DST];
Index: src/sys/net/npf/npf_conn.h
diff -u src/sys/net/npf/npf_conn.h:1.12 src/sys/net/npf/npf_conn.h:1.13
--- src/sys/net/npf/npf_conn.h:1.12	Sun Jan 29 00:15:54 2017
+++ src/sys/net/npf/npf_conn.h	Sun Dec 10 00:07:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_conn.h,v 1.12 2017/01/29 00:15:54 christos Exp $	*/
+/*	$NetBSD: npf_conn.h,v 1.13 2017/12/10 00:07:36 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -88,7 +88,12 @@ struct npf_conn {
 	npf_state_t		c_state;
 	u_int			c_refcnt;
 	uint64_t		c_atime;
-	npf_match_info_t	c_mi;
+
+	/*
+	 * Save the matching rule ID and flags.
+	 */
+	uint64_t		c_rid;
+	u_int			c_retfl;
 };
 
 #endif

Index: src/sys/net/npf/npf_conn.c
diff -u src/sys/net/npf/npf_conn.c:1.23 src/sys/net/npf/npf_conn.c:1.24
--- 

CVS commit: src/sys/net/npf

2017-12-09 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Dec 10 00:07:36 UTC 2017

Modified Files:
src/sys/net/npf: npf_alg_icmp.c npf_bpf.c npf_conn.c npf_conn.h
npf_ext_normalize.c

Log Message:
- npf_cop_table: handle non-IP packets in the ether (fixes PR/52290).
- npfa_icmp_nat: do not recompute the checksum if no port translation.
- npf_normalize (MSS clamping): fix the checksum handling on PFIL_OUT.
- npflog: report the packet direction correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/net/npf/npf_alg_icmp.c
cvs rdiff -u -r1.12 -r1.13 src/sys/net/npf/npf_bpf.c \
src/sys/net/npf/npf_conn.h
cvs rdiff -u -r1.23 -r1.24 src/sys/net/npf/npf_conn.c
cvs rdiff -u -r1.5 -r1.6 src/sys/net/npf/npf_ext_normalize.c

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



CVS commit: src/usr.bin/calendar/calendars

2017-12-09 Thread Leonardo Taccari
Module Name:src
Committed By:   leot
Date:   Sat Dec  9 23:16:27 UTC 2017

Modified Files:
src/usr.bin/calendar/calendars: calendar.birthday

Log Message:
Fix a typo.

(or, `Emily Dickinson' - the American poet - was born on the same date)


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/calendar/calendars/calendar.birthday

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



CVS commit: src/usr.bin/calendar/calendars

2017-12-09 Thread Leonardo Taccari
Module Name:src
Committed By:   leot
Date:   Sat Dec  9 23:16:27 UTC 2017

Modified Files:
src/usr.bin/calendar/calendars: calendar.birthday

Log Message:
Fix a typo.

(or, `Emily Dickinson' - the American poet - was born on the same date)


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/calendar/calendars/calendar.birthday

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/calendar/calendars/calendar.birthday
diff -u src/usr.bin/calendar/calendars/calendar.birthday:1.26 src/usr.bin/calendar/calendars/calendar.birthday:1.27
--- src/usr.bin/calendar/calendars/calendar.birthday:1.26	Mon Feb 15 20:58:02 2016
+++ src/usr.bin/calendar/calendars/calendar.birthday	Sat Dec  9 23:16:27 2017
@@ -253,7 +253,7 @@
 12/05	Walt (Walter Elias) Disney born in Chicago, 1901
 12/08	Horace (Quintus Horatius Flaccus) born in Venosa (Italy), 65 BC
 12/08	James (Grover) Thurber born in Columbus, Ohio, 1894
-12/10	Emily Dickenson born, 1830
+12/10	Emily Dickinson born, 1830
 12/12	E.G. Robinson born, 1893
 12/14	George Washington dies, 1799
 12/17	William Safire (Safir) born, 1929



CVS commit: src/lib/libc/locale

2017-12-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec  9 22:48:00 UTC 2017

Modified Files:
src/lib/libc/locale: wcstod.c wcstof.c wcstold.c

Log Message:
PR/52801: Kamil Rytarowski: Add missing weak aliases for wcsto{f,d,ld}_l
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/locale/wcstod.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/locale/wcstof.c \
src/lib/libc/locale/wcstold.c

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



CVS commit: src/lib/libc/locale

2017-12-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Dec  9 22:48:00 UTC 2017

Modified Files:
src/lib/libc/locale: wcstod.c wcstof.c wcstold.c

Log Message:
PR/52801: Kamil Rytarowski: Add missing weak aliases for wcsto{f,d,ld}_l
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/locale/wcstod.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/locale/wcstof.c \
src/lib/libc/locale/wcstold.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/locale/wcstod.c
diff -u src/lib/libc/locale/wcstod.c:1.15 src/lib/libc/locale/wcstod.c:1.16
--- src/lib/libc/locale/wcstod.c:1.15	Thu Apr 18 18:23:17 2013
+++ src/lib/libc/locale/wcstod.c	Sat Dec  9 17:48:00 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wcstod.c,v 1.15 2013/04/18 22:23:17 joerg Exp $ */
+/* $NetBSD: wcstod.c,v 1.16 2017/12/09 22:48:00 christos Exp $ */
 
 /*-
  * Copyright (c)2006 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcstod.c,v 1.15 2013/04/18 22:23:17 joerg Exp $");
+__RCSID("$NetBSD: wcstod.c,v 1.16 2017/12/09 22:48:00 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -42,6 +42,7 @@ __RCSID("$NetBSD: wcstod.c,v 1.15 2013/0
 #include 
 
 __weak_alias(wcstod,_wcstod)
+__weak_alias(wcstod_l,_wcstod_l)
 
 #define _FUNCNAME	wcstod
 #define _RETURN_TYPE	double

Index: src/lib/libc/locale/wcstof.c
diff -u src/lib/libc/locale/wcstof.c:1.4 src/lib/libc/locale/wcstof.c:1.5
--- src/lib/libc/locale/wcstof.c:1.4	Thu Apr 18 18:23:18 2013
+++ src/lib/libc/locale/wcstof.c	Sat Dec  9 17:48:00 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wcstof.c,v 1.4 2013/04/18 22:23:18 joerg Exp $ */
+/* $NetBSD: wcstof.c,v 1.5 2017/12/09 22:48:00 christos Exp $ */
 
 /*-
  * Copyright (c)2006 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcstof.c,v 1.4 2013/04/18 22:23:18 joerg Exp $");
+__RCSID("$NetBSD: wcstof.c,v 1.5 2017/12/09 22:48:00 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -42,6 +42,7 @@ __RCSID("$NetBSD: wcstof.c,v 1.4 2013/04
 #include 
 
 __weak_alias(wcstof,_wcstof)
+__weak_alias(wcstof_l,_wcstof_l)
 
 #define _FUNCNAME	wcstof
 #define _RETURN_TYPE	float
Index: src/lib/libc/locale/wcstold.c
diff -u src/lib/libc/locale/wcstold.c:1.4 src/lib/libc/locale/wcstold.c:1.5
--- src/lib/libc/locale/wcstold.c:1.4	Thu Apr 18 18:23:18 2013
+++ src/lib/libc/locale/wcstold.c	Sat Dec  9 17:48:00 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wcstold.c,v 1.4 2013/04/18 22:23:18 joerg Exp $ */
+/* $NetBSD: wcstold.c,v 1.5 2017/12/09 22:48:00 christos Exp $ */
 
 /*-
  * Copyright (c)2006 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcstold.c,v 1.4 2013/04/18 22:23:18 joerg Exp $");
+__RCSID("$NetBSD: wcstold.c,v 1.5 2017/12/09 22:48:00 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -42,6 +42,7 @@ __RCSID("$NetBSD: wcstold.c,v 1.4 2013/0
 #include 
 
 __weak_alias(wcstold,_wcstold)
+__weak_alias(wcstold_l,_wcstold_l)
 
 #define _FUNCNAME	wcstold
 #define _RETURN_TYPE	long double



CVS commit: src/sys/modules/nand

2017-12-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Dec  9 22:42:17 UTC 2017

Modified Files:
src/sys/modules/nand: Makefile

Log Message:
Include the flash_mtd_parts in the nand module.  Without this, the module
fails to load because of undefined linker symbol flash_attach_mtdparts

XXX pullup to netbsd-8


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/modules/nand/Makefile

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

Modified files:

Index: src/sys/modules/nand/Makefile
diff -u src/sys/modules/nand/Makefile:1.5 src/sys/modules/nand/Makefile:1.6
--- src/sys/modules/nand/Makefile:1.5	Wed Nov 15 00:48:42 2017
+++ src/sys/modules/nand/Makefile	Sat Dec  9 22:42:17 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2017/11/15 00:48:42 jmcneill Exp $
+# $NetBSD: Makefile,v 1.6 2017/12/09 22:42:17 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -14,4 +14,8 @@ SRCS+=	nand_micron.c
 SRCS+=	nand_samsung.c
 SRCS+=	nand_toshiba.c
 
+.PATH:	${S}/dev/flash
+
+SRCS+=	flash_mtdparts.c
+
 .include 



CVS commit: src/sys/modules/nand

2017-12-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Dec  9 22:42:17 UTC 2017

Modified Files:
src/sys/modules/nand: Makefile

Log Message:
Include the flash_mtd_parts in the nand module.  Without this, the module
fails to load because of undefined linker symbol flash_attach_mtdparts

XXX pullup to netbsd-8


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/modules/nand/Makefile

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



Re: CVS commit: src/tools/compat

2017-12-09 Thread Joerg Sonnenberger
On Sat, Dec 09, 2017 at 04:22:53AM +, Sevan Janiyan wrote:
> Module Name:  src
> Committed By: sevan
> Date: Sat Dec  9 04:22:53 UTC 2017
> 
> Modified Files:
>   src/tools/compat: configure.ac
> 
> Log Message:
> Add asnprintf() to the AC_CHECK_DECLS list.
> Resolves conflict when cross compiling on Cygwin the provided implementation
> does not get picked up.
> 
> Closes PR toolchain/52797

This change is wrong and makes the situation worse. The asnprintf on
Cygwin is broken by the agreed upon interface of asnprintf.

Joerg


CVS commit: src/share/man/man9

2017-12-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Dec  9 16:00:20 UTC 2017

Modified Files:
src/share/man/man9: mutex.9

Log Message:
Remove superfluous Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/share/man/man9/mutex.9

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/man9/mutex.9
diff -u src/share/man/man9/mutex.9:1.30 src/share/man/man9/mutex.9:1.31
--- src/share/man/man9/mutex.9:1.30	Fri Dec  8 15:52:01 2017
+++ src/share/man/man9/mutex.9	Sat Dec  9 16:00:19 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mutex.9,v 1.30 2017/12/08 15:52:01 riastradh Exp $
+.\"	$NetBSD: mutex.9,v 1.31 2017/12/09 16:00:19 wiz Exp $
 .\"
 .\" Copyright (c) 2007, 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -146,7 +146,6 @@ a spin mutex that is already held.
 See
 .Xr spl 9
 for further information on interrupt priority levels (IPLs).
-.Pp
 .It Fn mutex_destroy "mtx"
 .Pp
 Release resources used by a mutex.



CVS commit: src/share/man/man9

2017-12-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Dec  9 16:00:20 UTC 2017

Modified Files:
src/share/man/man9: mutex.9

Log Message:
Remove superfluous Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/share/man/man9/mutex.9

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



CVS commit: src/bin/ps

2017-12-09 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Dec  9 14:56:54 UTC 2017

Modified Files:
src/bin/ps: extern.h keyword.c print.c

Log Message:
ps: Rename local routine name from uname to usrname

This removes symbol name routine clash with libc's uname(3).
This allows to build ps(1) against LLVM Sanitizers.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/bin/ps/extern.h
cvs rdiff -u -r1.54 -r1.55 src/bin/ps/keyword.c
cvs rdiff -u -r1.127 -r1.128 src/bin/ps/print.c

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

Modified files:

Index: src/bin/ps/extern.h
diff -u src/bin/ps/extern.h:1.38 src/bin/ps/extern.h:1.39
--- src/bin/ps/extern.h:1.38	Fri Dec  2 21:59:03 2016
+++ src/bin/ps/extern.h	Sat Dec  9 14:56:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.38 2016/12/02 21:59:03 christos Exp $	*/
+/*	$NetBSD: extern.h,v 1.39 2017/12/09 14:56:54 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -93,7 +93,7 @@ void	 tdev(struct pinfo *, VARENT *, enu
 void	 tname(struct pinfo *, VARENT *, enum mode);
 void	 tsize(struct pinfo *, VARENT *, enum mode);
 void	 ucomm(struct pinfo *, VARENT *, enum mode);
-void	 uname(struct pinfo *, VARENT *, enum mode);
+void	 usrname(struct pinfo *, VARENT *, enum mode);
 void	 uvar(struct pinfo *, VARENT *, enum mode);
 void	 vsize(struct pinfo *, VARENT *, enum mode);
 void	 wchan(struct pinfo *, VARENT *, enum mode);

Index: src/bin/ps/keyword.c
diff -u src/bin/ps/keyword.c:1.54 src/bin/ps/keyword.c:1.55
--- src/bin/ps/keyword.c:1.54	Wed Jan 15 08:07:53 2014
+++ src/bin/ps/keyword.c	Sat Dec  9 14:56:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: keyword.c,v 1.54 2014/01/15 08:07:53 mlelstv Exp $	*/
+/*	$NetBSD: keyword.c,v 1.55 2017/12/09 14:56:54 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)keyword.c	8.5 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: keyword.c,v 1.54 2014/01/15 08:07:53 mlelstv Exp $");
+__RCSID("$NetBSD: keyword.c,v 1.55 2017/12/09 14:56:54 kamil Exp $");
 #endif
 #endif /* not lint */
 
@@ -126,7 +126,7 @@ VAR var[] = {
 	VAR4("emul", "EMUL", LJUST, emul),
 	VAR6("etime", "ELAPSED", 0, elapsed, POFF(p_ustart_sec), TIMEVAL),
 	UID("euid", "EUID", p_uid),
-	VAR4("euser", "EUSER", LJUST, uname),
+	VAR4("euser", "EUSER", LJUST, usrname),
 	PVAR("f", "F", 0, p_flag, INT, "x"),
 	VAR3("flags", "f", ALIAS),
 	GID("gid", "GID", p_gid),
@@ -213,7 +213,7 @@ VAR var[] = {
 	VAR4("ucomm", "UCOMM", LJUST, ucomm),
 	UID("uid", "UID", p_uid),
 	LVAR("upr", "UPR", 0, l_usrpri, UCHAR, "u"),
-	VAR4("user", "USER", LJUST, uname),
+	VAR4("user", "USER", LJUST, usrname),
 	VAR3("usrpri", "upr", ALIAS),
 	VAR6("utime", "UTIME", 0, putimeval, POFF(p_uutime_sec), TIMEVAL),
 	VAR3("vsize", "vsz", ALIAS),

Index: src/bin/ps/print.c
diff -u src/bin/ps/print.c:1.127 src/bin/ps/print.c:1.128
--- src/bin/ps/print.c:1.127	Mon Dec 12 20:35:36 2016
+++ src/bin/ps/print.c	Sat Dec  9 14:56:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: print.c,v 1.127 2016/12/12 20:35:36 christos Exp $	*/
+/*	$NetBSD: print.c,v 1.128 2017/12/09 14:56:54 kamil Exp $	*/
 
 /*
  * Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = "@(#)print.c	8.6 (Berkeley) 4/16/94";
 #else
-__RCSID("$NetBSD: print.c,v 1.127 2016/12/12 20:35:36 christos Exp $");
+__RCSID("$NetBSD: print.c,v 1.128 2017/12/09 14:56:54 kamil Exp $");
 #endif
 #endif /* not lint */
 
@@ -629,7 +629,7 @@ pri(struct pinfo *pi, VARENT *ve, enum m
 }
 
 void
-uname(struct pinfo *pi, VARENT *ve, enum mode mode)
+usrname(struct pinfo *pi, VARENT *ve, enum mode mode)
 {
 	struct kinfo_proc2 *k = pi->ki;
 	VAR *v;



CVS commit: src/bin/ps

2017-12-09 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Dec  9 14:56:54 UTC 2017

Modified Files:
src/bin/ps: extern.h keyword.c print.c

Log Message:
ps: Rename local routine name from uname to usrname

This removes symbol name routine clash with libc's uname(3).
This allows to build ps(1) against LLVM Sanitizers.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/bin/ps/extern.h
cvs rdiff -u -r1.54 -r1.55 src/bin/ps/keyword.c
cvs rdiff -u -r1.127 -r1.128 src/bin/ps/print.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

2017-12-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Dec  9 13:25:38 UTC 2017

Modified Files:
src/sys/dev/splash: files.splash
src/sys/dev/stbi: files.stbi

Log Message:
Only need to build stbi if options SPLASHSCREEN is defined


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/splash/files.splash
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/stbi/files.stbi

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



CVS commit: src/sys/dev

2017-12-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Dec  9 13:25:38 UTC 2017

Modified Files:
src/sys/dev/splash: files.splash
src/sys/dev/stbi: files.stbi

Log Message:
Only need to build stbi if options SPLASHSCREEN is defined


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/splash/files.splash
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/stbi/files.stbi

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/splash/files.splash
diff -u src/sys/dev/splash/files.splash:1.5 src/sys/dev/splash/files.splash:1.6
--- src/sys/dev/splash/files.splash:1.5	Mon Sep 14 01:40:03 2015
+++ src/sys/dev/splash/files.splash	Sat Dec  9 13:25:38 2017
@@ -1,8 +1,8 @@
-# $NetBSD: files.splash,v 1.5 2015/09/14 01:40:03 uebayasi Exp $
+# $NetBSD: files.splash,v 1.6 2017/12/09 13:25:38 jmcneill Exp $
 
 define splash: stbi
 file dev/splash/splash.c	splash & splashscreen
 file splash_image.o		splash & splashscreen
 
-defflag opt_splash.h	SPLASHSCREEN
-			makeoptions_SPLASHSCREEN_IMAGE
+defflag opt_splash.h	SPLASHSCREEN: STB_IMAGE
+defflag opt_splash.h	makeoptions_SPLASHSCREEN_IMAGE

Index: src/sys/dev/stbi/files.stbi
diff -u src/sys/dev/stbi/files.stbi:1.1 src/sys/dev/stbi/files.stbi:1.2
--- src/sys/dev/stbi/files.stbi:1.1	Sun Feb  6 23:13:04 2011
+++ src/sys/dev/stbi/files.stbi	Sat Dec  9 13:25:38 2017
@@ -1,4 +1,6 @@
-# $NetBSD: files.stbi,v 1.1 2011/02/06 23:13:04 jmcneill Exp $
+# $NetBSD: files.stbi,v 1.2 2017/12/09 13:25:38 jmcneill Exp $
+
+defflag	opt_stbi.h		STB_IMAGE
 
 define stbi
-file dev/stbi/stb_image.c	stbi
+file dev/stbi/stb_image.c	stbi & stb_image



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

2017-12-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Dec  9 11:52:38 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: mk.exynos mk.sunxi mk.tegra mk.ti mk.vexpress

Log Message:
Reduce the number of build artifacts and use a compressed version of the
kernel for legacy U-Boot images (netbsd.ub).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/mk.exynos
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/mk.sunxi
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/conf/mk.tegra
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/mk.ti
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/mk.vexpress

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



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

2017-12-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Dec  9 11:52:38 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: mk.exynos mk.sunxi mk.tegra mk.ti mk.vexpress

Log Message:
Reduce the number of build artifacts and use a compressed version of the
kernel for legacy U-Boot images (netbsd.ub).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/mk.exynos
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/mk.sunxi
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/conf/mk.tegra
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/mk.ti
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/mk.vexpress

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/evbarm/conf/mk.exynos
diff -u src/sys/arch/evbarm/conf/mk.exynos:1.2 src/sys/arch/evbarm/conf/mk.exynos:1.3
--- src/sys/arch/evbarm/conf/mk.exynos:1.2	Sat Dec 26 22:53:52 2015
+++ src/sys/arch/evbarm/conf/mk.exynos	Sat Dec  9 11:52:38 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mk.exynos,v 1.2 2015/12/26 22:53:52 jmcneill Exp $
+#	$NetBSD: mk.exynos,v 1.3 2017/12/09 11:52:38 jmcneill Exp $
 
 .if !empty(MACHINE_ARCH:M*eb)
 EXTRA_LINKFLAGS+=	--be8
@@ -18,7 +18,6 @@ KERNEL_BASE_VIRT?=$(LOADADDRESS)
 MKUBOOTIMAGEARGS=	-A arm -T kernel -O linux
 MKUBOOTIMAGEARGS+=	-a $(KERNEL_BASE_PHYS) -e $(KERNEL_BASE_PHYS)
 MKUBOOTIMAGEARGS+=	-n "NetBSD/$(BOARDTYPE) ${_OSRELEASE}"
-MKUBOOTIMAGEARGS_NONE=	${MKUBOOTIMAGEARGS} -C none
 MKUBOOTIMAGEARGS_GZ=	${MKUBOOTIMAGEARGS} -C gz
 
 SYSTEM_LD_TAIL_EXTRA+=; \
@@ -26,13 +25,10 @@ SYSTEM_LD_TAIL_EXTRA+=; \
 	${OBJCOPY} -S -O binary $@ $@.bin; \
 	echo ${TOOL_GZIP} -9c $@.bin > $@.bin.gz; \
 	${TOOL_GZIP} -9c $@.bin > $@.bin.gz; \
-	echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.gz.ub; \
-	${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.gz.ub; \
-	echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_NONE} $@.bin $@.ub; \
-	${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_NONE} $@.bin $@.ub; \
+	echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.ub; \
+	${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.ub; \
 	echo
 
 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin@}
-EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.ub@}
 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin.gz@}
-EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gz.ub@}
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.ub@}

Index: src/sys/arch/evbarm/conf/mk.sunxi
diff -u src/sys/arch/evbarm/conf/mk.sunxi:1.3 src/sys/arch/evbarm/conf/mk.sunxi:1.4
--- src/sys/arch/evbarm/conf/mk.sunxi:1.3	Mon Oct 23 19:36:01 2017
+++ src/sys/arch/evbarm/conf/mk.sunxi	Sat Dec  9 11:52:38 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mk.sunxi,v 1.3 2017/10/23 19:36:01 jakllsch Exp $
+#	$NetBSD: mk.sunxi,v 1.4 2017/12/09 11:52:38 jmcneill Exp $
 
 .if !empty(MACHINE_ARCH:M*eb)
 EXTRA_LINKFLAGS+=	--be8
@@ -14,20 +14,16 @@ _OSRELEASE!=		${HOST_SH} $S/conf/osrelea
 MKUBOOTIMAGEARGS=	-A arm -T kernel -O linux
 MKUBOOTIMAGEARGS+=	-a $(KERNEL_BASE_PHYS) -e $(KERNEL_BASE_PHYS)
 MKUBOOTIMAGEARGS+=	-n "NetBSD/$(BOARDTYPE) ${_OSRELEASE}"
-MKUBOOTIMAGEARGS_NONE=	${MKUBOOTIMAGEARGS} -C none
 MKUBOOTIMAGEARGS_GZ=	${MKUBOOTIMAGEARGS} -C gz
 
 SYSTEM_LD_TAIL_EXTRA+=; \
 	echo ${OBJCOPY} -S -O binary $@ $@.bin; \
 	${OBJCOPY} -S -O binary $@ $@.bin; \
-	echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_NONE} $@.bin $@.ub; \
-	${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_NONE} $@.bin $@.ub; \
 	echo ${TOOL_GZIP} -c $@.bin > $@.bin.gz; \
 	${TOOL_GZIP} -c $@.bin > $@.bin.gz; \
-	echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.gz.ub; \
-	${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.gz.ub
+	echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.ub; \
+	${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.ub
 
 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin@}
-EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.ub@}
 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin.gz@}
-EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gz.ub@}
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.ub@}

Index: src/sys/arch/evbarm/conf/mk.tegra
diff -u src/sys/arch/evbarm/conf/mk.tegra:1.6 src/sys/arch/evbarm/conf/mk.tegra:1.7
--- src/sys/arch/evbarm/conf/mk.tegra:1.6	Fri Jun 16 21:37:11 2017
+++ src/sys/arch/evbarm/conf/mk.tegra	Sat Dec  9 11:52:38 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mk.tegra,v 1.6 2017/06/16 21:37:11 jmcneill Exp $
+#	$NetBSD: mk.tegra,v 1.7 2017/12/09 11:52:38 jmcneill Exp $
 CPPFLAGS+=		-mcpu=cortex-a15 -mfpu=neon
 
 .include "$S/arch/arm/nvidia/tegra_xusb-fw.mk"
@@ -13,20 +13,16 @@ _OSRELEASE!=		${HOST_SH} $S/conf/osrelea
 MKUBOOTIMAGEARGS=	-A arm -T kernel -O linux
 MKUBOOTIMAGEARGS+=	-a $(KERNEL_BASE_PHYS) -e $(KERNEL_BASE_PHYS)
 MKUBOOTIMAGEARGS+=	-n "NetBSD/$(BOARDTYPE) ${_OSRELEASE}"
-MKUBOOTIMAGEARGS_NONE=	${MKUBOOTIMAGEARGS} -C none
 MKUBOOTIMAGEARGS_GZ=	${MKUBOOTIMAGEARGS} -C gz
 
 SYSTEM_LD_TAIL_EXTRA+=; \
 	echo ${OBJCOPY} -S -O 

Re: CVS commit: src/sys/arch

2017-12-09 Thread Maxime Villard

Le 04/12/2017 à 23:13, Maxime Villard a écrit :

Le 04/12/2017 à 20:17, Christos Zoulas a écrit :

In article ,
Maxime Villard   wrote:

Le 03/12/2017 à 16:55, David Holland a écrit :

On Sun, Dec 03, 2017 at 10:05:08AM +0100, Maxime Villard wrote:
> Good, and apparently no one has noticed that some options don't compile.

Are you saying Christos is lying about it working after reverting your
commits?


Why don't you read the previous emails from this thread, instead of coming
up with random, inaccurate statements like this one? I said very clearly that
COMPAT_20 for example does not compile. Same for COMPAT_16 and COMPAT_10,
actually.


By "does not compile" you probably mean "does not compile for me". Can you
please post your config file? Perhaps it is easy to fix.


Give me a few days and I'll handle that (along with reverting the things).


After investigating the matter, it looks like my VM's disk was corrupt. I
was getting the following error:

at_print.o: In function '_KERNEL_OPT__DIAGNOSTIC':
at_print.c:(*ABS*+0x6e074def): multiple definition of '_KERNEL_OPT_COMPAT_14'
at_print.c:(*ABS*+0x6e074def): multiple definition of '_KERNEL_OPT_COMPAT_13'
at_print.c:(*ABS*+0x6e074def): multiple definition of '_KERNEL_OPT_COMPAT_12'
at_print.c:(*ABS*+0x6e074def): multiple definition of '_KERNEL_OPT_COMPAT_11'
at_print.c:(*ABS*+0x6e074def): multiple definition of '_KERNEL_OPT_COMPAT_10'

With an up-to-date cvs tree, with no changes from me except
compat_netbsd10.config included in GENERIC instead of
compat_netbsd15.config.

After removing src/ and re-checking out everything, it builds normally.

Therefore, I withdraw what I said, it was an inaccurate statement from me
too.

Maxime


CVS commit: src/sys/net

2017-12-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Dec  9 10:51:30 UTC 2017

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

Log Message:
style


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/sys/net/if_ethersubr.c

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

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.249 src/sys/net/if_ethersubr.c:1.250
--- src/sys/net/if_ethersubr.c:1.249	Sat Dec  9 10:19:42 2017
+++ src/sys/net/if_ethersubr.c	Sat Dec  9 10:51:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.249 2017/12/09 10:19:42 maxv Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.250 2017/12/09 10:51:30 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.249 2017/12/09 10:19:42 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.250 2017/12/09 10:51:30 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -192,7 +192,7 @@ ether_output(struct ifnet * const ifp0, 
 {
 	uint16_t etype = 0;
 	int error = 0, hdrcmplt = 0;
- 	uint8_t esrc[6], edst[6];
+	uint8_t esrc[6], edst[6];
 	struct mbuf *m = m0;
 	struct mbuf *mcopy = NULL;
 	struct ether_header *eh;
@@ -301,7 +301,7 @@ ether_output(struct ifnet * const ifp0, 
 		break;
 #endif
 #ifdef NETATALK
-case AF_APPLETALK: {
+	case AF_APPLETALK: {
 		struct ifaddr *ifa;
 		int s;
 
@@ -347,7 +347,7 @@ ether_output(struct ifnet * const ifp0, 
 		pserialize_read_exit(s);
 		KERNEL_UNLOCK_ONE(NULL);
 		break;
-	}
+	}
 #endif /* NETATALK */
 	case pseudo_AF_HDRCMPLT:
 		hdrcmplt = 1;
@@ -357,7 +357,7 @@ ether_output(struct ifnet * const ifp0, 
 		/* FALLTHROUGH */
 
 	case AF_UNSPEC:
- 		memcpy(edst,
+		memcpy(edst,
 		((const struct ether_header *)dst->sa_data)->ether_dhost,
 		sizeof(edst));
 		/* AF_UNSPEC doesn't swap the byte order of the ether_type. */
@@ -401,7 +401,7 @@ ether_output(struct ifnet * const ifp0, 
 	eh = mtod(m, struct ether_header *);
 	/* Note: etype is already in network byte order. */
 	(void)memcpy(>ether_type, , sizeof(eh->ether_type));
- 	memcpy(eh->ether_dhost, edst, sizeof(edst));
+	memcpy(eh->ether_dhost, edst, sizeof(edst));
 	if (hdrcmplt)
 		memcpy(eh->ether_shost, esrc, sizeof(eh->ether_shost));
 	else
@@ -538,7 +538,7 @@ altq_etherclassify(struct ifaltq *ifq, s
 
 	return;
 
- bad:
+bad:
 	m->m_pkthdr.pattr_class = NULL;
 	m->m_pkthdr.pattr_hdr = NULL;
 	m->m_pkthdr.pattr_af = AF_UNSPEC;
@@ -579,7 +579,7 @@ ether_input(struct ifnet *ifp, struct mb
 	etype = ntohs(eh->ether_type);
 	ehlen = sizeof(*eh);
 
-	if(__predict_false(earlypkts < 100 || !rnd_initial_entropy)) {
+	if (__predict_false(earlypkts < 100 || !rnd_initial_entropy)) {
 		rnd_add_data(NULL, eh, ehlen, 0);
 		earlypkts++;
 	}
@@ -640,6 +640,7 @@ ether_input(struct ifnet *ifp, struct mb
 			return;
 	}
 #endif /* NCARP > 0 */
+
 	if ((m->m_flags & (M_BCAST | M_MCAST | M_PROMISC)) == 0 &&
 	(ifp->if_flags & IFF_PROMISC) != 0 &&
 	memcmp(CLLADDR(ifp->if_sadl), eh->ether_dhost,
@@ -695,7 +696,7 @@ ether_input(struct ifnet *ifp, struct mb
 		/*
 		 * If there is a tag of 0, then the VLAN header was probably
 		 * just being used to store the priority.  Extract the ether
-		 * type, and if IP or IPV6, let them deal with it. 
+		 * type, and if IP or IPV6, let them deal with it.
 		 */
 		if (m->m_len <= sizeof(*evl)
 		&& EVL_VLANOFTAG(evl->evl_tag) == 0) {
@@ -804,7 +805,7 @@ ether_input(struct ifnet *ifp, struct mb
 m_freem(m);
 return;
 			}
-#ifdef GATEWAY  
+#ifdef GATEWAY
 			if (ip6flow_fastforward())
 return;
 #endif
@@ -878,10 +879,10 @@ ether_input(struct ifnet *ifp, struct mb
 			m_freem(m);
 			return;
 		}
-#else /* ISO || LLC || NETATALK*/
+#else /* LLC || NETATALK */
 		m_freem(m);
 		return;
-#endif /* ISO || LLC || NETATALK*/
+#endif /* LLC || NETATALK */
 	}
 
 	if (__predict_true(pktq)) {
@@ -1113,7 +1114,7 @@ const uint8_t ether_ip6multicast_max[ETH
 int
 ether_aton_r(u_char *dest, size_t len, const char *str)
 {
-const u_char *cp = (const void *)str;
+	const u_char *cp = (const void *)str;
 	u_char *ep;
 
 #define atox(c)	(((c) <= '9') ? ((c) - '0') : ((toupper(c) - 'A') + 10))
@@ -1122,18 +1123,19 @@ ether_aton_r(u_char *dest, size_t len, c
 		return ENOSPC;
 
 	ep = dest + ETHER_ADDR_LEN;
-	 
+
 	while (*cp) {
-if (!isxdigit(*cp))
-return EINVAL;
+		if (!isxdigit(*cp))
+			return EINVAL;
 		*dest = atox(*cp);
 		cp++;
-if (isxdigit(*cp)) {
-*dest = (*dest << 4) | atox(*cp);
+		if (isxdigit(*cp)) {
+			*dest = (*dest << 4) | atox(*cp);
 			dest++;
 			cp++;
-} else
+		} else {
 			dest++;
+		}
 		if (dest == ep)
 			return *cp == '\0' ? 0 : ENAMETOOLONG;
 		switch (*cp) {
@@ -1143,7 +1145,7 @@ ether_aton_r(u_char *dest, size_t len, c
 			cp++;
 			

CVS commit: src/sys/net

2017-12-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Dec  9 10:51:30 UTC 2017

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

Log Message:
style


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/sys/net/if_ethersubr.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

2017-12-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Dec  9 10:30:30 UTC 2017

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

Log Message:
Kick MPLS packets earlier.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/net/if_mpls.c

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

Modified files:

Index: src/sys/net/if_mpls.c
diff -u src/sys/net/if_mpls.c:1.31 src/sys/net/if_mpls.c:1.32
--- src/sys/net/if_mpls.c:1.31	Fri Dec  8 17:49:54 2017
+++ src/sys/net/if_mpls.c	Sat Dec  9 10:30:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mpls.c,v 1.31 2017/12/08 17:49:54 maxv Exp $ */
+/*	$NetBSD: if_mpls.c,v 1.32 2017/12/09 10:30:30 maxv Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.31 2017/12/08 17:49:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.32 2017/12/09 10:30:30 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -360,6 +360,12 @@ mpls_lse(struct mbuf *m)
 	uint psize = sizeof(struct sockaddr_mpls);
 	bool push_back_alert = false;
 
+	/* If we're not accepting MPLS frames, leave now. */
+	if (!mpls_frame_accept) {
+		error = EINVAL;
+		goto done;
+	}
+
 	if (m->m_len < sizeof(union mpls_shim) &&
 	(m = m_pullup(m, sizeof(union mpls_shim))) == NULL)
 		goto done;
@@ -368,10 +374,7 @@ mpls_lse(struct mbuf *m)
 	dst.smpls_family = AF_MPLS;
 	dst.smpls_addr.s_addr = ntohl(mtod(m, union mpls_shim *)->s_addr);
 
-	/* Check if we're accepting MPLS Frames */
 	error = EINVAL;
-	if (!mpls_frame_accept)
-		goto done;
 
 	/* TTL decrement */
 	if ((m = mpls_ttl_dec(m)) == NULL)



CVS commit: src/sys/net

2017-12-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Dec  9 10:30:30 UTC 2017

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

Log Message:
Kick MPLS packets earlier.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/net/if_mpls.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

2017-12-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Dec  9 10:19:42 UTC 2017

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

Log Message:
Make sure we have an llc structure in the packet, and don't read past the
end of the mbuf if we don't. I'm wondering whether we should not pull up
instead, but whatever.


To generate a diff of this commit:
cvs rdiff -u -r1.248 -r1.249 src/sys/net/if_ethersubr.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

2017-12-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Dec  9 10:19:42 UTC 2017

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

Log Message:
Make sure we have an llc structure in the packet, and don't read past the
end of the mbuf if we don't. I'm wondering whether we should not pull up
instead, but whatever.


To generate a diff of this commit:
cvs rdiff -u -r1.248 -r1.249 src/sys/net/if_ethersubr.c

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

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.248 src/sys/net/if_ethersubr.c:1.249
--- src/sys/net/if_ethersubr.c:1.248	Wed Dec  6 04:00:07 2017
+++ src/sys/net/if_ethersubr.c	Sat Dec  9 10:19:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.248 2017/12/06 04:00:07 ozaki-r Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.249 2017/12/09 10:19:42 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.248 2017/12/06 04:00:07 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.249 2017/12/09 10:19:42 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -833,6 +833,9 @@ ether_input(struct ifnet *ifp, struct mb
 		}
 	} else {
 #if defined (LLC) || defined (NETATALK)
+		if (m->m_len < ehlen + sizeof(struct llc)) {
+			goto dropanyway;
+		}
 		l = (struct llc *)(eh+1);
 		switch (l->llc_dsap) {
 #ifdef NETATALK
@@ -869,8 +872,8 @@ ether_input(struct ifnet *ifp, struct mb
 goto dropanyway;
 			}
 			break;
-		dropanyway:
 #endif
+		dropanyway:
 		default:
 			m_freem(m);
 			return;



CVS commit: src/sys/netatalk

2017-12-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Dec  9 10:14:04 UTC 2017

Modified Files:
src/sys/netatalk: aarp.c

Log Message:
Mmh, pull up the packet to ether_aarp, otherwise we're reading past the
end of the mbuf.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/netatalk/aarp.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/netatalk/aarp.c
diff -u src/sys/netatalk/aarp.c:1.39 src/sys/netatalk/aarp.c:1.40
--- src/sys/netatalk/aarp.c:1.39	Mon Aug  1 03:15:30 2016
+++ src/sys/netatalk/aarp.c	Sat Dec  9 10:14:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: aarp.c,v 1.39 2016/08/01 03:15:30 ozaki-r Exp $	*/
+/*	$NetBSD: aarp.c,v 1.40 2017/12/09 10:14:04 maxv Exp $	*/
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.39 2016/08/01 03:15:30 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.40 2017/12/09 10:14:04 maxv Exp $");
 
 #include "opt_mbuftrace.h"
 
@@ -351,6 +351,11 @@ at_aarpinput(struct ifnet *ifp, struct m
 	struct psref	psref;
 	struct ifaddr *ifa;
 
+	/* We should also check ar_hln and ar_pln. */
+	if ((m = m_pullup(m, sizeof(struct ether_aarp))) == NULL) {
+		return;
+	}
+
 	ea = mtod(m, struct ether_aarp *);
 
 	/* Check to see if from my hardware address */



CVS commit: src/sys/netatalk

2017-12-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Dec  9 10:14:04 UTC 2017

Modified Files:
src/sys/netatalk: aarp.c

Log Message:
Mmh, pull up the packet to ether_aarp, otherwise we're reading past the
end of the mbuf.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/netatalk/aarp.c

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



CVS commit: src

2017-12-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Dec  9 08:03:07 UTC 2017

Modified Files:
src/distrib/sets/lists/modules: mi
src/sys/modules: Makefile
src/sys/modules/if_gif: Makefile
src/sys/net: if_gif.c
src/sys/netinet: ip_ecn.c
Added Files:
src/sys/modules/ip_ecn: Makefile

Log Message:
Split ip_ecn code into its own module, so it can be shared between
gif(4), stf(4), and ipsec(4).  Without this, loading the if_gif
module can result in redefined global symbols if either ipsec(4) or
stf(4) but not gif(4) is built into the kernel.

Fixes PR kern/52795 (as reported by martin@ via irc).

XXX pullup to netbsd-8


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r1.195 -r1.196 src/sys/modules/Makefile
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/if_gif/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/ip_ecn/Makefile
cvs rdiff -u -r1.135 -r1.136 src/sys/net/if_gif.c
cvs rdiff -u -r1.16 -r1.17 src/sys/netinet/ip_ecn.c

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/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.111 src/distrib/sets/lists/modules/mi:1.112
--- src/distrib/sets/lists/modules/mi:1.111	Sun Jun 11 22:22:36 2017
+++ src/distrib/sets/lists/modules/mi	Sat Dec  9 08:03:06 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.111 2017/06/11 22:22:36 pgoyette Exp $
+# $NetBSD: mi,v 1.112 2017/12/09 08:03:06 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -182,6 +182,8 @@
 ./@MODULEDIR@/if_vlan/if_vlan.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/iicbase-kernel-modules	kmod
 ./@MODULEDIR@/iic/iic.kmod			base-kernel-modules	kmod
+./@MODULEDIR@/ip_ecnbase-kernel-modules	kmod
+./@MODULEDIR@/ip_ecn/ip_ecn.kmod 		base-kernel-modules	kmod
 ./@MODULEDIR@/iplbase-kernel-modules	kmod
 ./@MODULEDIR@/ipl/ipl.kmod 			base-kernel-modules	kmod
 ./@MODULEDIR@/iscsibase-kernel-modules	kmod,iscsi

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.195 src/sys/modules/Makefile:1.196
--- src/sys/modules/Makefile:1.195	Fri Aug 11 12:58:14 2017
+++ src/sys/modules/Makefile	Sat Dec  9 08:03:07 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.195 2017/08/11 12:58:14 maxv Exp $
+#	$NetBSD: Makefile,v 1.196 2017/12/09 08:03:07 pgoyette Exp $
 
 .include 
 
@@ -70,6 +70,7 @@ SUBDIR+=	if_strip
 SUBDIR+=	if_tun tun
 SUBDIR+=	if_vlan
 SUBDIR+=	iic
+SUBDIR+=	ip_ecn
 SUBDIR+=	ipl
 SUBDIR+=	kernfs
 SUBDIR+=	layerfs

Index: src/sys/modules/if_gif/Makefile
diff -u src/sys/modules/if_gif/Makefile:1.2 src/sys/modules/if_gif/Makefile:1.3
--- src/sys/modules/if_gif/Makefile:1.2	Thu Aug 18 11:41:58 2016
+++ src/sys/modules/if_gif/Makefile	Sat Dec  9 08:03:07 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2016/08/18 11:41:58 knakahara Exp $
+# $NetBSD: Makefile,v 1.3 2017/12/09 08:03:07 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -6,7 +6,7 @@
 
 KMOD=		if_gif
 IOCONF=		gif.ioconf
-SRCS=		if_gif.c in_gif.c in6_gif.c ip_ecn.c
+SRCS=		if_gif.c in_gif.c in6_gif.c
 
 CPPFLAGS+=	-DINET
 CPPFLAGS+=	-DINET6

Index: src/sys/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.135 src/sys/net/if_gif.c:1.136
--- src/sys/net/if_gif.c:1.135	Wed Dec  6 08:23:17 2017
+++ src/sys/net/if_gif.c	Sat Dec  9 08:03:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.135 2017/12/06 08:23:17 knakahara Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.136 2017/12/09 08:03:06 pgoyette Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.135 2017/12/06 08:23:17 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.136 2017/12/09 08:03:06 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1187,4 +1187,4 @@ gif_update_variant(struct gif_softc *sc,
  */
 #include "if_module.h"
 
-IF_MODULE(MODULE_CLASS_DRIVER, gif, "")
+IF_MODULE(MODULE_CLASS_DRIVER, gif, "ip_ecn")

Index: src/sys/netinet/ip_ecn.c
diff -u src/sys/netinet/ip_ecn.c:1.16 src/sys/netinet/ip_ecn.c:1.17
--- src/sys/netinet/ip_ecn.c:1.16	Mon Aug 24 22:21:26 2015
+++ src/sys/netinet/ip_ecn.c	Sat Dec  9 08:03:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_ecn.c,v 1.16 2015/08/24 22:21:26 pooka Exp $	*/
+/*	$NetBSD: ip_ecn.c,v 1.17 2017/12/09 08:03:07 pgoyette Exp $	*/
 /*	$KAME: ip_ecn.c,v 1.11 2001/05/03 16:09:29 itojun Exp $	*/
 
 /*
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_ecn.c,v 1.16 2015/08/24 22:21:26 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_ecn.c,v 1.17 2017/12/09 08:03:07 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: ip_ecn.c,v 1
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -130,3 +131,20 @@ ip6_ecn_egress(int mode, const u_int32_t
 	*inner |= htonl((u_int32_t)inner8 << 20);
 }
 #endif
+

CVS commit: src

2017-12-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Dec  9 08:03:07 UTC 2017

Modified Files:
src/distrib/sets/lists/modules: mi
src/sys/modules: Makefile
src/sys/modules/if_gif: Makefile
src/sys/net: if_gif.c
src/sys/netinet: ip_ecn.c
Added Files:
src/sys/modules/ip_ecn: Makefile

Log Message:
Split ip_ecn code into its own module, so it can be shared between
gif(4), stf(4), and ipsec(4).  Without this, loading the if_gif
module can result in redefined global symbols if either ipsec(4) or
stf(4) but not gif(4) is built into the kernel.

Fixes PR kern/52795 (as reported by martin@ via irc).

XXX pullup to netbsd-8


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r1.195 -r1.196 src/sys/modules/Makefile
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/if_gif/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/ip_ecn/Makefile
cvs rdiff -u -r1.135 -r1.136 src/sys/net/if_gif.c
cvs rdiff -u -r1.16 -r1.17 src/sys/netinet/ip_ecn.c

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