CVS commit: othersrc/external/bsd/threshold/dist/src/libthreshold

2014-06-24 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Jun 24 07:04:00 UTC 2014

Modified Files:
othersrc/external/bsd/threshold/dist/src/libthreshold: raid.c

Log Message:
only include the codecs.h header if the main program is being used to test -
in normal operations, this won't be needed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
othersrc/external/bsd/threshold/dist/src/libthreshold/raid.c

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

Modified files:

Index: othersrc/external/bsd/threshold/dist/src/libthreshold/raid.c
diff -u othersrc/external/bsd/threshold/dist/src/libthreshold/raid.c:1.2 othersrc/external/bsd/threshold/dist/src/libthreshold/raid.c:1.3
--- othersrc/external/bsd/threshold/dist/src/libthreshold/raid.c:1.2	Tue Dec  4 07:39:19 2012
+++ othersrc/external/bsd/threshold/dist/src/libthreshold/raid.c	Tue Jun 24 07:04:00 2014
@@ -26,7 +26,6 @@
 #include sys/stat.h
 #include sys/mman.h
 
-#include codecs.h
 #include inttypes.h
 #include stdio.h
 #include stdlib.h
@@ -424,6 +423,9 @@ raid_read_header(const char *mem, uint8_
 }
 
 #ifdef RAID5_MAIN
+
+#include codecs.h
+
 int
 main(int argc, char **argv)
 {



CVS commit: othersrc/external/bsd/threshold/threshold

2014-06-24 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Jun 24 07:04:27 UTC 2014

Modified Files:
othersrc/external/bsd/threshold/threshold: Makefile

Log Message:
use the library just built when running regression tests locally


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/threshold/threshold/Makefile

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

Modified files:

Index: othersrc/external/bsd/threshold/threshold/Makefile
diff -u othersrc/external/bsd/threshold/threshold/Makefile:1.2 othersrc/external/bsd/threshold/threshold/Makefile:1.3
--- othersrc/external/bsd/threshold/threshold/Makefile:1.2	Sun Sep 18 18:48:23 2011
+++ othersrc/external/bsd/threshold/threshold/Makefile	Tue Jun 24 07:04:27 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2011/09/18 18:48:23 agc Exp $
+# $NetBSD: Makefile,v 1.3 2014/06/24 07:04:27 agc Exp $
 
 .include bsd.own.mk
 
@@ -24,16 +24,16 @@ EXTDIST=${.CURDIR}/../dist
 
 t test tst: $(PROG)
 	cp /etc/group origfile
-	./${PROG} -t 3/10 origfile
+	env LD_LIBRARY_PATH=${LIBTHRESHOLDDIR} ./${PROG} -t 3/10 origfile
 	ls -al origfile.split*
-	./${PROG} -j -o origfile.recons origfile.split4 origfile.split2 origfile.split3  
+	env LD_LIBRARY_PATH=${LIBTHRESHOLDDIR} ./${PROG} -j -o origfile.recons origfile.split4 origfile.split2 origfile.split3  
 	diff origfile origfile.recons
-	./${PROG} -t 3/10  origfile
+	env LD_LIBRARY_PATH=${LIBTHRESHOLDDIR} ./${PROG} -t 3/10  origfile
 	ls -al threshold.split*
-	./${PROG} -j -o origfile.mem threshold.split1 threshold.split2 threshold.split3  
+	env LD_LIBRARY_PATH=${LIBTHRESHOLDDIR} ./${PROG} -j -o origfile.mem threshold.split1 threshold.split2 threshold.split3  
 	-diff origfile origfile.mem
 	rm threshold.*
-	./${PROG} -t 3/10 -i
+	env LD_LIBRARY_PATH=${LIBTHRESHOLDDIR} ./${PROG} -t 3/10 -i
 	ls -al threshold.split*
-	./${PROG} -j threshold.split4 threshold.split2 threshold.split3  
+	env LD_LIBRARY_PATH=${LIBTHRESHOLDDIR} ./${PROG} -j threshold.split4 threshold.split2 threshold.split3  
 	rm -f origfile.recons origfile.split* origfile origfile.mem threshold.*



CVS commit: src/libexec/httpd

2014-06-24 Thread Mateusz Kocielski
Module Name:src
Committed By:   shm
Date:   Tue Jun 24 07:23:59 UTC 2014

Modified Files:
src/libexec/httpd: cgi-bozo.c

Log Message:
PR/48810 use cgi handler for index files

OK mrg@ martin@


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/libexec/httpd/cgi-bozo.c

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

Modified files:

Index: src/libexec/httpd/cgi-bozo.c
diff -u src/libexec/httpd/cgi-bozo.c:1.24 src/libexec/httpd/cgi-bozo.c:1.25
--- src/libexec/httpd/cgi-bozo.c:1.24	Thu Jan  2 08:21:38 2014
+++ src/libexec/httpd/cgi-bozo.c	Tue Jun 24 07:23:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgi-bozo.c,v 1.24 2014/01/02 08:21:38 mrg Exp $	*/
+/*	$NetBSD: cgi-bozo.c,v 1.25 2014/06/24 07:23:59 shm Exp $	*/
 
 /*	$eterna: cgi-bozo.c,v 1.40 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -259,7 +259,11 @@ bozo_process_cgi(bozo_httpreq_t *request
 	if (!httpd-cgibin  !httpd-process_cgi)
 		return 0;
 
-	uri = request-hr_oldfile ? request-hr_oldfile : request-hr_file;
+	if (request-hr_oldfile  strcmp(request-hr_oldfile, /) != 0)
+		uri = request-hr_oldfile;
+	else
+		uri = request-hr_file;
+
 	if (uri[0] == '/')
 		file = bozostrdup(httpd, uri);
 	else



CVS commit: src/sys/kern

2014-06-24 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jun 24 07:28:23 UTC 2014

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

Log Message:
KMEM_REDZONE+KMEM_POISON is supposed to detect buffer overflows. But it only
poisons memory after kmem_roundup_size(), which means that if an overflow
occurs in the page padding, it won't be detected.

Fix this by making KMEM_REDZONE independent from KMEM_POISON and making it
put a 2-byte pattern at the end of each requested buffer, and check it when
freeing memory to ensure the caller hasn't written outside the requested area.

Not enabled on DIAGNOSTIC for the moment.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/kern/subr_kmem.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/subr_kmem.c
diff -u src/sys/kern/subr_kmem.c:1.53 src/sys/kern/subr_kmem.c:1.54
--- src/sys/kern/subr_kmem.c:1.53	Mon Jun 23 17:43:42 2014
+++ src/sys/kern/subr_kmem.c	Tue Jun 24 07:28:23 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kmem.c,v 1.53 2014/06/23 17:43:42 maxv Exp $	*/
+/*	$NetBSD: subr_kmem.c,v 1.54 2014/06/24 07:28:23 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -72,8 +72,8 @@
  * KMEM_REDZONE
  *	Try to detect overrun bugs.
  *
- *	Allocate some more bytes for each allocation.
- *	The extra bytes are checked by KMEM_POISON on kmem_free.
+ *	Add a 2-byte pattern (allocate some more bytes if needed) at the end
+ *	of each allocated buffer. Check this pattern on kmem_free.
  *
  * KMEM_SIZE
  *	Try to detect alloc/free size mismatch bugs.
@@ -103,7 +103,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.53 2014/06/23 17:43:42 maxv Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.54 2014/06/24 07:28:23 maxv Exp $);
 
 #include sys/param.h
 #include sys/callback.h
@@ -199,9 +199,13 @@ static void kmem_poison_check(void *, si
 #endif /* defined(KMEM_POISON) */
 
 #if defined(KMEM_REDZONE)
-#define	REDZONE_SIZE	1
+#define	REDZONE_SIZE	2
+static void kmem_redzone_fill(void *p, size_t sz);
+static void kmem_redzone_check(void *p, size_t sz);
 #else /* defined(KMEM_REDZONE) */
 #define	REDZONE_SIZE	0
+#define	kmem_redzone_fill(p, sz)		/* nothing */
+#define	kmem_redzone_check(p, sz)	/* nothing */
 #endif /* defined(KMEM_REDZONE) */
 
 #if defined(KMEM_SIZE)
@@ -248,7 +252,15 @@ kmem_intr_alloc(size_t requested_size, k
 	}
 #endif
 	size = kmem_roundup_size(requested_size);
-	allocsz = size + REDZONE_SIZE + SIZE_SIZE;
+	allocsz = size + SIZE_SIZE;
+
+#ifdef KMEM_REDZONE
+	if (size - requested_size  REDZONE_SIZE) {
+		/* If there isn't enough space in the page padding,
+		 * allocate two more bytes for the red zone. */
+		allocsz += REDZONE_SIZE;
+	}
+#endif
 
 	if ((index = ((allocsz -1)  KMEM_SHIFT))
 	 kmem_cache_maxidx) {
@@ -274,6 +286,7 @@ kmem_intr_alloc(size_t requested_size, k
 		kmem_poison_check(p, size);
 		FREECHECK_OUT(kmem_freecheck, p);
 		kmem_size_set(p, requested_size);
+		kmem_redzone_fill(p, requested_size + SIZE_SIZE);
 
 		return p + SIZE_SIZE;
 	}
@@ -316,8 +329,15 @@ kmem_intr_free(void *p, size_t requested
 		return;
 	}
 #endif
+
 	size = kmem_roundup_size(requested_size);
-	allocsz = size + REDZONE_SIZE + SIZE_SIZE;
+	allocsz = size + SIZE_SIZE;
+
+#ifdef KMEM_REDZONE
+	if (size - requested_size  REDZONE_SIZE) {
+		allocsz += REDZONE_SIZE;
+	}
+#endif
 
 	if ((index = ((allocsz -1)  KMEM_SHIFT))
 	 kmem_cache_maxidx) {
@@ -334,10 +354,9 @@ kmem_intr_free(void *p, size_t requested
 
 	p = (uint8_t *)p - SIZE_SIZE;
 	kmem_size_check(p, requested_size);
+	kmem_redzone_check(p, requested_size + SIZE_SIZE);
 	FREECHECK_IN(kmem_freecheck, p);
 	LOCKDEBUG_MEM_CHECK(p, size);
-	kmem_poison_check((uint8_t *)p + SIZE_SIZE + size,
-  	allocsz - (SIZE_SIZE + size));
 	kmem_poison_fill(p, allocsz);
 
 	pool_cache_put(pc, p);
@@ -465,20 +484,20 @@ kmem_roundup_size(size_t size)
 	return (size + (KMEM_ALIGN - 1))  ~(KMEM_ALIGN - 1);
 }
 
-/*  debug */
-
-#if defined(KMEM_POISON)
+/* -- DEBUG / DIAGNOSTIC -- */
 
+#if defined(KMEM_POISON) || defined(KMEM_REDZONE)
 #if defined(_LP64)
 #define PRIME 0x9e37fffcUL
 #else /* defined(_LP64) */
 #define PRIME 0x9e3779b1
 #endif /* defined(_LP64) */
+#endif /* defined(KMEM_POISON) || defined(KMEM_REDZONE) */
 
+#if defined(KMEM_POISON)
 static inline uint8_t
 kmem_poison_pattern(const void *p)
 {
-
 	return (uint8_t)(((uintptr_t)p) * PRIME
 	((sizeof(uintptr_t) - sizeof(uint8_t))) * CHAR_BIT);
 }
@@ -525,14 +544,12 @@ kmem_poison_check(void *p, size_t sz)
 		cp++;
 	}
 }
-
 #endif /* defined(KMEM_POISON) */
 
 #if defined(KMEM_SIZE)
 static void
 kmem_size_set(void *p, size_t sz)
 {
-
 	memcpy(p, sz, sizeof(sz));
 }
 
@@ -547,7 +564,50 @@ kmem_size_check(void *p, size_t sz)
 		(const uint8_t *)p + SIZE_SIZE, sz, psz);
 	}
 }
-#endif	/* defined(KMEM_SIZE) */
+#endif /* 

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

2014-06-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jun 24 09:17:54 UTC 2014

Modified Files:
src/external/bsd/cron/dist: entry.c

Log Message:
PR/48944: cron ignores '?' (question mark) time field

Fix the obvious merge botch.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/cron/dist/entry.c

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

Modified files:

Index: src/external/bsd/cron/dist/entry.c
diff -u src/external/bsd/cron/dist/entry.c:1.4 src/external/bsd/cron/dist/entry.c:1.5
--- src/external/bsd/cron/dist/entry.c:1.4	Thu Jul 15 20:03:28 2010
+++ src/external/bsd/cron/dist/entry.c	Tue Jun 24 09:17:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: entry.c,v 1.4 2010/07/15 20:03:28 christos Exp $	*/
+/*	$NetBSD: entry.c,v 1.5 2014/06/24 09:17:54 skrll Exp $	*/
 
 /*
  * Copyright 1988,1990,1993,1994 by Paul Vixie
@@ -26,7 +26,7 @@
 #if 0
 static char rcsid[] = Id: entry.c,v 1.17 2004/01/23 18:56:42 vixie Exp;
 #else
-__RCSID($NetBSD: entry.c,v 1.4 2010/07/15 20:03:28 christos Exp $);
+__RCSID($NetBSD: entry.c,v 1.5 2014/06/24 09:17:54 skrll Exp $);
 #endif
 #endif
 
@@ -479,7 +479,6 @@ get_range(bitstr_t *bits, int low, int h
 		if (ch == EOF)
 			return (EOF);
 	} else if (ch == '?') {
-	} else if (ch == '?') {
 		qmark = TRUE;
 		ch = get_char(file);
 		if (ch == EOF)



CVS commit: src/sys/kern

2014-06-24 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jun 24 10:08:45 UTC 2014

Modified Files:
src/sys/kern: sched_4bsd.c sched_m2.c

Log Message:
'miliseconds' - 'milliseconds'.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/kern/sched_4bsd.c
cvs rdiff -u -r1.31 -r1.32 src/sys/kern/sched_m2.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/sched_4bsd.c
diff -u src/sys/kern/sched_4bsd.c:1.29 src/sys/kern/sched_4bsd.c:1.30
--- src/sys/kern/sched_4bsd.c:1.29	Tue Feb 25 18:30:11 2014
+++ src/sys/kern/sched_4bsd.c	Tue Jun 24 10:08:45 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched_4bsd.c,v 1.29 2014/02/25 18:30:11 pooka Exp $	*/
+/*	$NetBSD: sched_4bsd.c,v 1.30 2014/06/24 10:08:45 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sched_4bsd.c,v 1.29 2014/02/25 18:30:11 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: sched_4bsd.c,v 1.30 2014/06/24 10:08:45 maxv Exp $);
 
 #include opt_ddb.h
 #include opt_lockdebug.h
@@ -527,7 +527,7 @@ SYSCTL_SETUP(sysctl_sched_4bsd_setup, s
 	sysctl_createv(NULL, 0, node, NULL,
 		CTLFLAG_PERMANENT,
 		CTLTYPE_INT, rtts,
-		SYSCTL_DESCR(Round-robin time quantum (in miliseconds)),
+		SYSCTL_DESCR(Round-robin time quantum (in milliseconds)),
 		sysctl_sched_rtts, 0, NULL, 0,
 		CTL_CREATE, CTL_EOL);
 }

Index: src/sys/kern/sched_m2.c
diff -u src/sys/kern/sched_m2.c:1.31 src/sys/kern/sched_m2.c:1.32
--- src/sys/kern/sched_m2.c:1.31	Tue Feb 25 18:30:11 2014
+++ src/sys/kern/sched_m2.c	Tue Jun 24 10:08:45 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched_m2.c,v 1.31 2014/02/25 18:30:11 pooka Exp $	*/
+/*	$NetBSD: sched_m2.c,v 1.32 2014/06/24 10:08:45 maxv Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008 Mindaugas Rasiukevicius rmind at NetBSD org
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sched_m2.c,v 1.31 2014/02/25 18:30:11 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: sched_m2.c,v 1.32 2014/06/24 10:08:45 maxv Exp $);
 
 #include sys/param.h
 
@@ -55,7 +55,7 @@ __KERNEL_RCSID(0, $NetBSD: sched_m2.c,v
 #include sys/types.h
 
 /*
- * Priority related defintions.
+ * Priority related definitions.
  */
 #define	PRI_TS_COUNT	(NPRI_USER)
 #define	PRI_RT_COUNT	(PRI_COUNT - PRI_TS_COUNT)
@@ -436,19 +436,19 @@ SYSCTL_SETUP(sysctl_sched_m2_setup, sys
 	sysctl_createv(NULL, 0, node, NULL,
 		CTLFLAG_PERMANENT,
 		CTLTYPE_INT, rtts,
-		SYSCTL_DESCR(Round-robin time quantum (in miliseconds)),
+		SYSCTL_DESCR(Round-robin time quantum (in milliseconds)),
 		sysctl_sched_rtts, 0, NULL, 0,
 		CTL_CREATE, CTL_EOL);
 	sysctl_createv(NULL, 0, node, NULL,
 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
 		CTLTYPE_INT, maxts,
-		SYSCTL_DESCR(Maximal time quantum (in miliseconds)),
+		SYSCTL_DESCR(Maximal time quantum (in milliseconds)),
 		sysctl_sched_maxts, 0, max_ts, 0,
 		CTL_CREATE, CTL_EOL);
 	sysctl_createv(NULL, 0, node, NULL,
 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
 		CTLTYPE_INT, mints,
-		SYSCTL_DESCR(Minimal time quantum (in miliseconds)),
+		SYSCTL_DESCR(Minimal time quantum (in milliseconds)),
 		sysctl_sched_mints, 0, min_ts, 0,
 		CTL_CREATE, CTL_EOL);
 }



CVS commit: src/sys/net/npf

2014-06-24 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Tue Jun 24 11:31:49 UTC 2014

Modified Files:
src/sys/net/npf: npf_bpf.c

Log Message:
Fix signatures of copfuncs.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/net/npf/npf_bpf.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_bpf.c
diff -u src/sys/net/npf/npf_bpf.c:1.6 src/sys/net/npf/npf_bpf.c:1.7
--- src/sys/net/npf/npf_bpf.c:1.6	Fri Dec  6 01:33:37 2013
+++ src/sys/net/npf/npf_bpf.c	Tue Jun 24 11:31:49 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_bpf.c,v 1.6 2013/12/06 01:33:37 rmind Exp $	*/
+/*	$NetBSD: npf_bpf.c,v 1.7 2014/06/24 11:31:49 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf_bpf.c,v 1.6 2013/12/06 01:33:37 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf_bpf.c,v 1.7 2014/06/24 11:31:49 alnsn Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -51,8 +51,8 @@ __KERNEL_RCSID(0, $NetBSD: npf_bpf.c,v 
 
 static bpf_ctx_t *npf_bpfctx __read_mostly;
 
-static uint32_t	npf_cop_l3(bpf_ctx_t *, bpf_args_t *, uint32_t);
-static uint32_t	npf_cop_table(bpf_ctx_t *, bpf_args_t *, uint32_t);
+static uint32_t	npf_cop_l3(const bpf_ctx_t *, bpf_args_t *, uint32_t);
+static uint32_t	npf_cop_table(const bpf_ctx_t *, bpf_args_t *, uint32_t);
 
 static const bpf_copfunc_t npf_bpfcop[] = {
 	[NPF_COP_L3]	= npf_cop_l3,
@@ -112,7 +112,7 @@ npf_bpf_validate(const void *code, size_
  *	BPF_MW_L4PROTO	L4 protocol.
  */
 static uint32_t
-npf_cop_l3(bpf_ctx_t *bc, bpf_args_t *args, uint32_t A)
+npf_cop_l3(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A)
 {
 	const npf_cache_t * const npc = (const npf_cache_t *)args-arg;
 	uint32_t * const M = args-mem;
@@ -144,7 +144,7 @@ npf_cop_l3(bpf_ctx_t *bc, bpf_args_t *ar
  *	A - non-zero (true) if found and zero (false) otherwise
  */
 static uint32_t
-npf_cop_table(bpf_ctx_t *bc, bpf_args_t *args, uint32_t A)
+npf_cop_table(const bpf_ctx_t *bc, bpf_args_t *args, uint32_t A)
 {
 	const npf_cache_t * const npc = (const npf_cache_t *)args-arg;
 	npf_tableset_t *tblset = npf_config_tableset();



CVS commit: src/tests/net/bpfilter

2014-06-24 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Tue Jun 24 11:32:36 UTC 2014

Modified Files:
src/tests/net/bpfilter: t_bpfilter.c

Log Message:
Zap trailing spaces.


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

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

Modified files:

Index: src/tests/net/bpfilter/t_bpfilter.c
diff -u src/tests/net/bpfilter/t_bpfilter.c:1.7 src/tests/net/bpfilter/t_bpfilter.c:1.8
--- src/tests/net/bpfilter/t_bpfilter.c:1.7	Wed Dec 18 22:39:16 2013
+++ src/tests/net/bpfilter/t_bpfilter.c	Tue Jun 24 11:32:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_bpfilter.c,v 1.7 2013/12/18 22:39:16 alnsn Exp $	*/
+/*	$NetBSD: t_bpfilter.c,v 1.8 2014/06/24 11:32:36 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_bpfilter.c,v 1.7 2013/12/18 22:39:16 alnsn Exp $);
+__RCSID($NetBSD: t_bpfilter.c,v 1.8 2014/06/24 11:32:36 alnsn Exp $);
 
 #include sys/param.h
 #include sys/ioctl.h
@@ -178,8 +178,8 @@ pingtest(const char *dst, unsigned int w
 
 	memcpy(pkt + pktsize - 7, tail, 7);
 	icmp-icmp_type = ICMP_ECHO;
-	icmp-icmp_id = htons(37); 
-	icmp-icmp_seq = htons(1); 
+	icmp-icmp_id = htons(37);
+	icmp-icmp_seq = htons(1);
 	icmp-icmp_cksum = in_cksum(pkt, pktsize);
 
 	slen = sizeof(sin);



CVS commit: src/sys

2014-06-24 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jun 24 11:59:11 UTC 2014

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/arch/i386/conf: ALL
src/sys/compat/freebsd: freebsd_exec_elf32.c

Log Message:
Remove dead code. The kernel already checks for PT_INTERP sections, and puts
their content into itp. There's no need for re-reading the whole binary and
trying to find this section again. Just use itp.

DEBUG_FREEBSD_ELF is now unused, so remove its references in amd64/conf/ALL
and i386/conf/ALL.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.376 -r1.377 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.17 -r1.18 src/sys/compat/freebsd/freebsd_exec_elf32.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/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.9 src/sys/arch/amd64/conf/ALL:1.10
--- src/sys/arch/amd64/conf/ALL:1.9	Tue Jun 10 01:42:39 2014
+++ src/sys/arch/amd64/conf/ALL	Tue Jun 24 11:59:10 2014
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.9 2014/06/10 01:42:39 hikaru Exp $
+# $NetBSD: ALL,v 1.10 2014/06/24 11:59:10 maxv Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	arch/amd64/conf/std.amd64
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		ALL-$Revision: 1.9 $
+#ident 		ALL-$Revision: 1.10 $
 
 maxusers	64		# estimated number of users
 
@@ -1829,7 +1829,6 @@ options DEBUG_FIND_COMPORT
 options DEBUG_FIND_PCIC
 options DEBUG_FIND_PCIC_I82365SL_ONLY
 options DEBUG_FPE
-options DEBUG_FREEBSD_ELF
 options DEBUG_GPIO
 options DEBUG_GPIO2
 options DEBUG_HPUX

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.376 src/sys/arch/i386/conf/ALL:1.377
--- src/sys/arch/i386/conf/ALL:1.376	Tue Jun 10 01:42:39 2014
+++ src/sys/arch/i386/conf/ALL	Tue Jun 24 11:59:10 2014
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.376 2014/06/10 01:42:39 hikaru Exp $
+# $NetBSD: ALL,v 1.377 2014/06/24 11:59:10 maxv Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	arch/i386/conf/std.i386
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		ALL-$Revision: 1.376 $
+#ident 		ALL-$Revision: 1.377 $
 
 maxusers	64		# estimated number of users
 
@@ -2030,7 +2030,6 @@ options DEBUG_FIND_COMPORT
 options DEBUG_FIND_PCIC
 options DEBUG_FIND_PCIC_I82365SL_ONLY
 options DEBUG_FPE
-options DEBUG_FREEBSD_ELF
 options DEBUG_GPIO
 options DEBUG_GPIO2
 options DEBUG_HPUX

Index: src/sys/compat/freebsd/freebsd_exec_elf32.c
diff -u src/sys/compat/freebsd/freebsd_exec_elf32.c:1.17 src/sys/compat/freebsd/freebsd_exec_elf32.c:1.18
--- src/sys/compat/freebsd/freebsd_exec_elf32.c:1.17	Sun Apr 22 08:29:56 2007
+++ src/sys/compat/freebsd/freebsd_exec_elf32.c	Tue Jun 24 11:59:10 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: freebsd_exec_elf32.c,v 1.17 2007/04/22 08:29:56 dsl Exp $	*/
+/*	$NetBSD: freebsd_exec_elf32.c,v 1.18 2014/06/24 11:59:10 maxv Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: freebsd_exec_elf32.c,v 1.17 2007/04/22 08:29:56 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: freebsd_exec_elf32.c,v 1.18 2014/06/24 11:59:10 maxv Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -54,25 +54,15 @@ __KERNEL_RCSID(0, $NetBSD: freebsd_exec
 
 
 int
-ELFNAME2(freebsd,probe)(
-	struct lwp *l,
-	struct exec_package *epp,
-	void *veh,
-	char *itp,
-	vaddr_t *pos)
+ELFNAME2(freebsd,probe)(struct lwp *l, struct exec_package *epp, void *veh,
+char *itp, vaddr_t *pos)
 {
 	int error;
-	size_t i;
-	size_t phsize;
 	Elf_Ehdr *eh = (Elf_Ehdr *) veh;
-	Elf_Phdr *ph;
-	Elf_Phdr *ephp;
-	Elf_Nhdr *np;
+	static const char wantBrand[] = FREEBSD_ELF_BRAND_STRING;
+	static const char wantInterp[] = FREEBSD_ELF_INTERP_PREFIX_STRING;
 
-static const char wantBrand[] = FREEBSD_ELF_BRAND_STRING;
-static const char wantInterp[] = FREEBSD_ELF_INTERP_PREFIX_STRING;
-
-/*
+	/*
 	 * Insist that the executable have a brand, and that it be FreeBSD.
 	 * Newer FreeBSD binaries have OSABI set to ELFOSABI_FREEBSD. This
 	 * is arguably broken, but they seem to think they need it, for
@@ -81,56 +71,17 @@ ELFNAME2(freebsd,probe)(
 #ifndef EI_BRAND
 #define EI_BRAND 8
 #endif
-if ((eh-e_ident[EI_BRAND] == '\0'
-		|| strcmp(eh-e_ident[EI_BRAND], wantBrand) != 0)
-	 eh-e_ident[EI_OSABI] != ELFOSABI_FREEBSD)
+	if ((eh-e_ident[EI_BRAND] == '\0' ||
+	 strcmp(eh-e_ident[EI_BRAND], wantBrand) != 0) 
+		eh-e_ident[EI_OSABI] != ELFOSABI_FREEBSD)
 		return ENOEXEC;
 
-	i = eh-e_phnum;
-	if (i != 0) {
-		phsize = i * sizeof(Elf_Phdr);
-		ph = (Elf_Phdr *) malloc(phsize, M_TEMP, M_WAITOK);
-		if ((error = exec_read_from(l, epp-ep_vp, eh-e_phoff, ph,
-	

CVS commit: src/sys/compat/freebsd

2014-06-24 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jun 24 12:17:40 UTC 2014

Modified Files:
src/sys/compat/freebsd: freebsd_exec_elf32.c

Log Message:
Remove unused headers.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/compat/freebsd/freebsd_exec_elf32.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/freebsd/freebsd_exec_elf32.c
diff -u src/sys/compat/freebsd/freebsd_exec_elf32.c:1.18 src/sys/compat/freebsd/freebsd_exec_elf32.c:1.19
--- src/sys/compat/freebsd/freebsd_exec_elf32.c:1.18	Tue Jun 24 11:59:10 2014
+++ src/sys/compat/freebsd/freebsd_exec_elf32.c	Tue Jun 24 12:17:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: freebsd_exec_elf32.c,v 1.18 2014/06/24 11:59:10 maxv Exp $	*/
+/*	$NetBSD: freebsd_exec_elf32.c,v 1.19 2014/06/24 12:17:40 maxv Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: freebsd_exec_elf32.c,v 1.18 2014/06/24 11:59:10 maxv Exp $);
+__KERNEL_RCSID(0, $NetBSD: freebsd_exec_elf32.c,v 1.19 2014/06/24 12:17:40 maxv Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -44,15 +44,11 @@ __KERNEL_RCSID(0, $NetBSD: freebsd_exec
 #endif /* !ELFSIZE */
 #include sys/exec_elf.h
 
-#include compat/sys/signal.h
-#include compat/sys/signalvar.h
-
 #include compat/freebsd/freebsd_exec.h
 #include compat/common/compat_util.h
 
 #include machine/freebsd_machdep.h
 
-
 int
 ELFNAME2(freebsd,probe)(struct lwp *l, struct exec_package *epp, void *veh,
 char *itp, vaddr_t *pos)



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

2014-06-24 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Jun 24 12:17:33 UTC 2014

Modified Files:
src/sys/arch/shark/conf: GENERIC

Log Message:
Bump SYMTAB_SPACE to allow clang to build this kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/shark/conf/GENERIC

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/shark/conf/GENERIC
diff -u src/sys/arch/shark/conf/GENERIC:1.113 src/sys/arch/shark/conf/GENERIC:1.114
--- src/sys/arch/shark/conf/GENERIC:1.113	Fri Dec 27 22:13:32 2013
+++ src/sys/arch/shark/conf/GENERIC	Tue Jun 24 12:17:33 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC,v 1.113 2013/12/27 22:13:32 matt Exp $
+#	$NetBSD: GENERIC,v 1.114 2014/06/24 12:17:33 joerg Exp $
 #
 # Generic Shark configuration.
 #
@@ -7,7 +7,7 @@ include	arch/shark/conf/std.shark
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		GENERIC-$Revision: 1.113 $
+#ident		GENERIC-$Revision: 1.114 $
 
 # estimated number of users
 maxusers	32
@@ -153,7 +153,7 @@ options 	MODULAR		# new style module(7) 
 options 	DIAGNOSTIC	# internal consistency checks
 #options 	PMAP_DEBUG	# Enable pmap_debug_level code
 options 	DDB		# in-kernel debugger
-options 	SYMTAB_SPACE=69 	# reserve symbol space for DDB
+options 	SYMTAB_SPACE=75 	# reserve symbol space for DDB
 # (needed because we boot netbsd.aout)
 #options 	DDB_ONPANIC=0	# don't run DDB at panictime
 #options 	DDB_HISTORY_SIZE=100	# Enable history editing in DDB



CVS commit: src/external/lgpl3/gmp/dist

2014-06-24 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Jun 24 12:54:56 UTC 2014

Modified Files:
src/external/lgpl3/gmp/dist: configure

Log Message:
Revert previous commit.  Requested by matt@.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/lgpl3/gmp/dist/configure

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

Modified files:

Index: src/external/lgpl3/gmp/dist/configure
diff -u src/external/lgpl3/gmp/dist/configure:1.4 src/external/lgpl3/gmp/dist/configure:1.5
--- src/external/lgpl3/gmp/dist/configure:1.4	Mon Jun 23 12:48:42 2014
+++ src/external/lgpl3/gmp/dist/configure	Tue Jun 24 12:54:56 2014
@@ -4142,7 +4142,7 @@ echo include_mpn(\`alpha/default.m4') 
 ;;
 
 
-  arm*-*-* | earm*-*-*)
+  arm*-*-*)
 gcc_cflags=$gcc_cflags $fomit_frame_pointer
 gcc_cflags_optlist=arch tune
 gcc_cflags_maybe=-marm



CVS commit: src/sys/compat/netbsd32

2014-06-24 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jun 24 14:33:57 UTC 2014

Modified Files:
src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_event.c

Log Message:
Allocate directly KQ_NEVENTS bytes. Otherwise a user can panic the system.

ok christos@


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/compat/netbsd32/netbsd32_compat_50.c
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/netbsd32/netbsd32_event.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/netbsd32/netbsd32_compat_50.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.23 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.24
--- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.23	Fri Mar 29 01:04:30 2013
+++ src/sys/compat/netbsd32/netbsd32_compat_50.c	Tue Jun 24 14:33:57 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_50.c,v 1.23 2013/03/29 01:04:30 christos Exp $	*/
+/*	$NetBSD: netbsd32_compat_50.c,v 1.24 2014/06/24 14:33:57 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_compat_50.c,v 1.23 2013/03/29 01:04:30 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_compat_50.c,v 1.24 2014/06/24 14:33:57 maxv Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_sysv.h
@@ -633,7 +633,8 @@ compat_50_netbsd32_kevent(struct lwp *l,
 
 	nchanges = SCARG(uap, nchanges);
 	nevents = SCARG(uap, nevents);
-	maxalloc = MIN(KQ_NEVENTS, MAX(nchanges, nevents));
+	maxalloc = KQ_NEVENTS;
+
 	netbsd32_kevent_ops.keo_private =
 	kmem_alloc(maxalloc * sizeof(struct netbsd32_kevent), KM_SLEEP);
 

Index: src/sys/compat/netbsd32/netbsd32_event.c
diff -u src/sys/compat/netbsd32/netbsd32_event.c:1.10 src/sys/compat/netbsd32/netbsd32_event.c:1.11
--- src/sys/compat/netbsd32/netbsd32_event.c:1.10	Thu Jan 23 10:50:14 2014
+++ src/sys/compat/netbsd32/netbsd32_event.c	Tue Jun 24 14:33:57 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_event.c,v 1.10 2014/01/23 10:50:14 manu Exp $	*/
+/*	$NetBSD: netbsd32_event.c,v 1.11 2014/06/24 14:33:57 maxv Exp $	*/
 
 /*
  *  Copyright (c) 2005 The NetBSD Foundation.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: netbsd32_event.c,v 1.10 2014/01/23 10:50:14 manu Exp $);
+__KERNEL_RCSID(0, $NetBSD: netbsd32_event.c,v 1.11 2014/06/24 14:33:57 maxv Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -112,7 +112,8 @@ netbsd32___kevent50(struct lwp *l,
 
 	nchanges = SCARG(uap, nchanges);
 	nevents = SCARG(uap, nevents);
-	maxalloc = MIN(KQ_NEVENTS, MAX(nchanges, nevents));
+	maxalloc = KQ_NEVENTS;
+
 	netbsd32_kevent_ops.keo_private =
 	kmem_alloc(maxalloc * sizeof(struct netbsd32_kevent), KM_SLEEP);
 



CVS commit: src/sys/kern

2014-06-24 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jun 24 14:42:43 UTC 2014

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

Log Message:
Do not hardcode the value. Use KQ_NEVENTS.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/kern/kern_event.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_event.c
diff -u src/sys/kern/kern_event.c:1.79 src/sys/kern/kern_event.c:1.80
--- src/sys/kern/kern_event.c:1.79	Sat Nov 24 15:14:32 2012
+++ src/sys/kern/kern_event.c	Tue Jun 24 14:42:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_event.c,v 1.79 2012/11/24 15:14:32 christos Exp $	*/
+/*	$NetBSD: kern_event.c,v 1.80 2014/06/24 14:42:43 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_event.c,v 1.79 2012/11/24 15:14:32 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_event.c,v 1.80 2014/06/24 14:42:43 maxv Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -827,7 +827,7 @@ kevent1(register_t *retval, int fd,
 	struct timespec	ts;
 	size_t i, n, ichange;
 	int nerrors, error;
-	struct kevent kevbuf[8];	/* approx 300 bytes on 64-bit */
+	struct kevent kevbuf[KQ_NEVENTS];	/* approx 300 bytes on 64-bit */
 	file_t *fp;
 
 	/* check that we're dealing with a kq */



CVS commit: src/common/lib/libc/string

2014-06-24 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Tue Jun 24 16:39:39 UTC 2014

Modified Files:
src/common/lib/libc/string: consttime_memequal.c explicit_memset.c

Log Message:
add a public domain notice


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/string/consttime_memequal.c
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/string/explicit_memset.c

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

Modified files:

Index: src/common/lib/libc/string/consttime_memequal.c
diff -u src/common/lib/libc/string/consttime_memequal.c:1.4 src/common/lib/libc/string/consttime_memequal.c:1.5
--- src/common/lib/libc/string/consttime_memequal.c:1.4	Wed Aug 28 19:31:14 2013
+++ src/common/lib/libc/string/consttime_memequal.c	Tue Jun 24 16:39:39 2014
@@ -1,4 +1,9 @@
-/* $NetBSD: consttime_memequal.c,v 1.4 2013/08/28 19:31:14 riastradh Exp $ */
+/* $NetBSD: consttime_memequal.c,v 1.5 2014/06/24 16:39:39 drochner Exp $ */
+
+/*
+ * Written by Matthias Drochner droch...@netbsd.org.
+ * Public domain.
+ */
 
 #if !defined(_KERNEL)  !defined(_STANDALONE)
 #include namespace.h

Index: src/common/lib/libc/string/explicit_memset.c
diff -u src/common/lib/libc/string/explicit_memset.c:1.3 src/common/lib/libc/string/explicit_memset.c:1.4
--- src/common/lib/libc/string/explicit_memset.c:1.3	Wed Aug 28 17:47:07 2013
+++ src/common/lib/libc/string/explicit_memset.c	Tue Jun 24 16:39:39 2014
@@ -1,4 +1,9 @@
-/* $NetBSD: explicit_memset.c,v 1.3 2013/08/28 17:47:07 riastradh Exp $ */
+/* $NetBSD: explicit_memset.c,v 1.4 2014/06/24 16:39:39 drochner Exp $ */
+
+/*
+ * Written by Matthias Drochner droch...@netbsd.org.
+ * Public domain.
+ */
 
 #if !defined(_KERNEL)  !defined(_STANDALONE)
 #include namespace.h



CVS commit: src/sys/net

2014-06-24 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Tue Jun 24 22:19:36 UTC 2014

Modified Files:
src/sys/net: bpf.h bpf_filter.c bpfjit.c

Log Message:
- Improve the comments in bpf.h and KNF a little.
- Rename bpf_ctx_t member noinit to preinited (reflects the meaning better).


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/net/bpf.h
cvs rdiff -u -r1.62 -r1.63 src/sys/net/bpf_filter.c
cvs rdiff -u -r1.13 -r1.14 src/sys/net/bpfjit.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/bpf.h
diff -u src/sys/net/bpf.h:1.64 src/sys/net/bpf.h:1.65
--- src/sys/net/bpf.h:1.64	Tue Jun 24 10:53:30 2014
+++ src/sys/net/bpf.h	Tue Jun 24 22:19:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.h,v 1.64 2014/06/24 10:53:30 alnsn Exp $	*/
+/*	$NetBSD: bpf.h,v 1.65 2014/06/24 22:19:36 rmind Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -280,19 +280,16 @@ struct bpf_insn {
 /*
  * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
  */
-#define	BPF_MEMWORDS	16
+#define	BPF_MEMWORDS		16
 
 /*
- * Each bit in bpf_memword_init_t value indicates if the corresponding
- * external memory word is initialised prior to calling a bpf program.
- * Note that when used internally, a meaning is often flipped: bits
- * indicate which memory words need to be initialised prior to
- * executing a bpf program.
+ * bpf_memword_init_t: bits indicate which words in the external memory
+ * store will be initialised by the caller before BPF program execution.
  */
 typedef uint32_t bpf_memword_init_t;
-#define BPF_MEMWORD_INIT(k) (UINT32_C(1)  (k))
+#define	BPF_MEMWORD_INIT(k)	(UINT32_C(1)  (k))
 
-/* Two most significant bits are reserved by bpfjit. */
+/* Note: two most significant bits are reserved by bpfjit. */
 __CTASSERT(BPF_MEMWORDS + 2 = sizeof(bpf_memword_init_t) * NBBY);
 
 #ifdef _KERNEL
@@ -300,13 +297,10 @@ __CTASSERT(BPF_MEMWORDS + 2 = sizeof(bp
  * Max number of external memory words (for BPF_LD|BPF_MEM and BPF_ST).
  */
 #define	BPF_MAX_MEMWORDS	30
-__CTASSERT(BPF_MAX_MEMWORDS = BPF_MEMWORDS);
 
-#ifdef __BPF_PRIVATE
-/* Two most significant bits are reserved by bpfjit. */
+__CTASSERT(BPF_MAX_MEMWORDS = BPF_MEMWORDS);
 __CTASSERT(BPF_MAX_MEMWORDS + 2 = sizeof(bpf_memword_init_t) * NBBY);
 #endif
-#endif
 
 /*
  * Structure to retrieve available DLTs for the interface.
@@ -319,10 +313,7 @@ struct bpf_dltlist {
 struct bpf_ctx;
 typedef struct bpf_ctx bpf_ctx_t;
 
-struct bpf_args;
-typedef struct bpf_args bpf_args_t;
-
-struct bpf_args {
+typedef struct bpf_args {
 	const uint8_t *	pkt;
 	size_t		wirelen;
 	size_t		buflen;
@@ -336,21 +327,32 @@ struct bpf_args {
 	 */
 	uint32_t *	mem; /* pointer to external memory store */
 	void *		arg; /* auxiliary argument for a copfunc */
-};
+} bpf_args_t;
 
 #if defined(_KERNEL) || defined(__BPF_PRIVATE)
+
 typedef uint32_t (*bpf_copfunc_t)(const bpf_ctx_t *, bpf_args_t *, uint32_t);
 
 struct bpf_ctx {
+	/*
+	 * BPF coprocessor functions and the number of them.
+	 */
 	const bpf_copfunc_t *	copfuncs;
 	size_t			nfuncs;
+
 	/*
-	 * Number of external memwords, up to BPF_MAX_MEMWORDS or 0.
-	 * The latter forces a switch to internal memstore with a
-	 * fixed number (BPF_MEMWORDS) of memwords.
+	 * The number of memory words in the external memory store.
+	 * There may be up to BPF_MAX_MEMWORDS words; if zero is set,
+	 * then the internal memory store is used which has a fixed
+	 * number of words (BPF_MEMWORDS).
 	 */
 	size_t			extwords;
-	bpf_memword_init_t	noinit; /* pre-initialised external memwords */
+
+	/*
+	 * The bitmask indicating which words in the external memstore
+	 * will be initialised by the caller.
+	 */
+	bpf_memword_init_t	preinited;
 };
 #endif
 
@@ -447,20 +449,20 @@ bpf_mtap_sl_out(struct ifnet *_ifp, u_ch
 }
 
 
-void bpf_setops(void);
+void	bpf_setops(void);
 
-void bpf_ops_handover_enter(struct bpf_ops *);
-void bpf_ops_handover_exit(void);
+void	bpf_ops_handover_enter(struct bpf_ops *);
+void	bpf_ops_handover_exit(void);
 
-void	 bpfilterattach(int);
+void	bpfilterattach(int);
 
 bpf_ctx_t *bpf_create(void);
 void	bpf_destroy(bpf_ctx_t *);
 
-int   bpf_set_cop(bpf_ctx_t *, const bpf_copfunc_t *, size_t);
-int   bpf_set_extmem(bpf_ctx_t *, size_t, bpf_memword_init_t);
-u_int bpf_filter_ext(const bpf_ctx_t *, const struct bpf_insn *, bpf_args_t *);
-int   bpf_validate_ext(const bpf_ctx_t *, const struct bpf_insn *, int);
+int	bpf_set_cop(bpf_ctx_t *, const bpf_copfunc_t *, size_t);
+int	bpf_set_extmem(bpf_ctx_t *, size_t, bpf_memword_init_t);
+u_int	bpf_filter_ext(const bpf_ctx_t *, const struct bpf_insn *, bpf_args_t *);
+int	bpf_validate_ext(const bpf_ctx_t *, const struct bpf_insn *, int);
 
 bpfjit_func_t bpf_jit_generate(bpf_ctx_t *, void *, size_t);
 void	bpf_jit_freecode(bpfjit_func_t);

Index: src/sys/net/bpf_filter.c
diff -u src/sys/net/bpf_filter.c:1.62 src/sys/net/bpf_filter.c:1.63
--- 

CVS commit: src/lib/libc/citrus

2014-06-24 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Tue Jun 24 22:24:18 UTC 2014

Modified Files:
src/lib/libc/citrus: citrus_prop.c citrus_prop.h
src/lib/libc/citrus/modules: citrus_big5.c citrus_hz.c

Log Message:
Fix our iconv version for the issues that apply to us from CVE-2014-3951
(which are the:
- Consistently pass around context information using a simple pointer.
  This fixes some dereferencing bugs in Chinese character set conversions.
- Fix Simplified Chinese character set conversions by switching around the
  fields of an internal struct so it corresponds with the way variables of
  this type are initialised.
part)
Patch taken from FreeBSD and mutilated to fit.
FreeBSD credits: Manuel Mausz (reporter), Tijl Coosemans (report handler)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/citrus/citrus_prop.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/citrus/citrus_prop.h
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/citrus/modules/citrus_big5.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/citrus/modules/citrus_hz.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/citrus/citrus_prop.c
diff -u src/lib/libc/citrus/citrus_prop.c:1.4 src/lib/libc/citrus/citrus_prop.c:1.5
--- src/lib/libc/citrus/citrus_prop.c:1.4	Wed Mar 30 08:22:01 2011
+++ src/lib/libc/citrus/citrus_prop.c	Tue Jun 24 22:24:18 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_prop.c,v 1.4 2011/03/30 08:22:01 jruoho Exp $ */
+/* $NetBSD: citrus_prop.c,v 1.5 2014/06/24 22:24:18 spz Exp $ */
 
 /*-
  * Copyright (c)2006 Citrus Project,
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: citrus_prop.c,v 1.4 2011/03/30 08:22:01 jruoho Exp $);
+__RCSID($NetBSD: citrus_prop.c,v 1.5 2014/06/24 22:24:18 spz Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include assert.h
@@ -350,7 +350,7 @@ name_found:
 static int
 _citrus_prop_parse_element(struct _memstream * __restrict ms,
 	const _citrus_prop_hint_t * __restrict hints,
-	void ** __restrict context)
+	void * __restrict context)
 {
 	int ch, errnum;
 #define _CITRUS_PROP_HINT_NAME_LEN_MAX	255
@@ -459,8 +459,7 @@ _citrus_prop_parse_variable(const _citru
 		if (ch == EOF || ch == '\0')
 			break;
 		_memstream_ungetc(ms, ch);
-		errnum = _citrus_prop_parse_element(
-		ms, hints, (void **)context);
+		errnum = _citrus_prop_parse_element(ms, hints, context);
 		if (errnum != 0)
 			return errnum;
 	}

Index: src/lib/libc/citrus/citrus_prop.h
diff -u src/lib/libc/citrus/citrus_prop.h:1.5 src/lib/libc/citrus/citrus_prop.h:1.6
--- src/lib/libc/citrus/citrus_prop.h:1.5	Mon May 23 14:52:32 2011
+++ src/lib/libc/citrus/citrus_prop.h	Tue Jun 24 22:24:18 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_prop.h,v 1.5 2011/05/23 14:52:32 joerg Exp $ */
+/* $NetBSD: citrus_prop.h,v 1.6 2014/06/24 22:24:18 spz Exp $ */
 
 /*-
  * Copyright (c)2006 Citrus Project,
@@ -41,7 +41,7 @@ typedef struct _citrus_prop_hint_t _citr
 
 #define _CITRUS_PROP_CB0_T(_func_, _type_) \
 typedef int (*_citrus_prop_##_func_##_cb_func_t) \
-	(void ** __restrict, const char *, _type_); \
+	(void * __restrict, const char *, _type_); \
 typedef struct { \
 	_citrus_prop_##_func_##_cb_func_t func; \
 } _citrus_prop_##_func_##_cb_t;
@@ -51,7 +51,7 @@ _CITRUS_PROP_CB0_T(str, const char *)
 
 #define _CITRUS_PROP_CB1_T(_func_, _type_) \
 typedef int (*_citrus_prop_##_func_##_cb_func_t) \
-	(void ** __restrict, const char *, _type_, _type_); \
+	(void * __restrict, const char *, _type_, _type_); \
 typedef struct { \
 	_citrus_prop_##_func_##_cb_func_t func; \
 } _citrus_prop_##_func_##_cb_t;

Index: src/lib/libc/citrus/modules/citrus_big5.c
diff -u src/lib/libc/citrus/modules/citrus_big5.c:1.14 src/lib/libc/citrus/modules/citrus_big5.c:1.15
--- src/lib/libc/citrus/modules/citrus_big5.c:1.14	Tue May 28 16:57:56 2013
+++ src/lib/libc/citrus/modules/citrus_big5.c	Tue Jun 24 22:24:18 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: citrus_big5.c,v 1.14 2013/05/28 16:57:56 joerg Exp $	*/
+/*	$NetBSD: citrus_big5.c,v 1.15 2014/06/24 22:24:18 spz Exp $	*/
 
 /*-
  * Copyright (c)2002, 2006 Citrus Project,
@@ -60,7 +60,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: citrus_big5.c,v 1.14 2013/05/28 16:57:56 joerg Exp $);
+__RCSID($NetBSD: citrus_big5.c,v 1.15 2014/06/24 22:24:18 spz Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include sys/queue.h
@@ -192,18 +192,18 @@ _citrus_BIG5_check_excludes(_BIG5Encodin
 }
 
 static int
-_citrus_BIG5_fill_rowcol(void ** __restrict ctx, const char * __restrict s,
+_citrus_BIG5_fill_rowcol(void * __restrict ctx, const char * __restrict s,
 	uint64_t start, uint64_t end)
 {
 	_BIG5EncodingInfo *ei;
 	int i;
 	uint64_t n;
 
-	_DIAGASSERT(ctx != NULL  *ctx != NULL);
+	_DIAGASSERT(ctx != NULL);
 
 	if (start  0xFF || end  0xFF)
 		return EINVAL;
-	ei = (_BIG5EncodingInfo *)*ctx;
+	ei = (_BIG5EncodingInfo *)ctx;
 	i = 

CVS commit: src/sys/net

2014-06-24 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Tue Jun 24 22:27:40 UTC 2014

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

Log Message:
- bpf_validate_ext: fix memword validation in BPF_ST/BPF_STX case.
- bpf_set_extmem: check the number of words against BPF_MAX_MEMWORDS.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/net/bpf_filter.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/bpf_filter.c
diff -u src/sys/net/bpf_filter.c:1.63 src/sys/net/bpf_filter.c:1.64
--- src/sys/net/bpf_filter.c:1.63	Tue Jun 24 22:19:36 2014
+++ src/sys/net/bpf_filter.c	Tue Jun 24 22:27:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf_filter.c,v 1.63 2014/06/24 22:19:36 rmind Exp $	*/
+/*	$NetBSD: bpf_filter.c,v 1.64 2014/06/24 22:27:40 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bpf_filter.c,v 1.63 2014/06/24 22:19:36 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: bpf_filter.c,v 1.64 2014/06/24 22:27:40 rmind Exp $);
 
 #if 0
 #if !(defined(lint) || defined(KERNEL))
@@ -79,8 +79,9 @@ bpf_set_cop(bpf_ctx_t *bc, const bpf_cop
 int
 bpf_set_extmem(bpf_ctx_t *bc, size_t nwords, bpf_memword_init_t preinited)
 {
-	/* XXX check arguments */
-
+	if (nwords  BPF_MAX_MEMWORDS) {
+		return EINVAL;
+	}
 	bc-extwords = nwords;
 	bc-preinited = preinited;
 	return 0;
@@ -661,7 +662,7 @@ bpf_validate(const struct bpf_insn *f, i
 goto out;
 #if defined(KERNEL) || defined(_KERNEL)
 			/* validate the memory word */
-			invalid = ~BPF_MEMWORD_INIT(1  p-k);
+			invalid = ~BPF_MEMWORD_INIT(p-k);
 #endif
 			break;
 		case BPF_ALU:



CVS commit: src/sys/dev/pci

2014-06-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jun 24 23:25:33 UTC 2014

Modified Files:
src/sys/dev/pci: if_bnx.c if_bnxreg.h if_bnxvar.h

Log Message:
No functional change:
- Tabify.
- Remove trailing white spaces.
- Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/pci/if_bnx.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/if_bnxreg.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/if_bnxvar.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/pci/if_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.53 src/sys/dev/pci/if_bnx.c:1.54
--- src/sys/dev/pci/if_bnx.c:1.53	Tue Jun 17 21:37:20 2014
+++ src/sys/dev/pci/if_bnx.c	Tue Jun 24 23:25:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.53 2014/06/17 21:37:20 msaitoh Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.54 2014/06/24 23:25:33 msaitoh Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.85 2009/11/09 14:32:41 dlg Exp $ */
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID($FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $);
 #endif
-__KERNEL_RCSID(0, $NetBSD: if_bnx.c,v 1.53 2014/06/17 21:37:20 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bnx.c,v 1.54 2014/06/24 23:25:33 msaitoh Exp $);
 
 /*
  * The following controllers are supported by this driver:
@@ -48,7 +48,6 @@ __KERNEL_RCSID(0, $NetBSD: if_bnx.c,v 1
  *   BCM5716  C0
  *
  * The following controllers are not supported by this driver:
- *
  *   BCM5706C A0, A1
  *   BCM5706S A0, A1
  *   BCM5708C A0, B0
@@ -1754,7 +1753,7 @@ bnx_nvram_write(struct bnx_softc *sc, u_
 	}
 
 	if (len32  3) {
-	   	if ((len32  4) || !align_start) {
+		if ((len32  4) || !align_start) {
 			align_end = 4 - (len32  3);
 			len32 += align_end;
 			if ((rc = bnx_nvram_read(sc, offset32 + len32 - 4,
@@ -3142,13 +3141,11 @@ bnx_init_context(struct bnx_softc *sc)
 			DELAY(2);
 		}
 
-
 		/* ToDo: Consider returning an error here. */
 
 		for (i = 0; i  sc-ctx_pages; i++) {
 			int j;
 
-
 			/* Set the physaddr of the context memory cache. */
 			val = (u_int32_t)(sc-ctx_segs[i].ds_addr);
 			REG_WR(sc, BNX_CTX_HOST_PAGE_TBL_DATA0, val |
@@ -3159,7 +3156,6 @@ bnx_init_context(struct bnx_softc *sc)
 			REG_WR(sc, BNX_CTX_HOST_PAGE_TBL_CTRL, i |
 BNX_CTX_HOST_PAGE_TBL_CTRL_WRITE_REQ);
 
-
 			/* Verify that the context memory write was successful. */
 			for (j = 0; j  retry_cnt; j++) {
 val = REG_RD(sc, BNX_CTX_HOST_PAGE_TBL_CTRL);
@@ -3725,7 +3721,7 @@ bnx_add_buf(struct bnx_softc *sc, struct
 	sizeof(struct rx_bd), BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
 	/*
-	 * Save the mbuf, ajust the map pointer (swap map for first and
+	 * Save the mbuf, adjust the map pointer (swap map for first and
 	 * last rx_bd entry to that rx_mbuf_ptr and rx_mbuf_map matches)
 	 * and update counter.
 	 */
@@ -4031,7 +4027,7 @@ bnx_free_tx_chain(struct bnx_softc *sc)
 
 		mutex_enter(sc-tx_pkt_mtx);
 		TAILQ_INSERT_TAIL(sc-tx_free_pkts, pkt, pkt_entry);
-}
+	}
 
 	/* Destroy all the dmamaps we allocated for TX */
 	while ((pkt = TAILQ_FIRST(sc-tx_free_pkts)) != NULL) {
@@ -5258,7 +5254,8 @@ bnx_intr(void *xsc)
 		sc-hw_tx_cons)
 			bnx_tx_intr(sc);
 
-		/* Save the status block index value for use during the
+		/*
+		 * Save the status block index value for use during the
 		 * next interrupt.
 		 */
 		sc-last_status_idx = sblk-status_idx;

Index: src/sys/dev/pci/if_bnxreg.h
diff -u src/sys/dev/pci/if_bnxreg.h:1.15 src/sys/dev/pci/if_bnxreg.h:1.16
--- src/sys/dev/pci/if_bnxreg.h:1.15	Tue Jun 17 21:37:20 2014
+++ src/sys/dev/pci/if_bnxreg.h	Tue Jun 24 23:25:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnxreg.h,v 1.15 2014/06/17 21:37:20 msaitoh Exp $	*/
+/*	$NetBSD: if_bnxreg.h,v 1.16 2014/06/24 23:25:33 msaitoh Exp $	*/
 /*	$OpenBSD: if_bnxreg.h,v 1.33 2009/09/05 16:02:28 claudio Exp $  */
 
 /*-
@@ -326,7 +326,7 @@ struct flash_spec {
 #define BNX_NV_BUFFERED		0x0001
 #define BNX_NV_TRANSLATE	0x0002
 #define BNX_NV_WREN		0x0004
-u_int32_t flags;
+	u_int32_t flags;
 	u_int32_t page_bits;
 	u_int32_t page_size;
 	u_int32_t addr_mask;
@@ -341,19 +341,19 @@ struct flash_spec {
 /* information which can be accessed by the driver. */
 //
 
-/* 
+/*
  * This value (in milliseconds) determines the frequency of the driver
  * issuing the PULSE message code.  The firmware monitors this periodic
- * pulse to determine when to switch to an OS-absent mode. 
+ * pulse to determine when to switch to an OS-absent mode.
  */
 #define DRV_PULSE_PERIOD_MS 250
 
-/* 
+/*
  * This value (in milliseconds) determines how long the driver should
  * wait for an acknowledgement from the firmware before timing out.  Once
  * the firmware has timed out, the driver will assume there is no firmware
  * running and there won't be any firmware-driver synchronization 

CVS commit: src

2014-06-24 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Wed Jun 25 00:20:06 UTC 2014

Modified Files:
src/sys/net/npf: npf.h npf_bpf.c npf_impl.h npf_ruleset.c
src/usr.sbin/npf/npftest/libnpftest: npf_bpf_test.c

Log Message:
Adjust NPF to the recent BPF / BPF JIT changes and make it work again.
All regression tests are happy now (hi alnsn!).


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/net/npf/npf.h
cvs rdiff -u -r1.7 -r1.8 src/sys/net/npf/npf_bpf.c
cvs rdiff -u -r1.52 -r1.53 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.32 -r1.33 src/sys/net/npf/npf_ruleset.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/npf/npftest/libnpftest/npf_bpf_test.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.h
diff -u src/sys/net/npf/npf.h:1.40 src/sys/net/npf/npf.h:1.41
--- src/sys/net/npf/npf.h:1.40	Fri May 30 23:26:06 2014
+++ src/sys/net/npf/npf.h	Wed Jun 25 00:20:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf.h,v 1.40 2014/05/30 23:26:06 rmind Exp $	*/
+/*	$NetBSD: npf.h,v 1.41 2014/06/25 00:20:06 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -67,6 +67,8 @@ typedef uint8_t			npf_netmask_t;
 #define	BPF_MW_L4OFF		1
 #define	BPF_MW_L4PROTO		2
 #endif
+/* The number of words used. */
+#define	NPF_BPF_NWORDS		3
 
 #if defined(_KERNEL)
 

Index: src/sys/net/npf/npf_bpf.c
diff -u src/sys/net/npf/npf_bpf.c:1.7 src/sys/net/npf/npf_bpf.c:1.8
--- src/sys/net/npf/npf_bpf.c:1.7	Tue Jun 24 11:31:49 2014
+++ src/sys/net/npf/npf_bpf.c	Wed Jun 25 00:20:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_bpf.c,v 1.7 2014/06/24 11:31:49 alnsn Exp $	*/
+/*	$NetBSD: npf_bpf.c,v 1.8 2014/06/25 00:20:06 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -34,11 +34,12 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf_bpf.c,v 1.7 2014/06/24 11:31:49 alnsn Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf_bpf.c,v 1.8 2014/06/25 00:20:06 rmind Exp $);
 
 #include sys/types.h
 #include sys/param.h
 
+#include sys/bitops.h
 #include sys/mbuf.h
 #include net/bpf.h
 
@@ -59,12 +60,15 @@ static const bpf_copfunc_t npf_bpfcop[] 
 	[NPF_COP_TABLE]	= npf_cop_table,
 };
 
+#define	BPF_MW_ALLMASK \
+((1U  BPF_MW_IPVER) | (1U  BPF_MW_L4OFF) | (1U  BPF_MW_L4PROTO))
+
 void
 npf_bpf_sysinit(void)
 {
 	npf_bpfctx = bpf_create();
-	KASSERT(npf_bpfctx != NULL);
 	bpf_set_cop(npf_bpfctx, npf_bpfcop, __arraycount(npf_bpfcop));
+	bpf_set_extmem(npf_bpfctx, NPF_BPF_NWORDS, BPF_MW_ALLMASK);
 }
 
 void
@@ -73,6 +77,20 @@ npf_bpf_sysfini(void)
 	bpf_destroy(npf_bpfctx);
 }
 
+void
+npf_bpf_prepare(npf_cache_t *npc, nbuf_t *nbuf, bpf_args_t *args, uint32_t *m)
+{
+	const struct mbuf *mbuf = nbuf_head_mbuf(nbuf);
+	const size_t pktlen = m_length(mbuf);
+
+	/* Prepare the arguments for the BPF programs. */
+	args-pkt = (const uint8_t *)mbuf;
+	args-wirelen = pktlen;
+	args-buflen = 0;
+	args-mem = m;
+	args-arg = npc;
+}
+
 int
 npf_bpf_filter(bpf_args_t *args, const void *code, bpfjit_func_t jcode)
 {

Index: src/sys/net/npf/npf_impl.h
diff -u src/sys/net/npf/npf_impl.h:1.52 src/sys/net/npf/npf_impl.h:1.53
--- src/sys/net/npf/npf_impl.h:1.52	Fri May 30 23:26:06 2014
+++ src/sys/net/npf/npf_impl.h	Wed Jun 25 00:20:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_impl.h,v 1.52 2014/05/30 23:26:06 rmind Exp $	*/
+/*	$NetBSD: npf_impl.h,v 1.53 2014/06/25 00:20:06 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -223,6 +223,7 @@ bool		npf_return_block(npf_cache_t *, nb
 /* BPF interface. */
 void		npf_bpf_sysinit(void);
 void		npf_bpf_sysfini(void);
+void		npf_bpf_prepare(npf_cache_t *, nbuf_t *, bpf_args_t *, uint32_t *);
 int		npf_bpf_filter(bpf_args_t *, const void *, bpfjit_func_t);
 void *		npf_bpf_compile(void *, size_t);
 bool		npf_bpf_validate(const void *, size_t);

Index: src/sys/net/npf/npf_ruleset.c
diff -u src/sys/net/npf/npf_ruleset.c:1.32 src/sys/net/npf/npf_ruleset.c:1.33
--- src/sys/net/npf/npf_ruleset.c:1.32	Tue Jun 24 10:53:30 2014
+++ src/sys/net/npf/npf_ruleset.c	Wed Jun 25 00:20:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_ruleset.c,v 1.32 2014/06/24 10:53:30 alnsn Exp $	*/
+/*	$NetBSD: npf_ruleset.c,v 1.33 2014/06/25 00:20:06 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf_ruleset.c,v 1.32 2014/06/24 10:53:30 alnsn Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf_ruleset.c,v 1.33 2014/06/25 00:20:06 rmind Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -741,18 +741,18 @@ npf_ruleset_inspect(npf_cache_t *npc, nb
 	const u_int nitems = rlset-rs_nitems;
 	const u_int ifid = nbuf-nb_ifid;
 	npf_rule_t *final_rl = NULL;
-	const struct mbuf *m;
 	bpf_args_t bc_args;
 	u_int n = 0;
 
-	memset(bc_args, 0, sizeof(bpf_args_t));
-	m = nbuf_head_mbuf(nbuf);
-	bc_args.pkt = (const uint8_t *)m;
-	bc_args.wirelen = m_length(m);
-	bc_args.arg 

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

2014-06-24 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Wed Jun 25 00:21:42 UTC 2014

Modified Files:
src/usr.sbin/npf/npftest: README
src/usr.sbin/npf/npftest/libnpftest: npf_perf_test.c

Log Message:
npftest: add an example in the README, fix the total in npf_test_conc().


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/npf/npftest/README
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/npf/npftest/libnpftest/npf_perf_test.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/npftest/README
diff -u src/usr.sbin/npf/npftest/README:1.5 src/usr.sbin/npf/npftest/README:1.6
--- src/usr.sbin/npf/npftest/README:1.5	Wed May 14 21:46:50 2014
+++ src/usr.sbin/npf/npftest/README	Wed Jun 25 00:21:42 2014
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.5 2014/05/14 21:46:50 rmind Exp $
+$NetBSD: README,v 1.6 2014/06/25 00:21:42 rmind Exp $
 
 npftest - a tool for regression testing and debugging NPF.
 It uses RUMP framework to run NPF kernel module in the userspace.
@@ -12,12 +12,16 @@ npftest -c /tmp/npf.plist -t
 
 Stream:
 
-tcpdump -w stream.pcap -i $INTERFACE host $HOST and tcp
+tcpdump -w stream.pcap -i $interface host $host and tcp
 npfctl debug npftest.conf /tmp/npf.plist
 npftest -c /tmp/npf.plist -s stream.pcap  stream_npf_data.txt
 
 Preferably, use MALLOC_OPTIONS=AJ and/or other facilities.
 
+Benchmark:
+
+npftest -b rule -c /tmp/npf.plist -p $ncpu
+
 ---
 
 Update RUMP libraries once the kernel side has been changed.  Hint:

Index: src/usr.sbin/npf/npftest/libnpftest/npf_perf_test.c
diff -u src/usr.sbin/npf/npftest/libnpftest/npf_perf_test.c:1.3 src/usr.sbin/npf/npftest/libnpftest/npf_perf_test.c:1.4
--- src/usr.sbin/npf/npftest/libnpftest/npf_perf_test.c:1.3	Tue Sep 24 22:52:14 2013
+++ src/usr.sbin/npf/npftest/libnpftest/npf_perf_test.c	Wed Jun 25 00:21:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_perf_test.c,v 1.3 2013/09/24 22:52:14 joerg Exp $	*/
+/*	$NetBSD: npf_perf_test.c,v 1.4 2014/06/25 00:21:42 rmind Exp $	*/
 
 /*
  * NPF benchmarking.
@@ -99,5 +99,5 @@ npf_test_conc(bool st, unsigned nthreads
 	kmem_free(npackets, sizeof(uint64_t) * nthreads);
 	kmem_free(l, sizeof(lwp_t *) * nthreads);
 
-	printf(%u\t% PRIu64 \n, nthreads, total);
+	printf(%u\t% PRIu64 \n, nthreads, total / NSECS);
 }



CVS commit: src/sys/net

2014-06-24 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Wed Jun 25 01:21:36 UTC 2014

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

Log Message:
bpfjit_generate_code: emit the instruction correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/net/bpfjit.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/bpfjit.c
diff -u src/sys/net/bpfjit.c:1.14 src/sys/net/bpfjit.c:1.15
--- src/sys/net/bpfjit.c:1.14	Tue Jun 24 22:19:36 2014
+++ src/sys/net/bpfjit.c	Wed Jun 25 01:21:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpfjit.c,v 1.14 2014/06/24 22:19:36 rmind Exp $	*/
+/*	$NetBSD: bpfjit.c,v 1.15 2014/06/25 01:21:36 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2011-2014 Alexander Nasonov.
@@ -31,9 +31,9 @@
 
 #include sys/cdefs.h
 #ifdef _KERNEL
-__KERNEL_RCSID(0, $NetBSD: bpfjit.c,v 1.14 2014/06/24 22:19:36 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: bpfjit.c,v 1.15 2014/06/25 01:21:36 rmind Exp $);
 #else
-__RCSID($NetBSD: bpfjit.c,v 1.14 2014/06/24 22:19:36 rmind Exp $);
+__RCSID($NetBSD: bpfjit.c,v 1.15 2014/06/25 01:21:36 rmind Exp $);
 #endif
 
 #include sys/types.h
@@ -1670,7 +1670,7 @@ bpfjit_generate_code(const bpf_ctx_t *bc
 		status = sljit_emit_op1(compiler,
 		SLJIT_MOV_P,
 		BJ_TMP1REG, 0,
-		BJ_ARGS, offsetof(struct bpf_args, mem));
+		SLJIT_MEM1(BJ_ARGS), offsetof(struct bpf_args, mem));
 		if (status != SLJIT_SUCCESS)
 			goto fail;
 



CVS commit: src/usr.bin/sed

2014-06-24 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Jun 25 02:05:58 UTC 2014

Modified Files:
src/usr.bin/sed: sed.1

Log Message:
Command file argument to -f is not optional.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/sed/sed.1

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/sed/sed.1
diff -u src/usr.bin/sed/sed.1:1.39 src/usr.bin/sed/sed.1:1.40
--- src/usr.bin/sed/sed.1:1.39	Wed Jun 18 14:47:02 2014
+++ src/usr.bin/sed/sed.1	Wed Jun 25 02:05:58 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: sed.1,v 1.39 2014/06/18 14:47:02 uwe Exp $
+.\	$NetBSD: sed.1,v 1.40 2014/06/25 02:05:58 uwe Exp $
 .\ Copyright (c) 1992, 1993
 .\	The Regents of the University of California.  All rights reserved.
 .\
@@ -92,7 +92,7 @@ Append the editing commands specified by
 .Ar command
 argument
 to the list of commands.
-.It Fl f Op Ar command_file
+.It Fl f Ar command_file
 Append the editing commands found in the file
 .Ar command_file
 to the list of commands.