CVS commit: src/sys/net80211

2012-08-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug 20 07:30:10 UTC 2012

Modified Files:
src/sys/net80211: ieee80211.h

Log Message:
add more QoS bits


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/net80211/ieee80211.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/net80211/ieee80211.h
diff -u src/sys/net80211/ieee80211.h:1.21 src/sys/net80211/ieee80211.h:1.22
--- src/sys/net80211/ieee80211.h:1.21	Wed Nov  3 16:05:21 2010
+++ src/sys/net80211/ieee80211.h	Mon Aug 20 03:30:10 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211.h,v 1.21 2010/11/03 20:05:21 christos Exp $	*/
+/*	$NetBSD: ieee80211.h,v 1.22 2012/08/20 07:30:10 christos Exp $	*/
 /*-
  * Copyright (c) 2001 Atsushi Onoe
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -170,13 +170,22 @@ struct ieee80211_qosframe_addr4 {
 
 #define	IEEE80211_NWID_LEN			32
 
-#define	IEEE80211_QOS_TXOP			0x00ff
+/*
+ * QoS Control field (see 7.1.3.5).
+ */
 /* bit 8 is reserved */
-#define	IEEE80211_QOS_ACKPOLICY			0x60
+#define	IEEE80211_QOS_TXOP			0xff00
+#define	IEEE80211_QOS_AMSDU			0x0080  /* 11n */
+#define	IEEE80211_QOS_ACKPOLICY_NORMAL  0x
+#define	IEEE80211_QOS_ACKPOLICY_NOACK   0x0020
+#define	IEEE80211_QOS_ACKPOLICY_NOEXPLACK   0x0040
+#define	IEEE80211_QOS_ACKPOLICY			0x0060
 #define	IEEE80211_QOS_ACKPOLICY_S		5
-#define	IEEE80211_QOS_ESOP			0x10
+#define	IEEE80211_QOS_ACKPOLICY_MASK		0x0060
+#define	IEEE80211_QOS_ACKPOLICY_BA		0x0060
+#define	IEEE80211_QOS_ESOP			0x0010
 #define	IEEE80211_QOS_ESOP_S			4
-#define	IEEE80211_QOS_TID			0x0f
+#define	IEEE80211_QOS_TID			0x000f
 
 /* does frame have QoS sequence control data */
 #define	IEEE80211_QOS_HAS_SEQ(wh) \



CVS commit: src/sys/dev/usb

2012-08-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug 20 07:32:49 UTC 2012

Modified Files:
src/sys/dev/usb: if_otus.c if_otusvar.h if_run.c if_urtwnvar.h

Log Message:
remove duplicated QoS definitions


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/usb/if_otus.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/usb/if_otusvar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/usb/if_run.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/usb/if_urtwnvar.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/usb/if_otus.c
diff -u src/sys/dev/usb/if_otus.c:1.11 src/sys/dev/usb/if_otus.c:1.12
--- src/sys/dev/usb/if_otus.c:1.11	Sun Aug 19 03:55:54 2012
+++ src/sys/dev/usb/if_otus.c	Mon Aug 20 03:32:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_otus.c,v 1.11 2012/08/19 07:55:54 christos Exp $	*/
+/*	$NetBSD: if_otus.c,v 1.12 2012/08/20 07:32:49 christos Exp $	*/
 /*	$OpenBSD: if_otus.c,v 1.18 2010/08/27 17:08:00 jsg Exp $	*/
 
 /*-
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.11 2012/08/19 07:55:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.12 2012/08/20 07:32:49 christos Exp $");
 /*-
  * Driver for Atheros AR9001U chipset.
  * http://www.atheros.com/pt/bulletins/AR9001USBBulletin.pdf
@@ -1823,8 +1823,8 @@ otus_tx(struct otus_softc *sc, struct mb
 	macctl = AR_TX_MAC_BACKOFF | AR_TX_MAC_HW_DUR | AR_TX_MAC_QID(qid);
 
 	if (IEEE80211_IS_MULTICAST(wh->i_addr1) ||
-	(hasqos && ((qos & IEEE80211_QOS_ACK_POLICY_MASK) ==
-	 IEEE80211_QOS_ACK_POLICY_NOACK)))
+	(hasqos && ((qos & IEEE80211_QOS_ACKPOLICY_MASK) ==
+	 IEEE80211_QOS_ACKPOLICY_NOACK)))
 		macctl |= AR_TX_MAC_NOACK;
 
 	if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {

Index: src/sys/dev/usb/if_otusvar.h
diff -u src/sys/dev/usb/if_otusvar.h:1.2 src/sys/dev/usb/if_otusvar.h:1.3
--- src/sys/dev/usb/if_otusvar.h:1.2	Sun Aug 19 03:55:54 2012
+++ src/sys/dev/usb/if_otusvar.h	Mon Aug 20 03:32:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_otusvar.h,v 1.2 2012/08/19 07:55:54 christos Exp $	*/
+/*	$NetBSD: if_otusvar.h,v 1.3 2012/08/20 07:32:49 christos Exp $	*/
 /*	$OpenBSD: if_otusreg.h,v 1.6 2009/04/06 18:17:01 damien Exp $	*/
 
 /*-
@@ -53,10 +53,6 @@ enum ieee80211_edca_ac {
 };
 #define EDCA_NUM_AC	4
 
-/* XXX: OpenBSD has more of these defined with the standard referenced */
-#define IEEE80211_QOS_ACK_POLICY_NOACK		0x0020
-#define IEEE80211_QOS_ACK_POLICY_MASK		0x0060
-
 static __inline int
 ieee80211_has_addr4(const struct ieee80211_frame *wh)
 {

Index: src/sys/dev/usb/if_run.c
diff -u src/sys/dev/usb/if_run.c:1.3 src/sys/dev/usb/if_run.c:1.4
--- src/sys/dev/usb/if_run.c:1.3	Fri Jun  1 09:19:39 2012
+++ src/sys/dev/usb/if_run.c	Mon Aug 20 03:32:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_run.c,v 1.3 2012/06/01 13:19:39 nonaka Exp $	*/
+/*	$NetBSD: if_run.c,v 1.4 2012/08/20 07:32:49 christos Exp $	*/
 /*	$OpenBSD: if_run.c,v 1.90 2012/03/24 15:11:04 jsg Exp $	*/
 
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.3 2012/06/01 13:19:39 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.4 2012/08/20 07:32:49 christos Exp $");
 
 #include 
 #include 
@@ -2308,7 +2308,6 @@ run_tx(struct run_softc *sc, struct mbuf
 
 	txwi->txop = RT2860_TX_TXOP_BACKOFF;
 
-#define IEEE80211_QOS_ACKPOLICY_NOACK	0x20
 	if (!IEEE80211_IS_MULTICAST(wh->i_addr1) &&
 	(!hasqos || (qos & IEEE80211_QOS_ACKPOLICY) !=
 	IEEE80211_QOS_ACKPOLICY_NOACK)) {

Index: src/sys/dev/usb/if_urtwnvar.h
diff -u src/sys/dev/usb/if_urtwnvar.h:1.1 src/sys/dev/usb/if_urtwnvar.h:1.2
--- src/sys/dev/usb/if_urtwnvar.h:1.1	Sat Mar 24 20:11:16 2012
+++ src/sys/dev/usb/if_urtwnvar.h	Mon Aug 20 03:32:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwnvar.h,v 1.1 2012/03/25 00:11:16 nonaka Exp $	*/
+/*	$NetBSD: if_urtwnvar.h,v 1.2 2012/08/20 07:32:49 christos Exp $	*/
 /*	$OpenBSD: if_urtwnreg.h,v 1.3 2010/11/16 18:02:59 damien Exp $	*/
 
 /*-
@@ -94,7 +94,6 @@ struct urtwn_host_cmd_ring {
 };
 
 #if 1	/* XXX: sys/net80211/ieee80211.h */
-#define	IEEE80211_QOS_ACKPOLICY_BA	0x60	/* Block ACK */
 
 #define	IEEE80211_HTINFO_2NDCHAN	0x03	/* secondary/ext chan offset */
 #define	IEEE80211_HTINFO_2NDCHAN_S	0



CVS commit: src/sys/arch

2012-08-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Aug 20 07:45:24 UTC 2012

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_obio.c bcm2835reg.h files.bcm2835
src/sys/arch/evbarm/conf: RPI
Added Files:
src/sys/arch/arm/broadcom: bcm2835_mbox.c bcm2835_mbox.h
bcm2835_mboxreg.h

Log Message:
First pass at a VC mailbox driver.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/broadcom/bcm2835_mbox.c \
src/sys/arch/arm/broadcom/bcm2835_mbox.h \
src/sys/arch/arm/broadcom/bcm2835_mboxreg.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/broadcom/bcm2835_obio.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/broadcom/bcm2835reg.h \
src/sys/arch/arm/broadcom/files.bcm2835
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/RPI

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_obio.c
diff -u src/sys/arch/arm/broadcom/bcm2835_obio.c:1.3 src/sys/arch/arm/broadcom/bcm2835_obio.c:1.4
--- src/sys/arch/arm/broadcom/bcm2835_obio.c:1.3	Fri Aug 17 09:44:30 2012
+++ src/sys/arch/arm/broadcom/bcm2835_obio.c	Mon Aug 20 07:45:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_obio.c,v 1.3 2012/08/17 09:44:30 skrll Exp $	*/
+/*	$NetBSD: bcm2835_obio.c,v 1.4 2012/08/20 07:45:24 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_obio.c,v 1.3 2012/08/17 09:44:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_obio.c,v 1.4 2012/08/20 07:45:24 skrll Exp $");
 
 #include "opt_broadcom.h"
 #include "locators.h"
@@ -78,6 +78,13 @@ static const struct ambadev_locators bcm
 		.ad_size = BCM2835_ARMICU_SIZE,
 		.ad_intr = -1,
 	},
+{
+		/* Mailbox */
+		.ad_name = "bcmmbox",
+		.ad_addr = BCM2835_ARMMBOX_BASE,
+		.ad_size = BCM2835_ARMMBOX_SIZE,
+		.ad_intr = -1, /* BCM2835_INT_ARMMAILBOX */
+	},
 	{
 		/* System Timer */
 		.ad_name = "bcmtmr",

Index: src/sys/arch/arm/broadcom/bcm2835reg.h
diff -u src/sys/arch/arm/broadcom/bcm2835reg.h:1.1 src/sys/arch/arm/broadcom/bcm2835reg.h:1.2
--- src/sys/arch/arm/broadcom/bcm2835reg.h:1.1	Thu Jul 26 06:21:57 2012
+++ src/sys/arch/arm/broadcom/bcm2835reg.h	Mon Aug 20 07:45:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835reg.h,v 1.1 2012/07/26 06:21:57 skrll Exp $	*/
+/*	$NetBSD: bcm2835reg.h,v 1.2 2012/08/20 07:45:24 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -65,6 +65,9 @@
 #define	BCM2835_ARMICU_BASE	(BCM2835_ARM_BASE + 0x0200)
 #define	BCM2835_ARMICU_SIZE	0x200
 
+#define	BCM2835_ARMMBOX_BASE	(BCM2835_ARM_BASE + 0x0880)
+#define	BCM2835_ARMMBOX_SIZE	0x40
+
 #define	BCM2835_ARMICU_VBASE	BCM2835_IOPHYSTOVIRT(BCM2835_ARMICU_BASE)
 
 #define	BCM2835_INTC_BASE	(0x0)	/* Relative to BCM2835_ARMICU_BASE */
Index: src/sys/arch/arm/broadcom/files.bcm2835
diff -u src/sys/arch/arm/broadcom/files.bcm2835:1.1 src/sys/arch/arm/broadcom/files.bcm2835:1.2
--- src/sys/arch/arm/broadcom/files.bcm2835:1.1	Thu Jul 26 06:21:57 2012
+++ src/sys/arch/arm/broadcom/files.bcm2835	Mon Aug 20 07:45:24 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.bcm2835,v 1.1 2012/07/26 06:21:57 skrll Exp $
+#	$NetBSD: files.bcm2835,v 1.2 2012/08/20 07:45:24 skrll Exp $
 #
 # Configuration info for Broadcom BCM2835 ARM Peripherals
 #
@@ -27,6 +27,11 @@ device	bcmicu: pic, pic_splfuncs
 attach	bcmicu at obio with bcmicu
 file	arch/arm/broadcom/bcm2835_intr.c	bcmicu
 
+# VC Mailbox (BCM2835_ARMMBOX_BASE)
+device	bcmmbox
+attach	bcmmbox at obio with bcmmbox
+file	arch/arm/broadcom/bcm2835_mbox.c	bcmmbox
+
 # System Timer (BCM2835_TIMER_BASE)
 device	bcmtmr
 attach	bcmtmr at obio with bcmtmr_amba

Index: src/sys/arch/evbarm/conf/RPI
diff -u src/sys/arch/evbarm/conf/RPI:1.3 src/sys/arch/evbarm/conf/RPI:1.4
--- src/sys/arch/evbarm/conf/RPI:1.3	Fri Aug 17 19:43:24 2012
+++ src/sys/arch/evbarm/conf/RPI	Mon Aug 20 07:45:24 2012
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: RPI,v 1.3 2012/08/17 19:43:24 abs Exp $
+#	$NetBSD: RPI,v 1.4 2012/08/20 07:45:24 skrll Exp $
 #
 #	RPi -- Raspberry Pi
 #
@@ -176,6 +176,9 @@ obio0		at mainbus?
 # Interrupt Controller
 bcmicu0		at obio?
 
+# VC Mailbox
+bcmmbox0	at obio?
+
 # PL011 uart
 plcom0		at obio?
 

Added files:

Index: src/sys/arch/arm/broadcom/bcm2835_mbox.c
diff -u /dev/null src/sys/arch/arm/broadcom/bcm2835_mbox.c:1.1
--- /dev/null	Mon Aug 20 07:45:24 2012
+++ src/sys/arch/arm/broadcom/bcm2835_mbox.c	Mon Aug 20 07:45:24 2012
@@ -0,0 +1,151 @@
+/*	$NetBSD: bcm2835_mbox.c,v 1.1 2012/08/20 07:45:24 skrll Exp $	*/
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the abov

CVS commit: src/tests/modules

2012-08-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug 20 08:07:52 UTC 2012

Modified Files:
src/tests/modules: t_modctl.c

Log Message:
Fix stupid thinko when checking for the availability of options MODULAR
and permission to load modules.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/modules/t_modctl.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/modules/t_modctl.c
diff -u src/tests/modules/t_modctl.c:1.11 src/tests/modules/t_modctl.c:1.12
--- src/tests/modules/t_modctl.c:1.11	Sun Aug 19 20:54:56 2012
+++ src/tests/modules/t_modctl.c	Mon Aug 20 08:07:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_modctl.c,v 1.11 2012/08/19 20:54:56 martin Exp $	*/
+/*	$NetBSD: t_modctl.c,v 1.12 2012/08/20 08:07:52 martin Exp $	*/
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: t_modctl.c,v 1.11 2012/08/19 20:54:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: t_modctl.c,v 1.12 2012/08/20 08:07:52 martin Exp $");
 
 #include 
 #include 
@@ -70,12 +70,13 @@ check_permission(void)
 	int err;
 
 	err = modctl(MODCTL_EXISTS, 0);
-	if (err == ENOSYS)
+	if (err == 0) return;
+	if (errno == ENOSYS)
 		atf_tc_skip("Kernel does not have 'options MODULAR'.");
-	else if (err == EPERM)
+	else if (errno == EPERM)
 		atf_tc_skip("Module loading administratively forbidden");
-	ATF_REQUIRE_EQ_MSG(err, 0, "unexpected error code %d from "
-	"modctl(MODCTL_EXISTS, 0)", err);
+	ATF_REQUIRE_EQ_MSG(errno, 0, "unexpected error %d from "
+	"modctl(MODCTL_EXISTS, 0)", errno);
 }
 
 static bool



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

2012-08-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Aug 20 08:38:32 UTC 2012

Modified Files:
src/sys/arch/evbarm/conf: RPI

Log Message:
Better/different/consistent wscons colours.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/RPI

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

Modified files:

Index: src/sys/arch/evbarm/conf/RPI
diff -u src/sys/arch/evbarm/conf/RPI:1.4 src/sys/arch/evbarm/conf/RPI:1.5
--- src/sys/arch/evbarm/conf/RPI:1.4	Mon Aug 20 07:45:24 2012
+++ src/sys/arch/evbarm/conf/RPI	Mon Aug 20 08:38:32 2012
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: RPI,v 1.4 2012/08/20 07:45:24 skrll Exp $
+#	$NetBSD: RPI,v 1.5 2012/08/20 08:38:32 skrll Exp $
 #
 #	RPi -- Raspberry Pi
 #
@@ -197,10 +197,10 @@ ld* at sdmmc?
 # various options for wscons - we try to look as much like a standard
 # sun console as possible
 options 	WSEMUL_VT100		# sun terminal emulation
-options 	WS_DEFAULT_FG=WSCOL_BLACK
-options 	WS_DEFAULT_BG=WSCOL_LIGHT_WHITE
-options		WS_KERNEL_FG=WSCOL_GREEN
-options		WS_KERNEL_BG=WSCOL_LIGHT_WHITE
+options 	WS_DEFAULT_FG=WSCOL_WHITE
+options 	WS_DEFAULT_BG=WSCOL_BLACK
+options 	WS_KERNEL_FG=WSCOL_GREEN
+options 	WS_KERNEL_BG=WSCOL_BLACK
 options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
 options 	WSDISPLAY_COMPAT_RAWKBD		# can get raw scancodes
 options 	WSDISPLAY_DEFAULTSCREENS=4



CVS commit: src/sys/dev/usb

2012-08-20 Thread Matthias Drochner
Module Name:src
Committed By:   drochner
Date:   Mon Aug 20 10:32:32 UTC 2012

Modified Files:
src/sys/dev/usb: umass_scsipi.c

Log Message:
For devices which don't claim SPC-3, don't request 32 bytes of sense
data but just 18. Some devices signal an error if the transfer length
is not exactly what the device expects, and it is hard to deal with
these errors afterwards.
This makes a number of USB memory sticks and SD card readers work
which were not usable before.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/usb/umass_scsipi.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/usb/umass_scsipi.c
diff -u src/sys/dev/usb/umass_scsipi.c:1.45 src/sys/dev/usb/umass_scsipi.c:1.46
--- src/sys/dev/usb/umass_scsipi.c:1.45	Fri Apr 20 20:23:21 2012
+++ src/sys/dev/usb/umass_scsipi.c	Mon Aug 20 10:32:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_scsipi.c,v 1.45 2012/04/20 20:23:21 bouyer Exp $	*/
+/*	$NetBSD: umass_scsipi.c,v 1.46 2012/08/20 10:32:31 drochner Exp $	*/
 
 /*
  * Copyright (c) 2001, 2003, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.45 2012/04/20 20:23:21 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.46 2012/08/20 10:32:31 drochner Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_umass.h"
@@ -398,7 +398,7 @@ umass_scsipi_cb(struct umass_softc *sc, 
 	struct umass_scsipi_softc *scbus = (struct umass_scsipi_softc *)sc->bus;
 	struct scsipi_xfer *xs = priv;
 	struct scsipi_periph *periph = xs->xs_periph;
-	int cmdlen;
+	int cmdlen, senselen;
 	int s;
 #ifdef UMASS_DEBUG
 	struct timeval tv;
@@ -426,16 +426,20 @@ umass_scsipi_cb(struct umass_softc *sc, 
 		scbus->sc_sense_cmd.opcode = SCSI_REQUEST_SENSE;
 		scbus->sc_sense_cmd.byte2 = periph->periph_lun <<
 		SCSI_CMD_LUN_SHIFT;
-		scbus->sc_sense_cmd.length = sizeof(xs->sense);
 
 		if (sc->sc_cmd == UMASS_CPROTO_UFI ||
 		sc->sc_cmd == UMASS_CPROTO_ATAPI)
 			cmdlen = UFI_COMMAND_LENGTH;	/* XXX */
 		else
 			cmdlen = sizeof(scbus->sc_sense_cmd);
+		if (periph->periph_version < 0x05) /* SPC-3 */
+			senselen = 18;
+		else
+			senselen = sizeof(xs->sense);
+		scbus->sc_sense_cmd.length = senselen;
 		sc->sc_methods->wire_xfer(sc, periph->periph_lun,
 	  &scbus->sc_sense_cmd, cmdlen,
-	  &xs->sense, sizeof(xs->sense),
+	  &xs->sense, senselen,
 	  DIR_IN, xs->timeout, 0,
 	  umass_scsipi_sense_cb, xs);
 		return;



CVS commit: src/sys/dev/ic

2012-08-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Mon Aug 20 11:59:29 UTC 2012

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

Log Message:
Fix AHCI_QUIRK_BADPMPRESET: when reset fails for drive 15, stop, clear
errors and restart the channel before retrying with drive 0.
Should fix the problem of drives not detected any more reported by
Markus W Kilbinger on current-users.


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

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

Modified files:

Index: src/sys/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.41 src/sys/dev/ic/ahcisata_core.c:1.42
--- src/sys/dev/ic/ahcisata_core.c:1.41	Fri Aug 10 16:35:00 2012
+++ src/sys/dev/ic/ahcisata_core.c	Mon Aug 20 11:59:29 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.41 2012/08/10 16:35:00 bouyer Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.42 2012/08/20 11:59:29 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.41 2012/08/10 16:35:00 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.42 2012/08/20 11:59:29 bouyer Exp $");
 
 #include 
 #include 
@@ -644,6 +644,7 @@ ahci_do_reset_drive(struct ata_channel *
 	uint32_t sig;
 
 	KASSERT((AHCI_READ(sc, AHCI_P_CMD(chp->ch_channel)) & AHCI_P_CMD_CR) == 0);
+again:
 	/* clear port interrupt register */
 	AHCI_WRITE(sc, AHCI_P_IS(chp->ch_channel), 0x);
 	/* clear SErrors and start operations */
@@ -660,7 +661,6 @@ ahci_do_reset_drive(struct ata_channel *
 	if (drive > 0) {
 		KASSERT(sc->sc_ahci_cap & AHCI_CAP_SPM);
 	}
-again:
 	/* polled command, assume interrupts are disabled */
 	/* use slot 0 to send reset, the channel is idle */
 	cmd_h = &achp->ahcic_cmdh[0];
@@ -701,6 +701,7 @@ again:
 			 * try again with port 0
 			 */
 			drive = 0;
+			ahci_channel_stop(sc, chp, flags);
 			goto again;
 		}
 		aprint_error("%s channel %d: clearing WDCTL_RST failed "



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

2012-08-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Aug 20 12:38:29 UTC 2012

Modified Files:
src/sys/arch/arm/omap: files.omap2 omap2_gpio.c omap2_gpmcreg.h
omap2_icu.c omap2_obio.c omap2_obioreg.h omap2_reg.h
omap_nobyteacc_io.S

Log Message:
Add support for the TI AM335x (beaglebone) and the OMAP4430 (pandaboard)


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/omap/files.omap2
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/omap/omap2_gpio.c \
src/sys/arch/arm/omap/omap2_icu.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/omap/omap2_gpmcreg.h \
src/sys/arch/arm/omap/omap2_reg.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/omap/omap2_obio.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/omap/omap2_obioreg.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/omap/omap_nobyteacc_io.S

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

Modified files:

Index: src/sys/arch/arm/omap/files.omap2
diff -u src/sys/arch/arm/omap/files.omap2:1.11 src/sys/arch/arm/omap/files.omap2:1.12
--- src/sys/arch/arm/omap/files.omap2:1.11	Thu Jul 12 03:30:29 2012
+++ src/sys/arch/arm/omap/files.omap2	Mon Aug 20 12:38:28 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.omap2,v 1.11 2012/07/12 03:30:29 matt Exp $
+#	$NetBSD: files.omap2,v 1.12 2012/08/20 12:38:28 matt Exp $
 #
 # Configuration info for Texas Instruments OMAP2/OMAP3 CPU support
 # Based on xscale/files.pxa2x0
@@ -19,6 +19,7 @@ defflag	opt_omap.hOMAP_2430: OMAP2
 defflag opt_omap.hOMAP_2420: OMAP2
 defflag opt_omap.hOMAP_3530: OMAP3
 defflag opt_omap.hOMAP_4430: OMAP4
+defflag opt_omap.hTI_AM335X: OMAP3
 
 # OBIO just an attach point
 device	obio { [addr=-1], [size=0], [intr=-1], [mult=1], [intrbase=-1], [nobyteacc=0]

Index: src/sys/arch/arm/omap/omap2_gpio.c
diff -u src/sys/arch/arm/omap/omap2_gpio.c:1.8 src/sys/arch/arm/omap/omap2_gpio.c:1.9
--- src/sys/arch/arm/omap/omap2_gpio.c:1.8	Fri Jul  1 20:30:21 2011
+++ src/sys/arch/arm/omap/omap2_gpio.c	Mon Aug 20 12:38:28 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap2_gpio.c,v 1.8 2011/07/01 20:30:21 dyoung Exp $	*/
+/*	$NetBSD: omap2_gpio.c,v 1.9 2012/08/20 12:38:28 matt Exp $	*/
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -28,7 +28,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.8 2011/07/01 20:30:21 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.9 2012/08/20 12:38:28 matt Exp $");
 
 #define _INTR_PRIVATE
 
@@ -348,6 +348,13 @@ gpio_match(device_t parent, cfdata_t cfd
 	|| oa->obio_addr == GPIO6_BASE_3530)
 		return 1;
 #endif
+#ifdef TI_AM335X
+	if (oa->obio_addr == GPIO0_BASE_TI_AM335X
+	|| oa->obio_addr == GPIO1_BASE_TI_AM335X
+	|| oa->obio_addr == GPIO2_BASE_TI_AM335X
+	|| oa->obio_addr == GPIO3_BASE_TI_AM335X)
+		return 1;
+#endif
 
 	return 0;
 }
Index: src/sys/arch/arm/omap/omap2_icu.c
diff -u src/sys/arch/arm/omap/omap2_icu.c:1.8 src/sys/arch/arm/omap/omap2_icu.c:1.9
--- src/sys/arch/arm/omap/omap2_icu.c:1.8	Fri Jul  1 20:30:21 2011
+++ src/sys/arch/arm/omap/omap2_icu.c	Mon Aug 20 12:38:28 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap2_icu.c,v 1.8 2011/07/01 20:30:21 dyoung Exp $	*/
+/*	$NetBSD: omap2_icu.c,v 1.9 2012/08/20 12:38:28 matt Exp $	*/
 /*
  * Define the SDP2430 specific information and then include the generic OMAP
  * interrupt header.
@@ -30,7 +30,7 @@
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap2_icu.c,v 1.8 2011/07/01 20:30:21 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap2_icu.c,v 1.9 2012/08/20 12:38:28 matt Exp $");
 
 #include 
 #include 
@@ -172,7 +172,7 @@ omap2icu_match(device_t parent, cfdata_t
 
 #if defined(OMAP_2430) || defined(OMAP_2420)
 	return oa->obio_addr == INTC_BASE;
-#elif defined(OMAP_3530)
+#elif defined(OMAP3)
 	return oa->obio_addr == INTC_BASE_3530;
 #else
 #error unsupported OMAP variant

Index: src/sys/arch/arm/omap/omap2_gpmcreg.h
diff -u src/sys/arch/arm/omap/omap2_gpmcreg.h:1.5 src/sys/arch/arm/omap/omap2_gpmcreg.h:1.6
--- src/sys/arch/arm/omap/omap2_gpmcreg.h:1.5	Mon Feb  7 23:22:18 2011
+++ src/sys/arch/arm/omap/omap2_gpmcreg.h	Mon Aug 20 12:38:28 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap2_gpmcreg.h,v 1.5 2011/02/07 23:22:18 ahoka Exp $	*/
+/*	$NetBSD: omap2_gpmcreg.h,v 1.6 2012/08/20 12:38:28 matt Exp $	*/
 /*
  * Copyright (c) 2007 Microsoft
  * All rights reserved.
@@ -47,6 +47,9 @@
 #ifdef OMAP_3530
 #define GPMC_BASE			0x6e00
 #endif
+#ifdef TI_AM335X
+#define GPMC_BASE			0x5000
+#endif
 
 #define GPMC_REVISION			0x000
 #define GPMC_SYSCONFIG			0x010
Index: src/sys/arch/arm/omap/omap2_reg.h
diff -u src/sys/arch/arm/omap/omap2_reg.h:1.5 src/sys/arch/arm/omap/omap2_reg.h:1.6
--- src/sys/arch/arm/omap/omap2_reg.h:1.5	Thu Jul 12 03:38:25 2012
+++ src/sys/arch/arm/omap/omap2_reg.h	Mon Aug 20 12:38:29 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: omap2_reg.h,v 1.5 2012/07/12 03:38:25 matt Exp $ */
+/* $NetBS

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

2012-08-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Aug 20 12:40:40 UTC 2012

Modified Files:
src/sys/arch/evbarm/beagle: beagle.h beagle_machdep.c beagle_start.S

Log Message:
Add initial support for BEAGLEBONE and PANDABOARD.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/beagle/beagle.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbarm/beagle/beagle_machdep.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/beagle/beagle_start.S

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

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle.h
diff -u src/sys/arch/evbarm/beagle/beagle.h:1.3 src/sys/arch/evbarm/beagle/beagle.h:1.4
--- src/sys/arch/evbarm/beagle/beagle.h:1.3	Wed Jun 16 22:06:54 2010
+++ src/sys/arch/evbarm/beagle/beagle.h	Mon Aug 20 12:40:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle.h,v 1.3 2010/06/16 22:06:54 jmcneill Exp $	*/
+/*	$NetBSD: beagle.h,v 1.4 2012/08/20 12:40:40 matt Exp $	*/
 /*
  * Copyright (c) 2007 Microsoft
  * All rights reserved.
@@ -34,21 +34,58 @@
 #include 
 
 /*
- * Kernel VM space: 576MB at KERNEL_VM_BASE
+ * Memory will mapped 1:1 VA:PA starting at 0x8000
+ * Kernel VM space: 512MB at KERNEL_VM_BASE
  */
-#define	KERNEL_VM_BASE		((KERNEL_BASE + 0x0100) & ~(0x40-1))
-#define KERNEL_VM_SIZE		0x2400
+#define KERNEL_VM_BASE		0xc000
+#define KERNEL_VM_SIZE		0x2000
+
+#ifdef OMAP_3530
+#define OMAP_L4_CORE_BASE		OMAP3530_L4_CORE_BASE
+#define OMAP_L4_CORE_SIZE		OMAP3530_L4_CORE_SIZE
+#define OMAP_L4_PERIPHERAL_BASE		OMAP3530_L4_PERIPHERAL_BASE
+#define OMAP_L4_PERIPHERAL_SIZE		OMAP3530_L4_PERIPHERAL_SIZE
+#define OMAP_L4_WAKEUP_BASE		OMAP3530_L4_WAKEUP_BASE
+#define OMAP_L4_WAKEUP_SIZE		OMAP3530_L4_WAKEUP_SIZE
+#endif
+
+#ifdef OMAP_4430
+#define OMAP_L4_CORE_BASE		OMAP4430_L4_CORE_BASE
+#define OMAP_L4_CORE_SIZE		OMAP4430_L4_CORE_SIZE
+#define OMAP_L4_PERIPHERAL_BASE		OMAP4430_L4_PERIPHERAL_BASE
+#define OMAP_L4_PERIPHERAL_SIZE		OMAP4430_L4_PERIPHERAL_SIZE
+#define OMAP_L4_WAKEUP_BASE		OMAP4430_L4_WAKEUP_BASE
+#define OMAP_L4_WAKEUP_SIZE		OMAP4430_L4_WAKEUP_SIZE
+#endif
+
+#ifdef TI_AM335X
+#define OMAP_L4_CORE_BASE		TI_AM335X_L4_WAKEUP_BASE
+#define OMAP_L4_CORE_SIZE		TI_AM335X_L4_WAKEUP_SIZE
+#define OMAP_L4_PERIPHERAL_BASE		TI_AM335X_L4_PERIPHERAL_BASE
+#define OMAP_L4_PERIPHERAL_SIZE		TI_AM335X_L4_PERIPHERAL_SIZE
+#define OMAP_L4_FAST_BASE		TI_AM335X_L4_FAST_BASE
+#define OMAP_L4_FAST_SIZE		TI_AM335X_L4_FAST_SIZE
+#endif
 
 /*
  * We devmap IO starting at KERNEL_VM_BASE + KERNEL_VM_SIZE
  */
-#define	OMAP3530_KERNEL_IO_VBASE	(KERNEL_VM_BASE + KERNEL_VM_SIZE)
-#define	OMAP3530_L4_CORE_VBASE		OMAP3530_KERNEL_IO_VBASE
-#define	OMAP3530_L4_PERIPHERAL_VBASE	(OMAP3530_L4_CORE_VBASE   + OMAP3530_L4_CORE_SIZE)
-#define	OMAP3530_L4_WAKEUP_VBASE	(OMAP3530_L4_PERIPHERAL_VBASE + OMAP3530_L4_PERIPHERAL_SIZE)
-#define	OMAP3530_KERNEL_IO_VEND		(OMAP3530_L4_WAKEUP_VBASE + OMAP3530_L4_WAKEUP_SIZE)
-
-#define CONSADDR_VA	((CONSADDR - OMAP3530_L4_PERIPHERAL_BASE) + OMAP3530_L4_PERIPHERAL_VBASE)
+#define OMAP_KERNEL_IO_VBASE	(KERNEL_VM_BASE + KERNEL_VM_SIZE)
+#if defined(OMAP_3530) || defined(OMAP_4430)
+#define OMAP_L4_CORE_VBASE	OMAP_KERNEL_IO_VBASE
+#define OMAP_L4_PERIPHERAL_VBASE	(OMAP_L4_CORE_VBASE + OMAP_L4_CORE_SIZE)
+#define OMAP_L4_WAKEUP_VBASE	(OMAP_L4_PERIPHERAL_VBASE + OMAP_L4_PERIPHERAL_SIZE)
+#define OMAP_KERNEL_IO_VEND	(OMAP_L4_WAKEUP_VBASE + OMAP_L4_WAKEUP_SIZE)
+#define CONSADDR_VA	((CONSADDR - OMAP_L4_PERIPHERAL_BASE) + OMAP_L4_PERIPHERAL_VBASE)
+#elif defined(TI_AM335X)
+#define OMAP_L4_CORE_VBASE	OMAP_KERNEL_IO_VBASE
+#define OMAP_L4_PERIPHERAL_VBASE	(OMAP_L4_CORE_VBASE + OMAP_L4_CORE_SIZE)
+#define OMAP_L4_FAST_VBASE	(OMAP_L4_PERIPHERAL_VBASE + OMAP_L4_PERIPHERAL_SIZE)
+#define OMAP_KERNEL_IO_VEND	(OMAP_L4_FAST_VBASE + OMAP_L4_FAST_SIZE)
+#define CONSADDR_VA	((CONSADDR - OMAP_L4_CORE_BASE) + OMAP_L4_CORE_VBASE)
+#else
+#error unknown OMAP variant
+#endif
 
 
 #endif /* _EVBARM_BEAGLE_BEAGLE_H */

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.15 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.16
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.15	Thu Aug 16 18:26:22 2012
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Mon Aug 20 12:40:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.15 2012/08/16 18:26:22 matt Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.16 2012/08/20 12:40:40 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.15 2012/08/16 18:26:22 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.16 2012/08/20 12:40:40 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -348,9 +348,9 @@ static const struct pmap_devmap devmap[]
 		 * this gets us the ICU, I2C, USB, GPT[10-11], MMC, McSPI
 		 * UART[12], clock manager, sDMA

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

2012-08-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Aug 20 12:44:31 UTC 2012

Modified Files:
src/sys/arch/evbarm/conf: mk.beagle

Log Message:
Make gzip'ed uboot images.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/conf/mk.beagle

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

Modified files:

Index: src/sys/arch/evbarm/conf/mk.beagle
diff -u src/sys/arch/evbarm/conf/mk.beagle:1.6 src/sys/arch/evbarm/conf/mk.beagle:1.7
--- src/sys/arch/evbarm/conf/mk.beagle:1.6	Sat Jul 14 06:55:18 2012
+++ src/sys/arch/evbarm/conf/mk.beagle	Mon Aug 20 12:44:31 2012
@@ -1,14 +1,16 @@
-#	$NetBSD: mk.beagle,v 1.6 2012/07/14 06:55:18 matt Exp $
-CPPFLAGS+= -mcpu=cortex-a8
+#	$NetBSD: mk.beagle,v 1.7 2012/08/20 12:44:31 matt Exp $
+CPPFLAGS+=		-mcpu=cortex-a8
 
 SYSTEM_FIRST_OBJ=	beagle_start.o
 SYSTEM_FIRST_SFILE=	${THISARM}/beagle/beagle_start.S
 
 _OSRELEASE!=		${HOST_SH} $S/conf/osrelease.sh
 
-MKUBOOTIMAGEARGS=	-A arm -T kernel -C none
+MKUBOOTIMAGEARGS=	-A arm -T kernel
 MKUBOOTIMAGEARGS+=	-a $(LOADADDRESS) -e $(LOADADDRESS)
 MKUBOOTIMAGEARGS+=	-n "NetBSD/$(BOARDTYPE) ${_OSRELEASE}"
+MKUBOOTIMAGEARGS_NONE=	${MKUBOOTIMAGEARGS} -C none
+MKUBOOTIMAGEARGS_GZ=	${MKUBOOTIMAGEARGS} -C gz
 
 KERNEL_BASE_PHYS=$(LOADADDRESS)
 KERNEL_BASE_VIRT=$(LOADADDRESS)
@@ -16,9 +18,14 @@ KERNEL_BASE_VIRT=$(LOADADDRESS)
 SYSTEM_LD_TAIL_EXTRA+=; \
 	echo ${OBJCOPY} -S -O binary $@ $@.bin; \
 	${OBJCOPY} -S -O binary $@ $@.bin; \
-	echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS} $@.bin $@.ub; \
-	${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS} $@.bin $@.ub; \
-	echo
+	echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_NONE} $@.bin $@.ub; \
+	${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_NONE} $@.bin $@.ub; \
+	echo ${TOOL_GZIP} -c $@.bin > $@.bin.gz; \
+	${TOOL_GZIP} -c $@.bin > $@.bin.gz; \
+	echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.gz.ub; \
+	${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.gz.ub
 
 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin@}
 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.ub@}
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin.gz@}
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gz.ub@}



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

2012-08-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Aug 20 12:45:36 UTC 2012

Added Files:
src/sys/arch/evbarm/conf: BEAGLEBONE

Log Message:
Inital config file BEAGLEBONE


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/BEAGLEBONE

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

Added files:

Index: src/sys/arch/evbarm/conf/BEAGLEBONE
diff -u /dev/null src/sys/arch/evbarm/conf/BEAGLEBONE:1.1
--- /dev/null	Mon Aug 20 12:45:36 2012
+++ src/sys/arch/evbarm/conf/BEAGLEBONE	Mon Aug 20 12:45:36 2012
@@ -0,0 +1,293 @@
+#
+#	$NetBSD: BEAGLEBONE,v 1.1 2012/08/20 12:45:36 matt Exp $
+#
+#	BEAGLEBONE -- TI AM335x board Kernel
+#
+
+include	"arch/evbarm/conf/std.beagle"
+
+# estimated number of users
+
+maxusers	32
+
+# Standard system options
+
+options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
+#options 	NTP		# NTP phase/frequency locked loop
+
+# CPU options
+
+options 	CPU_CORTEXA8
+options 	TI_AM335X
+options 	PMAPCOUNTERS
+
+# Architecture options
+#makeoptions	CPUFLAGS+="-mthumb"
+
+# File systems
+
+file-system	FFS		# UFS
+#file-system	LFS		# log-structured file system
+file-system	MFS		# memory file system
+file-system	NFS		# Network file system
+#file-system 	ADOSFS		# AmigaDOS-compatible file system
+#file-system 	EXT2FS		# second extended file system (linux)
+#file-system	CD9660		# ISO 9660 + Rock Ridge file system
+file-system	MSDOSFS		# MS-DOS file system
+#file-system	FDESC		# /dev/fd
+#file-system	KERNFS		# /kern
+#file-system	NULLFS		# loopback file system
+#file-system	PROCFS		# /proc
+#file-system	UMAPFS		# NULLFS + uid and gid remapping
+#file-system	UNION		# union file system
+file-system	TMPFS		# memory file system
+file-system	PTYFS		# /dev/pts/N support
+
+# File system options
+#options 	QUOTA		# legacy UFS quotas
+#options 	QUOTA2		# new, in-filesystem UFS quotas
+#options 	FFS_EI		# FFS Endian Independent support
+#options 	NFSSERVER
+options 	WAPBL		# File system journaling support
+#options 	FFS_NO_SNAPSHOT	# No FFS snapshot support
+
+# Networking options
+
+#options 	GATEWAY		# packet forwarding
+options 	INET		# IP + ICMP + TCP + UDP
+options 	INET6		# IPV6
+#options 	IPSEC		# IP security
+#options 	IPSEC_ESP	# IP security (encryption part; define w/ IPSEC)
+#options 	IPSEC_NAT_T	# IPsec NAT traversal (NAT-T)
+#options 	IPSEC_DEBUG	# debug for IP security
+#options 	MROUTING	# IP multicast routing
+#options 	PIM		# Protocol Independent Multicast
+#options 	NS		# XNS
+#options 	NSIP		# XNS tunneling over IP
+#options 	ISO,TPIP	# OSI
+#options 	EON		# OSI tunneling over IP
+#options 	CCITT,LLC,HDLC	# X.25
+#options 	NETATALK	# AppleTalk networking
+#options 	PFIL_HOOKS	# pfil(9) packet filter hooks
+#options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
+#options 	PPP_DEFLATE	# Deflate compression support for PPP
+#options 	PPP_FILTER	# Active filter support for PPP (requires bpf)
+#options 	TCP_DEBUG	# Record last TCP_NDEBUG packets with SO_DEBUG
+
+options 	NFS_BOOT_BOOTP
+options 	NFS_BOOT_DHCP
+#options		NFS_BOOT_BOOTSTATIC
+#options		NFS_BOOTSTATIC_MYIP="\"192.168.1.4\""
+#options		NFS_BOOTSTATIC_GWIP="\"192.168.1.1\""
+#options		NFS_BOOTSTATIC_MASK="\"255.255.255.0\""
+#options		NFS_BOOTSTATIC_SERVADDR="\"192.168.1.1\""
+#options		NFS_BOOTSTATIC_SERVER="\"192.168.1.1:/nfs/sdp2430\""
+
+options		NFS_BOOT_RWSIZE=1024
+
+# Compatibility options
+
+#options 	COMPAT_43	# 4.3BSD compatibility.
+options 	COMPAT_50	# NetBSD 5.0 compatibility.
+options 	COMPAT_40	# NetBSD 4.0 compatibility.
+options 	COMPAT_30	# NetBSD 3.0 compatibility.
+#options 	COMPAT_20	# NetBSD 2.0 compatibility.
+#options 	COMPAT_16	# NetBSD 1.6 compatibility.
+#options 	COMPAT_15	# NetBSD 1.5 compatibility.
+#options 	COMPAT_14	# NetBSD 1.4 compatibility.
+#options 	COMPAT_13	# NetBSD 1.3 compatibility.
+#options 	COMPAT_12	# NetBSD 1.2 compatibility.
+#options 	COMPAT_11	# NetBSD 1.1 compatibility.
+#options 	COMPAT_10	# NetBSD 1.0 compatibility.
+#options 	COMPAT_09	# NetBSD 0.9 compatibility.
+#options 	TCP_COMPAT_42	# 4.2BSD TCP/IP bug compat. Not recommended.
+#options		COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
+
+# Shared memory options
+
+options 	SYSVMSG		# System V-like message queues
+options 	SYSVSEM		# System V-like semaphores
+options 	SYSVSHM		# System V-like memory sharing
+
+# Device options
+
+#options 	MEMORY_DISK_HOOKS	# boottime setup of ramdisk
+#options 	MEMORY_DISK_ROOT_SIZE=8192	# Size in blocks
+#options 	MEMORY_DISK_DYNAMIC
+#options 	MINIROOTSIZE=1000	# Size in blocks
+#options 	MEMORY_DISK_IS_ROOT	# use memory disk as root
+
+# Miscellaneous kernel options
+options 	KTRACE		# system call tracing, a la ktrace(1)
+#options 	KMEMSTATS	# kernel memory statistics
+#options 	SCSIVERBOSE	# Verbose SCSI errors
+#options 	MIIVERBOSE	# Verbose MII autoconfuration messages
+#options 	DDB_KEYCODE=0x40
+#options 	USERCONF	# userconf(4) support
+#options	PIPE_SOCK

CVS commit: src/sys/dev

2012-08-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Mon Aug 20 12:48:47 UTC 2012

Modified Files:
src/sys/dev/ic: ahcisata_core.c ahcisatavar.h
src/sys/dev/pci: ahcisata_pci.c

Log Message:
Fix typo, pointed out by Markus W Kilbinger


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/ic/ahcisata_core.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/ahcisatavar.h
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/pci/ahcisata_pci.c

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

Modified files:

Index: src/sys/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.42 src/sys/dev/ic/ahcisata_core.c:1.43
--- src/sys/dev/ic/ahcisata_core.c:1.42	Mon Aug 20 11:59:29 2012
+++ src/sys/dev/ic/ahcisata_core.c	Mon Aug 20 12:48:47 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.42 2012/08/20 11:59:29 bouyer Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.43 2012/08/20 12:48:47 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.42 2012/08/20 11:59:29 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.43 2012/08/20 12:48:47 bouyer Exp $");
 
 #include 
 #include 
@@ -225,7 +225,7 @@ ahci_attach(struct ahci_softc *sc)
 		return;
 
 	sc->sc_ahci_cap = AHCI_READ(sc, AHCI_CAP);
-	if (sc->sc_achi_quirks & AHCI_QUIRK_BADPMP) {
+	if (sc->sc_ahci_quirks & AHCI_QUIRK_BADPMP) {
 		aprint_verbose_dev(sc->sc_atac.atac_dev,
 		"ignoring broken port multiplier support\n");
 		sc->sc_ahci_cap &= ~AHCI_CAP_SPM;
@@ -693,7 +693,7 @@ again:
 	switch(ahci_exec_fis(chp, 31, flags)) {
 	case ERR_DF:
 	case TIMEOUT:
-		if ((sc->sc_achi_quirks & AHCI_QUIRK_BADPMPRESET) != 0 &&
+		if ((sc->sc_ahci_quirks & AHCI_QUIRK_BADPMPRESET) != 0 &&
 		drive == PMP_PORT_CTL) {
 			/*
 			 * some controllers fails to reset when

Index: src/sys/dev/ic/ahcisatavar.h
diff -u src/sys/dev/ic/ahcisatavar.h:1.12 src/sys/dev/ic/ahcisatavar.h:1.13
--- src/sys/dev/ic/ahcisatavar.h:1.12	Mon Aug 13 19:42:50 2012
+++ src/sys/dev/ic/ahcisatavar.h	Mon Aug 20 12:48:47 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisatavar.h,v 1.12 2012/08/13 19:42:50 bouyer Exp $	*/
+/*	$NetBSD: ahcisatavar.h,v 1.13 2012/08/20 12:48:47 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@ struct ahci_softc {
 	bus_dma_segment_t sc_cmd_hdr_seg;
 	int sc_cmd_hdr_nseg;
 	int sc_atac_capflags;
-	int sc_achi_quirks;
+	int sc_ahci_quirks;
 #define AHCI_PCI_QUIRK_FORCE	__BIT(0)  /* force attach */
 #define AHCI_PCI_QUIRK_BAD64	__BIT(1)  /* broken 64-bit DMA */
 #define AHCI_QUIRK_BADPMP	__BIT(2)  /* broken PMP support, ignore */

Index: src/sys/dev/pci/ahcisata_pci.c
diff -u src/sys/dev/pci/ahcisata_pci.c:1.29 src/sys/dev/pci/ahcisata_pci.c:1.30
--- src/sys/dev/pci/ahcisata_pci.c:1.29	Fri Aug 10 16:40:40 2012
+++ src/sys/dev/pci/ahcisata_pci.c	Mon Aug 20 12:48:47 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_pci.c,v 1.29 2012/08/10 16:40:40 bouyer Exp $	*/
+/*	$NetBSD: ahcisata_pci.c,v 1.30 2012/08/20 12:48:47 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.29 2012/08/10 16:40:40 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.30 2012/08/20 12:48:47 bouyer Exp $");
 
 #include 
 #include 
@@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: ahcisata_pci
 struct ahci_pci_quirk { 
 	pci_vendor_id_t  vendor;	/* Vendor ID */
 	pci_product_id_t product;	/* Product ID */
-	int  quirks;	/* quirks; same as sc_achi_quirks */
+	int  quirks;	/* quirks; same as sc_ahci_quirks */
 };
 
 static const struct ahci_pci_quirk ahci_pci_quirks[] = {
@@ -292,11 +292,11 @@ ahci_pci_attach(device_t parent, device_
 
 	sc->sc_dmat = pa->pa_dmat;
 
-	sc->sc_achi_quirks = ahci_pci_has_quirk(PCI_VENDOR(pa->pa_id),
+	sc->sc_ahci_quirks = ahci_pci_has_quirk(PCI_VENDOR(pa->pa_id),
 	PCI_PRODUCT(pa->pa_id));
 
 	ahci_cap_64bit = (AHCI_READ(sc, AHCI_CAP) & AHCI_CAP_64BIT) != 0;
-	ahci_bad_64bit = ((sc->sc_achi_quirks & AHCI_PCI_QUIRK_BAD64) != 0);
+	ahci_bad_64bit = ((sc->sc_ahci_quirks & AHCI_PCI_QUIRK_BAD64) != 0);
 
 	if (pci_dma64_available(pa) && ahci_cap_64bit) {
 		if (!ahci_bad_64bit)



CVS commit: src/sys/arch/arm

2012-08-20 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Aug 20 13:03:41 UTC 2012

Modified Files:
src/sys/arch/arm/arm32: pmap.c
src/sys/arch/arm/include/arm32: pmap.h pte.h

Log Message:
Add support for mapping SuperSection on armv6 and armv7.  These always
a domain of 0 so move the kernel from domain 15 to domain 0.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/sys/arch/arm/arm32/pmap.c
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/arm/include/arm32/pmap.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/include/arm32/pte.h

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.229 src/sys/arch/arm/arm32/pmap.c:1.230
--- src/sys/arch/arm/arm32/pmap.c:1.229	Fri Jul 13 06:02:58 2012
+++ src/sys/arch/arm/arm32/pmap.c	Mon Aug 20 13:03:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.229 2012/07/13 06:02:58 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.230 2012/08/20 13:03:41 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -211,7 +211,7 @@
 #include 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.229 2012/07/13 06:02:58 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.230 2012/08/20 13:03:41 matt Exp $");
 
 #ifdef PMAP_DEBUG
 
@@ -1149,7 +1149,7 @@ pmap_alloc_l1(pmap_t pm)
 	 * Fix up the relevant bits in the pmap structure
 	 */
 	pm->pm_l1 = l1;
-	pm->pm_domain = domain;
+	pm->pm_domain = domain + 1;
 }
 
 /*
@@ -1172,8 +1172,8 @@ pmap_free_l1(pmap_t pm)
 	/*
 	 * Free up the domain number which was allocated to the pmap
 	 */
-	l1->l1_domain_free[pm->pm_domain] = l1->l1_domain_first;
-	l1->l1_domain_first = pm->pm_domain;
+	l1->l1_domain_free[pm->pm_domain - 1] = l1->l1_domain_first;
+	l1->l1_domain_first = pm->pm_domain - 1;
 	l1->l1_domain_use_count--;
 
 	/*
@@ -5692,7 +5692,7 @@ vsize_t
 pmap_map_chunk(vaddr_t l1pt, vaddr_t va, paddr_t pa, vsize_t size,
 int prot, int cache)
 {
-	pd_entry_t *pde = (pd_entry_t *) l1pt;
+	pd_entry_t *pdep = (pd_entry_t *) l1pt;
 	pt_entry_t *pte, f1, f2s, f2l;
 	vsize_t resid;  
 	int i;
@@ -5731,15 +5731,37 @@ pmap_map_chunk(vaddr_t l1pt, vaddr_t va,
 	size = resid;
 
 	while (resid > 0) {
+#ifdef _ARM_ARCH_6
+		/* See if we can use a supersection mapping. */
+		if (L1_SS_PROTO && L1_SS_MAPPABLE_P(va, pa, resid)) {
+			/* Supersection are always domain 0 */
+			pd_entry_t pde = L1_SS_PROTO | pa |
+			L1_S_PROT(PTE_KERNEL, prot) | f1;
+#ifdef VERBOSE_INIT_ARM
+			printf("sS");
+#endif
+			for (size_t s = va >> L1_S_SHIFT,
+			 e = s + L1_SS_SIZE / L1_S_SIZE;
+			 s < e;
+			 s++) {
+pdep[s] = pde;
+PTE_SYNC(&pdep[s]);
+			}
+			va += L1_SS_SIZE;
+			pa += L1_SS_SIZE;
+			resid -= L1_SS_SIZE;
+			continue;
+		}
+#endif
 		/* See if we can use a section mapping. */
 		if (L1_S_MAPPABLE_P(va, pa, resid)) {
 #ifdef VERBOSE_INIT_ARM
 			printf("S");
 #endif
-			pde[va >> L1_S_SHIFT] = L1_S_PROTO | pa |
+			pdep[va >> L1_S_SHIFT] = L1_S_PROTO | pa |
 			L1_S_PROT(PTE_KERNEL, prot) | f1 |
 			L1_S_DOM(PMAP_DOMAIN_KERNEL);
-			PTE_SYNC(&pde[va >> L1_S_SHIFT]);
+			PTE_SYNC(&pdep[va >> L1_S_SHIFT]);
 			va += L1_S_SIZE;
 			pa += L1_S_SIZE;
 			resid -= L1_S_SIZE;
@@ -5751,15 +5773,15 @@ pmap_map_chunk(vaddr_t l1pt, vaddr_t va,
 		 * one is actually in the corresponding L1 slot
 		 * for the current VA.
 		 */
-		if ((pde[va >> L1_S_SHIFT] & L1_TYPE_MASK) != L1_TYPE_C)
+		if ((pdep[va >> L1_S_SHIFT] & L1_TYPE_MASK) != L1_TYPE_C)
 			panic("pmap_map_chunk: no L2 table for VA 0x%08lx", va);
 
 #ifndef ARM32_NEW_VM_LAYOUT
 		pte = (pt_entry_t *)
-		kernel_pt_lookup(pde[va >> L1_S_SHIFT] & L2_S_FRAME);
+		kernel_pt_lookup(pdep[va >> L1_S_SHIFT] & L2_S_FRAME);
 #else
 		pte = (pt_entry_t *) kernel_pt_lookup(
-		pde[L1_IDX(va)] & L1_C_ADDR_MASK);
+		pdep[L1_IDX(va)] & L1_C_ADDR_MASK);
 #endif
 		if (pte == NULL)
 			panic("pmap_map_chunk: can't find L2 table for VA"
@@ -5935,6 +5957,7 @@ pt_entry_t	pte_l2_l_prot_w;
 pt_entry_t	pte_l2_l_prot_ro;
 pt_entry_t	pte_l2_l_prot_mask;
 
+pt_entry_t	pte_l1_ss_proto;
 pt_entry_t	pte_l1_s_proto;
 pt_entry_t	pte_l1_c_proto;
 pt_entry_t	pte_l2_s_proto;
@@ -5962,22 +5985,28 @@ pmap_pte_init_generic(void)
 	/*
 	 * If we have a write-through cache, set B and C.  If
 	 * we have a write-back cache, then we assume setting
-	 * only C will make those pages write-through.
+	 * only C will make those pages write-through (except for those
+	 * Cortex CPUs which can read the L1 caches).
 	 */
-	if (cpufuncs.cf_dcache_wb_range == (void *) cpufunc_nullop) {
+	if (cpufuncs.cf_dcache_wb_range == (void *) cpufunc_nullop
+#if ARM_MMU_V7 > 1
+	|| (CPU_ID_CORTEX_P(curcpu()->ci_arm_cpuid)
+		&& !CPU_ID_CORTEX_A8_P(curcpu()->ci_arm_cpuid))
+#endif
+	|| false) {
 		pte_l1_s_cache_mode_pt = L1_S_B|L1_S_C;
 		pte_l2_l_cache_mode_pt = L2_B|L2_C;
 		pte_l2_s_cache_mode_pt = L2_B|L2_C;
-	} else {
 #if ARM_MMU_V

CVS commit: src/sys/netinet

2012-08-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Mon Aug 20 14:14:32 UTC 2012

Modified Files:
src/sys/netinet: ip_carp.c

Log Message:
Support checksum offloading in carp(4) if the underlying device suports it,
as proposed on tech-net@ on 2 Aug 2012.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/netinet/ip_carp.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/netinet/ip_carp.c
diff -u src/sys/netinet/ip_carp.c:1.48 src/sys/netinet/ip_carp.c:1.49
--- src/sys/netinet/ip_carp.c:1.48	Tue Mar 27 17:48:17 2012
+++ src/sys/netinet/ip_carp.c	Mon Aug 20 14:14:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_carp.c,v 1.48 2012/03/27 17:48:17 bouyer Exp $	*/
+/*	$NetBSD: ip_carp.c,v 1.49 2012/08/20 14:14:32 bouyer Exp $	*/
 /*	$OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $	*/
 
 /*
@@ -30,7 +30,7 @@
 #include "opt_inet.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.48 2012/03/27 17:48:17 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.49 2012/08/20 14:14:32 bouyer Exp $");
 
 /*
  * TODO:
@@ -1552,6 +1552,14 @@ carp_set_ifp(struct carp_softc *sc, stru
 		if (ncif != NULL)
 			ifp->if_carp = (void *)ncif;
 		sc->sc_carpdev = ifp;
+		sc->sc_if.if_capabilities = ifp->if_capabilities &
+		 (IFCAP_TSOv4 | IFCAP_TSOv6 |
+ IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_IPv4_Rx|
+ IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_TCPv4_Rx|
+ IFCAP_CSUM_UDPv4_Tx|IFCAP_CSUM_UDPv4_Rx|
+ IFCAP_CSUM_TCPv6_Tx|IFCAP_CSUM_TCPv6_Rx|
+ IFCAP_CSUM_UDPv6_Tx|IFCAP_CSUM_UDPv6_Rx);
+
 		cif = (struct carp_if *)ifp->if_carp;
 		TAILQ_FOREACH(vr, &cif->vhif_vrs, sc_list) {
 			if (vr == sc)
@@ -2010,6 +2018,11 @@ carp_ioctl(struct ifnet *ifp, u_long cmd
 		error = carp_ether_delmulti(sc, ifr);
 		break;
 
+	case SIOCSIFCAP:
+		if ((error = ifioctl_common(ifp, cmd, addr)) == ENETRESET)
+			error = 0;
+		break;
+
 	default:
 		error = ether_ioctl(ifp, cmd, data);
 	}



CVS commit: src

2012-08-20 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Mon Aug 20 15:39:01 UTC 2012

Modified Files:
src/distrib/sets/lists/xfont: mi
src/external/mit/xorg/share/fonts/misc/font-misc-misc: Makefile

Log Message:
Build and install iso10646-1 encoded 10x20 font. This matches the behaviour
of the upstream software and modular X.org in pkgsrc.

Patch supplied by Piotr Meyer in PR xsrc/46755.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/distrib/sets/lists/xfont/mi
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/mit/xorg/share/fonts/misc/font-misc-misc/Makefile

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

Modified files:

Index: src/distrib/sets/lists/xfont/mi
diff -u src/distrib/sets/lists/xfont/mi:1.39 src/distrib/sets/lists/xfont/mi:1.40
--- src/distrib/sets/lists/xfont/mi:1.39	Sun Apr 11 02:41:38 2010
+++ src/distrib/sets/lists/xfont/mi	Mon Aug 20 15:38:59 2012
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.39 2010/04/11 02:41:38 jakllsch Exp $
+# $NetBSD: mi,v 1.40 2012/08/20 15:38:59 tron Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -8440,6 +8440,7 @@
 ./usr/X11R7/lib/X11/fonts/misc/10x20-ISO8859-8.pcf.gz	xfont	share,xorg,x11fonts
 ./usr/X11R7/lib/X11/fonts/misc/10x20-ISO8859-9.pcf.gz	xfont	share,xorg,x11fonts
 ./usr/X11R7/lib/X11/fonts/misc/10x20-KOI8-R.pcf.gz	xfont	share,xorg,x11fonts
+./usr/X11R7/lib/X11/fonts/misc/10x20.pcf.gz		xfont	share,xorg,x11fonts
 ./usr/X11R7/lib/X11/fonts/misc/12x13ja.pcf.gz		xfont	share,xorg,x11fonts
 ./usr/X11R7/lib/X11/fonts/misc/12x24.pcf.gz		xfont	share,xorg,x11fonts
 ./usr/X11R7/lib/X11/fonts/misc/12x24rk.pcf.gz		xfont	share,xorg,x11fonts

Index: src/external/mit/xorg/share/fonts/misc/font-misc-misc/Makefile
diff -u src/external/mit/xorg/share/fonts/misc/font-misc-misc/Makefile:1.1.1.1 src/external/mit/xorg/share/fonts/misc/font-misc-misc/Makefile:1.2
--- src/external/mit/xorg/share/fonts/misc/font-misc-misc/Makefile:1.1.1.1	Tue Jul 29 05:01:23 2008
+++ src/external/mit/xorg/share/fonts/misc/font-misc-misc/Makefile	Mon Aug 20 15:38:58 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1.1.1 2008/07/29 05:01:23 mrg Exp $
+#	$NetBSD: Makefile,v 1.2 2012/08/20 15:38:58 tron Exp $
 
 .include 
 
@@ -15,7 +15,7 @@ BDFFILES+=	k14.bdf nil2.bdf
 BDFFILES+=	4x6.bdf 5x7.bdf 5x8.bdf 6x10.bdf 6x12.bdf 6x13.bdf \
 		6x13B.bdf 6x13O.bdf 6x9.bdf 7x13.bdf 7x13B.bdf 7x13O.bdf \
 		7x14.bdf 7x14B.bdf 8x13.bdf 8x13B.bdf 8x13O.bdf 9x15.bdf \
-		9x15B.bdf 9x18.bdf 9x18B.bdf
+		9x15B.bdf 9x18.bdf 9x18B.bdf 10x20.bdf
 
 # Most fonts have 22 output types, but ISO8859-8 and ISO8859-11 are
 # missing a few.



CVS commit: src/lib/libterminfo

2012-08-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Aug 20 15:44:02 UTC 2012

Modified Files:
src/lib/libterminfo: Makefile.hash

Log Message:
Add tic dependency only for the USETOOLS case.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/Makefile.hash

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

Modified files:

Index: src/lib/libterminfo/Makefile.hash
diff -u src/lib/libterminfo/Makefile.hash:1.5 src/lib/libterminfo/Makefile.hash:1.6
--- src/lib/libterminfo/Makefile.hash:1.5	Sun Jun  3 23:19:10 2012
+++ src/lib/libterminfo/Makefile.hash	Mon Aug 20 15:44:02 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.hash,v 1.5 2012/06/03 23:19:10 joerg Exp $
+#	$NetBSD: Makefile.hash,v 1.6 2012/08/20 15:44:02 joerg Exp $
 
 SCRIPT_ENV=	\
 	TOOL_AWK=${TOOL_AWK:Q} \
@@ -22,7 +22,9 @@ compiled_terms.c: genterms term.h ${NETB
 		@echo "Generating compiled terminfo descriptions"
 		${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} > ${.TARGET}
 
+.if ${USETOOLS} == "yes"
 compiled_terms.c: ${TOOL_TIC}
+.endif
 
 DPSRCS+=	hash.c termcap_hash.c compiled_terms.c
 



CVS commit: src/sys/netinet

2012-08-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug 20 16:01:37 UTC 2012

Modified Files:
src/sys/netinet: ip_carp.c

Log Message:
make this compile.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/netinet/ip_carp.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/netinet/ip_carp.c
diff -u src/sys/netinet/ip_carp.c:1.49 src/sys/netinet/ip_carp.c:1.50
--- src/sys/netinet/ip_carp.c:1.49	Mon Aug 20 10:14:32 2012
+++ src/sys/netinet/ip_carp.c	Mon Aug 20 12:01:37 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_carp.c,v 1.49 2012/08/20 14:14:32 bouyer Exp $	*/
+/*	$NetBSD: ip_carp.c,v 1.50 2012/08/20 16:01:37 christos Exp $	*/
 /*	$OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $	*/
 
 /*
@@ -30,7 +30,7 @@
 #include "opt_inet.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.49 2012/08/20 14:14:32 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.50 2012/08/20 16:01:37 christos Exp $");
 
 /*
  * TODO:
@@ -2019,7 +2019,7 @@ carp_ioctl(struct ifnet *ifp, u_long cmd
 		break;
 
 	case SIOCSIFCAP:
-		if ((error = ifioctl_common(ifp, cmd, addr)) == ENETRESET)
+		if ((error = ifioctl_common(ifp, cmd, data)) == ENETRESET)
 			error = 0;
 		break;
 



CVS commit: src/tests/fs

2012-08-20 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Aug 20 16:37:35 UTC 2012

Modified Files:
src/tests/fs/common: Makefile
src/tests/fs/vfs: Makefile
Added Files:
src/tests/fs/common: fstest_zfs.c

Log Message:
Add a vfstest zfs attachment.  This is a compile-time option,
default off, due the large numbers of failing tests (some of them
look like quite trivial failures).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/fs/common/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/fs/common/fstest_zfs.c
cvs rdiff -u -r1.16 -r1.17 src/tests/fs/vfs/Makefile

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

Modified files:

Index: src/tests/fs/common/Makefile
diff -u src/tests/fs/common/Makefile:1.7 src/tests/fs/common/Makefile:1.8
--- src/tests/fs/common/Makefile:1.7	Thu Aug 11 10:52:12 2011
+++ src/tests/fs/common/Makefile	Mon Aug 20 16:37:35 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.7 2011/08/11 10:52:12 uch Exp $
+#	$NetBSD: Makefile,v 1.8 2012/08/20 16:37:35 pooka Exp $
 #
 
 .include 
@@ -8,6 +8,11 @@ SRCS=	fstest_ext2fs.c fstest_ffs.c fstes
 	fstest_nfs.c fstest_puffs.c fstest_rumpfs.c fstest_sysvbfs.c	\
 	fstest_tmpfs.c fstest_v7fs.c
 
+.ifdef WANT_ZFS_TESTS
+SRCS+=	fstest_zfs.c
+CPPFLAGS+=-DWANT_ZFS_TESTS
+.endif
+
 WARNS=	3
 
 .PATH: ${.CURDIR}/nfsrpc

Index: src/tests/fs/vfs/Makefile
diff -u src/tests/fs/vfs/Makefile:1.16 src/tests/fs/vfs/Makefile:1.17
--- src/tests/fs/vfs/Makefile:1.16	Thu Aug 11 10:52:12 2011
+++ src/tests/fs/vfs/Makefile	Mon Aug 20 16:37:35 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2011/08/11 10:52:12 uch Exp $
+#	$NetBSD: Makefile,v 1.17 2012/08/20 16:37:35 pooka Exp $
 #
 
 .include 
@@ -38,4 +38,9 @@ LDADD+=-lrumpvfs -lrump -lrumpuser -lpth
 
 LDADD+=-lutil
 
+.ifdef WANT_ZFS_TESTS
+LDADD+=-lrumpfs_zfs -lrumpkern_solaris -lrumpdev_rnd
+CPPFLAGS+=-DWANT_ZFS_TESTS
+.endif
+
 .include 

Added files:

Index: src/tests/fs/common/fstest_zfs.c
diff -u /dev/null src/tests/fs/common/fstest_zfs.c:1.1
--- /dev/null	Mon Aug 20 16:37:35 2012
+++ src/tests/fs/common/fstest_zfs.c	Mon Aug 20 16:37:35 2012
@@ -0,0 +1,134 @@
+/*	$NetBSD: fstest_zfs.c,v 1.1 2012/08/20 16:37:35 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 2010, 2011  The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nicolas Joly.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "h_fsmacros.h"
+
+#define SRVPATH "zfssurvo"
+#define SRVURL "unix://" SRVPATH
+#define ZFSDEV "/zfsdev"
+
+int
+zfs_fstest_newfs(const atf_tc_t *tc, void **buf, const char *image,
+	off_t size, void *fspriv)
+{
+	int res;
+	int fd;
+
+	/* XXX: hardcoded zfs minimum size */
+	size = MAX(64*1024*1024, size);
+
+	res = rump_init();
+	if (res != 0) {
+		errno = res;
+		return -1;
+	}
+
+	/* create backing image, sparse file is enough */
+	if ((fd = open(image, O_RDWR | O_CREAT, 0777)) == -1)
+		return -1;
+	if (ftruncate(fd, size) == -1) {
+		close(fd);
+		return -1;
+	}
+	close(fd);
+
+	res = rump_pub_etfs_register(ZFSDEV, image, RUMP_ETFS_BLK);
+	if (res != 0) {
+		errno = res;
+		return -1;
+	}
+
+	res = rump_init_server(SRVURL);
+	if (res != 0) {
+		errno = res;
+		return -1;
+	}
+	*buf = NULL;
+
+	return 0;
+}
+
+int
+zfs_fstest_delfs(const atf_tc_t *tc, void *buf)
+{
+
+	unlink(SRVPATH);
+	return 0;
+}
+
+int
+zfs_fstest_mount(const atf_tc_t *tc, void *buf, const char *path, int flags)
+{
+	char tmpbuf[128];
+	int error;
+
+	/* set up the hijack env for running zpool */
+	set

CVS commit: src/tests/fs/common

2012-08-20 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Aug 20 16:39:46 UTC 2012

Modified Files:
src/tests/fs/common: h_fsmacros.h

Log Message:
Add a vfstest zfs attachment.  This is a compile-time option,
default off, due the large numbers of failing tests (some of them
look like quite trivial failures).


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/tests/fs/common/h_fsmacros.h

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

Modified files:

Index: src/tests/fs/common/h_fsmacros.h
diff -u src/tests/fs/common/h_fsmacros.h:1.35 src/tests/fs/common/h_fsmacros.h:1.36
--- src/tests/fs/common/h_fsmacros.h:1.35	Thu Aug 11 10:52:12 2011
+++ src/tests/fs/common/h_fsmacros.h	Mon Aug 20 16:39:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_fsmacros.h,v 1.35 2011/08/11 10:52:12 uch Exp $	*/
+/*	$NetBSD: h_fsmacros.h,v 1.36 2012/08/20 16:39:46 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -62,6 +62,7 @@ FSPROTOS(rumpfs);
 FSPROTOS(sysvbfs);
 FSPROTOS(tmpfs);
 FSPROTOS(v7fs);
+FSPROTOS(zfs);
 
 #ifndef FSTEST_IMGNAME
 #define FSTEST_IMGNAME "image.fs"
@@ -154,7 +155,7 @@ do {	\
 #define ATF_TP_FSADD(fs,func)		\
   ATF_TP_ADD_TC(tp,fs##_##func)
 
-#define ATF_TC_FSAPPLY(func,desc)	\
+#define ATF_TC_FSAPPLY_NOZFS(func,desc)	\
   ATF_TC_FSADD(ext2fs,MOUNT_EXT2FS,func,desc)\
   ATF_TC_FSADD(ffs,MOUNT_FFS,func,desc)	\
   ATF_TC_FSADD(ffslog,MOUNT_FFS,func,desc)\
@@ -168,7 +169,7 @@ do {	\
   ATF_TC_FSADD(tmpfs,MOUNT_TMPFS,func,desc)\
   ATF_TC_FSADD(v7fs,MOUNT_V7FS,func,desc)
 
-#define ATF_TP_FSAPPLY(func)		\
+#define ATF_TP_FSAPPLY_NOZFS(func)	\
   ATF_TP_FSADD(ext2fs,func);		\
   ATF_TP_FSADD(ffs,func);		\
   ATF_TP_FSADD(ffslog,func);		\
@@ -182,6 +183,24 @@ do {	\
   ATF_TP_FSADD(tmpfs,func);		\
   ATF_TP_FSADD(v7fs,func);
 
+/* XXX: this will not scale */
+#ifdef WANT_ZFS_TESTS
+#define ATF_TC_FSAPPLY(func,desc)	\
+  ATF_TC_FSAPPLY_NOZFS(func,desc)	\
+  ATF_TC_FSADD(zfs,MOUNT_ZFS,func,desc)
+#define ATF_TP_FSAPPLY(func)		\
+  ATF_TP_FSAPPLY_NOZFS(func)		\
+  ATF_TP_FSADD(zfs,func);
+
+#else /* !WANT_ZFS_TESTS */
+
+#define ATF_TC_FSAPPLY(func,desc)	\
+  ATF_TC_FSAPPLY_NOZFS(func,desc)
+#define ATF_TP_FSAPPLY(func)		\
+  ATF_TP_FSAPPLY_NOZFS(func)
+
+#endif /* WANT_ZFS_TESTS */
+
 /*
  * Same as above, but generate a file system image first and perform
  * tests for a r/o mount.
@@ -261,6 +280,8 @@ atf_check_fstype(const atf_tc_t *tc, con
 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "tmpfs") == 0)
 #define FSTYPE_V7FS(tc)\
 (strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "v7fs") == 0)
+#define FSTYPE_ZFS(tc)\
+(strcmp(atf_tc_get_md_var(tc, "X-fs.type"), "zfs") == 0)
 
 #define FSTEST_ENTER()			\
 	if (rump_sys_chdir(FSTEST_MNTNAME) == -1)			\



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

2012-08-20 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Aug 20 19:15:36 UTC 2012

Modified Files:
src/sys/kern [netbsd-6]: tty.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #516):
sys/kern/tty.c: revision 1.251
sys/kern/tty.c: revision 1.252
sys/kern/tty.c: revision 1.253
Better (not racy fix) from Paul Goyette.
Use the queue of the tty not garbage from the stack (Paul Goyette)
PR/46780: Dennis Ferguson: Take the easy way out and return EBUSY when changing
the queue size if the output queue is not empty. Other solutions seemed too
complex/fragile.


To generate a diff of this commit:
cvs rdiff -u -r1.249.8.1 -r1.249.8.2 src/sys/kern/tty.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/tty.c
diff -u src/sys/kern/tty.c:1.249.8.1 src/sys/kern/tty.c:1.249.8.2
--- src/sys/kern/tty.c:1.249.8.1	Mon Mar 19 23:23:10 2012
+++ src/sys/kern/tty.c	Mon Aug 20 19:15:36 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty.c,v 1.249.8.1 2012/03/19 23:23:10 riz Exp $	*/
+/*	$NetBSD: tty.c,v 1.249.8.2 2012/08/20 19:15:36 riz Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.249.8.1 2012/03/19 23:23:10 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.249.8.2 2012/08/20 19:15:36 riz Exp $");
 
 #include 
 #include 
@@ -224,7 +224,7 @@ tty_get_qsize(int *qsize, int newsize)
 	return 0;
 }
 
-static void
+static int
 tty_set_qsize(struct tty *tp, int newsize)
 {
 	struct clist rawq, canq, outq;
@@ -236,6 +236,14 @@ tty_set_qsize(struct tty *tp, int newsiz
 
 	mutex_spin_enter(&tty_lock);
 
+	if (tp->t_outq.c_cc != 0) {
+		mutex_spin_exit(&tty_lock);
+		clfree(&rawq);
+		clfree(&canq);
+		clfree(&outq);
+		return EBUSY;
+	}
+
 	orawq = tp->t_rawq;
 	ocanq = tp->t_canq;
 	ooutq = tp->t_outq;
@@ -252,6 +260,8 @@ tty_set_qsize(struct tty *tp, int newsiz
 	clfree(&orawq);
 	clfree(&ocanq);
 	clfree(&ooutq);
+
+	return 0;
 }
 
 static int
@@ -1350,7 +1360,7 @@ ttioctl(struct tty *tp, u_long cmd, void
 	case TIOCSQSIZE:
 		if ((error = tty_get_qsize(&s, *(int *)data)) == 0 &&
 		s != tp->t_qsize)
-			tty_set_qsize(tp, s);
+			error = tty_set_qsize(tp, s);
 		return error;
 	default:
 		/* We may have to load the compat module for this. */



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

2012-08-20 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Aug 20 19:23:07 UTC 2012

Modified Files:
src/sys/net [netbsd-6]: if_ethersubr.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #517):
sys/net/if_ethersubr.c: revision 1.190
PR/46587: Roger Pau Monne: Prevent panic on shutdown on bridge teardown ->
ifpromisc-> if_ioctl -> if_init. Idea from dyoung.
XXX: Pullup to 6.


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

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

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.188.8.1 src/sys/net/if_ethersubr.c:1.188.8.2
--- src/sys/net/if_ethersubr.c:1.188.8.1	Fri May 18 17:04:28 2012
+++ src/sys/net/if_ethersubr.c	Mon Aug 20 19:23:07 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.188.8.1 2012/05/18 17:04:28 riz Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.188.8.2 2012/08/20 19:23:07 riz Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.188.8.1 2012/05/18 17:04:28 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.188.8.2 2012/08/20 19:23:07 riz Exp $");
 
 #include "opt_inet.h"
 #include "opt_atalk.h"
@@ -1144,6 +1144,15 @@ ether_ifdetach(struct ifnet *ifp)
 	struct ether_multi *enm;
 	int s;
 
+	/*
+	 * Prevent further calls to ioctl (for example turning off
+	 * promiscuous mode from the bridge code), which eventually can
+	 * call if_init() which can cause panics because the interface
+	 * is in the process of being detached. Return device not configured
+	 * instead.
+	 */
+	ifp->if_ioctl = (int (*)(struct ifnet *, u_long, void *))enxio;
+
 #if NBRIDGE > 0
 	if (ifp->if_bridge)
 		bridge_ifdetach(ifp);



CVS commit: [netbsd-6] src/lib/libc/locale

2012-08-20 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Aug 20 19:27:04 UTC 2012

Modified Files:
src/lib/libc/locale [netbsd-6]: rune.c

Log Message:
Pull up following revision(s) (requested by tnozaki in ticket #518):
lib/libc/locale/rune.c: revision 1.44
lib/libc/locale/rune.c: revision 1.45
Restore RCS Id lost in previous.
fix PR lib/46781 statically compiled bash makes locale loading fail.
analyzed and  patch provided by enami@ nonaka@ obache@ soda@, thanks.
patch modified by me.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.43.2.1 src/lib/libc/locale/rune.c

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

Modified files:

Index: src/lib/libc/locale/rune.c
diff -u src/lib/libc/locale/rune.c:1.43 src/lib/libc/locale/rune.c:1.43.2.1
--- src/lib/libc/locale/rune.c:1.43	Fri Jan 20 16:31:30 2012
+++ src/lib/libc/locale/rune.c	Mon Aug 20 19:27:04 2012
@@ -1,5 +1,4 @@
-/* $NetBSD: rune.c,v 1.43 2012/01/20 16:31:30 joerg Exp $ */
-
+/*	$NetBSD: rune.c,v 1.43.2.1 2012/08/20 19:27:04 riz Exp $	*/
 /*-
  * Copyright (c)2010 Citrus Project,
  * All rights reserved.
@@ -162,7 +161,7 @@ _rune_read_file(const char * __restrict 
 
 	variable_len = be32toh((uint32_t)frl->frl_variable_len);
 
-	n = (len * sizeof(*fre)) + variable_len;
+	n = len * sizeof(*fre);
 	if (lenvar < n)
 		return EFTYPE;
 	lenvar -= n;
@@ -219,15 +218,15 @@ do {	\
 	READ_RANGE(maplower);
 	READ_RANGE(mapupper);
 
-	memcpy((void *)rune, (void const *)frune, variable_len);
-	rl->rl_variable_len = variable_len;
-	rl->rl_variable = (void *)rune;
-
-	if (lenvar > 0) {
+	if (lenvar < variable_len) {
 		ret = EFTYPE;
 		goto err;
 	}
 
+	memcpy((void *)rune, (void const *)frune, variable_len);
+	rl->rl_variable_len = variable_len;
+	rl->rl_variable = (void *)rune;
+
 	_rune_find_codeset(rlp->rlp_codeset, sizeof(rlp->rlp_codeset),
 	(char *)rl->rl_variable, &rl->rl_variable_len);
 



CVS commit: [netbsd-6] src/sys/dev/usb

2012-08-20 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Aug 20 19:34:20 UTC 2012

Modified Files:
src/sys/dev/usb [netbsd-6]: umass_scsipi.c

Log Message:
Pull up following revision(s) (requested by drochner in ticket #520):
sys/dev/usb/umass_scsipi.c: revision 1.46
For devices which don't claim SPC-3, don't request 32 bytes of sense
data but just 18. Some devices signal an error if the transfer length
is not exactly what the device expects, and it is hard to deal with
these errors afterwards.
This makes a number of USB memory sticks and SD card readers work
which were not usable before.


To generate a diff of this commit:
cvs rdiff -u -r1.38.10.1 -r1.38.10.2 src/sys/dev/usb/umass_scsipi.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/usb/umass_scsipi.c
diff -u src/sys/dev/usb/umass_scsipi.c:1.38.10.1 src/sys/dev/usb/umass_scsipi.c:1.38.10.2
--- src/sys/dev/usb/umass_scsipi.c:1.38.10.1	Mon Apr 23 16:28:31 2012
+++ src/sys/dev/usb/umass_scsipi.c	Mon Aug 20 19:34:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_scsipi.c,v 1.38.10.1 2012/04/23 16:28:31 riz Exp $	*/
+/*	$NetBSD: umass_scsipi.c,v 1.38.10.2 2012/08/20 19:34:20 riz Exp $	*/
 
 /*
  * Copyright (c) 2001, 2003 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.38.10.1 2012/04/23 16:28:31 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.38.10.2 2012/08/20 19:34:20 riz Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_umass.h"
@@ -395,7 +395,7 @@ umass_scsipi_cb(struct umass_softc *sc, 
 	struct umass_scsipi_softc *scbus = (struct umass_scsipi_softc *)sc->bus;
 	struct scsipi_xfer *xs = priv;
 	struct scsipi_periph *periph = xs->xs_periph;
-	int cmdlen;
+	int cmdlen, senselen;
 	int s;
 #ifdef UMASS_DEBUG
 	struct timeval tv;
@@ -423,16 +423,20 @@ umass_scsipi_cb(struct umass_softc *sc, 
 		scbus->sc_sense_cmd.opcode = SCSI_REQUEST_SENSE;
 		scbus->sc_sense_cmd.byte2 = periph->periph_lun <<
 		SCSI_CMD_LUN_SHIFT;
-		scbus->sc_sense_cmd.length = sizeof(xs->sense);
 
 		if (sc->sc_cmd == UMASS_CPROTO_UFI ||
 		sc->sc_cmd == UMASS_CPROTO_ATAPI)
 			cmdlen = UFI_COMMAND_LENGTH;	/* XXX */
 		else
 			cmdlen = sizeof(scbus->sc_sense_cmd);
+		if (periph->periph_version < 0x05) /* SPC-3 */
+			senselen = 18;
+		else
+			senselen = sizeof(xs->sense);
+		scbus->sc_sense_cmd.length = senselen;
 		sc->sc_methods->wire_xfer(sc, periph->periph_lun,
 	  &scbus->sc_sense_cmd, cmdlen,
-	  &xs->sense, sizeof(xs->sense),
+	  &xs->sense, senselen,
 	  DIR_IN, xs->timeout,
 	  umass_scsipi_sense_cb, xs);
 		return;



CVS commit: [netbsd-6] src

2012-08-20 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Aug 20 19:36:58 UTC 2012

Modified Files:
src/distrib/sets/lists/xfont [netbsd-6]: mi
src/external/mit/xorg/share/fonts/misc/font-misc-misc [netbsd-6]:
Makefile

Log Message:
Pull up following revision(s) (requested by tron in ticket #519):
distrib/sets/lists/xfont/mi: revision 1.40
external/mit/xorg/share/fonts/misc/font-misc-misc/Makefile: revision 1.2
Build and install iso10646-1 encoded 10x20 font. This matches the behaviour
of the upstream software and modular X.org in pkgsrc.
Patch supplied by Piotr Meyer in PR xsrc/46755.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.8.1 src/distrib/sets/lists/xfont/mi
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.24.1 \
src/external/mit/xorg/share/fonts/misc/font-misc-misc/Makefile

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

Modified files:

Index: src/distrib/sets/lists/xfont/mi
diff -u src/distrib/sets/lists/xfont/mi:1.39 src/distrib/sets/lists/xfont/mi:1.39.8.1
--- src/distrib/sets/lists/xfont/mi:1.39	Sun Apr 11 02:41:38 2010
+++ src/distrib/sets/lists/xfont/mi	Mon Aug 20 19:36:57 2012
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.39 2010/04/11 02:41:38 jakllsch Exp $
+# $NetBSD: mi,v 1.39.8.1 2012/08/20 19:36:57 riz Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -8440,6 +8440,7 @@
 ./usr/X11R7/lib/X11/fonts/misc/10x20-ISO8859-8.pcf.gz	xfont	share,xorg,x11fonts
 ./usr/X11R7/lib/X11/fonts/misc/10x20-ISO8859-9.pcf.gz	xfont	share,xorg,x11fonts
 ./usr/X11R7/lib/X11/fonts/misc/10x20-KOI8-R.pcf.gz	xfont	share,xorg,x11fonts
+./usr/X11R7/lib/X11/fonts/misc/10x20.pcf.gz		xfont	share,xorg,x11fonts
 ./usr/X11R7/lib/X11/fonts/misc/12x13ja.pcf.gz		xfont	share,xorg,x11fonts
 ./usr/X11R7/lib/X11/fonts/misc/12x24.pcf.gz		xfont	share,xorg,x11fonts
 ./usr/X11R7/lib/X11/fonts/misc/12x24rk.pcf.gz		xfont	share,xorg,x11fonts

Index: src/external/mit/xorg/share/fonts/misc/font-misc-misc/Makefile
diff -u src/external/mit/xorg/share/fonts/misc/font-misc-misc/Makefile:1.1.1.1 src/external/mit/xorg/share/fonts/misc/font-misc-misc/Makefile:1.1.1.1.24.1
--- src/external/mit/xorg/share/fonts/misc/font-misc-misc/Makefile:1.1.1.1	Tue Jul 29 05:01:23 2008
+++ src/external/mit/xorg/share/fonts/misc/font-misc-misc/Makefile	Mon Aug 20 19:36:58 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1.1.1 2008/07/29 05:01:23 mrg Exp $
+#	$NetBSD: Makefile,v 1.1.1.1.24.1 2012/08/20 19:36:58 riz Exp $
 
 .include 
 
@@ -15,7 +15,7 @@ BDFFILES+=	k14.bdf nil2.bdf
 BDFFILES+=	4x6.bdf 5x7.bdf 5x8.bdf 6x10.bdf 6x12.bdf 6x13.bdf \
 		6x13B.bdf 6x13O.bdf 6x9.bdf 7x13.bdf 7x13B.bdf 7x13O.bdf \
 		7x14.bdf 7x14B.bdf 8x13.bdf 8x13B.bdf 8x13O.bdf 9x15.bdf \
-		9x15B.bdf 9x18.bdf 9x18B.bdf
+		9x15B.bdf 9x18.bdf 9x18B.bdf 10x20.bdf
 
 # Most fonts have 22 output types, but ISO8859-8 and ISO8859-11 are
 # missing a few.



CVS commit: [netbsd-6] src/sys/arch/evbarm/iq80310

2012-08-20 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Aug 20 19:39:27 UTC 2012

Modified Files:
src/sys/arch/evbarm/iq80310 [netbsd-6]: iq80310_intr.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #509):
sys/arch/evbarm/iq80310/iq80310_intr.c: revision 1.31
move evcnt_attach_dynamic() calls later to avoid assertions.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.29.8.1 src/sys/arch/evbarm/iq80310/iq80310_intr.c

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

Modified files:

Index: src/sys/arch/evbarm/iq80310/iq80310_intr.c
diff -u src/sys/arch/evbarm/iq80310/iq80310_intr.c:1.29 src/sys/arch/evbarm/iq80310/iq80310_intr.c:1.29.8.1
--- src/sys/arch/evbarm/iq80310/iq80310_intr.c:1.29	Fri Jul  1 20:41:16 2011
+++ src/sys/arch/evbarm/iq80310/iq80310_intr.c	Mon Aug 20 19:39:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: iq80310_intr.c,v 1.29 2011/07/01 20:41:16 dyoung Exp $	*/
+/*	$NetBSD: iq80310_intr.c,v 1.29.8.1 2012/08/20 19:39:27 riz Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: iq80310_intr.c,v 1.29 2011/07/01 20:41:16 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iq80310_intr.c,v 1.29.8.1 2012/08/20 19:39:27 riz Exp $");
 
 #ifndef EVBARM_SPL_NOINLINE
 #define	EVBARM_SPL_NOINLINE
@@ -338,8 +338,6 @@ iq80310_intr_init(void)
 		TAILQ_INIT(&iq->iq_list);
 
 		sprintf(iq->iq_name, "irq %d", i);
-		evcnt_attach_dynamic(&iq->iq_ev, EVCNT_TYPE_INTR,
-		NULL, "iq80310", iq->iq_name);
 	}
 
 	iq80310_intr_calculate_masks();
@@ -379,6 +377,8 @@ iq80310_intr_establish(int irq, int ipl,
 	oldirqstate = disable_interrupts(I32_bit);
 
 	TAILQ_INSERT_TAIL(&iq->iq_list, ih, ih_list);
+	evcnt_attach_dynamic(&iq->iq_ev, EVCNT_TYPE_INTR,
+	NULL, "iq80310", iq->iq_name);
 
 	iq80310_intr_calculate_masks();
 



CVS commit: [netbsd-6] src/doc

2012-08-20 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Aug 20 19:40:57 UTC 2012

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

Log Message:
Tickets 509, 516-520.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.195 -r1.1.2.196 src/doc/CHANGES-6.0

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

Modified files:

Index: src/doc/CHANGES-6.0
diff -u src/doc/CHANGES-6.0:1.1.2.195 src/doc/CHANGES-6.0:1.1.2.196
--- src/doc/CHANGES-6.0:1.1.2.195	Sun Aug 19 17:47:18 2012
+++ src/doc/CHANGES-6.0	Mon Aug 20 19:40:57 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0,v 1.1.2.195 2012/08/19 17:47:18 riz Exp $
+# $NetBSD: CHANGES-6.0,v 1.1.2.196 2012/08/20 19:40:57 riz Exp $
 
 A complete list of changes from the initial NetBSD 6.0 branch on 15 Feb 2012
 until the 6.0 release:
@@ -8368,6 +8368,39 @@ sys/arch/arm/broadcom/bcm2835_intr.c		1.
 	Fix interrupt strings.
 	[skrll, ticket #515]
 
+sys/kern/tty.c	1.251-1.253
+
+	Avoid clist corruption on new qsize ioctl.  PR#46780.
+	[christos, ticket #516]
+
+sys/net/if_ethersubr.c1.190
+
+	Prevent panic on bridge teardown. PR#46587.
+	[christos, ticket #517]
+
+lib/libc/locale/rune.c1.44-1.45
+
+	Fix locale loading on statically compiled bash. PR#46781.
+	[tnozaki, ticket #518]
+
+distrib/sets/lists/xfont/mi			1.40
+external/mit/xorg/share/fonts/misc/font-misc-misc/Makefile 1.2
+
+	Build and install iso10646-1 encoded 10x20 font to match behavior
+	of upstream and modular X.org from pkgsrc. PR#46755
+	[tron, ticket #519]
+
+sys/dev/usb/umass_scsipi.c			1.46 via patch
+
+	Make a number of USB memory sticks and SD card readers work
+	which were not usable before.
+	[drochner, ticket #520]
+
+sys/arch/evbarm/iq80310/iq80310_intr.c		1.31
+
+	Move evcnt_attach_dynamic() calls later to avoid assertions.
+	[chs, ticket #509]
+
 sys/sys/param.h	patched by hand
 
 	Welcome to NetBSD 6.0_RC1!



CVS commit: src/lib/libc/gen

2012-08-20 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Mon Aug 20 20:27:47 UTC 2012

Modified Files:
src/lib/libc/gen: arc4random.c

Log Message:
Since 'rs' is statically initialised (not bss) its s[] might as well be
  compile-time initialised as well.
arc4_init) is the same as arc4_stir().
Initialise rs.i to 0xff (not 0) so that the first key byte is processed
  with rs.i == 0 without the splurios rs.i-- in arc4_addrandom().
Remove the assignment rs.j = rs.i at the end of arc4_addrandom(), it isn't
  necessary and I can see no justificationm for it.
Replace RSIZE with __arraycount(as->s), however it is manifestly 256 (more
  correctly the number of values in rs.i and rs.j).


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/gen/arc4random.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/gen/arc4random.c
diff -u src/lib/libc/gen/arc4random.c:1.17 src/lib/libc/gen/arc4random.c:1.18
--- src/lib/libc/gen/arc4random.c:1.17	Sat Aug 18 15:55:07 2012
+++ src/lib/libc/gen/arc4random.c	Mon Aug 20 20:27:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: arc4random.c,v 1.17 2012/08/18 15:55:07 dsl Exp $	*/
+/*	$NetBSD: arc4random.c,v 1.18 2012/08/20 20:27:46 dsl Exp $	*/
 /*	$OpenBSD: arc4random.c,v 1.6 2001/06/05 05:05:38 pvalchev Exp $	*/
 
 /*
@@ -27,7 +27,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: arc4random.c,v 1.17 2012/08/18 15:55:07 dsl Exp $");
+__RCSID("$NetBSD: arc4random.c,v 1.18 2012/08/20 20:27:46 dsl Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -44,13 +44,13 @@ __RCSID("$NetBSD: arc4random.c,v 1.17 20
 __weak_alias(arc4random,_arc4random)
 #endif
 
-#define RSIZE 256
 struct arc4_stream {
-	mutex_t mtx;
-	int initialized;
+	uint8_t stirred;
+	uint8_t pad;
 	uint8_t i;
 	uint8_t j;
-	uint8_t s[RSIZE];
+	uint8_t s[(uint8_t)~0u + 1u];	/* 256 to you and me */
+	mutex_t mtx;
 };
 
 #ifdef _REENTRANT
@@ -67,35 +67,33 @@ struct arc4_stream {
 #define UNLOCK(rs)
 #endif
 
-
-/* XXX lint explodes with an internal error if only mtx is initialized! */
-static struct arc4_stream rs = { .i = 0, .mtx = MUTEX_INITIALIZER };
+#define S(n) (n)
+#define S4(n) S(n), S(n + 1), S(n + 2), S(n + 3)
+#define S16(n) S4(n), S4(n + 4), S4(n + 8), S4(n + 12)
+#define S64(n) S16(n), S16(n + 16), S16(n + 32), S16(n + 48)
+#define S256 S64(0), S64(64), S64(128), S64(192)
+
+static struct arc4_stream rs = { .i = 0xff, .j = 0, .s = { S256 },
+		.stirred = 0, .mtx = MUTEX_INITIALIZER };
+
+#undef S
+#undef S4
+#undef S16
+#undef S64
+#undef S256
 
 static inline void arc4_addrandom(struct arc4_stream *, u_char *, int);
-static void arc4_stir(struct arc4_stream *);
+static __noinline void arc4_stir(struct arc4_stream *);
 static inline uint8_t arc4_getbyte(struct arc4_stream *);
 static inline uint32_t arc4_getword(struct arc4_stream *);
 
-static __noinline void
-arc4_init(struct arc4_stream *as)
-{
-	int n;
-	for (n = 0; n < RSIZE; n++)
-		as->s[n] = n;
-	as->i = 0;
-	as->j = 0;
-
-	as->initialized = 1;
-	arc4_stir(as);
-}
-
 static inline int
 arc4_check_init(struct arc4_stream *as)
 {
-	if (__predict_true(rs.initialized))
+	if (__predict_true(rs.stirred))
 		return 0;
 
-	arc4_init(as);
+	arc4_stir(as);
 	return 1;
 }
 
@@ -103,20 +101,18 @@ static inline void
 arc4_addrandom(struct arc4_stream *as, u_char *dat, int datlen)
 {
 	uint8_t si;
-	int n;
+	size_t n;
 
-	as->i--;
-	for (n = 0; n < RSIZE; n++) {
+	for (n = 0; n < __arraycount(as->s); n++) {
 		as->i = (as->i + 1);
 		si = as->s[as->i];
 		as->j = (as->j + si + dat[n % datlen]);
 		as->s[as->i] = as->s[as->j];
 		as->s[as->j] = si;
 	}
-	as->j = as->i;
 }
 
-static void
+static __noinline void
 arc4_stir(struct arc4_stream *as)
 {
 	int rdat[32];
@@ -146,8 +142,10 @@ arc4_stir(struct arc4_stream *as)
 	 * paper "Weaknesses in the Key Scheduling Algorithm of RC4"
 	 * by Fluher, Mantin, and Shamir.  (N = 256 in our case.)
 	 */
-	for (j = 0; j < RSIZE * 4; j++)
+	for (j = 0; j < __arraycount(as->s) * 4; j++)
 		arc4_getbyte(as);
+
+	as->stirred = 1;
 }
 
 static __always_inline uint8_t
@@ -185,8 +183,7 @@ void
 arc4random_stir(void)
 {
 	LOCK(&rs);
-	if (__predict_false(!arc4_check_init(&rs)))	/* init() stirs */
-		arc4_stir(&rs);
+	arc4_stir(&rs);
 	UNLOCK(&rs);
 }
 



CVS commit: src/lib/libc/gen

2012-08-20 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Mon Aug 20 20:32:09 UTC 2012

Modified Files:
src/lib/libc/gen: arc4random.c

Log Message:
arc4 is a random number sequence, there is no point using its own
output values to determine a number of output values to skip.
Skipping values on any possibly random event might be worth while, as
  might using the keying algorithm to stir in a possibly random value.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/gen/arc4random.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/gen/arc4random.c
diff -u src/lib/libc/gen/arc4random.c:1.18 src/lib/libc/gen/arc4random.c:1.19
--- src/lib/libc/gen/arc4random.c:1.18	Mon Aug 20 20:27:46 2012
+++ src/lib/libc/gen/arc4random.c	Mon Aug 20 20:32:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: arc4random.c,v 1.18 2012/08/20 20:27:46 dsl Exp $	*/
+/*	$NetBSD: arc4random.c,v 1.19 2012/08/20 20:32:09 dsl Exp $	*/
 /*	$OpenBSD: arc4random.c,v 1.6 2001/06/05 05:05:38 pvalchev Exp $	*/
 
 /*
@@ -27,7 +27,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: arc4random.c,v 1.18 2012/08/20 20:27:46 dsl Exp $");
+__RCSID("$NetBSD: arc4random.c,v 1.19 2012/08/20 20:32:09 dsl Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -214,7 +214,6 @@ arc4random_buf(void *buf, size_t len)
 	uint8_t *bp = buf;
 	uint8_t *ep = bp + len;
 	uint8_t i, j;
-	int skip;
 
 	LOCK(&rs);
 	arc4_check_init(&rs);
@@ -223,10 +222,6 @@ arc4random_buf(void *buf, size_t len)
 	i = rs.i;
 	j = rs.j;
 
-	skip = arc4_getbyte_ij(&rs, &i, &j) % 3;
-	while (skip--)
-		(void)arc4_getbyte_ij(&rs, &i, &j);
-
 	while (bp < ep)
 		*bp++ = arc4_getbyte_ij(&rs, &i, &j);
 	rs.i = i;
@@ -266,9 +261,6 @@ arc4random_uniform(uint32_t upper_bound)
 	LOCK(&rs);
 	arc4_check_init(&rs);
 
-	if (arc4_getbyte(&rs) & 1)
-		(void)arc4_getbyte(&rs);
-
 	/*
 	 * This could theoretically loop forever but each retry has
 	 * p > 0.5 (worst case, usually far better) of selecting a



CVS commit: src/share/examples/npf

2012-08-20 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Mon Aug 20 21:09:50 UTC 2012

Added Files:
src/share/examples/npf: host-npf.conf

Log Message:
add an example for a npf.conf
It probably could do with polishing of both rules and comments, but meh,
better than nothing


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/examples/npf/host-npf.conf

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

Added files:

Index: src/share/examples/npf/host-npf.conf
diff -u /dev/null src/share/examples/npf/host-npf.conf:1.1
--- /dev/null	Mon Aug 20 21:09:50 2012
+++ src/share/examples/npf/host-npf.conf	Mon Aug 20 21:09:49 2012
@@ -0,0 +1,118 @@
+# this is an example of NPF rules for a host (i.e., not routing) with
+# two network interfaces, wired and wifi
+#
+# it does both IPv4 and IPv6 and allows for DHCP in v4 and SLAAC in v6
+# it also does IPSEC on the wifi
+#
+$wired_if = "wm0"
+$wifi_if = "iwn0"
+
+$dhcpserver = { 198.51.100.1 }
+
+# sample udp service
+$services_udp = { ntp }
+
+# sample mixed service
+$backupsrv_v4 = { 198.51.100.11 }
+$backupsrv_v6 = { 2001:0DB8:404::11 }
+$backup_port = { amanda }
+
+# watching a tcpdump of npflog0, when it only logs blocks,
+# can be very helpful for building the rules you actually need
+procedure "log" {
+ log: npflog0
+}
+
+procedure "rid" {
+ normalise: "random-id"
+}
+
+group (name "wired", interface $wired_if) {
+
+	# not being picky about our own address here
+	pass in  final family inet6 proto ipv6-icmp all
+	pass out final family inet6 proto ipv6-icmp all
+	pass in  final family inet  proto icmp  all
+
+	pass in  final family inet proto tcp \
+		from $dhcpserver port bootps to $wired_if port bootpc
+	pass in  final family inet proto udp \
+		from $dhcpserver port bootps to $wired_if port bootpc
+
+	pass in final family inet6 proto tcp to $wired_if port ssh
+
+	pass in final family inet  proto tcp flags S/SA \
+		from $backupsrv_v4 to $wired_if port $backup_port 
+	pass in final family inet  proto udp \
+		from $backupsrv_v4 to $wired_if port $backup_port
+	pass in final family inet6 proto tcp flags S/SA \
+		from $backupsrv_v6 to $wired_if port $backup_port 
+	pass in final family inet6 proto udp \
+		from $backupsrv_v6 to $wired_if port $backup_port
+
+	pass stateful in final family inet6 proto udp to $wired_if \
+		port $services_udp
+	pass stateful in final family inet  proto udp to $wired_if \
+		port $services_udp
+
+	# only SYN packets need to generate state
+	pass stateful out final family inet6 proto tcp flags S/SA \
+		from $wired_if apply "rid" 
+	pass stateful out final family inet  proto tcp flags S/SA \
+		from $wired_if apply "rid" 
+	# pass the other tcp packets without generating extra state
+	pass out final family inet6 proto tcp from $wired_if apply "rid" 
+	pass out final family inet  proto tcp from $wired_if apply "rid" 
+
+	# all other types of traffic, generate state per packet
+	pass stateful out final family inet6 from $wired_if apply "rid" 
+	pass stateful out final family inet  from $wired_if apply "rid" 
+
+}
+
+group (name "wifi", interface $wifi_if) {
+	# linklocal
+	pass in  final family inet6 proto ipv6-icmp  to fe80::/10
+	pass out final family inet6 proto ipv6-icmp from fe80::/10
+
+	# administrative multicasts
+	pass in  final family inet6 proto ipv6-icmp  to ff00::/10
+	pass out final family inet6 proto ipv6-icmp from ff00::/10
+
+	pass in  final family inet6 proto ipv6-icmp to $wifi_if
+	pass in  final family inet  proto icmp  to $wifi_if
+
+	pass in  final family inet proto tcp \
+		from any port bootps to $wifi_if port bootpc
+	pass in  final family inet proto udp \
+		from any port bootps to $wifi_if port bootpc
+
+pass in final family inet6 proto tcp flags S/SA to $wifi_if port ssh 
+
+pass in final family inet6 proto udp to $wifi_if port $services_udp
+pass in final family inet  proto udp to $wifi_if port $services_udp
+
+	# IPSEC
+	pass in final family inet6 proto udp to $wifi_if port isakmp
+	pass in final family inet  proto udp to $wifi_if port isakmp
+	pass in family inet6 proto esp all
+	pass in family inet  proto esp all
+
+	# only SYN packets need to generate state
+pass stateful out final family inet6 proto tcp flags S/SA \
+		from $wifi_if apply "rid" 
+pass stateful out final family inet  proto tcp flags S/SA \
+		from $wifi_if apply "rid" 
+	# pass the other tcp packets without generating extra state
+pass out final family inet6 proto tcp from $wifi_if apply "rid" 
+pass out final family inet  proto tcp from $wifi_if apply "rid" 
+
+	# all other types of traffic, generate state per packet
+pass stateful out final family inet6 from $wifi_if apply "rid" 
+pass stateful out final family inet  from $wifi_if apply "rid" 
+}
+
+group (default) {
+	pass final on lo0 all
+	block all apply "log"
+}



CVS commit: src/doc

2012-08-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Aug 20 21:20:19 UTC 2012

Modified Files:
src/doc: 3RDPARTY

Log Message:
grep-2.14 out.


To generate a diff of this commit:
cvs rdiff -u -r1.959 -r1.960 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.959 src/doc/3RDPARTY:1.960
--- src/doc/3RDPARTY:1.959	Sat Aug 18 10:27:58 2012
+++ src/doc/3RDPARTY	Mon Aug 20 21:20:19 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.959 2012/08/18 10:27:58 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.960 2012/08/20 21:20:19 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -434,7 +434,7 @@ Notes:
 
 Package:	grep
 Version:	2.5.1
-Current Vers:	2.13
+Current Vers:	2.14
 Maintainer:	FSF
 Archive Site:	ftp://ftp.gnu.org/gnu/grep/
 Home Page:	http://www.gnu.org/software/grep/



CVS commit: src/lib/libc

2012-08-20 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Mon Aug 20 21:38:10 UTC 2012

Modified Files:
src/lib/libc/gen: arc4random.c
src/lib/libc/include: namespace.h

Log Message:
I'm fairly sure the libc rules require that arc4random_addrandom,
arc4random_buf, arc4random_stir and arc4random_uniform be weak.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/gen/arc4random.c
cvs rdiff -u -r1.155 -r1.156 src/lib/libc/include/namespace.h

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/gen/arc4random.c
diff -u src/lib/libc/gen/arc4random.c:1.19 src/lib/libc/gen/arc4random.c:1.20
--- src/lib/libc/gen/arc4random.c:1.19	Mon Aug 20 20:32:09 2012
+++ src/lib/libc/gen/arc4random.c	Mon Aug 20 21:38:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: arc4random.c,v 1.19 2012/08/20 20:32:09 dsl Exp $	*/
+/*	$NetBSD: arc4random.c,v 1.20 2012/08/20 21:38:09 dsl Exp $	*/
 /*	$OpenBSD: arc4random.c,v 1.6 2001/06/05 05:05:38 pvalchev Exp $	*/
 
 /*
@@ -27,7 +27,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: arc4random.c,v 1.19 2012/08/20 20:32:09 dsl Exp $");
+__RCSID("$NetBSD: arc4random.c,v 1.20 2012/08/20 21:38:09 dsl Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -42,6 +42,10 @@ __RCSID("$NetBSD: arc4random.c,v 1.19 20
 
 #ifdef __weak_alias
 __weak_alias(arc4random,_arc4random)
+__weak_alias(arc4random_addrandom,_arc4random_addrandom)
+__weak_alias(arc4random_buf,_arc4random_buf)
+__weak_alias(arc4random_stir,_arc4random_stir)
+__weak_alias(arc4random_uniform,_arc4random_uniform)
 #endif
 
 struct arc4_stream {

Index: src/lib/libc/include/namespace.h
diff -u src/lib/libc/include/namespace.h:1.155 src/lib/libc/include/namespace.h:1.156
--- src/lib/libc/include/namespace.h:1.155	Mon Jul  9 21:25:46 2012
+++ src/lib/libc/include/namespace.h	Mon Aug 20 21:38:10 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: namespace.h,v 1.155 2012/07/09 21:25:46 rmind Exp $	*/
+/*	$NetBSD: namespace.h,v 1.156 2012/08/20 21:38:10 dsl Exp $	*/
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -155,6 +155,10 @@
 #define alarm			_alarm
 #define alphasort		_alphasort
 #define arc4random		_arc4random
+#define arc4random_addrandom	_arc4random_addrandom
+#define arc4random_buf		_arc4random_buf
+#define arc4random_stir		_arc4random_stir
+#define arc4random_uniform	_arc4random_uniform
 #define asctime_r		_asctime_r
 #define asprintf		_asprintf
 #define atoll			_atoll



CVS commit: src/sys

2012-08-20 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Mon Aug 20 22:01:30 UTC 2012

Modified Files:
src/sys/kern: subr_kcpuset.c
src/sys/sys: kcpuset.h

Log Message:
kcpuset_copybits: fix potential endianness problem.  Spotted by matt@.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/subr_kcpuset.c
cvs rdiff -u -r1.6 -r1.7 src/sys/sys/kcpuset.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/kern/subr_kcpuset.c
diff -u src/sys/kern/subr_kcpuset.c:1.6 src/sys/kern/subr_kcpuset.c:1.7
--- src/sys/kern/subr_kcpuset.c:1.6	Wed Jun  6 22:22:41 2012
+++ src/sys/kern/subr_kcpuset.c	Mon Aug 20 22:01:29 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kcpuset.c,v 1.6 2012/06/06 22:22:41 rmind Exp $	*/
+/*	$NetBSD: subr_kcpuset.c,v 1.7 2012/08/20 22:01:29 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_kcpuset.c,v 1.6 2012/06/06 22:22:41 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kcpuset.c,v 1.7 2012/08/20 22:01:29 rmind Exp $");
 
 #include 
 #include 
@@ -302,7 +302,7 @@ kcpuset_copyout(kcpuset_t *kcp, cpuset_t
 }
 
 void
-kcpuset_copybits(const kcpuset_t *kcp, void *bitfield, size_t len)
+kcpuset_copybits(const kcpuset_t *kcp, uint32_t *bitfield, size_t len)
 {
 	size_t rlen = MIN(kc_bitsize, len);
 

Index: src/sys/sys/kcpuset.h
diff -u src/sys/sys/kcpuset.h:1.6 src/sys/sys/kcpuset.h:1.7
--- src/sys/sys/kcpuset.h:1.6	Wed Jun  6 22:22:41 2012
+++ src/sys/sys/kcpuset.h	Mon Aug 20 22:01:30 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kcpuset.h,v 1.6 2012/06/06 22:22:41 rmind Exp $	*/
+/*	$NetBSD: kcpuset.h,v 1.7 2012/08/20 22:01:30 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2011 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@ void		kcpuset_unuse(kcpuset_t *, kcpuset
 
 int		kcpuset_copyin(const cpuset_t *, kcpuset_t *, size_t);
 int		kcpuset_copyout(kcpuset_t *, cpuset_t *, size_t);
-void		kcpuset_copybits(const kcpuset_t *, void *, size_t);
+void		kcpuset_copybits(const kcpuset_t *, uint32_t *, size_t);
 
 void		kcpuset_zero(kcpuset_t *);
 void		kcpuset_fill(kcpuset_t *);



CVS commit: src/sys/arch/xen/x86

2012-08-20 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Tue Aug 21 01:17:46 UTC 2012

Modified Files:
src/sys/arch/xen/x86: x86_xpmap.c

Log Message:
Fix Xen build.  Make xcpumask uint32_t, fits 32 CPUs (can increase).


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/xen/x86/x86_xpmap.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/xen/x86/x86_xpmap.c
diff -u src/sys/arch/xen/x86/x86_xpmap.c:1.46 src/sys/arch/xen/x86/x86_xpmap.c:1.47
--- src/sys/arch/xen/x86/x86_xpmap.c:1.46	Sat Jun 30 22:50:37 2012
+++ src/sys/arch/xen/x86/x86_xpmap.c	Tue Aug 21 01:17:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_xpmap.c,v 1.46 2012/06/30 22:50:37 jym Exp $	*/
+/*	$NetBSD: x86_xpmap.c,v 1.47 2012/08/21 01:17:46 rmind Exp $	*/
 
 /*
  * Copyright (c) 2006 Mathieu Ropert 
@@ -69,7 +69,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.46 2012/06/30 22:50:37 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.47 2012/08/21 01:17:46 rmind Exp $");
 
 #include "opt_xen.h"
 #include "opt_ddb.h"
@@ -364,7 +364,7 @@ xpq_queue_invlpg(vaddr_t va)
 void
 xen_mcast_invlpg(vaddr_t va, kcpuset_t *kc)
 {
-	u_long xcpumask = 0;
+	uint32_t xcpumask = 0;
 	mmuext_op_t op;
 
 	kcpuset_copybits(kc, &xcpumask, sizeof(xcpumask));
@@ -405,7 +405,7 @@ xen_bcast_invlpg(vaddr_t va)
 void
 xen_mcast_tlbflush(kcpuset_t *kc)
 {
-	u_long xcpumask = 0;
+	uint32_t xcpumask = 0;
 	mmuext_op_t op;
 
 	kcpuset_copybits(kc, &xcpumask, sizeof(xcpumask));



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

2012-08-20 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Aug 21 03:18:39 UTC 2012

Modified Files:
src/sys/arch/evbmips/conf: ALCHEMY

Log Message:
Bump SYMTAB_SPACE.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/evbmips/conf/ALCHEMY

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/evbmips/conf/ALCHEMY
diff -u src/sys/arch/evbmips/conf/ALCHEMY:1.43 src/sys/arch/evbmips/conf/ALCHEMY:1.44
--- src/sys/arch/evbmips/conf/ALCHEMY:1.43	Mon Jul 30 19:31:06 2012
+++ src/sys/arch/evbmips/conf/ALCHEMY	Tue Aug 21 03:18:39 2012
@@ -1,11 +1,11 @@
-#	$NetBSD: ALCHEMY,v 1.43 2012/07/30 19:31:06 pgoyette Exp $
+#	$NetBSD: ALCHEMY,v 1.44 2012/08/21 03:18:39 riz Exp $
 #
 # Kernel config for the Alchemy Semiconductor (AMD) PB1000, PB1500,
 # DBAu1000 and DBAu1500 evaluation boards.
 
 include 	"arch/evbmips/conf/std.alchemy"
 
-#ident 		"ALCHEMY-$Revision: 1.43 $"
+#ident 		"ALCHEMY-$Revision: 1.44 $"
 
 maxusers	32
 
@@ -45,7 +45,7 @@ options 	DEBUG		# extra kernel debugging
 options 	DDB		# kernel dynamic debugger
 options 	DDB_HISTORY_SIZE=100 # enable history editing in DDB
 makeoptions 	DEBUG="-g"	# compile full symbol table
-options 	SYMTAB_SPACE=485000	# size for embedded symbol table
+options 	SYMTAB_SPACE=495000	# size for embedded symbol table
 
 # Compatibility options
 #options 	COMPAT_43	# compatibility with 4.3BSD binaries



CVS commit: [netbsd-6] src/sys/arch/evbmips/conf

2012-08-20 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Aug 21 05:34:48 UTC 2012

Modified Files:
src/sys/arch/evbmips/conf [netbsd-6]: ALCHEMY

Log Message:
Pull up following revision(s) (requested by riz in ticket #521):
sys/arch/evbmips/conf/ALCHEMY: revision 1.44
Bump SYMTAB_SPACE.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.41.2.1 src/sys/arch/evbmips/conf/ALCHEMY

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/evbmips/conf/ALCHEMY
diff -u src/sys/arch/evbmips/conf/ALCHEMY:1.41 src/sys/arch/evbmips/conf/ALCHEMY:1.41.2.1
--- src/sys/arch/evbmips/conf/ALCHEMY:1.41	Sat Feb  4 19:03:49 2012
+++ src/sys/arch/evbmips/conf/ALCHEMY	Tue Aug 21 05:34:48 2012
@@ -1,11 +1,11 @@
-#	$NetBSD: ALCHEMY,v 1.41 2012/02/04 19:03:49 christos Exp $
+#	$NetBSD: ALCHEMY,v 1.41.2.1 2012/08/21 05:34:48 riz Exp $
 #
 # Kernel config for the Alchemy Semiconductor (AMD) PB1000, PB1500,
 # DBAu1000 and DBAu1500 evaluation boards.
 
 include 	"arch/evbmips/conf/std.alchemy"
 
-#ident 		"ALCHEMY-$Revision: 1.41 $"
+#ident 		"ALCHEMY-$Revision: 1.41.2.1 $"
 
 maxusers	32
 
@@ -45,7 +45,7 @@ options 	DEBUG		# extra kernel debugging
 options 	DDB		# kernel dynamic debugger
 options 	DDB_HISTORY_SIZE=100 # enable history editing in DDB
 makeoptions 	DEBUG="-g"	# compile full symbol table
-options 	SYMTAB_SPACE=485000	# size for embedded symbol table
+options 	SYMTAB_SPACE=495000	# size for embedded symbol table
 
 # Compatibility options
 #options 	COMPAT_43	# compatibility with 4.3BSD binaries



CVS commit: [netbsd-6] src/doc

2012-08-20 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Aug 21 05:36:23 UTC 2012

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

Log Message:
Ticket 521.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.196 -r1.1.2.197 src/doc/CHANGES-6.0

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

Modified files:

Index: src/doc/CHANGES-6.0
diff -u src/doc/CHANGES-6.0:1.1.2.196 src/doc/CHANGES-6.0:1.1.2.197
--- src/doc/CHANGES-6.0:1.1.2.196	Mon Aug 20 19:40:57 2012
+++ src/doc/CHANGES-6.0	Tue Aug 21 05:36:23 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0,v 1.1.2.196 2012/08/20 19:40:57 riz Exp $
+# $NetBSD: CHANGES-6.0,v 1.1.2.197 2012/08/21 05:36:23 riz Exp $
 
 A complete list of changes from the initial NetBSD 6.0 branch on 15 Feb 2012
 until the 6.0 release:
@@ -8401,6 +8401,11 @@ sys/arch/evbarm/iq80310/iq80310_intr.c		
 	Move evcnt_attach_dynamic() calls later to avoid assertions.
 	[chs, ticket #509]
 
+sys/arch/evbmips/conf/ALCHEMY			1.44
+
+	Bump SYMTAB_SPACE to fix evbmips* build.
+	[riz, ticket #521]
+
 sys/sys/param.h	patched by hand
 
 	Welcome to NetBSD 6.0_RC1!



CVS commit: src/share/examples/npf

2012-08-20 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Tue Aug 21 06:54:40 UTC 2012

Added Files:
src/share/examples/npf: soho_gw-npf.conf

Log Message:
the example from the man page, with a few extra comments


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/examples/npf/soho_gw-npf.conf

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

Added files:

Index: src/share/examples/npf/soho_gw-npf.conf
diff -u /dev/null src/share/examples/npf/soho_gw-npf.conf:1.1
--- /dev/null	Tue Aug 21 06:54:40 2012
+++ src/share/examples/npf/soho_gw-npf.conf	Tue Aug 21 06:54:39 2012
@@ -0,0 +1,60 @@
+# $NetBSD: soho_gw-npf.conf,v 1.1 2012/08/21 06:54:39 spz Exp $
+#
+# SOHO border
+#
+# This is a natting border gateway/webserver/mailserver/nameserver
+#
+$ext_if = "wm0"
+$int_if = "wm1"
+
+table <1> type hash file "/etc/npf_blacklist"
+# for NAT
+table <2> type tree dynamic
+
+$services_tcp = { http, https, smtp, domain, 6000, 9022 }
+$services_udp = { domain, ntp, 6000 }
+$localnet = { 198.51.100.0/24 }
+
+# NAT outgoing to the address of the external interface
+# Note: if $ext_if has multiple IP addresses (e.g. IPv6 as well),
+# then the translation address has to be specified explicitly.
+map $ext_if dynamic 198.51.100.0/24 -> $ext_if
+
+# NAT traffic arriving on port 9022 of the external interface address
+# to host 198.51.100.2 port 22
+map $ext_if dynamic 198.51.100.2 port 22 <- $ext_if 9022
+
+procedure "log" {
+	log: npflog0
+}
+
+procedure "rid" {
+	normalise: "random-id"
+}
+
+group (name "external", interface $ext_if) {
+	pass stateful out final from $ext_if apply "rid"
+
+	block in final from <1>
+	pass stateful in final family inet proto tcp to $ext_if port ssh \
+		apply "log"
+	pass stateful in final proto tcp to $ext_if port $services_tcp
+	pass stateful in final proto udp to $ext_if port $services_udp
+
+	# Passive FTP
+	pass stateful in final proto tcp to $ext_if port 49151-65535
+	# Traceroute
+	pass stateful in final proto udp to $ext_if port 33434-33600
+}
+
+group (name "internal", interface $int_if) {
+	block in all
+	pass in final from <2>
+	pass out final all
+}
+
+group (default) {
+	pass final on lo0 all
+	block all
+}
+