CVS commit: [nick-nhusb] src/sys/dev/usb

2015-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  1 08:23:02 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: usbroothub.c

Log Message:
Convert to USBHIST


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/dev/usb/usbroothub.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/usbroothub.c
diff -u src/sys/dev/usb/usbroothub.c:1.1.2.4 src/sys/dev/usb/usbroothub.c:1.1.2.5
--- src/sys/dev/usb/usbroothub.c:1.1.2.4	Sat Jan 31 22:28:15 2015
+++ src/sys/dev/usb/usbroothub.c	Sun Feb  1 08:23:02 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: usbroothub.c,v 1.1.2.4 2015/01/31 22:28:15 skrll Exp $ */
+/* $NetBSD: usbroothub.c,v 1.1.2.5 2015/02/01 08:23:02 skrll Exp $ */
 
 /*-
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -61,20 +61,9 @@
 #include dev/usb/usbdi.h
 #include dev/usb/usbdivar.h
 #include dev/usb/usbroothub.h
+#include dev/usb/usbhist.h
 
-#ifdef USB_DEBUG
-#define	DPRINTFN(n,fmt,...) do {		\
-	if (usbdebug = (n)) {			\
-		printf(%s:  fmt,		\
-		__FUNCTION__,## __VA_ARGS__);	\
-	}	\
-} while (0)
-#define	DPRINTF(...)	DPRINTFN(1, __VA_ARGS__)
 extern int usbdebug;
-#else
-#define	DPRINTF(...) do { } while (0)
-#define	DPRINTFN(...) do { } while (0)
-#endif
 
 /* helper functions for USB root hub emulation */
 
@@ -282,11 +271,13 @@ roothub_ctrl_start(usbd_xfer_handle xfer
 	int buflen, actlen;
 	void *buf;
 
+	USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
+
 	KASSERT(xfer-ux_rqflags  URQ_REQUEST);
 	req = xfer-ux_request;
 
-	DPRINTFN(4, type=%#2x request=%#2x\n,
-	req-bmRequestType, req-bRequest);
+	USBHIST_LOG(usbdebug, type=%#2x request=%#2x, req-bmRequestType,
+	req-bRequest, 0, 0);
 
 	len = UGETW(req-wLength);
 	value = UGETW(req-wValue);
@@ -313,7 +304,7 @@ roothub_ctrl_start(usbd_xfer_handle xfer
 		}
 		break;
 	case C(UR_GET_DESCRIPTOR, UT_READ_DEVICE):
-		DPRINTFN(8, wValue=%#4x\n, value);
+		USBHIST_LOG(usbdebug, wValue=%#4x, value, 0, 0, 0);
 
 		if (len == 0)
 			break;
@@ -416,8 +407,8 @@ roothub_ctrl_start(usbd_xfer_handle xfer
 		break;
 	case C(UR_SET_ADDRESS, UT_WRITE_DEVICE):
 		/* Set Address, 9.4.6 */
-		DPRINTF(UR_SET_ADDRESS, UT_WRITE_DEVICE: addr %d\n,
-		value);
+		USBHIST_LOG(usbdebug, UR_SET_ADDRESS, UT_WRITE_DEVICE: addr %d,
+		value, 0, 0, 0);
 		if (value = USB_MAX_DEVICES) {
 			goto fail;
 		}
@@ -451,6 +442,8 @@ roothub_ctrl_start(usbd_xfer_handle xfer
 	}
 
 	actlen = bus-ub_methods-ubm_rhctrl(bus, req, buf, buflen);
+	USBHIST_LOG(usbdebug, xfer %p buflen %d actlen %d, xfer, buflen,
+	actlen, 0);
 	if (actlen  0)
 		goto fail;
 
@@ -458,6 +451,8 @@ roothub_ctrl_start(usbd_xfer_handle xfer
 	err = USBD_NORMAL_COMPLETION;
 
  fail:
+	USBHIST_LOG(usbdebug, xfer %p err %d, xfer, err, 0, 0);
+
 	xfer-ux_status = err;
 	mutex_enter(bus-ub_lock);
 	usb_transfer_complete(xfer);
@@ -471,7 +466,6 @@ Static void
 roothub_ctrl_abort(usbd_xfer_handle xfer)
 {
 
-	DPRINTF(\n);
 	/* Nothing to do, all transfers are synchronous. */
 }
 
@@ -480,7 +474,6 @@ Static void
 roothub_ctrl_close(usbd_pipe_handle pipe)
 {
 
-	DPRINTF(\n);
 	/* Nothing to do. */
 }
 
@@ -488,7 +481,6 @@ Static void
 roothub_ctrl_done(usbd_xfer_handle xfer)
 {
 
-	DPRINTF(\n);
 	/* Nothing to do. */
 }
 



CVS commit: [nick-nhusb] src/sys/dev/usb

2015-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  1 08:16:31 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: uhci.c

Log Message:
Return success when clearing port reset.


To generate a diff of this commit:
cvs rdiff -u -r1.264.4.15 -r1.264.4.16 src/sys/dev/usb/uhci.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/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.264.4.15 src/sys/dev/usb/uhci.c:1.264.4.16
--- src/sys/dev/usb/uhci.c:1.264.4.15	Sat Dec  6 08:27:23 2014
+++ src/sys/dev/usb/uhci.c	Sun Feb  1 08:16:31 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.264.4.15 2014/12/06 08:27:23 skrll Exp $	*/
+/*	$NetBSD: uhci.c,v 1.264.4.16 2015/02/01 08:16:31 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.264.4.15 2014/12/06 08:27:23 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.264.4.16 2015/02/01 08:16:31 skrll Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -3502,7 +3502,7 @@ uhci_roothub_ctrl(struct usbd_bus *bus, 
 			break;
 		case UHF_C_PORT_RESET:
 			sc-sc_isreset = 0;
-			return -1;
+			break;
 		case UHF_PORT_CONNECTION:
 		case UHF_PORT_OVER_CURRENT:
 		case UHF_PORT_POWER:



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

2015-02-01 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Sun Feb  1 10:19:00 UTC 2015

Modified Files:
src/external/bsd/libevent/dist: evutil_rand.c

Log Message:
void functions should not return values.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libevent/dist/evutil_rand.c

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

Modified files:

Index: src/external/bsd/libevent/dist/evutil_rand.c
diff -u src/external/bsd/libevent/dist/evutil_rand.c:1.3 src/external/bsd/libevent/dist/evutil_rand.c:1.4
--- src/external/bsd/libevent/dist/evutil_rand.c:1.3	Thu Jan 29 07:26:02 2015
+++ src/external/bsd/libevent/dist/evutil_rand.c	Sun Feb  1 10:19:00 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: evutil_rand.c,v 1.3 2015/01/29 07:26:02 spz Exp $	*/
+/*	$NetBSD: evutil_rand.c,v 1.4 2015/02/01 10:19:00 njoly Exp $	*/
 /*
  * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
  *
@@ -35,7 +35,7 @@
 
 #include event2/event-config.h
 #include sys/cdefs.h
-__RCSID($NetBSD: evutil_rand.c,v 1.3 2015/01/29 07:26:02 spz Exp $);
+__RCSID($NetBSD: evutil_rand.c,v 1.4 2015/02/01 10:19:00 njoly Exp $);
 
 #include limits.h
 
@@ -70,7 +70,8 @@ static void
 ev_arc4random_buf(void *buf, size_t n)
 {
 #if defined(_EVENT_HAVE_ARC4RANDOM_BUF)  !defined(__APPLE__)
-	return arc4random_buf(buf, n);
+	arc4random_buf(buf, n);
+	return;
 #else
 	unsigned char *b = buf;
 
@@ -85,7 +86,8 @@ ev_arc4random_buf(void *buf, size_t n)
 		void (*tptr)(void *,size_t) =
 		(void (*)(void*,size_t))arc4random_buf;
 		if (tptr != NULL) {
-			return arc4random_buf(buf, n);
+			arc4random_buf(buf, n);
+			return;
 		}
 	}
 #endif



CVS commit: [nick-nhusb] src/sys/dev/usb

2015-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  1 13:09:15 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: usbdi.c

Log Message:
Remove newline character in USBHIST_LOG format


To generate a diff of this commit:
cvs rdiff -u -r1.162.2.9 -r1.162.2.10 src/sys/dev/usb/usbdi.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/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.162.2.9 src/sys/dev/usb/usbdi.c:1.162.2.10
--- src/sys/dev/usb/usbdi.c:1.162.2.9	Fri Dec  5 09:37:50 2014
+++ src/sys/dev/usb/usbdi.c	Sun Feb  1 13:09:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.162.2.9 2014/12/05 09:37:50 skrll Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.162.2.10 2015/02/01 13:09:15 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.162.2.9 2014/12/05 09:37:50 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.162.2.10 2015/02/01 13:09:15 skrll Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_usb.h
@@ -83,7 +83,7 @@ usbd_dump_iface(struct usbd_interface *i
 {
 	USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
 
-	USBHIST_LOG(usbdebug, iface %p\n, iface, 0, 0, 0);
+	USBHIST_LOG(usbdebug, iface %p, iface, 0, 0, 0);
 	if (iface == NULL)
 		return;
 	USBHIST_LOG(usbdebug,  device = %p idesc = %p index = %d,



CVS commit: [nick-nhusb] src/sys/dev/usb

2015-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  1 11:13:46 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: uhci.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.264.4.16 -r1.264.4.17 src/sys/dev/usb/uhci.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/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.264.4.16 src/sys/dev/usb/uhci.c:1.264.4.17
--- src/sys/dev/usb/uhci.c:1.264.4.16	Sun Feb  1 08:16:31 2015
+++ src/sys/dev/usb/uhci.c	Sun Feb  1 11:13:46 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.264.4.16 2015/02/01 08:16:31 skrll Exp $	*/
+/*	$NetBSD: uhci.c,v 1.264.4.17 2015/02/01 11:13:46 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.264.4.16 2015/02/01 08:16:31 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.264.4.17 2015/02/01 11:13:46 skrll Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -961,7 +961,8 @@ uhci_root_intr_done(usbd_xfer_handle xfe
  * If we are already looping, just count it.
  */
 void
-uhci_add_loop(uhci_softc_t *sc) {
+uhci_add_loop(uhci_softc_t *sc)
+{
 #ifdef UHCI_DEBUG
 	if (uhcinoloop)
 		return;
@@ -979,7 +980,8 @@ uhci_add_loop(uhci_softc_t *sc) {
 }
 
 void
-uhci_rem_loop(uhci_softc_t *sc) {
+uhci_rem_loop(uhci_softc_t *sc)
+{
 #ifdef UHCI_DEBUG
 	if (uhcinoloop)
 		return;



CVS commit: [nick-nhusb] src/sys/dev/usb

2015-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  1 08:45:04 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: ehci.c ehcireg.h

Log Message:
Define and use EHCI_QTD_MAXTRANSFER.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.234.2.29 -r1.234.2.30 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.34.14.3 -r1.34.14.4 src/sys/dev/usb/ehcireg.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/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.234.2.29 src/sys/dev/usb/ehci.c:1.234.2.30
--- src/sys/dev/usb/ehci.c:1.234.2.29	Sun Feb  1 06:15:41 2015
+++ src/sys/dev/usb/ehci.c	Sun Feb  1 08:45:04 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.234.2.29 2015/02/01 06:15:41 skrll Exp $ */
+/*	$NetBSD: ehci.c,v 1.234.2.30 2015/02/01 08:45:04 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ehci.c,v 1.234.2.29 2015/02/01 06:15:41 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: ehci.c,v 1.234.2.30 2015/02/01 08:45:04 skrll Exp $);
 
 #include ohci.h
 #include uhci.h
@@ -2786,12 +2786,12 @@ ehci_alloc_sqtd_chain(struct ehci_pipe *
 		/* The EHCI hardware can handle at most 5 pages. */
 		va_offs = (vaddr_t)KERNADDR(dma, curoffs);
 		va_offs = EHCI_PAGE_OFFSET(va_offs);
-		if (len-curoffs  EHCI_QTD_NBUFFERS*EHCI_PAGE_SIZE - va_offs) {
+		if (len-curoffs  EHCI_QTD_MAXTRANSFER - va_offs) {
 			/* we can handle it in this QTD */
 			curlen = len - curoffs;
 		} else {
 			/* must use multiple TDs, fill as much as possible. */
-			curlen = EHCI_QTD_NBUFFERS * EHCI_PAGE_SIZE - va_offs;
+			curlen = EHCI_QTD_MAXTRANSFER - va_offs;
 
 			/* the length must be a multiple of the max size */
 			curlen -= curlen % mps;

Index: src/sys/dev/usb/ehcireg.h
diff -u src/sys/dev/usb/ehcireg.h:1.34.14.3 src/sys/dev/usb/ehcireg.h:1.34.14.4
--- src/sys/dev/usb/ehcireg.h:1.34.14.3	Sun Feb  1 08:39:43 2015
+++ src/sys/dev/usb/ehcireg.h	Sun Feb  1 08:45:04 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehcireg.h,v 1.34.14.3 2015/02/01 08:39:43 skrll Exp $	*/
+/*	$NetBSD: ehcireg.h,v 1.34.14.4 2015/02/01 08:45:04 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001, 2004 The NetBSD Foundation, Inc.
@@ -281,7 +281,8 @@ typedef struct {
 #define EHCI_SITD_ALIGN 32
 
 /* Queue Element Transfer Descriptor */
-#define EHCI_QTD_NBUFFERS 5
+#define EHCI_QTD_NBUFFERS	5
+#define EHCI_QTD_MAXTRANSFER	(EHCI_QTD_NBUFFERS * EHCI_PAGE_SIZE)
 typedef struct {
 	volatile ehci_link_t	qtd_next;
 	volatile ehci_link_t	qtd_altnext;



CVS commit: [nick-nhusb] src/sys/dev/usb

2015-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  1 11:54:29 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: uhci.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.264.4.17 -r1.264.4.18 src/sys/dev/usb/uhci.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/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.264.4.17 src/sys/dev/usb/uhci.c:1.264.4.18
--- src/sys/dev/usb/uhci.c:1.264.4.17	Sun Feb  1 11:13:46 2015
+++ src/sys/dev/usb/uhci.c	Sun Feb  1 11:54:29 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.264.4.17 2015/02/01 11:13:46 skrll Exp $	*/
+/*	$NetBSD: uhci.c,v 1.264.4.18 2015/02/01 11:54:29 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.264.4.17 2015/02/01 11:13:46 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.264.4.18 2015/02/01 11:54:29 skrll Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -794,7 +794,8 @@ uhci_dump_qhs(uhci_soft_qh_t *sqh)
 {
 	uhci_dump_qh(sqh);
 
-	/* uhci_dump_qhs displays all the QHs and TDs from the given QH onwards
+	/*
+	 * uhci_dump_qhs displays all the QHs and TDs from the given QH onwards
 	 * Traverses sideways first, then down.
 	 *
 	 * QH1
@@ -832,7 +833,8 @@ uhci_dump_tds(uhci_soft_td_t *std)
 	for(td = std; td != NULL; td = td-link.std) {
 		uhci_dump_td(td);
 
-		/* Check whether the link pointer in this TD marks
+		/*
+		 * Check whether the link pointer in this TD marks
 		 * the link pointer as end of queue. This avoids
 		 * printing the free list in case the queue/TD has
 		 * already been moved there (seatbelt).



CVS commit: [nick-nhusb] src/sys/dev/usb

2015-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  1 12:08:15 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: motg.c uhci.c usb_mem.c

Log Message:
Remove unused #includes


To generate a diff of this commit:
cvs rdiff -u -r1.12.2.12 -r1.12.2.13 src/sys/dev/usb/motg.c
cvs rdiff -u -r1.264.4.18 -r1.264.4.19 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.65.2.4 -r1.65.2.5 src/sys/dev/usb/usb_mem.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/motg.c
diff -u src/sys/dev/usb/motg.c:1.12.2.12 src/sys/dev/usb/motg.c:1.12.2.13
--- src/sys/dev/usb/motg.c:1.12.2.12	Sat Dec  6 09:07:59 2014
+++ src/sys/dev/usb/motg.c	Sun Feb  1 12:08:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: motg.c,v 1.12.2.12 2014/12/06 09:07:59 skrll Exp $	*/
+/*	$NetBSD: motg.c,v 1.12.2.13 2015/02/01 12:08:15 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012, 2014 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
 #include opt_motg.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: motg.c,v 1.12.2.12 2014/12/06 09:07:59 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: motg.c,v 1.12.2.13 2015/02/01 12:08:15 skrll Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -50,7 +50,6 @@ __KERNEL_RCSID(0, $NetBSD: motg.c,v 1.1
 #include sys/kmem.h
 #include sys/device.h
 #include sys/select.h
-#include sys/extent.h
 #include sys/proc.h
 #include sys/queue.h
 #include sys/bus.h

Index: src/sys/dev/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.264.4.18 src/sys/dev/usb/uhci.c:1.264.4.19
--- src/sys/dev/usb/uhci.c:1.264.4.18	Sun Feb  1 11:54:29 2015
+++ src/sys/dev/usb/uhci.c	Sun Feb  1 12:08:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.264.4.18 2015/02/01 11:54:29 skrll Exp $	*/
+/*	$NetBSD: uhci.c,v 1.264.4.19 2015/02/01 12:08:15 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.264.4.18 2015/02/01 11:54:29 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.264.4.19 2015/02/01 12:08:15 skrll Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -50,7 +50,6 @@ __KERNEL_RCSID(0, $NetBSD: uhci.c,v 1.2
 #include sys/kmem.h
 #include sys/device.h
 #include sys/select.h
-#include sys/extent.h
 #include sys/proc.h
 #include sys/queue.h
 #include sys/bus.h

Index: src/sys/dev/usb/usb_mem.c
diff -u src/sys/dev/usb/usb_mem.c:1.65.2.4 src/sys/dev/usb/usb_mem.c:1.65.2.5
--- src/sys/dev/usb/usb_mem.c:1.65.2.4	Fri Dec  5 09:37:50 2014
+++ src/sys/dev/usb/usb_mem.c	Sun Feb  1 12:08:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_mem.c,v 1.65.2.4 2014/12/05 09:37:50 skrll Exp $	*/
+/*	$NetBSD: usb_mem.c,v 1.65.2.5 2015/02/01 12:08:15 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: usb_mem.c,v 1.65.2.4 2014/12/05 09:37:50 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: usb_mem.c,v 1.65.2.5 2015/02/01 12:08:15 skrll Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_usb.h
@@ -54,8 +54,6 @@ __KERNEL_RCSID(0, $NetBSD: usb_mem.c,v 
 #include sys/cpu.h
 #include sys/once.h
 
-#include sys/extent.h
-
 #ifdef DIAGNOSTIC
 #include sys/proc.h
 #endif



CVS commit: [nick-nhusb] src/sys/dev/usb

2015-02-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  1 08:29:46 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: ehcivar.h

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.42.14.8 -r1.42.14.9 src/sys/dev/usb/ehcivar.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/ehcivar.h
diff -u src/sys/dev/usb/ehcivar.h:1.42.14.8 src/sys/dev/usb/ehcivar.h:1.42.14.9
--- src/sys/dev/usb/ehcivar.h:1.42.14.8	Sun Feb  1 06:15:41 2015
+++ src/sys/dev/usb/ehcivar.h	Sun Feb  1 08:29:46 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehcivar.h,v 1.42.14.8 2015/02/01 06:15:41 skrll Exp $ */
+/*	$NetBSD: ehcivar.h,v 1.42.14.9 2015/02/01 08:29:46 skrll Exp $ */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@ typedef struct ehci_soft_itd {
 	};
 	union {
 		struct {
-			/* soft_itds links in a periodic frame*/
+			/* soft_itds links in a periodic frame */
 			struct ehci_soft_itd *next;
 			struct ehci_soft_itd *prev;
 		} frame_list;



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

2015-02-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb  1 19:32:59 UTC 2015

Modified Files:
src/sys/arch/arm/omap: if_cpsw.c

Log Message:
PR/49621: Robert Sprowson: Add detach function to if_cpsw


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/omap/if_cpsw.c

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

Modified files:

Index: src/sys/arch/arm/omap/if_cpsw.c
diff -u src/sys/arch/arm/omap/if_cpsw.c:1.6 src/sys/arch/arm/omap/if_cpsw.c:1.7
--- src/sys/arch/arm/omap/if_cpsw.c:1.6	Wed Apr  9 16:52:14 2014
+++ src/sys/arch/arm/omap/if_cpsw.c	Sun Feb  1 14:32:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cpsw.c,v 1.6 2014/04/09 20:52:14 hans Exp $	*/
+/*	$NetBSD: if_cpsw.c,v 1.7 2015/02/01 19:32:59 christos Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -53,7 +53,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: if_cpsw.c,v 1.6 2014/04/09 20:52:14 hans Exp $);
+__KERNEL_RCSID(1, $NetBSD: if_cpsw.c,v 1.7 2015/02/01 19:32:59 christos Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -115,6 +115,7 @@ struct cpsw_softc {
 	device_t sc_dev;
 	bus_space_tag_t sc_bst;
 	bus_space_handle_t sc_bsh;
+	bus_size_t sc_bss;
 	bus_dma_tag_t sc_bdt;
 	bus_space_handle_t sc_bsh_txdescs;
 	bus_space_handle_t sc_bsh_rxdescs;
@@ -123,6 +124,7 @@ struct cpsw_softc {
 	struct ethercom sc_ec;
 	struct mii_data sc_mii;
 	bool sc_phy_has_1000t;
+	bool sc_attached;
 	callout_t sc_tick_ch;
 	void *sc_ih;
 	struct cpsw_ring_data *sc_rdp;
@@ -145,6 +147,7 @@ struct cpsw_softc {
 
 static int cpsw_match(device_t, cfdata_t, void *);
 static void cpsw_attach(device_t, device_t, void *);
+static int cpsw_detach(device_t, int);
 
 static void cpsw_start(struct ifnet *);
 static int cpsw_ioctl(struct ifnet *, u_long, void *);
@@ -170,7 +173,7 @@ static int cpsw_miscintr(void *);
 static int cpsw_ale_update_addresses(struct cpsw_softc *, int purge);
 
 CFATTACH_DECL_NEW(cpsw, sizeof(struct cpsw_softc),
-cpsw_match, cpsw_attach, NULL, NULL);
+cpsw_match, cpsw_attach, cpsw_detach, NULL);
 
 #undef KERNHIST
 #include sys/kernhist.h
@@ -336,6 +339,55 @@ cpsw_phy_has_1000t(struct cpsw_softc * c
 	return false;
 }
 
+static int
+cpsw_detach(device_t self, int flags)
+{
+	struct cpsw_softc * const sc = device_private(self);
+	struct ifnet *ifp = sc-sc_ec.ec_if;
+	u_int i;
+
+	/* Succeed now if there's no work to do. */
+	if (!sc-sc_attached)
+		return 0;
+
+	sc-sc_attached = false;
+
+	/* Stop the interface. Callouts are stopped in it. */
+	cpsw_stop(ifp, 1);
+
+	/* Destroy our callout. */
+	callout_destroy(sc-sc_tick_ch);
+
+	/* Let go of the interrupts */
+	intr_disestablish(sc-sc_rxthih);
+	intr_disestablish(sc-sc_rxih);
+	intr_disestablish(sc-sc_txih);
+	intr_disestablish(sc-sc_miscih);
+
+	/* Delete all media. */
+	ifmedia_delete_instance(sc-sc_mii.mii_media, IFM_INST_ANY);
+
+	ether_ifdetach(ifp);
+	if_detach(ifp);
+
+	/* Free the packet padding buffer */
+	kmem_free(sc-sc_txpad, ETHER_MIN_LEN);
+	bus_dmamap_destroy(sc-sc_bdt, sc-sc_txpad_dm);
+
+	/* Destroy all the descriptors */
+	for (i = 0; i  CPSW_NTXDESCS; i++)
+		bus_dmamap_destroy(sc-sc_bdt, sc-sc_rdp-tx_dm[i]);
+	for (i = 0; i  CPSW_NRXDESCS; i++)
+		bus_dmamap_destroy(sc-sc_bdt, sc-sc_rdp-rx_dm[i]);
+	kmem_free(sc-sc_rdp, sizeof(*sc-sc_rdp));
+
+	/* Unmap */
+	bus_space_unmap(sc-sc_bst, sc-sc_bsh, sc-sc_bss);
+
+
+	return 0;
+}
+
 static void
 cpsw_attach(device_t parent, device_t self, void *aux)
 {
@@ -398,6 +450,7 @@ cpsw_attach(device_t parent, device_t se
 	IPL_VM, IST_LEVEL, cpsw_miscintr, sc);
 
 	sc-sc_bst = oa-obio_iot;
+	sc-sc_bss = oa-obio_size;
 	sc-sc_bdt = oa-obio_dmat;
 
 	error = bus_space_map(sc-sc_bst, oa-obio_addr, oa-obio_size, 0,
@@ -515,6 +568,9 @@ cpsw_attach(device_t parent, device_t se
 	if_attach(ifp);
 	ether_ifattach(ifp, sc-sc_enaddr);
 
+	/* The attach is successful. */
+	sc-sc_attached = true;
+
 	return;
 }
 



CVS commit: src/lib/libc/sys

2015-02-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb  1 15:24:15 UTC 2015

Modified Files:
src/lib/libc/sys: fdiscard.2

Log Message:
PR/49617: Kirk Russell: Describe the posix_fallocate return values correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/sys/fdiscard.2

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/sys/fdiscard.2
diff -u src/lib/libc/sys/fdiscard.2:1.2 src/lib/libc/sys/fdiscard.2:1.3
--- src/lib/libc/sys/fdiscard.2:1.2	Fri Jul 25 04:47:42 2014
+++ src/lib/libc/sys/fdiscard.2	Sun Feb  1 10:24:15 2015
@@ -1,4 +1,4 @@
-.\	$NetBSD: fdiscard.2,v 1.2 2014/07/25 08:47:42 wiz Exp $
+.\	$NetBSD: fdiscard.2,v 1.3 2015/02/01 15:24:15 christos Exp $
 .\
 .\ Copyright (c) 2014 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd July 25, 2014
+.Dd February 1, 2015
 .Dt FDISCARD 2
 .Os
 .Sh NAME
@@ -127,8 +127,16 @@ by
 may not be persistent after a crash or reboot if the space reserved
 has not yet been written to.
 .Sh RETURN VALUES
-On success these calls return 0.
-On error, \-1 is returned, and the global variable
+If successful, the
+.Fn posix_fallocate
+function will return zero.
+Otherwise an error number will be returned, without setting
+.Va errno .
+.Pp
+If successful, the
+.Fn fdiscard
+function will return zero.
+Otherwise the value \-1 is returned and the global variable
 .Va errno
 is set to indicate the error.
 .Sh ERRORS



CVS commit: src/external/gpl3/gcc/usr.bin/backend

2015-02-01 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Feb  1 17:47:00 UTC 2015

Modified Files:
src/external/gpl3/gcc/usr.bin/backend: Makefile

Log Message:
update m68k gcc bug workarounds for gcc 4.8.  fixes PR 49609.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/gpl3/gcc/usr.bin/backend/Makefile

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

Modified files:

Index: src/external/gpl3/gcc/usr.bin/backend/Makefile
diff -u src/external/gpl3/gcc/usr.bin/backend/Makefile:1.23 src/external/gpl3/gcc/usr.bin/backend/Makefile:1.24
--- src/external/gpl3/gcc/usr.bin/backend/Makefile:1.23	Wed Jan  7 02:06:03 2015
+++ src/external/gpl3/gcc/usr.bin/backend/Makefile	Sun Feb  1 17:47:00 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.23 2015/01/07 02:06:03 christos Exp $
+#	$NetBSD: Makefile,v 1.24 2015/02/01 17:47:00 chs Exp $
 
 LIBISPRIVATE=	yes
 
@@ -398,9 +398,9 @@ COPTS.recog.c=-O0
 
 CFLAGS+=	-Wno-stack-protector
 
-.if ${GCC_MACHINE_ARCH} == m68000 || ${GCC_MACHINE_ARCH} == m68k
-COPTS.lambda-code.c=		-O0
-COPTS.tree-loop-linear.c=	-O0
+.if ${GCC_MACHINE_ARCH} == m68000 || ${GCC_MACHINE_ARCH} == m68k || \
+	${GCC_MACHINE_ARCH} == coldfire
+COPTS.tree-loop-distribution.c=	-O2
 .endif
 
 COPTS.tree.c=	${${ACTIVE_CC} == clang :? -O0 :}



CVS commit: src

2015-02-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb  1 18:49:25 UTC 2015

Modified Files:
src: build.sh

Log Message:
Fix the build kernels target with -n, disable temporarily runcmd while we
are fetching the allkernels variable.


To generate a diff of this commit:
cvs rdiff -u -r1.305 -r1.306 src/build.sh

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.305 src/build.sh:1.306
--- src/build.sh:1.305	Sun Nov 30 10:53:29 2014
+++ src/build.sh	Sun Feb  1 13:49:25 2015
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.305 2014/11/30 15:53:29 uebayasi Exp $
+#	$NetBSD: build.sh,v 1.306 2015/02/01 18:49:25 christos Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1869,7 +1869,7 @@ createmakewrapper()
 	eval cat EOF ${makewrapout}
 #! ${HOST_SH}
 # Set proper variables to allow easy make building of a NetBSD subtree.
-# Generated from:  \$NetBSD: build.sh,v 1.305 2014/11/30 15:53:29 uebayasi Exp $
+# Generated from:  \$NetBSD: build.sh,v 1.306 2015/02/01 18:49:25 christos Exp $
 # with these arguments: ${_args}
 #
 
@@ -2023,7 +2023,7 @@ releasekernel()
 
 buildkernels()
 {
-	allkernels=$( make_in_dir etc '-V ${ALL_KERNELS}' )
+	allkernels=$( runcmd= make_in_dir etc '-V ${ALL_KERNELS}' )
 	for k in $allkernels; do
 		buildkernel ${k}
 	done



CVS commit: src/sys/uvm

2015-02-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb  1 16:26:01 UTC 2015

Modified Files:
src/sys/uvm: uvm_map.c

Log Message:
The diagnostic function uvm_km_check_empty() takes a mutex, so don't call it
if we are using UVM_FLAG_NOWAIT.


To generate a diff of this commit:
cvs rdiff -u -r1.332 -r1.333 src/sys/uvm/uvm_map.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/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.332 src/sys/uvm/uvm_map.c:1.333
--- src/sys/uvm/uvm_map.c:1.332	Fri Jan 23 11:13:53 2015
+++ src/sys/uvm/uvm_map.c	Sun Feb  1 11:26:00 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.332 2015/01/23 16:13:53 chs Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.333 2015/02/01 16:26:00 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.332 2015/01/23 16:13:53 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.333 2015/02/01 16:26:00 christos Exp $);
 
 #include opt_ddb.h
 #include opt_uvmhist.h
@@ -1078,7 +1078,7 @@ uvm_map(struct vm_map *map, vaddr_t *sta
 	}
 
 #if defined(DEBUG)
-	if (!error  VM_MAP_IS_KERNEL(map)) {
+	if (!error  VM_MAP_IS_KERNEL(map)  (flags  UVM_FLAG_NOWAIT) == 0) {
 		uvm_km_check_empty(map, *startp, *startp + size);
 	}
 #endif /* defined(DEBUG) */
@@ -2253,7 +2253,7 @@ uvm_unmap_remove(struct vm_map *map, vad
 			}
 		}
 
-		if (VM_MAP_IS_KERNEL(map)) {
+		if (VM_MAP_IS_KERNEL(map)  (flags  UVM_FLAG_NOWAIT) == 0) {
 			uvm_km_check_empty(map, entry-start,
 			entry-end);
 		}



CVS commit: src/external/bsd/libevent/dist/include/event2

2015-02-01 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Sun Feb  1 19:09:05 UTC 2015

Removed Files:
src/external/bsd/libevent/dist/include/event2: event-config.h

Log Message:
this generated include file oughtn't be around, the 'good' version is in
external/bsd/libevent/include/event2/event-config.h instead


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r0 \
src/external/bsd/libevent/dist/include/event2/event-config.h

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



CVS commit: src/sys/net/npf

2015-02-01 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Feb  1 22:41:22 UTC 2015

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

Log Message:
- npf_conn_establish: remove a rare race condition when we might destroy a
  connection when it is still referenced by another thread.
- npf_conn_destroy: remove the backwards entry using the saved key, PR/49488.
- Sprinkle some asserts.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/net/npf/npf_conn.c

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

Modified files:

Index: src/sys/net/npf/npf_conn.c
diff -u src/sys/net/npf/npf_conn.c:1.14 src/sys/net/npf/npf_conn.c:1.15
--- src/sys/net/npf/npf_conn.c:1.14	Sat Dec 20 16:19:43 2014
+++ src/sys/net/npf/npf_conn.c	Sun Feb  1 22:41:22 2015
@@ -1,7 +1,7 @@
-/*	$NetBSD: npf_conn.c,v 1.14 2014/12/20 16:19:43 rmind Exp $	*/
+/*	$NetBSD: npf_conn.c,v 1.15 2015/02/01 22:41:22 rmind Exp $	*/
 
 /*-
- * Copyright (c) 2014 Mindaugas Rasiukevicius rmind at netbsd org
+ * Copyright (c) 2014-2015 Mindaugas Rasiukevicius rmind at netbsd org
  * Copyright (c) 2010-2014 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -99,7 +99,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf_conn.c,v 1.14 2014/12/20 16:19:43 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf_conn.c,v 1.15 2015/02/01 22:41:22 rmind Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -369,7 +369,6 @@ npf_conn_lookup(const npf_cache_t *npc, 
 	/* Check if connection is active and not expired. */
 	flags = con-c_flags;
 	ok = (flags  (CONN_ACTIVE | CONN_EXPIRE)) == CONN_ACTIVE;
-
 	if (__predict_false(!ok)) {
 		atomic_dec_uint(con-c_refcnt);
 		return NULL;
@@ -453,6 +452,7 @@ npf_conn_establish(npf_cache_t *npc, int
 {
 	const nbuf_t *nbuf = npc-npc_nbuf;
 	npf_conn_t *con;
+	int error = 0;
 
 	KASSERT(!nbuf_flag_p(nbuf, NBUF_DATAREF_RESET));
 
@@ -468,16 +468,16 @@ npf_conn_establish(npf_cache_t *npc, int
 	NPF_PRINTF((NPF: create conn %p\n, con));
 	npf_stats_inc(NPF_STAT_CONN_CREATE);
 
-	/* Reference count and flags (indicate direction). */
 	mutex_init(con-c_lock, MUTEX_DEFAULT, IPL_SOFTNET);
 	con-c_flags = (di  PFIL_ALL);
-	con-c_refcnt = 1;
+	con-c_refcnt = 0;
 	con-c_rproc = NULL;
 	con-c_nat = NULL;
 
-	/* Initialize protocol state. */
+	/* Initialize the protocol state. */
 	if (!npf_state_init(npc, con-c_state)) {
-		goto err;
+		npf_conn_destroy(con);
+		return NULL;
 	}
 
 	KASSERT(npf_iscached(npc, NPC_IP46));
@@ -488,45 +488,65 @@ npf_conn_establish(npf_cache_t *npc, int
 	 * Construct forwards and backwards keys.  Also, set the
 	 * interface ID for this connection (unless it is global).
 	 */
-	if (!npf_conn_conkey(npc, fw, true)) {
-		goto err;
-	}
-	if (!npf_conn_conkey(npc, bk, false)) {
-		goto err;
+	if (!npf_conn_conkey(npc, fw, true) ||
+	!npf_conn_conkey(npc, bk, false)) {
+		npf_conn_destroy(con);
+		return NULL;
 	}
 	fw-ck_backptr = bk-ck_backptr = con;
 	con-c_ifid = per_if ? nbuf-nb_ifid : 0;
 	con-c_proto = npc-npc_proto;
 
-	/* Set last activity time for a new connection. */
+	/*
+	 * Set last activity time for a new connection and acquire
+	 * a reference for the caller before we make it visible.
+	 */
 	getnanouptime(con-c_atime);
+	con-c_refcnt = 1;
 
 	/*
 	 * Insert both keys (entries representing directions) of the
-	 * connection.  At this point, it becomes visible.
+	 * connection.  At this point it becomes visible, but we activate
+	 * the connection later.
 	 */
+	mutex_enter(con-c_lock);
 	if (!npf_conndb_insert(conn_db, fw, con)) {
+		error = EISCONN;
 		goto err;
 	}
 	if (!npf_conndb_insert(conn_db, bk, con)) {
-		/* We have hit the duplicate. */
-		npf_conndb_remove(conn_db, fw);
-		npf_stats_inc(NPF_STAT_RACE_CONN);
+		npf_conn_t *ret __diagused;
+		ret = npf_conndb_remove(conn_db, fw);
+		KASSERT(ret == con);
+		error = EISCONN;
 		goto err;
 	}
+err:
+	/*
+	 * If we have hit the duplicate: mark the connection as expired
+	 * and let the G/C thread to take care of it.  We cannot do it
+	 * here since there might be references acquired already.
+	 */
+	if (error) {
+		const u_int dflags = CONN_REMOVED | CONN_EXPIRE;
+		atomic_or_uint(con-c_flags, dflags);
+		npf_stats_inc(NPF_STAT_RACE_CONN);
+	} else {
+		NPF_PRINTF((NPF: establish conn %p\n, con));
+	}
 
 	/* Finally, insert into the connection list. */
-	NPF_PRINTF((NPF: establish conn %p\n, con));
 	npf_conndb_enqueue(conn_db, con);
-	return con;
-err:
-	npf_conn_destroy(con);
-	return NULL;
+	mutex_exit(con-c_lock);
+
+	return error ? NULL : con;
 }
 
 static void
 npf_conn_destroy(npf_conn_t *con)
 {
+	KASSERT(con-c_refcnt == 0);
+
 	if (con-c_nat) {
 		/* Release any NAT structures. */
 		npf_nat_destroy(con-c_nat);
@@ -582,6 +602,8 @@ npf_conn_setnat(const npf_cache_t *npc, 
 		mutex_exit(con-c_lock);
 		return EINVAL;
 	}
+	KASSERT((con-c_flags  CONN_REMOVED) == 0);
+
 	if (__predict_false(con-c_nat != NULL)) {
 		/* Race with a 

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

2015-02-01 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sun Feb  1 22:57:22 UTC 2015

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
npf.conf(5): mention alg, include in the example, minor fix.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/npf/npfctl/npf.conf.5

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.43 src/usr.sbin/npf/npfctl/npf.conf.5:1.44
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.43	Fri Dec 26 22:44:54 2014
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Sun Feb  1 22:57:21 2015
@@ -1,6 +1,6 @@
-.\$NetBSD: npf.conf.5,v 1.43 2014/12/26 22:44:54 christos Exp $
+.\$NetBSD: npf.conf.5,v 1.44 2015/02/01 22:57:21 rmind Exp $
 .\
-.\ Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
+.\ Copyright (c) 2009-2015 The NetBSD Foundation, Inc.
 .\ All rights reserved.
 .\
 .\ This material is based upon work partially supported by The
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd December 26, 2014
+.Dd February 1, 2015
 .Dt NPF.CONF 5
 .Os
 .Sh NAME
@@ -232,7 +232,8 @@ is more flexible.
 ; Syntax of a single line.  Lines can be separated by LF (\\n) or
 ; a semicolon.  Comments start with a hash (#) character.
 
-syntax		= var-def | table-def | map | group | rproc | comment
+syntax		= var-def | set-param | alg | table-def |
+		  map | group | rproc | comment
 
 ; Variable definition.  Names can be alpha-numeric, including _ character.
 
@@ -240,8 +241,12 @@ var-name	= $ . string
 interface	= interface-name | var-name
 var-def		= var = ( var-value | { value *[ , value ] } )
 
-; Parameter setting
-set-statement	= set parameter value
+; Parameter setting.
+set-param	= set param-value
+
+; Application level gateway.  The name should be in the double quotes.
+
+alg		= alg alg-name
 
 ; Table definition.  Table ID shall be numeric.  Path is in the double quotes.
 
@@ -306,8 +311,8 @@ directory containing further examples
 .\ -
 .Sh EXAMPLES
 .Bd -literal
-$ext_if = { inet4(wm0), inet6(wm0) }
-$int_if = { inet4(wm1), inet6(wm1) }
+$ext_if = { inet4(wm0) }
+$int_if = { inet4(wm1) }
 
 table blacklist type hash file /etc/npf_blacklist
 table limited type tree dynamic
@@ -316,6 +321,8 @@ $services_tcp = { http, https, smtp, dom
 $services_udp = { domain, ntp, 6000 }
 $localnet = { 10.1.1.0/24 }
 
+alg icmp
+
 # Note: if $ext_if has multiple IP address (e.g. IPv6 as well),
 # then the translation address has to be specified explicitly.
 map $ext_if dynamic 10.1.1.0/24 - $ext_if



CVS commit: src

2015-02-01 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Mon Feb  2 00:31:39 UTC 2015

Modified Files:
src/sys/net/npf: npf_impl.h npf_ruleset.c
src/usr.sbin/npf/npfctl: npf_show.c

Log Message:
npfctl(8): report dynamic rule ID in a comment, print the case when libpcap
is used correctly.  Also, add npf_ruleset_dump() helper in the kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.40 -r1.41 src/sys/net/npf/npf_ruleset.c
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/npf/npfctl/npf_show.c

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

Modified files:

Index: src/sys/net/npf/npf_impl.h
diff -u src/sys/net/npf/npf_impl.h:1.60 src/sys/net/npf/npf_impl.h:1.61
--- src/sys/net/npf/npf_impl.h:1.60	Sun Nov 30 01:37:53 2014
+++ src/sys/net/npf/npf_impl.h	Mon Feb  2 00:31:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_impl.h,v 1.60 2014/11/30 01:37:53 rmind Exp $	*/
+/*	$NetBSD: npf_impl.h,v 1.61 2015/02/02 00:31:39 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -344,6 +344,7 @@ prop_array_t	npf_alg_export(void);
 const char *	npf_addr_dump(const npf_addr_t *, int);
 void		npf_state_dump(const npf_state_t *);
 void		npf_nat_dump(const npf_nat_t *);
+void		npf_ruleset_dump(const char *);
 void		npf_state_setsampler(void (*)(npf_state_t *, bool));
 
 #endif	/* _NPF_IMPL_H_ */

Index: src/sys/net/npf/npf_ruleset.c
diff -u src/sys/net/npf/npf_ruleset.c:1.40 src/sys/net/npf/npf_ruleset.c:1.41
--- src/sys/net/npf/npf_ruleset.c:1.40	Sun Nov 30 01:37:53 2014
+++ src/sys/net/npf/npf_ruleset.c	Mon Feb  2 00:31:39 2015
@@ -1,7 +1,7 @@
-/*	$NetBSD: npf_ruleset.c,v 1.40 2014/11/30 01:37:53 rmind Exp $	*/
+/*	$NetBSD: npf_ruleset.c,v 1.41 2015/02/02 00:31:39 rmind Exp $	*/
 
 /*-
- * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
+ * Copyright (c) 2009-2015 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This material is based upon work partially supported by The
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf_ruleset.c,v 1.40 2014/11/30 01:37:53 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf_ruleset.c,v 1.41 2015/02/02 00:31:39 rmind Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -936,3 +936,25 @@ npf_rule_conclude(const npf_rule_t *rl, 
 	*retfl = rl-r_attr;
 	return (rl-r_attr  NPF_RULE_PASS) ? 0 : ENETUNREACH;
 }
+
+
+#if defined(DDB) || defined(_NPF_TESTING)
+
+void
+npf_ruleset_dump(const char *name)
+{
+	npf_ruleset_t *rlset = npf_config_ruleset();
+	npf_rule_t *rg, *rl;
+
+	LIST_FOREACH(rg, rlset-rs_dynamic, r_dentry) {
+		printf(ruleset '%s':\n, rg-r_name);
+		TAILQ_FOREACH(rl, rg-r_subset, r_entry) {
+			printf(\tid %PRIu64, key: , rl-r_id);
+			for (u_int i = 0; i  NPF_RULE_MAXKEYLEN; i++)
+printf(%x, rl-r_key[i]);
+			printf(\n);
+		}
+	}
+}
+
+#endif

Index: src/usr.sbin/npf/npfctl/npf_show.c
diff -u src/usr.sbin/npf/npfctl/npf_show.c:1.15 src/usr.sbin/npf/npfctl/npf_show.c:1.16
--- src/usr.sbin/npf/npfctl/npf_show.c:1.15	Sun Jul 20 00:48:51 2014
+++ src/usr.sbin/npf/npfctl/npf_show.c	Mon Feb  2 00:31:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_show.c,v 1.15 2014/07/20 00:48:51 rmind Exp $	*/
+/*	$NetBSD: npf_show.c,v 1.16 2015/02/02 00:31:39 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: npf_show.c,v 1.15 2014/07/20 00:48:51 rmind Exp $);
+__RCSID($NetBSD: npf_show.c,v 1.16 2015/02/02 00:31:39 rmind Exp $);
 
 #include sys/socket.h
 #include netinet/in.h
@@ -316,10 +316,25 @@ static void
 npfctl_print_filter(npf_conf_info_t *ctx, nl_rule_t *rl)
 {
 	const void *marks;
-	size_t mlen;
+	size_t mlen, len;
+	const void *code;
+	int type;
 
-	/* BPF filter criteria described by the byte-code marks. */
 	marks = npf_rule_getinfo(rl, mlen);
+	if (!marks  (code = npf_rule_getcode(rl, type, len)) != NULL) {
+		/*
+		 * No marks, but the byte-code is present.  This must
+		 * have been filled by libpcap(3) or possibly an unknown
+		 * to us byte-code.
+		 */
+		fprintf(ctx-fp, %s , type == NPF_CODE_BPF ?
+		pcap-filter \...\ : unrecognized-bytecode);
+		return;
+	}
+
+	/*
+	 * BPF filter criteria described by the byte-code marks.
+	 */
 	for (u_int i = 0; i  __arraycount(mark_keyword_map); i++) {
 		const struct mark_keyword_mapent *mk = mark_keyword_map[i];
 		char *val;
@@ -356,7 +371,7 @@ npfctl_print_rule(npf_conf_info_t *ctx, 
 		fprintf(ctx-fp, on %s , ifname);
 	}
 
-	if ((attr  (NPF_RULE_GROUP | NPF_RULE_DYNAMIC)) == NPF_RULE_GROUP) {
+	if ((attr  NPF_DYNAMIC_GROUP) == NPF_RULE_GROUP) {
 		/* Group; done. */
 		fputs(\n, ctx-fp);
 		return;
@@ -367,8 +382,15 @@ npfctl_print_rule(npf_conf_info_t *ctx, 
 
 	/* Rule procedure. */
 	if ((rproc = npf_rule_getproc(rl)) != NULL) {
-		fprintf(ctx-fp, apply \%s\, rproc);
+		fprintf(ctx-fp, apply \%s\ , rproc);
+	}
+
+	/* If dynamic rule - print its ID. */
+	

CVS commit: src/lib/libnpf

2015-02-01 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Mon Feb  2 00:55:28 UTC 2015

Modified Files:
src/lib/libnpf: npf.c npf.h

Log Message:
libnpf: add npf_rule_getid() and npf_rule_getcode().
Missed in the previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libnpf/npf.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libnpf/npf.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/libnpf/npf.c
diff -u src/lib/libnpf/npf.c:1.34 src/lib/libnpf/npf.c:1.35
--- src/lib/libnpf/npf.c:1.34	Sun Aug 24 20:37:35 2014
+++ src/lib/libnpf/npf.c	Mon Feb  2 00:55:28 2015
@@ -1,7 +1,7 @@
-/*	$NetBSD: npf.c,v 1.34 2014/08/24 20:37:35 rmind Exp $	*/
+/*	$NetBSD: npf.c,v 1.35 2015/02/02 00:55:28 rmind Exp $	*/
 
 /*-
- * Copyright (c) 2010-2014 The NetBSD Foundation, Inc.
+ * Copyright (c) 2010-2015 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This material is based upon work partially supported by The
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: npf.c,v 1.34 2014/08/24 20:37:35 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: npf.c,v 1.35 2015/02/02 00:55:28 rmind Exp $);
 
 #include sys/types.h
 #include netinet/in_systm.h
@@ -715,6 +715,27 @@ npf_rule_getproc(nl_rule_t *rl)
 	return rpname;
 }
 
+uint64_t
+npf_rule_getid(nl_rule_t *rl)
+{
+	prop_dictionary_t rldict = rl-nrl_dict;
+	uint64_t id = 0;
+
+	(void)prop_dictionary_get_uint64(rldict, id, id);
+	return id;
+}
+
+const void *
+npf_rule_getcode(nl_rule_t *rl, int *type, size_t *len)
+{
+	prop_dictionary_t rldict = rl-nrl_dict;
+	prop_object_t obj = prop_dictionary_get(rldict, code);
+
+	prop_dictionary_get_uint32(rldict, code-type, (uint32_t *)type);
+	*len = prop_data_size(obj);
+	return prop_data_data_nocopy(obj);
+}
+
 int
 _npf_ruleset_list(int fd, const char *rname, nl_config_t *ncf)
 {

Index: src/lib/libnpf/npf.h
diff -u src/lib/libnpf/npf.h:1.27 src/lib/libnpf/npf.h:1.28
--- src/lib/libnpf/npf.h:1.27	Wed Jul 23 01:25:34 2014
+++ src/lib/libnpf/npf.h	Mon Feb  2 00:55:28 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf.h,v 1.27 2014/07/23 01:25:34 rmind Exp $	*/
+/*	$NetBSD: npf.h,v 1.28 2015/02/02 00:55:28 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2011-2014 The NetBSD Foundation, Inc.
@@ -129,6 +129,8 @@ uint32_t	npf_rule_getattr(nl_rule_t *);
 const char *	npf_rule_getinterface(nl_rule_t *);
 const void *	npf_rule_getinfo(nl_rule_t *, size_t *);
 const char *	npf_rule_getproc(nl_rule_t *);
+uint64_t	npf_rule_getid(nl_rule_t *);
+const void *	npf_rule_getcode(nl_rule_t *, int *, size_t *);
 
 nl_table_t *	npf_table_iterate(nl_config_t *);
 const char *	npf_table_getname(nl_table_t *);



CVS import: src/external/mit/lua/dist

2015-02-01 Thread Lourival Pereira Vieira Neto
Module Name:src
Committed By:   lneto
Date:   Mon Feb  2 02:01:19 UTC 2015

Update of /cvsroot/src/external/mit/lua/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv18467

Log Message:
imported Lua 5.3.0

Status:

Vendor Tag: LUA
Release Tags:   LUA_5_3_0

C src/external/mit/lua/dist/README
C src/external/mit/lua/dist/Makefile
C src/external/mit/lua/dist/src/lobject.h
C src/external/mit/lua/dist/src/liolib.c
U src/external/mit/lua/dist/src/lctype.h
C src/external/mit/lua/dist/src/ltm.h
C src/external/mit/lua/dist/src/ldump.c
C src/external/mit/lua/dist/src/lopcodes.h
C src/external/mit/lua/dist/src/luac.c
C src/external/mit/lua/dist/src/lbitlib.c
C src/external/mit/lua/dist/src/llimits.h
C src/external/mit/lua/dist/src/luaconf.h
C src/external/mit/lua/dist/src/lgc.h
C src/external/mit/lua/dist/src/lauxlib.c
C src/external/mit/lua/dist/src/lstate.h
C src/external/mit/lua/dist/src/llex.c
C src/external/mit/lua/dist/src/ldblib.c
U src/external/mit/lua/dist/src/lcode.h
C src/external/mit/lua/dist/src/lstate.c
C src/external/mit/lua/dist/src/lua.c
C src/external/mit/lua/dist/src/lzio.c
C src/external/mit/lua/dist/src/lcode.c
C src/external/mit/lua/dist/src/llex.h
C src/external/mit/lua/dist/src/lparser.c
C src/external/mit/lua/dist/src/linit.c
C src/external/mit/lua/dist/src/ldebug.h
C src/external/mit/lua/dist/src/lcorolib.c
C src/external/mit/lua/dist/src/lbaselib.c
C src/external/mit/lua/dist/src/ldebug.c
C src/external/mit/lua/dist/src/lutf8lib.c
C src/external/mit/lua/dist/src/lapi.c
C src/external/mit/lua/dist/src/lua.h
C src/external/mit/lua/dist/src/lauxlib.h
C src/external/mit/lua/dist/src/lobject.c
C src/external/mit/lua/dist/src/lstrlib.c
C src/external/mit/lua/dist/src/ltm.c
C src/external/mit/lua/dist/src/ltablib.c
U src/external/mit/lua/dist/src/lualib.h
U src/external/mit/lua/dist/src/lfunc.h
C src/external/mit/lua/dist/src/ldo.c
C src/external/mit/lua/dist/src/lfunc.c
C src/external/mit/lua/dist/src/lctype.c
C src/external/mit/lua/dist/src/lvm.c
C src/external/mit/lua/dist/src/loadlib.c
C src/external/mit/lua/dist/src/ltable.h
C src/external/mit/lua/dist/src/lstring.h
C src/external/mit/lua/dist/src/ltable.c
C src/external/mit/lua/dist/src/lopcodes.c
U src/external/mit/lua/dist/src/lua.hpp
C src/external/mit/lua/dist/src/lapi.h
C src/external/mit/lua/dist/src/lparser.h
C src/external/mit/lua/dist/src/lundump.c
C src/external/mit/lua/dist/src/Makefile
C src/external/mit/lua/dist/src/lmem.h
U src/external/mit/lua/dist/src/lundump.h
N src/external/mit/lua/dist/src/lprefix.h
C src/external/mit/lua/dist/src/lstring.c
C src/external/mit/lua/dist/src/lmathlib.c
C src/external/mit/lua/dist/src/lvm.h
C src/external/mit/lua/dist/src/lgc.c
C src/external/mit/lua/dist/src/ldo.h
C src/external/mit/lua/dist/src/lzio.h
C src/external/mit/lua/dist/src/loslib.c
C src/external/mit/lua/dist/src/lmem.c
U src/external/mit/lua/dist/doc/manual.css
U src/external/mit/lua/dist/doc/luac.1
C src/external/mit/lua/dist/doc/lua.1
C src/external/mit/lua/dist/doc/manual.html
U src/external/mit/lua/dist/doc/osi-certified-72x60.png
C src/external/mit/lua/dist/doc/readme.html
U src/external/mit/lua/dist/doc/logo.gif
C src/external/mit/lua/dist/doc/contents.html
C src/external/mit/lua/dist/doc/lua.css

62 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jLUA:yesterday -jLUA src/external/mit/lua/dist



CVS commit: src/sys/kern

2015-02-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb  2 02:28:26 UTC 2015

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

Log Message:
Handle LOCAL_PEERID for socketpair() connected sockets which connect through
connect2().
1. move the code that sets the peerid structure into connect1(). This
   handles so2.  The datagram code calls connect2 twice with flipped
   so arguments so both sockets get set.
2. in connect2 copy the peerid structure from so2 to so, so that that
   both stream sockets get set.


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/sys/kern/uipc_usrreq.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/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.172 src/sys/kern/uipc_usrreq.c:1.173
--- src/sys/kern/uipc_usrreq.c:1.172	Wed Oct  8 12:13:02 2014
+++ src/sys/kern/uipc_usrreq.c	Sun Feb  1 21:28:26 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.172 2014/10/08 16:13:02 taca Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.173 2015/02/02 02:28:26 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uipc_usrreq.c,v 1.172 2014/10/08 16:13:02 taca Exp $);
+__KERNEL_RCSID(0, $NetBSD: uipc_usrreq.c,v 1.173 2015/02/02 02:28:26 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1075,7 +1075,7 @@ unp_abort(struct socket *so)
 }
 
 static int
-unp_connect1(struct socket *so, struct socket *so2)
+unp_connect1(struct socket *so, struct socket *so2, struct lwp *l)
 {
 	struct unpcb *unp = sotounpcb(so);
 	struct unpcb *unp2;
@@ -1099,6 +1099,18 @@ unp_connect1(struct socket *so, struct s
 
 	unp2 = sotounpcb(so2);
 	unp-unp_conn = unp2;
+
+	if ((so-so_proto-pr_flags  PR_CONNREQUIRED) != 0) {
+		unp2-unp_connid.unp_pid = l-l_proc-p_pid;
+		unp2-unp_connid.unp_euid = kauth_cred_geteuid(l-l_cred);
+		unp2-unp_connid.unp_egid = kauth_cred_getegid(l-l_cred);
+		unp2-unp_flags |= UNP_EIDSVALID;
+		if (unp2-unp_flags  UNP_EIDSBIND) {
+			unp-unp_connid = unp2-unp_connid;
+			unp-unp_flags |= UNP_EIDSVALID;
+		}
+	}
+
 	switch (so-so_type) {
 
 	case SOCK_DGRAM:
@@ -1208,17 +1220,9 @@ unp_connect(struct socket *so, struct mb
 			unp3-unp_addrlen = unp2-unp_addrlen;
 		}
 		unp3-unp_flags = unp2-unp_flags;
-		unp3-unp_connid.unp_pid = l-l_proc-p_pid;
-		unp3-unp_connid.unp_euid = kauth_cred_geteuid(l-l_cred);
-		unp3-unp_connid.unp_egid = kauth_cred_getegid(l-l_cred);
-		unp3-unp_flags |= UNP_EIDSVALID;
-		if (unp2-unp_flags  UNP_EIDSBIND) {
-			unp-unp_connid = unp2-unp_connid;
-			unp-unp_flags |= UNP_EIDSVALID;
-		}
 		so2 = so3;
 	}
-	error = unp_connect1(so, so2);
+	error = unp_connect1(so, so2, l);
 	if (error) {
 		sounlock(so);
 		goto bad;
@@ -1269,7 +1273,7 @@ unp_connect2(struct socket *so, struct s
 
 	KASSERT(solocked2(so, so2));
 
-	error = unp_connect1(so, so2);
+	error = unp_connect1(so, so2, curlwp);
 	if (error)
 		return error;
 
@@ -1285,6 +1289,10 @@ unp_connect2(struct socket *so, struct s
 	case SOCK_SEQPACKET: /* FALLTHROUGH */
 	case SOCK_STREAM:
 		unp2-unp_conn = unp;
+		if ((so-so_proto-pr_flags  PR_CONNREQUIRED) != 0) {
+			unp-unp_connid = unp2-unp_connid;
+			unp-unp_flags |= UNP_EIDSVALID;
+		}
 		soisconnected(so);
 		soisconnected(so2);
 		break;



CVS commit: src/sys/netinet6

2015-02-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb  2 03:14:02 UTC 2015

Modified Files:
src/sys/netinet6: ip6_output.c

Log Message:
CID/1267860: Missing break in switch


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/netinet6/ip6_output.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/netinet6/ip6_output.c
diff -u src/sys/netinet6/ip6_output.c:1.162 src/sys/netinet6/ip6_output.c:1.163
--- src/sys/netinet6/ip6_output.c:1.162	Tue Jan 20 16:42:36 2015
+++ src/sys/netinet6/ip6_output.c	Sun Feb  1 22:14:02 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_output.c,v 1.162 2015/01/20 21:42:36 roy Exp $	*/
+/*	$NetBSD: ip6_output.c,v 1.163 2015/02/02 03:14:02 christos Exp $	*/
 /*	$KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip6_output.c,v 1.162 2015/01/20 21:42:36 roy Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip6_output.c,v 1.163 2015/02/02 03:14:02 christos Exp $);
 
 #include opt_inet.h
 #include opt_inet6.h
@@ -2144,6 +2144,7 @@ ip6_getpcbopt(struct ip6_pktopts *pktopt
 		else
 			optdata = (void *)defpreftemp;
 		optdatalen = sizeof(int);
+		break;
 	default:		/* should not happen */
 #ifdef DIAGNOSTIC
 		panic(ip6_getpcbopt: unexpected option\n);