CVS commit: src/sys/dev/pci

2014-06-29 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Jun 30 06:09:44 UTC 2014

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
Acquire SW semaphore in wm_get_swsm_semaphore

It is required to serialize device drivers running on different CPUs.
The basic instructions are same as the official Intel driver.

ok msaitoh@


To generate a diff of this commit:
cvs rdiff -u -r1.270 -r1.271 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.270 src/sys/dev/pci/if_wm.c:1.271
--- src/sys/dev/pci/if_wm.c:1.270	Mon Jun 16 16:48:16 2014
+++ src/sys/dev/pci/if_wm.c	Mon Jun 30 06:09:44 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.270 2014/06/16 16:48:16 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.271 2014/06/30 06:09:44 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.270 2014/06/16 16:48:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.271 2014/06/30 06:09:44 ozaki-r Exp $");
 
 #include 
 #include 
@@ -7569,6 +7569,23 @@ wm_get_swsm_semaphore(struct wm_softc *s
 	int32_t timeout;
 	uint32_t swsm;
 
+	/* Get the SW semaphore. */
+	timeout = 1000 + 1; /* XXX */
+	while (timeout) {
+		swsm = CSR_READ(sc, WMREG_SWSM);
+
+		if ((swsm & SWSM_SMBI) == 0)
+			break;
+
+		delay(50);
+		timeout--;
+	}
+
+	if (timeout == 0) {
+		aprint_error_dev(sc->sc_dev, "could not acquire SWSM SMBI\n");
+		return 1;
+	}
+
 	/* Get the FW semaphore. */
 	timeout = 1000 + 1; /* XXX */
 	while (timeout) {
@@ -7585,7 +7602,7 @@ wm_get_swsm_semaphore(struct wm_softc *s
 	}
 
 	if (timeout == 0) {
-		aprint_error_dev(sc->sc_dev, "could not acquire EEPROM GNT\n");
+		aprint_error_dev(sc->sc_dev, "could not acquire SWSM SWESMBI\n");
 		/* Release semaphores */
 		wm_put_swsm_semaphore(sc);
 		return 1;
@@ -7599,7 +7616,7 @@ wm_put_swsm_semaphore(struct wm_softc *s
 	uint32_t swsm;
 
 	swsm = CSR_READ(sc, WMREG_SWSM);
-	swsm &= ~(SWSM_SWESMBI);
+	swsm &= ~(SWSM_SMBI | SWSM_SWESMBI);
 	CSR_WRITE(sc, WMREG_SWSM, swsm);
 }
 



CVS commit: src/doc

2014-06-29 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Jun 30 05:52:24 UTC 2014

Modified Files:
src/doc: CHANGES

Log Message:
Note micphy(4)


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1939 src/doc/CHANGES:1.1940
--- src/doc/CHANGES:1.1939	Sun Jun 22 23:53:16 2014
+++ src/doc/CHANGES	Mon Jun 30 05:52:24 2014
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1939 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1940 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -376,6 +376,7 @@ Changes from NetBSD 6.0 to NetBSD 7.0:
 	dhcpcd(8): Import dhcpcd-6.3.0 [roy 20140225]
 	mcp48x1dac(4): Add preliminary support for Microchip MCP48x1 family of
 		Digital-to-Analog converters. [rkujawa 20140225]
+	micphy(4): Add Micrel PHY (KSZ9021RN) [ozaki-r 20140226]
 	bind: update to 9.10.0b1 [christos 20130228]
 	dhcpcd(8): Import dhcpcd-6.3.1 [roy 20140301]
 	x68k: Switch to X11FLAVOUR=Xorg, including X68k monolithic server.



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

2014-06-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jun 30 04:38:18 UTC 2014

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

Log Message:
Ticket 1086.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/doc/CHANGES-6.0.6

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

Modified files:

Index: src/doc/CHANGES-6.0.6
diff -u src/doc/CHANGES-6.0.6:1.1.2.11 src/doc/CHANGES-6.0.6:1.1.2.12
--- src/doc/CHANGES-6.0.6:1.1.2.11	Wed Jun 18 09:35:59 2014
+++ src/doc/CHANGES-6.0.6	Mon Jun 30 04:38:18 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.6,v 1.1.2.11 2014/06/18 09:35:59 msaitoh Exp $
+# $NetBSD: CHANGES-6.0.6,v 1.1.2.12 2014/06/30 04:38:18 msaitoh Exp $
 
 A complete list of changes from the NetBSD 6.0.5 release to the NetBSD 6.0.6
 release:
@@ -616,3 +616,9 @@ sys/rump/librump/rumpkern/klock.c		1.4
 	for details. For netinet6, the problem report, fix and test were done
 	by njoly@ on current-users@
 	[bouyer, ticket #1067]
+
+sys/compat/freebsd/freebsd_sched.c		1.20-1.21
+
+	Avoid NULL dereference and fix sched param conversion.
+	Pointed out by Maxime Villard.
+	[maxv, ticket #1086]



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

2014-06-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jun 30 04:37:47 UTC 2014

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

Log Message:
Ticket 1086.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/doc/CHANGES-6.1.5

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

Modified files:

Index: src/doc/CHANGES-6.1.5
diff -u src/doc/CHANGES-6.1.5:1.1.2.11 src/doc/CHANGES-6.1.5:1.1.2.12
--- src/doc/CHANGES-6.1.5:1.1.2.11	Wed Jun 18 09:34:45 2014
+++ src/doc/CHANGES-6.1.5	Mon Jun 30 04:37:47 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.5,v 1.1.2.11 2014/06/18 09:34:45 msaitoh Exp $
+# $NetBSD: CHANGES-6.1.5,v 1.1.2.12 2014/06/30 04:37:47 msaitoh Exp $
 
 A complete list of changes from the NetBSD 6.1.4 release to the NetBSD 6.1.5
 release:
@@ -616,3 +616,9 @@ sys/rump/librump/rumpkern/klock.c		1.4
 	for details. For netinet6, the problem report, fix and test were done
 	by njoly@ on current-users@
 	[bouyer, ticket #1067]
+
+sys/compat/freebsd/freebsd_sched.c		1.20-1.21
+
+	Avoid NULL dereference and fix sched param conversion.
+	Pointed out by Maxime Villard.
+	[maxv, ticket #1086]



CVS commit: src/sys/net/npf

2014-06-29 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Mon Jun 30 00:01:24 UTC 2014

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

Log Message:
NPF: use BPF JIT by default.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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.9 src/sys/net/npf/npf_bpf.c:1.10
--- src/sys/net/npf/npf_bpf.c:1.9	Sun Jun 29 00:05:24 2014
+++ src/sys/net/npf/npf_bpf.c	Mon Jun 30 00:01:23 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_bpf.c,v 1.9 2014/06/29 00:05:24 rmind Exp $	*/
+/*	$NetBSD: npf_bpf.c,v 1.10 2014/06/30 00:01:23 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_bpf.c,v 1.9 2014/06/29 00:05:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_bpf.c,v 1.10 2014/06/30 00:01:23 rmind Exp $");
 
 #include 
 #include 
@@ -127,11 +127,7 @@ npf_bpf_filter(bpf_args_t *args, const v
 void *
 npf_bpf_compile(void *code, size_t size)
 {
-#if 0
 	return bpf_jit_generate(npf_bpfctx, code, size);
-#else
-	return NULL;
-#endif
 }
 
 bool



CVS commit: src/sys/arch/amd64/amd64

2014-06-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jun 29 23:21:28 UTC 2014

Modified Files:
src/sys/arch/amd64/amd64: rbus_machdep.c

Log Message:
drop trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/amd64/rbus_machdep.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/amd64/rbus_machdep.c
diff -u src/sys/arch/amd64/amd64/rbus_machdep.c:1.5 src/sys/arch/amd64/amd64/rbus_machdep.c:1.6
--- src/sys/arch/amd64/amd64/rbus_machdep.c:1.5	Fri Jul  1 19:24:14 2011
+++ src/sys/arch/amd64/amd64/rbus_machdep.c	Sun Jun 29 23:21:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rbus_machdep.c,v 1.5 2011/07/01 19:24:14 dyoung Exp $	*/
+/*	$NetBSD: rbus_machdep.c,v 1.6 2014/06/29 23:21:28 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1999
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.5 2011/07/01 19:24:14 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.6 2014/06/29 23:21:28 jakllsch Exp $");
 
 #include "opt_pcifixup.h"
 
@@ -92,11 +92,11 @@ rbus_pccbb_parent_mem(struct pci_attach_
 	 * which is not recognised by the kernel as already reserved.
 	 */
 
-	if (start < rbus_min_start) 
+	if (start < rbus_min_start)
 		start = rbus_min_start;
 
 	size = ex->ex_end - start;
-  
+
 	return rbus_new_root_share(pa->pa_memt, ex, start, size, 0);
 }
 



CVS commit: src/external/bsd/wpa/dist/src/drivers

2014-06-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jun 29 23:10:48 UTC 2014

Modified Files:
src/external/bsd/wpa/dist/src/drivers: driver_bsd.c

Log Message:
Pass the scan result RSSI to the WPA code in a way that it understands.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/wpa/dist/src/drivers/driver_bsd.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/wpa/dist/src/drivers/driver_bsd.c
diff -u src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.8 src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.9
--- src/external/bsd/wpa/dist/src/drivers/driver_bsd.c:1.8	Wed May 28 14:36:41 2014
+++ src/external/bsd/wpa/dist/src/drivers/driver_bsd.c	Sun Jun 29 23:10:48 2014
@@ -1354,7 +1354,7 @@ wpa_driver_bsd_add_scan_entry(struct wpa
 	result->freq = sr->isr_freq;
 	result->beacon_int = sr->isr_intval;
 	result->caps = sr->isr_capinfo;
-	result->qual = sr->isr_rssi;
+	result->level = sr->isr_rssi;
 	result->noise = sr->isr_noise;
 
 	pos = (u8 *)(result + 1);



CVS commit: src/etc/etc.mac68k

2014-06-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jun 29 17:49:04 UTC 2014

Modified Files:
src/etc/etc.mac68k: Makefile.inc

Log Message:
Make sure the iso target directory is created in-time for the mkisofs
invocation


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/etc/etc.mac68k/Makefile.inc

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

Modified files:

Index: src/etc/etc.mac68k/Makefile.inc
diff -u src/etc/etc.mac68k/Makefile.inc:1.20 src/etc/etc.mac68k/Makefile.inc:1.21
--- src/etc/etc.mac68k/Makefile.inc:1.20	Tue Mar 18 04:20:37 2008
+++ src/etc/etc.mac68k/Makefile.inc	Sun Jun 29 17:49:04 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.20 2008/03/18 04:20:37 lukem Exp $
+#	$NetBSD: Makefile.inc,v 1.21 2014/06/29 17:49:04 martin Exp $
 #
 #	etc.mac68k/Makefile.inc -- mac68k-specific etc Makefile targets
 #
@@ -21,4 +21,7 @@ snap_md_post:
 MKISOFS_FLAGS+=	-hfs --macbin \
 	-map ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/misc/extensions.map
 
-iso-image: do-iso-image
+check-iso-dir:
+	-mkdir -p ${RELEASEDIR}/iso
+
+iso-image: check-iso-dir .WAIT do-iso-image



CVS commit: src/share/mk

2014-06-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Jun 29 15:10:17 UTC 2014

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

Log Message:
set TOOLCHAIN_MISSING for playstation2.
default EXTERNAL_TOOLCHAIN to choosing to be GCC.

ps2 pkgsrc almost works now..


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

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.816 src/share/mk/bsd.own.mk:1.817
--- src/share/mk/bsd.own.mk:1.816	Mon Jun 23 02:13:53 2014
+++ src/share/mk/bsd.own.mk	Sun Jun 29 15:10:17 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.816 2014/06/23 02:13:53 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.817 2014/06/29 15:10:17 mrg Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -44,6 +44,10 @@ NEED_OWN_INSTALL_TARGET?=	yes
 # If some future port is not supported by the in-tree toolchain, this should
 # be set to "yes" for that port only.
 #
+.if ${MACHINE} == "playstation2"
+TOOLCHAIN_MISSING?=	yes
+.endif
+
 TOOLCHAIN_MISSING?=	no
 
 #
@@ -58,6 +62,8 @@ TOOLCHAIN_MISSING?=	no
   ${MACHINE_ARCH} == "powerpc64"
 HAVE_GCC?=45
 
+.elif ${MACHINE} == "playstation2"
+HAVE_GCC?=0
 .else
 # Otherwise, default to GCC4.8
 HAVE_GCC?=48
@@ -481,7 +487,7 @@ TOOL_CXX.false=		false
 TOOL_FC.false=		false
 TOOL_OBJC.false=	false
 
-AVAILABLE_COMPILER?=	${HAVE_PCC:Dpcc} ${HAVE_LLVM:Dclang} ${HAVE_GCC:Dgcc} false
+AVAILABLE_COMPILER?=	${HAVE_PCC:Dpcc} ${HAVE_LLVM:Dclang} ${HAVE_GCC:Dgcc} ${EXTERNAL_TOOLCHAIN:Dgcc} false
 
 .for _t in CC CPP CXX FC OBJC
 ACTIVE_${_t}=	${AVAILABLE_COMPILER:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@:[1]}



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

2014-06-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jun 29 12:18:42 UTC 2014

Modified Files:
src/sys/arch/mac68k/dev: sbc.c

Log Message:
Remove an unused variable


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/mac68k/dev/sbc.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/mac68k/dev/sbc.c
diff -u src/sys/arch/mac68k/dev/sbc.c:1.55 src/sys/arch/mac68k/dev/sbc.c:1.56
--- src/sys/arch/mac68k/dev/sbc.c:1.55	Fri Dec  7 08:04:02 2012
+++ src/sys/arch/mac68k/dev/sbc.c	Sun Jun 29 12:18:42 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbc.c,v 1.55 2012/12/07 08:04:02 hauke Exp $	*/
+/*	$NetBSD: sbc.c,v 1.56 2014/06/29 12:18:42 martin Exp $	*/
 
 /*
  * Copyright (C) 1996 Scott Reynolds.  All rights reserved.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sbc.c,v 1.55 2012/12/07 08:04:02 hauke Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbc.c,v 1.56 2014/06/29 12:18:42 martin Exp $");
 
 #include "opt_ddb.h"
 
@@ -426,7 +426,6 @@ sbc_drq_intr(void *p)
 	volatile u_int8_t *drq = 0;	/* XXX gcc4 -Wuninitialized */
 	u_int8_t *data;
 	int count, dcount, resid;
-	u_int8_t tmp;
 
 	/*
 	 * If we're not ready to xfer data, or have no more, just return.
@@ -534,7 +533,7 @@ sbc_drq_intr(void *p)
 		 */
 		if (dcount >= MAX_DMA_LEN)
 			drq = (volatile u_int8_t *)sc->sc_drq_addr;
-		tmp = *drq;
+		(void)*drq;
 	} else {	/* Data In */
 		/*
 		 * Get the dest address aligned.



CVS commit: src/sys/rump/librump/rumpkern

2014-06-29 Thread Justin Cormack
Module Name:src
Committed By:   justin
Date:   Sun Jun 29 11:36:52 UTC 2014

Modified Files:
src/sys/rump/librump/rumpkern: rump.c

Log Message:
Change assertion as rump_component_load may be called before curlwp available


To generate a diff of this commit:
cvs rdiff -u -r1.306 -r1.307 src/sys/rump/librump/rumpkern/rump.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/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.306 src/sys/rump/librump/rumpkern/rump.c:1.307
--- src/sys/rump/librump/rumpkern/rump.c:1.306	Fri Jun 13 15:45:02 2014
+++ src/sys/rump/librump/rumpkern/rump.c	Sun Jun 29 11:36:52 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.306 2014/06/13 15:45:02 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.307 2014/06/29 11:36:52 justin Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.306 2014/06/13 15:45:02 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.307 2014/06/29 11:36:52 justin Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -531,7 +531,7 @@ rump_component_load(const struct rump_co
 	 */
 	rc = __UNCONST(rc_const);
 
-	KASSERT(curlwp == bootlwp);
+	KASSERT(!rump_inited || curlwp == bootlwp);
 
 	LIST_FOREACH(rc_iter, &rchead, rc_entries) {
 		if (rc_iter == rc)



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

2014-06-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Jun 29 11:18:40 UTC 2014

Modified Files:
src/sys/arch/playstation2/dev: if_smap.c

Log Message:
NBPFILTER is no more.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/playstation2/dev/if_smap.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/playstation2/dev/if_smap.c
diff -u src/sys/arch/playstation2/dev/if_smap.c:1.15 src/sys/arch/playstation2/dev/if_smap.c:1.16
--- src/sys/arch/playstation2/dev/if_smap.c:1.15	Mon Mar 31 11:25:49 2014
+++ src/sys/arch/playstation2/dev/if_smap.c	Sun Jun 29 11:18:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smap.c,v 1.15 2014/03/31 11:25:49 martin Exp $	*/
+/*	$NetBSD: if_smap.c,v 1.16 2014/06/29 11:18:40 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,11 +30,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.15 2014/03/31 11:25:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.16 2014/06/29 11:18:40 mrg Exp $");
 
 #include "debug_playstation2.h"
 
-#include "bpfilter.h"
 #include "rnd.h"
 
 #include 
@@ -67,10 +66,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 
 #include 
 #include 
 
-#if NBPFILTER > 0
 #include 
 #include 
-#endif
 
 #include 
 #include 
@@ -421,10 +418,8 @@ smap_rxeof(void *arg)
 		_wbflush();
 		
 		if (m != NULL) {
-#if NBPFILTER > 0
 			if (ifp->if_bpf)
 bpf_mtap(ifp->if_bpf, m);
-#endif
 			(*ifp->if_input)(ifp, m);
 		}
 	}
@@ -523,10 +518,8 @@ smap_start(struct ifnet *ifp)
 
 		IFQ_DEQUEUE(&ifp->if_snd, m0);
 		KDASSERT(m0 != NULL);
-#if NBPFILTER > 0
 		if (ifp->if_bpf)
 			bpf_mtap(ifp->if_bpf, m0);
-#endif
 
 		p = (u_int8_t *)sc->tx_buf;
 		q = p + sz;



CVS commit: src/sys/dev/i2c

2014-06-29 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Sun Jun 29 09:52:43 UTC 2014

Modified Files:
src/sys/dev/i2c: hytp14.c

Log Message:
allow i2c address 0x01-0x7F
igore responses if the sensor is in command mode


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/hytp14.c

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

Modified files:

Index: src/sys/dev/i2c/hytp14.c
diff -u src/sys/dev/i2c/hytp14.c:1.1 src/sys/dev/i2c/hytp14.c:1.2
--- src/sys/dev/i2c/hytp14.c:1.1	Sun May 18 11:46:23 2014
+++ src/sys/dev/i2c/hytp14.c	Sun Jun 29 09:52:43 2014
@@ -37,7 +37,7 @@
  */ 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hytp14.c,v 1.1 2014/05/18 11:46:23 kardel Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hytp14.c,v 1.2 2014/06/29 09:52:43 kardel Exp $");
 
 #include 
 #include 
@@ -98,8 +98,8 @@ hytp14_match(device_t parent, cfdata_t m
 		if (strcmp(ia->ia_name, "hythygtemp") == 0)
 			return 1;
 	} else {
-		/* indirect config - check typical address */
-		if (ia->ia_addr == HYTP14_DEFAULT_ADDR)
+		/* indirect config - check for configured address */
+		if ((ia->ia_addr > 0) && (ia->ia_addr <= 0x7F))
 			return 1;
 	}
 	return 0;
@@ -189,15 +189,17 @@ hytp14_refresh_sensor(struct hytp14_sc *
 
 		/* send MR command */
 /* avoid quick read/write by providing a result buffer */
-		if ((error = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
-  sc->sc_addr, NULL, 0, buf, sizeof buf, 0)) == 0) {
+		error = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
+ sc->sc_addr, NULL, 0, buf, sizeof buf, 0);
+if (error == 0) {
 			DPRINTF(3, ("hytp14_refresh_sensor(%s): MR sent\n",
 device_xname(sc->sc_dev)));
 
 			/* send DF command - read data from sensor */
-			if ((error = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP,
-	  sc->sc_addr, NULL, 0, sc->sc_data,
-	  sizeof sc->sc_data, 0)) != 0) {
+			error = iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP,
+	 sc->sc_addr, NULL, 0, sc->sc_data,
+	  sizeof sc->sc_data, 0);
+if (error != 0) {
 DPRINTF(2, ("%s: %s: failed read from 0x%02x - error %d\n",
 	device_xname(sc->sc_dev),
 	__func__, sc->sc_addr, error));
@@ -224,7 +226,8 @@ hytp14_refresh_sensor(struct hytp14_sc *
 			
 	sc->sc_refresh = hardclock_ticks;
 	
-	if (error == 0) {
+	/* skip data if sensor is in command mode */
+	if (error == 0 && (sc->sc_data[0] & HYTP14_RESP_CMDMODE) == 0) {
 		sc->sc_valid = ENVSYS_SVALID;
 	} else {
 		sc->sc_valid = ENVSYS_SINVALID;



CVS commit: src/sys/dev/gpio

2014-06-29 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Sun Jun 29 09:32:24 UTC 2014

Modified Files:
src/sys/dev/gpio: gpio.c

Log Message:
make implementation match gpio(4) man entry. do no change configuration
if no flags are be set (allows non-destructive inquiry via GPIOSET again).


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/gpio/gpio.c

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

Modified files:

Index: src/sys/dev/gpio/gpio.c
diff -u src/sys/dev/gpio/gpio.c:1.55 src/sys/dev/gpio/gpio.c:1.56
--- src/sys/dev/gpio/gpio.c:1.55	Fri May 23 13:57:04 2014
+++ src/sys/dev/gpio/gpio.c	Sun Jun 29 09:32:24 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: gpio.c,v 1.55 2014/05/23 13:57:04 msaitoh Exp $ */
+/* $NetBSD: gpio.c,v 1.56 2014/06/29 09:32:24 kardel Exp $ */
 /*	$OpenBSD: gpio.c,v 1.6 2006/01/14 12:33:49 grange Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.55 2014/05/23 13:57:04 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.56 2014/06/29 09:32:24 kardel Exp $");
 
 /*
  * General Purpose Input/Output framework.
@@ -699,12 +699,14 @@ gpio_ioctl(struct gpio_softc *sc, u_long
 		/* check that the controller supports all requested flags */
 		if ((flags & sc->sc_pins[pin].pin_caps) != flags)
 			return ENODEV;
-		flags = set->gp_flags | GPIO_PIN_SET;
+		flags = set->gp_flags;
 
 		set->gp_caps = sc->sc_pins[pin].pin_caps;
 		/* return old value */
 		set->gp_flags = sc->sc_pins[pin].pin_flags;
+
 		if (flags > 0) {
+			flags |= GPIO_PIN_SET;
 			gpiobus_pin_ctl(gc, pin, flags);
 			/* update current value */
 			sc->sc_pins[pin].pin_flags = flags;



CVS commit: src/tests/ipf

2014-06-29 Thread Darren Reed
Module Name:src
Committed By:   darrenr
Date:   Sun Jun 29 09:27:58 UTC 2014

Modified Files:
src/tests/ipf: t_filter_parse.sh

Log Message:
PR kern/47462


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/ipf/t_filter_parse.sh

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

Modified files:

Index: src/tests/ipf/t_filter_parse.sh
diff -u src/tests/ipf/t_filter_parse.sh:1.10 src/tests/ipf/t_filter_parse.sh:1.11
--- src/tests/ipf/t_filter_parse.sh:1.10	Sun Mar 17 03:00:05 2013
+++ src/tests/ipf/t_filter_parse.sh	Sun Jun 29 09:27:58 2014
@@ -1,4 +1,4 @@
-# $NetBSD: t_filter_parse.sh,v 1.10 2013/03/17 03:00:05 jmmv Exp $
+# $NetBSD: t_filter_parse.sh,v 1.11 2014/06/29 09:27:58 darrenr Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -101,7 +101,7 @@ test_case i15 itest text ipf
 test_case i16 itest text ipf
 failing_test_case i17 itest "Known to be broken" text ipftest
 test_case i18 itest text ipf
-test_case i19 itest_i19 "PR kern/47262 Proto-family missing from logs" text ipf
+test_case i19 itest_i19 text ipf
 test_case i20 itest text ipf
 test_case i21 itest text ipf
 test_case i22 itest text ipf



CVS commit: src/tests/ipf

2014-06-29 Thread Darren Reed
Module Name:src
Committed By:   darrenr
Date:   Sun Jun 29 09:26:32 UTC 2014

Modified Files:
src/tests/ipf: t_nat_parse.sh

Log Message:
Add in test cases for testing ipnat's parsing of IPv6 NAT rules


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/ipf/t_nat_parse.sh

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

Modified files:

Index: src/tests/ipf/t_nat_parse.sh
diff -u src/tests/ipf/t_nat_parse.sh:1.7 src/tests/ipf/t_nat_parse.sh:1.8
--- src/tests/ipf/t_nat_parse.sh:1.7	Sun Jun 29 04:00:59 2014
+++ src/tests/ipf/t_nat_parse.sh	Sun Jun 29 09:26:32 2014
@@ -1,4 +1,4 @@
-# $NetBSD: t_nat_parse.sh,v 1.7 2014/06/29 04:00:59 darrenr Exp $
+# $NetBSD: t_nat_parse.sh,v 1.8 2014/06/29 09:26:32 darrenr Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -47,6 +47,16 @@ test_case in7 intest text text
 test_case in100 intest text text
 test_case in101 intest text text
 test_case in102 intest text text
+test_case in1_6 intest text text
+test_case in2_6 intest text text
+test_case in3_6 intest text text
+test_case in4_6 intest text text
+test_case in5_6 intest text text
+test_case in6_6 intest text text
+test_case in8_6 intest text text
+test_case in100_6 intest text text
+test_case in101_6 intest text text
+test_case in102_6 intest text text
 
 atf_init_test_cases()
 {
@@ -60,4 +70,14 @@ atf_init_test_cases()
 	atf_add_test_case in100
 	atf_add_test_case in101
 	atf_add_test_case in102
+	atf_add_test_case in1_6
+	atf_add_test_case in2_6
+	atf_add_test_case in3_6
+	atf_add_test_case in4_6
+	atf_add_test_case in5_6
+	atf_add_test_case in6_6
+	atf_add_test_case in8_6
+	atf_add_test_case in100_6
+	atf_add_test_case in101_6
+	atf_add_test_case in102_6
 }



CVS commit: src/tests/ipf

2014-06-29 Thread Darren Reed
Module Name:src
Committed By:   darrenr
Date:   Sun Jun 29 09:25:31 UTC 2014

Added Files:
src/tests/ipf/expected: in100_6 in101_6 in102_6 in1_6 in2_6 in3_6 in4_6
in5_6 in6_6 in8_6
src/tests/ipf/regress: in100_6 in101_6 in102_6 in1_6 in2_6 in3_6 in4_6
in5_6 in6_6 in8_6

Log Message:
Add in test cases for testing ipnat's parsing of IPv6 NAT rules


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/ipf/expected/in100_6 \
src/tests/ipf/expected/in101_6 src/tests/ipf/expected/in102_6 \
src/tests/ipf/expected/in1_6 src/tests/ipf/expected/in2_6 \
src/tests/ipf/expected/in3_6 src/tests/ipf/expected/in4_6 \
src/tests/ipf/expected/in5_6 src/tests/ipf/expected/in6_6 \
src/tests/ipf/expected/in8_6
cvs rdiff -u -r0 -r1.1 src/tests/ipf/regress/in100_6 \
src/tests/ipf/regress/in101_6 src/tests/ipf/regress/in102_6 \
src/tests/ipf/regress/in1_6 src/tests/ipf/regress/in2_6 \
src/tests/ipf/regress/in3_6 src/tests/ipf/regress/in4_6 \
src/tests/ipf/regress/in5_6 src/tests/ipf/regress/in6_6 \
src/tests/ipf/regress/in8_6

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

Added files:

Index: src/tests/ipf/expected/in100_6
diff -u /dev/null src/tests/ipf/expected/in100_6:1.1
--- /dev/null	Sun Jun 29 09:25:31 2014
+++ src/tests/ipf/expected/in100_6	Sun Jun 29 09:25:31 2014
@@ -0,0 +1,3 @@
+rewrite in on bge0 inet6 from 1:1:1::1/128 to 2:2::2:2/128 -> src 3:3:3::3/128 dst 4::4:4:4/128;
+rewrite out on bge0 inet6 from 1:1:1::1/128 to 2:2::2:2/128 -> src 3:3:3::/96 dst 4::4:4:4/128;
+rewrite in on bge0 inet6 from 1:1:1::1/128 to 2:2::2:2/128 -> src 3:3:3::/96 dst 4::4:0:0/96;
Index: src/tests/ipf/expected/in101_6
diff -u /dev/null src/tests/ipf/expected/in101_6:1.1
--- /dev/null	Sun Jun 29 09:25:31 2014
+++ src/tests/ipf/expected/in101_6	Sun Jun 29 09:25:31 2014
@@ -0,0 +1,4 @@
+rewrite in on bge0 inet6 proto icmp from 1:1:1::1/128 to 2:2::2:2/128 -> src 3:3:3::3/128 dst 4::4:4:4/128;
+rewrite in on bge0 inet6 proto udp from 1:1:1::1/128 to 2:2::2:2/128 -> src 3:3:3::3/128 dst 4::4:4:4/128;
+rewrite out on bge0 inet6 proto tcp from 1:1:1::1/128 to 2:2::2:2/128 -> src 3::/24 dst 4::4:4:4/128;
+rewrite in on bge0 inet6 proto tcp/udp from 1:1:1::1/128 to 2:2::/32 -> src 3::/24,20202 dst 4::/24,10101;
Index: src/tests/ipf/expected/in102_6
diff -u /dev/null src/tests/ipf/expected/in102_6:1.1
--- /dev/null	Sun Jun 29 09:25:31 2014
+++ src/tests/ipf/expected/in102_6	Sun Jun 29 09:25:31 2014
@@ -0,0 +1,5 @@
+rewrite in on bge0 inet6 proto tcp from any to any -> src any dst dstlist/a;
+rewrite in on bge0 inet6 proto tcp from 1:1:1::1/128 to any -> src any dst dstlist/bee;
+rewrite in on bge0 inet6 proto tcp from 1:1:1::1/128 to 2:2::2:2/128 -> src any dst dstlist/cat;
+rewrite in on bge0 inet6 proto tcp from pool/a to 2:2::2:2/128 -> src any dst dstlist/bat;
+rewrite in on bge0 inet6 proto tcp from pool/a to pool/1 -> src any dst dstlist/ant;
Index: src/tests/ipf/expected/in1_6
diff -u /dev/null src/tests/ipf/expected/in1_6:1.1
--- /dev/null	Sun Jun 29 09:25:31 2014
+++ src/tests/ipf/expected/in1_6	Sun Jun 29 09:25:31 2014
@@ -0,0 +1,29 @@
+map le0 inet6 any -> ::/128
+map le0 inet6 any -> any
+map le0 inet6 ::/1 -> any
+map le0 inet6 10::/16 -> 1:2:3::/96
+map le0 inet6 10::/16 -> 1:2:3::/96
+map le0 inet6 192:168::/32 -> range 203:1:1::23-203:1:3::45
+map ppp0 inet6 192:168::/32 -> ::/128 portmap tcp 1:1
+map ppp0 inet6 192:168::/32 -> ::/128 portmap udp 2:2
+map ppp0 inet6 192:168::/32 -> ::/128 portmap tcp/udp 3:3
+map ppp0 inet6 192:168::/32 -> ::/128 portmap tcp auto
+map ppp0 inet6 192:168::/32 -> ::/128 portmap udp auto
+map ppp0 inet6 192:168::/32 -> ::/128 portmap tcp/udp auto
+map ppp0 inet6 192:168::/32 -> ::/128 proxy port 21 ftp/tcp
+map ppp0 inet6 192:168::/32 -> ::/128 proxy port 1010 ftp/tcp
+map le0 inet6 any -> ::/128 frag
+map le0 inet6 192:168::/32 -> range 203:1:1::23-203:1:3::45 frag
+map ppp0 inet6 192:168::/32 -> ::/128 portmap tcp 1:1 frag
+map ppp0 inet6 192:168::/32 -> ::/128 proxy port 21 ftp/tcp frag
+map le0 inet6 any -> ::/128 age 10/10
+map le0 inet6 192:168::/32 -> range 203:1:1::23-203:1:3::45 age 10/20
+map ppp0 inet6 192:168::/32 -> ::/128 portmap tcp 1:1 age 30/30
+map le0 inet6 any -> ::/128 frag age 10/10
+map le0 inet6 192:168::/32 -> range 203:1:1::23-203:1:3::45 frag age 10/20
+map ppp0 inet6 192:168::/32 -> ::/128 portmap tcp 1:1 frag age 30/30
+map fxp0 inet6 from 192::/18 to any port = 21 -> 1:2:3::4/128 proxy port 21 ftp/tcp
+map thisisalonginte inet6 any -> ::/128 mssclamp 1452 tag freddyliveshere
+map bar0 inet6 any -> ::/128 icmpidmap icmp 1000:2000
+map ppp0,adsl0 inet6 any -> ::/128
+map ppp0 inet6 from 192:168::/32 to any port = 123 -> ::/128 age 30/1 udp
Index: src/tests/ipf/expected/in2_6
diff -u /dev/null src/tests/ipf/expected/in2_6:1.1
--- /dev/null	Sun Jun 29 09:25:31

CVS commit: src/sys/dev/i2c

2014-06-29 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Sun Jun 29 09:06:05 UTC 2014

Modified Files:
src/sys/dev/i2c: hytp14reg.h

Log Message:
remove artifacts inspired by misleading documentation
fix address caculation macros
fix typoes


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/i2c/hytp14reg.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/i2c/hytp14reg.h
diff -u src/sys/dev/i2c/hytp14reg.h:1.1 src/sys/dev/i2c/hytp14reg.h:1.2
--- src/sys/dev/i2c/hytp14reg.h:1.1	Sun May 18 11:46:23 2014
+++ src/sys/dev/i2c/hytp14reg.h	Sun Jun 29 09:06:05 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: hytp14reg.h,v 1.1 2014/05/18 11:46:23 kardel Exp $ */
+/* $NetBSD: hytp14reg.h,v 1.2 2014/06/29 09:06:05 kardel Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -42,9 +42,6 @@
 
 #define HYTP14_DEFAULT_ADDR	0x28
 
-#define HYTP14_CMD_SEND		0x50 /* send command */
-#define HYTP14_CMD_RESP		0x51 /* receive response */
-
 #define HYTP14_CMD_START_NOM	0x80 /* end command mode (or power-off)  */
 #define HYTP14_CMD_START_CM	0xA0 /* start command mode (within 10ms after power-up) */
 #define HYTP14_CMD_GET_REV	0xB0 /* get revison */
@@ -53,13 +50,16 @@
 #define HYTP14_READ_OFFSET	0x00 /* command offset to read EEPROM words */
 #define HYTP14_WRITE_OFFSET	0x40 /* command offset to write EEPROM words */
 
-#define HYTP14_READ_EEPROM(_X_)	(HYTP14_READ_OFFSET + (_X_) & (HYTP14_NUM_WORDS - 1))
-#define HYTP14_WRITE_EEPROM(_X_) (HYTP14_WRITE_OFFSET + (_X_) & (HYTP14_NUM_WORDS - 1))
+#define HYTP14_READ_EEPROM(_X_)	(HYTP14_READ_OFFSET + ((_X_) & (HYTP14_NUM_WORDS - 1)))
+#define HYTP14_WRITE_EEPROM(_X_) (HYTP14_WRITE_OFFSET + ((_X_) & (HYTP14_NUM_WORDS - 1)))
 
-#define HYTP14_EEADDR_I2CADDR	0x1C /* I2C address EEPROD word address */
+#define HYTP14_EEADDR_I2CADDR	0x1C /* I2C address EEPROM word address */
 
 #define HYTP14_RESP_CMDMODE	0x80 /* command mode response */
-#define HYTP14_RESP_STALE	0y40 /* stale measurement data */
+#define HYTP14_RESP_STALE	0x40 /* stale measurement data */
+
+#define HYT_STATUS_FMT "\177\20b\7CM\0b\6STALE\0b\5ERR_CFG\0b\4ERR_RAM\0b\3ERR_UNCEEP\0"\
+   "b\2ERR_COREEP\0f\0\2RESP\0=\0BSY\0=\1ACK\0=\2NAK\0=\3INV\0\0"
 
 #define HYTP14_DIAG_ERR_CFG	0x20 /* configuration error */
 #define HYTP14_DIAG_ERR_RAMPRTY	0x10 /* RAM parity error */
@@ -81,10 +81,3 @@
 #define HYTP14_TEMP_OFFSET	(-40)
 
 #endif
-/*
- * $Log: hytp14reg.h,v $
- * Revision 1.1  2014/05/18 11:46:23  kardel
- * add HYT-221/271/939 humidity/temperature I2C sensor
- * extend envsys(4) framework by %rH (relative humidity)
- *
- */



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

2014-06-29 Thread Darren Reed
Module Name:src
Committed By:   darrenr
Date:   Sun Jun 29 08:58:01 UTC 2014

Modified Files:
src/external/bsd/ipf/dist/tools: ipnat_y.y

Log Message:
#552 destination port not zero after parsing nat rule
3561691 gethost never returns an ipv6 address


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/ipf/dist/tools/ipnat_y.y

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

Modified files:

Index: src/external/bsd/ipf/dist/tools/ipnat_y.y
diff -u src/external/bsd/ipf/dist/tools/ipnat_y.y:1.3 src/external/bsd/ipf/dist/tools/ipnat_y.y:1.4
--- src/external/bsd/ipf/dist/tools/ipnat_y.y:1.3	Thu Jun 12 22:15:25 2014
+++ src/external/bsd/ipf/dist/tools/ipnat_y.y	Sun Jun 29 08:58:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipnat_y.y,v 1.3 2014/06/12 22:15:25 joerg Exp $	*/
+/*	$NetBSD: ipnat_y.y,v 1.4 2014/06/29 08:58:01 darrenr Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -871,9 +871,9 @@ mapport:
 			  }
 			  free($2);
 			  if ($3.p1 < 0 || $3.p1 > 65535)
-yyerror("invalid ICMP Id number");
+yyerror("invalid 1st ICMP Id number");
 			  if ($3.p2 < 0 || $3.p2 > 65535)
-yyerror("invalid ICMP Id number");
+yyerror("invalid 2nd ICMP Id number");
 			  if (strcmp($2, "ipv6-icmp") == 0) {
 nat->in_pr[0] = IPPROTO_ICMPV6;
 nat->in_pr[1] = IPPROTO_ICMPV6;
@@ -1058,7 +1058,7 @@ hash:	IPNY_HASH			{ if (!(nat->in_flags 
 	;
 
 portstuff:
-	compare portspec		{ $$.pc = $1; $$.p1 = $2; }
+	compare portspec		{ $$.pc = $1; $$.p1 = $2; $$.p2 = 0; }
 	| portspec range portspec	{ $$.pc = $2; $$.p1 = $1; $$.p2 = $3; }
 	;
 
@@ -1151,7 +1151,7 @@ proto:	YY_NUMBER			{ $$ = $1;
 	| YY_STR			{ $$ = getproto($1);
 	  free($1);
 	  if ($$ == -1)
-		yyerror("unknwon protocol");
+		yyerror("unknown protocol");
 	  if ($$ != IPPROTO_TCP &&
 	  $$ != IPPROTO_UDP)
 		suggest_port = 0;
@@ -1164,17 +1164,20 @@ hexnumber:
 
 hostname:
 	YY_STR{ i6addr_t addr;
+	  int family;
 
-	  bzero(&$$, sizeof($$));
-	  if (gethost(AF_INET, $1,
-		  &addr) == 0) {
-		$$.a = addr;
-		$$.f = AF_INET;
-	  } else
-	  if (gethost(AF_INET6, $1,
+#ifdef USE_INET6
+	  if (nat->in_v[0] == 6)
+		family = AF_INET6;
+	  else
+#endif
+		family = AF_INET;
+	  memset(&($$), 0, sizeof($$));
+	  memset(&addr, 0, sizeof(addr));
+	  $$.f = family;
+	  if (gethost(family, $1,
 		  &addr) == 0) {
 		$$.a = addr;
-		$$.f = AF_INET6;
 	  } else {
 		FPRINTF(stderr,
 			"Unknown host '%s'\n",
@@ -1182,17 +1185,17 @@ hostname:
 	  }
 	  free($1);
 	}
-	| YY_NUMBER			{ bzero(&$$, sizeof($$));
+	| YY_NUMBER			{ memset(&($$), 0, sizeof($$));
 	  $$.a.in4.s_addr = htonl($1);
 	  if ($$.a.in4.s_addr != 0)
 		$$.f = AF_INET;
 	}
 	| ipv4{ $$ = $1; }
-	| YY_IPV6			{ bzero(&$$, sizeof($$));
+	| YY_IPV6			{ memset(&($$), 0, sizeof($$));
 	  $$.a = $1;
 	  $$.f = AF_INET6;
 	}
-	| YY_NUMBER YY_IPV6		{ bzero(&$$, sizeof($$));
+	| YY_NUMBER YY_IPV6		{ memset(&($$), 0, sizeof($$));
 	  $$.a = $2;
 	  $$.f = AF_INET6;
 	}
@@ -1427,6 +1430,9 @@ setnatproto(p)
 		nat->in_flags |= IPN_UDP;
 		nat->in_flags &= ~IPN_TCP;
 		break;
+#ifdef USE_INET6
+	case IPPROTO_ICMPV6 :
+#endif
 	case IPPROTO_ICMP :
 		nat->in_flags &= ~IPN_TCPUDP;
 		if (!(nat->in_flags & IPN_ICMPQUERY) &&
@@ -1506,7 +1512,7 @@ ipnat_addrule(fd, ioctlfunc, ptr)
 		printnat(ipn, opts);
 
 	if (opts & OPT_DEBUG)
-		binprint(ipn, sizeof(*ipn));
+		binprint(ipn, ipn->in_size);
 
 	if ((opts & OPT_ZERORULEST) != 0) {
 		if ((*ioctlfunc)(fd, add, (void *)&obj) == -1) {



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

2014-06-29 Thread Darren Reed
Module Name:src
Committed By:   darrenr
Date:   Sun Jun 29 08:53:08 UTC 2014

Modified Files:
src/external/bsd/ipf/dist/tools: ipf_y.y

Log Message:
#551 ipf.conf address structure not properly zero filled


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/ipf/dist/tools/ipf_y.y

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

Modified files:

Index: src/external/bsd/ipf/dist/tools/ipf_y.y
diff -u src/external/bsd/ipf/dist/tools/ipf_y.y:1.2 src/external/bsd/ipf/dist/tools/ipf_y.y:1.3
--- src/external/bsd/ipf/dist/tools/ipf_y.y:1.2	Thu Jun 12 17:23:06 2014
+++ src/external/bsd/ipf/dist/tools/ipf_y.y	Sun Jun 29 08:53:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipf_y.y,v 1.2 2014/06/12 17:23:06 christos Exp $	*/
+/*	$NetBSD: ipf_y.y,v 1.3 2014/06/29 08:53:08 darrenr Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -1022,12 +1022,13 @@ addr:	pool '/' YY_NUMBER		{ pooled = 1;
 	  yyexpectaddr = 0; }
 	;
 
-ipaddr:	IPFY_ANY			{ bzero(&($$), sizeof($$));
+ipaddr:	IPFY_ANY			{ memset(&($$), 0, sizeof($$));
 	  $$.type = FRI_NORMAL;
 	  $$.ifpos = -1;
 	  yyexpectaddr = 0;
 	}
-	| hostname			{ $$.a = $1.adr;
+	| hostname			{ memset(&($$), 0, sizeof($$));
+	  $$.a = $1.adr;
 	  $$.f = $1.f;
 	  if ($1.f == AF_INET6)
 		  fill6bits(128, $$.m.i6);
@@ -1040,7 +1041,8 @@ ipaddr:	IPFY_ANY			{ bzero(&($$), sizeof
 	| hostname			{ yyresetdict(); }
 		maskspace		{ yysetdict(maskwords);
 	  yyexpectaddr = 2; }
-		ipmask			{ ntomask($1.f, $5, $$.m.i6);
+		ipmask			{ memset(&($$), 0, sizeof($$));
+	  ntomask($1.f, $5, $$.m.i6);
 	  $$.a = $1.adr;
 	  $$.a.i6[0] &= $$.m.i6[0];
 	  $$.a.i6[1] &= $$.m.i6[1];
@@ -1062,7 +1064,8 @@ ipaddr:	IPFY_ANY			{ bzero(&($$), sizeof
 	  yyresetdict();
 	  yyexpectaddr = 0;
 	}
-	| '(' YY_STR ')'		{ $$.type = FRI_DYNAMIC;
+	| '(' YY_STR ')'		{ memset(&($$), 0, sizeof($$));
+	  $$.type = FRI_DYNAMIC;
 	  ifpflag = FRI_DYNAMIC;
 	  $$.ifpos = addname(&fr, $2);
 	  $$.lif = 0;
@@ -1070,7 +1073,8 @@ ipaddr:	IPFY_ANY			{ bzero(&($$), sizeof
 	| '(' YY_STR ')' '/'
 	  { ifpflag = FRI_DYNAMIC; yysetdict(maskwords); }
 	  maskopts
-	{ $$.type = ifpflag;
+	{ memset(&($$), 0, sizeof($$));
+	  $$.type = ifpflag;
 	  $$.ifpos = addname(&fr, $2);
 	  $$.lif = 0;
 	  if (frc->fr_family == AF_UNSPEC)
@@ -1085,7 +1089,8 @@ ipaddr:	IPFY_ANY			{ bzero(&($$), sizeof
 	| '(' YY_STR ':' YY_NUMBER ')' '/'
 	  { ifpflag = FRI_DYNAMIC; yysetdict(maskwords); }
 	  maskopts
-	{ $$.type = ifpflag;
+	{ memset(&($$), 0, sizeof($$));
+	  $$.type = ifpflag;
 	  $$.ifpos = addname(&fr, $2);
 	  $$.lif = $4;
 	  if (frc->fr_family == AF_UNSPEC)
@@ -1144,30 +1149,35 @@ maskopts:
 	;
 
 hostname:
-	ipv4{ $$.adr.in4 = $1;
+	ipv4{ memset(&($$), 0, sizeof($$));
+	  $$.adr.in4 = $1;
 	  if (frc->fr_family == AF_INET6)
 		YYERROR;
 	  $$.f = AF_INET;
 	  yyexpectaddr = 2;
 	}
-	| YY_NUMBER			{ if (frc->fr_family == AF_INET6)
+	| YY_NUMBER			{ memset(&($$), 0, sizeof($$));
+	  if (frc->fr_family == AF_INET6)
 		YYERROR;
 	  $$.adr.in4_addr = $1;
 	  $$.f = AF_INET;
 	  yyexpectaddr = 2;
 	}
-	| YY_HEX			{ if (frc->fr_family == AF_INET6)
+	| YY_HEX			{ memset(&($$), 0, sizeof($$));
+	  if (frc->fr_family == AF_INET6)
 		YYERROR;
 	  $$.adr.in4_addr = $1;
 	  $$.f = AF_INET;
 	  yyexpectaddr = 2;
 	}
-	| YY_STR			{ if (lookuphost($1, &$$.adr) == 0)
+	| YY_STR			{ memset(&($$), 0, sizeof($$));
+	  if (lookuphost($1, &$$.adr) == 0)
 		  $$.f = AF_INET;
 	  free($1);
 	  yyexpectaddr = 2;
 	}
-	| YY_IPV6			{ if (frc->fr_family == AF_INET)
+	| YY_IPV6			{ memset(&($$), 0, sizeof($$));
+	  if (frc->fr_family == AF_INET)
 		YYERROR;
 	  $$.adr = $1;
 	  $$.f = AF_INET6;



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

2014-06-29 Thread Darren Reed
Module Name:src
Committed By:   darrenr
Date:   Sun Jun 29 08:51:01 UTC 2014

Modified Files:
src/external/bsd/ipf/dist/lib: printnat.c

Log Message:
#536 ipnat can try to print rule as dstlist incorrectly


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/ipf/dist/lib/printnat.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/ipf/dist/lib/printnat.c
diff -u src/external/bsd/ipf/dist/lib/printnat.c:1.2 src/external/bsd/ipf/dist/lib/printnat.c:1.3
--- src/external/bsd/ipf/dist/lib/printnat.c:1.2	Sun Jul 22 14:27:37 2012
+++ src/external/bsd/ipf/dist/lib/printnat.c	Sun Jun 29 08:51:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: printnat.c,v 1.2 2012/07/22 14:27:37 darrenr Exp $	*/
+/*	$NetBSD: printnat.c,v 1.3 2014/06/29 08:51:01 darrenr Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -153,7 +153,8 @@ printnat(np, opts)
 
 	} else if (np->in_redir & NAT_REWRITE) {
 		PRINTF(" -> src ");
-		if (np->in_nsrc.na_type == IPLT_DSTLIST) {
+		if (np->in_nsrc.na_atype == FRI_LOOKUP &&
+		np->in_nsrc.na_type == IPLT_DSTLIST) {
 			PRINTF("dstlist/");
 			if (np->in_nsrc.na_subtype == 0)
 PRINTF("%d", np->in_nsrc.na_num);
@@ -174,7 +175,8 @@ printnat(np, opts)
 			}
 		}
 		PRINTF(" dst ");
-		if (np->in_ndst.na_type == IPLT_DSTLIST) {
+		if (np->in_ndst.na_atype == FRI_LOOKUP &&
+		np->in_ndst.na_type == IPLT_DSTLIST) {
 			PRINTF("dstlist/");
 			if (np->in_ndst.na_subtype == 0)
 PRINTF("%d", np->in_nsrc.na_num);