Re: CVS commit: src/sys/dev/pci

2016-10-30 Thread Paul Goyette

On Fri, 28 Oct 2016, Paul Goyette wrote:

Attached is a revised patch, which has a prototype/signature much more 
similar to snprintf(), more appropriate variable types, and improved 
comments/documentation.


I'll plan on committing this sometime late next week...


One more revision.  This one updates the length parameter as well as the 
dest pointer, so the caller doesn't need to recalculate on each call.


I've also changed it to return an int value rather than void:

x = 0   success
x < 0vsnprintf() failed (for userland code, errno will
contain details)
x > 0success, however the output was truncated to avoid
overflowing the output buffer.

This variant seems to work just fine, both in-kernel and userland.


+--+--++
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:  |
| (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+--+--++Index: pci_subr.c
===
RCS file: /cvsroot/src/sys/dev/pci/pci_subr.c,v
retrieving revision 1.152
diff -u -p -r1.152 pci_subr.c
--- pci_subr.c  20 Oct 2016 04:11:02 -  1.152
+++ pci_subr.c  30 Oct 2016 03:00:18 -
@@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v
 #include 
 #else
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -567,6 +568,45 @@ static const struct pci_class pci_class[
 
 DEV_VERBOSE_DEFINE(pci);
 
+/*
+ * Append a formatted string to dest without writing more than len
+ * characters (including the trailing NUL character).  dest and len
+ * are updated for use in subsequent calls to snappendf().
+ *
+ * Returns 0 on success, a negative value if vnsprintf() fails, or
+ * a positive value if the dest buffer would have overflowed.
+ */
+static int
+snappendf(char **, size_t *, const char * restrict, ...) __printflike(3,4);
+
+static int
+snappendf(char **dest, size_t *len, const char * restrict fmt, ...)
+{
+   va_list ap;
+   int count;
+
+   va_start(ap, fmt);
+   count = vsnprintf(*dest, *len, fmt, ap);
+   va_end(ap);
+
+   /* Let vsnprintf() errors bubble up to caller */
+   if (count < 0 || *len == 0)
+   return count;
+
+   /* Handle overflow */
+   if ((size_t)count >= *len) {
+   *dest += *len - 1;
+   *len = 1;
+   return 1;
+   }
+
+   /* Update dest & len to point at trailing NUL */
+   *dest += count;
+   *len -= count;
+   
+   return 0;
+}
+
 void
 pci_devinfo(pcireg_t id_reg, pcireg_t class_reg, int showclass, char *cp,
 size_t l)
@@ -577,9 +617,6 @@ pci_devinfo(pcireg_t id_reg, pcireg_t cl
pci_revision_t revision;
char vendor[PCI_VENDORSTR_LEN], product[PCI_PRODUCTSTR_LEN];
const struct pci_class *classp, *subclassp, *interfacep;
-   char *ep;
-
-   ep = cp + l;
 
pciclass = PCI_CLASS(class_reg);
subclass = PCI_SUBCLASS(class_reg);
@@ -612,32 +649,31 @@ pci_devinfo(pcireg_t id_reg, pcireg_t cl
interfacep++;
}
 
-   cp += snprintf(cp, ep - cp, "%s %s", vendor, product);
+   (void)snappendf(, , "%s %s", vendor, product);
if (showclass) {
-   cp += snprintf(cp, ep - cp, " (");
+   (void)snappendf(, , " (");
if (classp->name == NULL)
-   cp += snprintf(cp, ep - cp,
-   "class 0x%02x, subclass 0x%02x", pciclass, 
subclass);
+   (void)snappendf(, ,
+   "class 0x%02x, subclass 0x%02x",
+   pciclass, subclass);
else {
if (subclassp == NULL || subclassp->name == NULL)
-   cp += snprintf(cp, ep - cp,
+   (void)snappendf(, ,
"%s, subclass 0x%02x",
classp->name, subclass);
else
-   cp += snprintf(cp, ep - cp, "%s %s",
+   (void)snappendf(, , "%s %s",
subclassp->name, classp->name);
}
if ((interfacep == NULL) || (interfacep->name == NULL)) {
if (interface != 0)
-   cp += snprintf(cp, ep - cp,
-   ", interface 0x%02x", interface);
+   (void)snappendf(, , ", interface 0x%02x",
+   interface);
} else if (strncmp(interfacep->name, "", 1) != 0)
-   cp += snprintf(cp, ep - cp, ", %s",
-   

CVS commit: src/usr.bin/cmp

2016-10-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 30 19:33:49 UTC 2016

Modified Files:
src/usr.bin/cmp: cmp.1 cmp.c

Log Message:
fix usage (thanks wiz)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/cmp/cmp.1
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/cmp/cmp.c

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



CVS commit: src/usr.bin/cmp

2016-10-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 30 19:33:49 UTC 2016

Modified Files:
src/usr.bin/cmp: cmp.1 cmp.c

Log Message:
fix usage (thanks wiz)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/cmp/cmp.1
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/cmp/cmp.c

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

Modified files:

Index: src/usr.bin/cmp/cmp.1
diff -u src/usr.bin/cmp/cmp.1:1.10 src/usr.bin/cmp/cmp.1:1.11
--- src/usr.bin/cmp/cmp.1:1.10	Sun Oct 30 15:13:36 2016
+++ src/usr.bin/cmp/cmp.1	Sun Oct 30 15:33:49 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: cmp.1,v 1.10 2016/10/30 19:13:36 christos Exp $
+.\"	$NetBSD: cmp.1,v 1.11 2016/10/30 19:33:49 christos Exp $
 .\"
 .\" Copyright (c) 1987, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -40,7 +40,8 @@
 .Nd compare two files
 .Sh SYNOPSIS
 .Nm
-.Op Fl c | Fl l | Fl s
+.Op Fl c
+.Op Fl l | Fl s
 .Ar file1 file2
 .Op Ar skip1 Op Ar skip2
 .Sh DESCRIPTION

Index: src/usr.bin/cmp/cmp.c
diff -u src/usr.bin/cmp/cmp.c:1.19 src/usr.bin/cmp/cmp.c:1.20
--- src/usr.bin/cmp/cmp.c:1.19	Sun Oct 30 15:13:36 2016
+++ src/usr.bin/cmp/cmp.c	Sun Oct 30 15:33:49 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cmp.c,v 1.19 2016/10/30 19:13:36 christos Exp $	*/
+/*	$NetBSD: cmp.c,v 1.20 2016/10/30 19:33:49 christos Exp $	*/
 
 /*
  * Copyright (c) 1987, 1990, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 19
 #if 0
 static char sccsid[] = "@(#)cmp.c	8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: cmp.c,v 1.19 2016/10/30 19:13:36 christos Exp $");
+__RCSID("$NetBSD: cmp.c,v 1.20 2016/10/30 19:33:49 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -162,6 +162,7 @@ usage(void)
 {
 
 	(void)fprintf(stderr,
-	"usage: cmp [-c | -l | -s] file1 file2 [skip1 [skip2]]\n");
+	"Usage: %s [-c] [-l | -s] file1 file2 [skip1 [skip2]]\n",
+	getprogname());
 	exit(ERR_EXIT);
 }



CVS commit: src/sys/dev/pci

2016-10-30 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Oct 31 02:44:54 UTC 2016

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

Log Message:
Fix locking against myself at wm_turn{on,off} when NET_MPSAFE is defined.

Pointed out by ozaki-r@n.o, thanks.


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

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.435 src/sys/dev/pci/if_wm.c:1.436
--- src/sys/dev/pci/if_wm.c:1.435	Fri Oct 28 09:16:02 2016
+++ src/sys/dev/pci/if_wm.c	Mon Oct 31 02:44:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.435 2016/10/28 09:16:02 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.436 2016/10/31 02:44:54 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.435 2016/10/28 09:16:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.436 2016/10/31 02:44:54 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -4572,6 +4572,8 @@ wm_turnon(struct wm_softc *sc)
 {
 	int i;
 
+	KASSERT(WM_CORE_LOCKED(sc));
+
 	for(i = 0; i < sc->sc_nqueues; i++) {
 		struct wm_txqueue *txq = >sc_queue[i].wmq_txq;
 		struct wm_rxqueue *rxq = >sc_queue[i].wmq_rxq;
@@ -4585,9 +4587,7 @@ wm_turnon(struct wm_softc *sc)
 		mutex_exit(rxq->rxq_lock);
 	}
 
-	WM_CORE_LOCK(sc);
 	sc->sc_core_stopping = false;
-	WM_CORE_UNLOCK(sc);
 }
 
 static void
@@ -4595,9 +4595,9 @@ wm_turnoff(struct wm_softc *sc)
 {
 	int i;
 
-	WM_CORE_LOCK(sc);
+	KASSERT(WM_CORE_LOCKED(sc));
+
 	sc->sc_core_stopping = true;
-	WM_CORE_UNLOCK(sc);
 
 	for(i = 0; i < sc->sc_nqueues; i++) {
 		struct wm_rxqueue *rxq = >sc_queue[i].wmq_rxq;



CVS commit: src/sys/dev/pci

2016-10-30 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Oct 31 02:44:54 UTC 2016

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

Log Message:
Fix locking against myself at wm_turn{on,off} when NET_MPSAFE is defined.

Pointed out by ozaki-r@n.o, thanks.


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

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



CVS commit: src/sys/dev/ic

2016-10-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Oct 30 23:56:06 UTC 2016

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

Log Message:
Error recovery stops normal queue processing but didn't resume it
when the recovery succeeded. Add the missing calls to scsipi_channel_thaw
similar to kern/41867.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/aic7xxx_osm.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/aic7xxx_osm.c
diff -u src/sys/dev/ic/aic7xxx_osm.c:1.37 src/sys/dev/ic/aic7xxx_osm.c:1.38
--- src/sys/dev/ic/aic7xxx_osm.c:1.37	Wed Feb 24 22:37:57 2010
+++ src/sys/dev/ic/aic7xxx_osm.c	Sun Oct 30 23:56:05 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: aic7xxx_osm.c,v 1.37 2010/02/24 22:37:57 dyoung Exp $	*/
+/*	$NetBSD: aic7xxx_osm.c,v 1.38 2016/10/30 23:56:05 mlelstv Exp $	*/
 
 /*
  * Bus independent FreeBSD shim for the aic7xxx based adaptec SCSI controllers
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aic7xxx_osm.c,v 1.37 2010/02/24 22:37:57 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic7xxx_osm.c,v 1.38 2016/10/30 23:56:05 mlelstv Exp $");
 
 #include 
 #include 
@@ -258,6 +258,10 @@ ahc_done(struct ahc_softc *ahc, struct s
 		scsipi_printaddr(xs->xs_periph);
 		printf("%s: no longer in timeout, status = %x\n",
 		   ahc_name(ahc), xs->status);
+
+		scsipi_channel_thaw(>sc_channel, 1);
+		if (ahc->features & AHC_TWIN)
+			scsipi_channel_thaw(>sc_channel_b, 1);
 	}
 
 	/* Don't clobber any existing error state */



CVS commit: src/sys/dev/ic

2016-10-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Oct 30 23:56:06 UTC 2016

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

Log Message:
Error recovery stops normal queue processing but didn't resume it
when the recovery succeeded. Add the missing calls to scsipi_channel_thaw
similar to kern/41867.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/aic7xxx_osm.c

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



Re: CVS commit: src/lib/librumpuser/build-aux

2016-10-30 Thread coypu
For the record, this is because the build server is running -6-1..


CVS commit: src/sys/dev/ic

2016-10-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Oct 30 23:35:10 UTC 2016

Modified Files:
src/sys/dev/ic: aic7xxx_cam.h

Log Message:
CAM status values are used as xs_status and must be mapped to XS values.
Add the missing mapping for CAM_CMD_TIMEOUT.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/aic7xxx_cam.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/ic/aic7xxx_cam.h
diff -u src/sys/dev/ic/aic7xxx_cam.h:1.4 src/sys/dev/ic/aic7xxx_cam.h:1.5
--- src/sys/dev/ic/aic7xxx_cam.h:1.4	Tue Mar 14 15:24:30 2006
+++ src/sys/dev/ic/aic7xxx_cam.h	Sun Oct 30 23:35:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: aic7xxx_cam.h,v 1.4 2006/03/14 15:24:30 tsutsui Exp $	*/
+/*	$NetBSD: aic7xxx_cam.h,v 1.5 2016/10/30 23:35:10 mlelstv Exp $	*/
 
 /*
  * Data structures and definitions for the CAM system.
@@ -71,7 +71,7 @@ typedef enum {
 	CAM_REQ_INVALID = XS_DRIVER_STUFFUP,	/* CCB request was invalid */
 	CAM_PATH_INVALID,			/* Supplied Path ID is invalid */
 	CAM_SEL_TIMEOUT = XS_SELTIMEOUT,	/* Target Selection Timeout */
-	CAM_CMD_TIMEOUT,			/* Command timeout */
+	CAM_CMD_TIMEOUT = XS_TIMEOUT,		/* Command timeout */
 	CAM_SCSI_STATUS_ERROR,			/* SCSI error, look at error code in CCB */
 	CAM_SCSI_BUS_RESET = XS_RESET,		/* SCSI Bus Reset Sent/Received */
 	CAM_UNCOR_PARITY = XS_DRIVER_STUFFUP,	/* Uncorrectable parity error occurred */



CVS commit: src/sys/dev/ic

2016-10-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Oct 30 23:35:10 UTC 2016

Modified Files:
src/sys/dev/ic: aic7xxx_cam.h

Log Message:
CAM status values are used as xs_status and must be mapped to XS values.
Add the missing mapping for CAM_CMD_TIMEOUT.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/aic7xxx_cam.h

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



CVS commit: src/sys/netinet6

2016-10-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Oct 31 02:50:31 UTC 2016

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

Log Message:
Remove unnecessary NULL checks


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/netinet6/in6_src.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/in6_src.c
diff -u src/sys/netinet6/in6_src.c:1.70 src/sys/netinet6/in6_src.c:1.71
--- src/sys/netinet6/in6_src.c:1.70	Fri Aug 26 20:29:31 2016
+++ src/sys/netinet6/in6_src.c	Mon Oct 31 02:50:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_src.c,v 1.70 2016/08/26 20:29:31 roy Exp $	*/
+/*	$NetBSD: in6_src.c,v 1.71 2016/10/31 02:50:31 ozaki-r Exp $	*/
 /*	$KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $	*/
 
 /*
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.70 2016/08/26 20:29:31 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.71 2016/10/31 02:50:31 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -590,11 +590,14 @@ selectroute(struct sockaddr_in6 *dstsock
 	struct sockaddr_in6 *sin6_next;
 	struct in6_pktinfo *pi = NULL;
 	struct in6_addr *dst;
-	struct psref local_psref;
-#define PSREF	((psref == NULL) ? _psref : psref)
-
-	KASSERT((retifp != NULL && psref != NULL) ||
-	(retifp == NULL && psref == NULL));
+	union {
+		struct sockaddr		dst;
+		struct sockaddr_in6	dst6;
+	} u;
+
+	KASSERT(ro != NULL);
+	KASSERT(retifp != NULL && psref != NULL);
+	KASSERT(retrt != NULL);
 
 	dst = >sin6_addr;
 
@@ -614,17 +617,16 @@ selectroute(struct sockaddr_in6 *dstsock
 	/* If the caller specify the outgoing interface explicitly, use it. */
 	if (opts && (pi = opts->ip6po_pktinfo) != NULL && pi->ipi6_ifindex) {
 		/* XXX boundary check is assumed to be already done. */
-		ifp = if_get_byindex(pi->ipi6_ifindex, PSREF);
+		ifp = if_get_byindex(pi->ipi6_ifindex, psref);
 		if (ifp != NULL &&
-		(norouteok || retrt == NULL ||
-		IN6_IS_ADDR_MULTICAST(dst))) {
+		(norouteok || IN6_IS_ADDR_MULTICAST(dst))) {
 			/*
 			 * we do not have to check or get the route for
 			 * multicast.
 			 */
 			goto done;
 		} else {
-			if_put(ifp, PSREF);
+			if_put(ifp, psref);
 			ifp = NULL;
 			goto getroute;
 		}
@@ -635,7 +637,7 @@ selectroute(struct sockaddr_in6 *dstsock
 	 * interface for the address is specified by the caller, use it.
 	 */
 	if (IN6_IS_ADDR_MULTICAST(dst) && mopts != NULL) {
-		ifp = if_get_byindex(mopts->im6o_multicast_if_index, PSREF);
+		ifp = if_get_byindex(mopts->im6o_multicast_if_index, psref);
 		if (ifp != NULL)
 			goto done; /* we do not need a route for multicast. */
 	}
@@ -671,7 +673,7 @@ selectroute(struct sockaddr_in6 *dstsock
 		ifp = rt->rt_ifp;
 		if (ifp != NULL) {
 			if (!if_is_deactivated(ifp))
-if_acquire_NOMPSAFE(ifp, PSREF);
+if_acquire_NOMPSAFE(ifp, psref);
 			else
 ifp = NULL;
 		}
@@ -690,52 +692,42 @@ selectroute(struct sockaddr_in6 *dstsock
 	 * a new one.  Note that we should check the address family of the
 	 * cached destination, in case of sharing the cache with IPv4.
 	 */
-	if (ro != NULL) {
-		union {
-			struct sockaddr		dst;
-			struct sockaddr_in6	dst6;
-		} u;
-
-		/* No route yet, so try to acquire one */
-		u.dst6 = *dstsock;
-		u.dst6.sin6_scope_id = 0;
-		rt = rtcache_lookup1(ro, , clone);
+	u.dst6 = *dstsock;
+	u.dst6.sin6_scope_id = 0;
+	rt = rtcache_lookup1(ro, , clone);
 
-		/*
-		 * do not care about the result if we have the nexthop
-		 * explicitly specified.
-		 */
-		if (opts && opts->ip6po_nexthop)
-			goto done;
+	/*
+	 * do not care about the result if we have the nexthop
+	 * explicitly specified.
+	 */
+	if (opts && opts->ip6po_nexthop)
+		goto done;
 
-		if (rt == NULL)
-			error = EHOSTUNREACH;
-		else {
-			if_put(ifp, PSREF);
-			ifp = rt->rt_ifp;
-			if (ifp != NULL) {
-if (!if_is_deactivated(ifp))
-	if_acquire_NOMPSAFE(ifp, PSREF);
-else
-	ifp = NULL;
-			}
+	if (rt == NULL)
+		error = EHOSTUNREACH;
+	else {
+		if_put(ifp, psref);
+		ifp = rt->rt_ifp;
+		if (ifp != NULL) {
+			if (!if_is_deactivated(ifp))
+if_acquire_NOMPSAFE(ifp, psref);
+			else
+ifp = NULL;
 		}
+	}
 
-		/*
-		 * Check if the outgoing interface conflicts with
-		 * the interface specified by ipi6_ifindex (if specified).
-		 * Note that loopback interface is always okay.
-		 * (this may happen when we are sending a packet to one of
-		 *  our own addresses.)
-		 */
-		if (opts && opts->ip6po_pktinfo &&
-		opts->ip6po_pktinfo->ipi6_ifindex) {
-			if (!(ifp->if_flags & IFF_LOOPBACK) &&
-			ifp->if_index !=
-			opts->ip6po_pktinfo->ipi6_ifindex) {
-error = EHOSTUNREACH;
-goto done;
-			}
+	/*
+	 * Check if the outgoing interface conflicts with
+	 * the interface specified by ipi6_ifindex (if specified).
+	 * Note that loopback interface is always okay.
+	 * (this may happen when we are sending a packet to one of
+	 *  our own 

CVS commit: src/sys/netinet6

2016-10-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Oct 31 02:50:31 UTC 2016

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

Log Message:
Remove unnecessary NULL checks


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/netinet6/in6_src.c

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



CVS commit: src/lib/libpthread

2016-10-30 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Oct 30 23:26:33 UTC 2016

Modified Files:
src/lib/libpthread: pthread.h pthread_mutex.3

Log Message:
POSIX harder the pthread_mutex_timedlock(3) prototype

Add missing __restrict keyword to the first pointer parameter.

It was already used for the second argument, should not be a functional
change and generated code should be the same.

This new form is now aligned with POSIX.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libpthread/pthread.h
cvs rdiff -u -r1.8 -r1.9 src/lib/libpthread/pthread_mutex.3

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

Modified files:

Index: src/lib/libpthread/pthread.h
diff -u src/lib/libpthread/pthread.h:1.37 src/lib/libpthread/pthread.h:1.38
--- src/lib/libpthread/pthread.h:1.37	Sun Jul  3 14:24:58 2016
+++ src/lib/libpthread/pthread.h	Sun Oct 30 23:26:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.h,v 1.37 2016/07/03 14:24:58 christos Exp $	*/
+/*	$NetBSD: pthread.h,v 1.38 2016/10/30 23:26:33 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -94,7 +94,7 @@ int	pthread_mutex_destroy(pthread_mutex_
 int	pthread_mutex_lock(pthread_mutex_t *);
 int	pthread_mutex_trylock(pthread_mutex_t *);
 int	pthread_mutex_unlock(pthread_mutex_t *);
-int	pthread_mutex_timedlock(pthread_mutex_t *,
+int	pthread_mutex_timedlock(pthread_mutex_t * __restrict,
 	const struct timespec * __restrict);
 int	pthread_mutex_getprioceiling(const pthread_mutex_t * __restrict,
 	int * __restrict);

Index: src/lib/libpthread/pthread_mutex.3
diff -u src/lib/libpthread/pthread_mutex.3:1.8 src/lib/libpthread/pthread_mutex.3:1.9
--- src/lib/libpthread/pthread_mutex.3:1.8	Tue Jul  5 10:04:17 2016
+++ src/lib/libpthread/pthread_mutex.3	Sun Oct 30 23:26:33 2016
@@ -1,4 +1,4 @@
-.\" $NetBSD: pthread_mutex.3,v 1.8 2016/07/05 10:04:17 wiz Exp $
+.\" $NetBSD: pthread_mutex.3,v 1.9 2016/10/30 23:26:33 kamil Exp $
 .\"
 .\" Copyright (c) 2002, 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -76,7 +76,7 @@
 .Ft int
 .Fn pthread_mutex_unlock "pthread_mutex_t *mutex"
 .Ft int
-.Fn pthread_mutex_timedlock "pthread_mutex_t * mutex" "const struct timespec *__restrict timeout"
+.Fn pthread_mutex_timedlock "pthread_mutex_t *__restrict mutex" "const struct timespec *__restrict timeout"
 .Ft int
 .Fn pthread_mutex_getprioceiling "const pthread_mutex_t * __restrict mutex" "int * __restrict prioceiling"
 .Ft int



CVS commit: src/lib/libpthread

2016-10-30 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Oct 30 23:26:33 UTC 2016

Modified Files:
src/lib/libpthread: pthread.h pthread_mutex.3

Log Message:
POSIX harder the pthread_mutex_timedlock(3) prototype

Add missing __restrict keyword to the first pointer parameter.

It was already used for the second argument, should not be a functional
change and generated code should be the same.

This new form is now aligned with POSIX.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libpthread/pthread.h
cvs rdiff -u -r1.8 -r1.9 src/lib/libpthread/pthread_mutex.3

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



CVS commit: src/usr.bin/cmp

2016-10-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 30 19:13:37 UTC 2016

Modified Files:
src/usr.bin/cmp: cmp.1 cmp.c

Log Message:
add a flag to avoid mmap...


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/cmp/cmp.1
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/cmp/cmp.c

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

Modified files:

Index: src/usr.bin/cmp/cmp.1
diff -u src/usr.bin/cmp/cmp.1:1.9 src/usr.bin/cmp/cmp.1:1.10
--- src/usr.bin/cmp/cmp.1:1.9	Thu Aug  7 07:13:21 2003
+++ src/usr.bin/cmp/cmp.1	Sun Oct 30 15:13:36 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: cmp.1,v 1.9 2003/08/07 11:13:21 agc Exp $
+.\"	$NetBSD: cmp.1,v 1.10 2016/10/30 19:13:36 christos Exp $
 .\"
 .\" Copyright (c) 1987, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" @(#)cmp.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd June 6, 1993
+.Dd October 30, 2016
 .Dt CMP 1
 .Os
 .Sh NAME
@@ -40,7 +40,7 @@
 .Nd compare two files
 .Sh SYNOPSIS
 .Nm
-.Op Fl l | Fl s
+.Op Fl c | Fl l | Fl s
 .Ar file1 file2
 .Op Ar skip1 Op Ar skip2
 .Sh DESCRIPTION
@@ -55,6 +55,15 @@ Bytes and lines are numbered beginning w
 .Pp
 The following options are available:
 .Bl -tag -width flag
+.It Fl c
+Do the compare using
+.Xr getc 3
+rather than
+.Xr mmap 2 .
+Combined with the
+.Fl l
+flag, this can be helpful in locating an I/O error in the underlying
+device.
 .It Fl l
 Print the byte number (decimal) and the differing
 byte values (octal) for each difference.

Index: src/usr.bin/cmp/cmp.c
diff -u src/usr.bin/cmp/cmp.c:1.18 src/usr.bin/cmp/cmp.c:1.19
--- src/usr.bin/cmp/cmp.c:1.18	Mon Aug 29 10:14:11 2011
+++ src/usr.bin/cmp/cmp.c	Sun Oct 30 15:13:36 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cmp.c,v 1.18 2011/08/29 14:14:11 joerg Exp $	*/
+/*	$NetBSD: cmp.c,v 1.19 2016/10/30 19:13:36 christos Exp $	*/
 
 /*
  * Copyright (c) 1987, 1990, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 19
 #if 0
 static char sccsid[] = "@(#)cmp.c	8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: cmp.c,v 1.18 2011/08/29 14:14:11 joerg Exp $");
+__RCSID("$NetBSD: cmp.c,v 1.19 2016/10/30 19:13:36 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -71,8 +71,12 @@ main(int argc, char *argv[])
 
 	setlocale(LC_ALL, "");
 
-	while ((ch = getopt(argc, argv, "ls")) != -1)
+	special = 0;
+	while ((ch = getopt(argc, argv, "cls")) != -1)
 		switch (ch) {
+		case 'c':
+			special = 1;	/* careful!  Don't use mmap() */
+			break;
 		case 'l':		/* print all differences */
 			lflag = 1;
 			break;
@@ -93,7 +97,6 @@ main(int argc, char *argv[])
 		usage();
 
 	/* Backward compatibility -- handle "-" meaning stdin. */
-	special = 0;
 	if (strcmp(file1 = argv[0], "-") == 0) {
 		special = 1;
 		fd1 = 0;
@@ -159,6 +162,6 @@ usage(void)
 {
 
 	(void)fprintf(stderr,
-	"usage: cmp [-l | -s] file1 file2 [skip1 [skip2]]\n");
+	"usage: cmp [-c | -l | -s] file1 file2 [skip1 [skip2]]\n");
 	exit(ERR_EXIT);
 }



CVS commit: src/usr.bin/cmp

2016-10-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 30 19:13:37 UTC 2016

Modified Files:
src/usr.bin/cmp: cmp.1 cmp.c

Log Message:
add a flag to avoid mmap...


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/cmp/cmp.1
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/cmp/cmp.c

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



CVS commit: src/lib/libexecinfo

2016-10-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Oct 31 01:31:25 UTC 2016

Modified Files:
src/lib/libexecinfo: backtrace.3

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libexecinfo/backtrace.3

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



CVS commit: src/lib/libexecinfo

2016-10-30 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Oct 31 01:31:25 UTC 2016

Modified Files:
src/lib/libexecinfo: backtrace.3

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libexecinfo/backtrace.3

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

Modified files:

Index: src/lib/libexecinfo/backtrace.3
diff -u src/lib/libexecinfo/backtrace.3:1.7 src/lib/libexecinfo/backtrace.3:1.8
--- src/lib/libexecinfo/backtrace.3:1.7	Sat Dec 26 10:34:36 2015
+++ src/lib/libexecinfo/backtrace.3	Mon Oct 31 01:31:25 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: backtrace.3,v 1.7 2015/12/26 10:34:36 wiz Exp $
+.\"	$NetBSD: backtrace.3,v 1.8 2016/10/31 01:31:25 pgoyette Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -107,7 +107,7 @@ The
 and
 .Fn backtrace_symbols_fd_fmt
 are similar to the non _fd named functions, only instead of returning
-an array or strings, they print a new-line separated array of strings in
+an array of strings, they print a new-line separated array of strings in
 fd, and return
 .Dv 0
 on success and



CVS commit: src/sys/dev/usb

2016-10-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Oct 31 03:19:23 UTC 2016

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.712 -r1.713 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.713 -r1.714 src/sys/dev/usb/usbdevs_data.h

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



CVS commit: src/sys/netinet6

2016-10-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Oct 31 04:57:11 UTC 2016

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

Log Message:
Pull best address selection code out of in6_selectsrc

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/netinet6/in6_src.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/in6_src.c
diff -u src/sys/netinet6/in6_src.c:1.72 src/sys/netinet6/in6_src.c:1.73
--- src/sys/netinet6/in6_src.c:1.72	Mon Oct 31 04:16:25 2016
+++ src/sys/netinet6/in6_src.c	Mon Oct 31 04:57:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_src.c,v 1.72 2016/10/31 04:16:25 ozaki-r Exp $	*/
+/*	$NetBSD: in6_src.c,v 1.73 2016/10/31 04:57:10 ozaki-r Exp $	*/
 /*	$KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $	*/
 
 /*
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.72 2016/10/31 04:16:25 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.73 2016/10/31 04:57:10 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -171,138 +171,25 @@ static struct in6_addrpolicy *match_addr
 #define BREAK(r) goto out
 #endif
 
-int
-in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, 
-	struct ip6_moptions *mopts, struct route *ro, struct in6_addr *laddr, 
-	struct ifnet **ifpp, struct psref *psref, struct in6_addr *ret_ia6)
+/*
+ * Called inside pserialize critical section. Don't sleep/block.
+ */
+static struct in6_ifaddr *
+in6_select_best_ia(struct sockaddr_in6 *dstsock, struct in6_addr *dst,
+const struct ifnet *ifp, const struct ip6_pktopts *opts,
+const u_int32_t odstzone)
 {
-	struct in6_addr dst;
-	struct ifnet *ifp = NULL;
-	struct in6_ifaddr *ia = NULL, *ia_best = NULL;
-	struct in6_pktinfo *pi = NULL;
+	struct in6_ifaddr *ia, *ia_best = NULL;
 	int dst_scope = -1, best_scope = -1, best_matchlen = -1;
 	struct in6_addrpolicy *dst_policy = NULL, *best_policy = NULL;
-	u_int32_t odstzone;
-	int error;
-	int prefer_tempaddr;
-#if defined(MIP6) && NMIP > 0
-	u_int8_t ip6po_usecoa = 0;
-#endif /* MIP6 && NMIP > 0 */
-	struct psref local_psref;
-	int bound = curlwp_bind();
-#define PSREF (psref == NULL) ? _psref : psref
-	int s;
-
-	KASSERT((ifpp != NULL && psref != NULL) ||
-	(ifpp == NULL && psref == NULL));
-
-	dst = dstsock->sin6_addr; /* make a copy for local operation */
-	if (ifpp)
-		*ifpp = NULL;
-
-	/*
-	 * Try to determine the outgoing interface for the given destination.
-	 * We do this regardless of whether the socket is bound, since the
-	 * caller may need this information as a side effect of the call
-	 * to this function (e.g., for identifying the appropriate scope zone
-	 * ID).
-	 */
-	error = in6_selectif(dstsock, opts, mopts, ro, , PSREF);
-	if (ifpp != NULL)
-		*ifpp = ifp;
-
-	/*
-	 * If the source address is explicitly specified by the caller,
-	 * check if the requested source address is indeed a unicast address
-	 * assigned to the node, and can be used as the packet's source
-	 * address.  If everything is okay, use the address as source.
-	 */
-	if (opts && (pi = opts->ip6po_pktinfo) &&
-	!IN6_IS_ADDR_UNSPECIFIED(>ipi6_addr)) {
-		struct sockaddr_in6 srcsock;
-		struct in6_ifaddr *ia6;
-		int _s;
-		struct ifaddr *ifa;
-
-		/*
-		 * Determine the appropriate zone id of the source based on
-		 * the zone of the destination and the outgoing interface.
-		 * If the specified address is ambiguous wrt the scope zone,
-		 * the interface must be specified; otherwise, ifa_ifwithaddr()
-		 * will fail matching the address.
-		 */
-		memset(, 0, sizeof(srcsock));
-		srcsock.sin6_family = AF_INET6;
-		srcsock.sin6_len = sizeof(srcsock);
-		srcsock.sin6_addr = pi->ipi6_addr;
-		if (ifp) {
-			error = in6_setscope(_addr, ifp, NULL);
-			if (error != 0)
-goto exit;
-		}
-
-		_s = pserialize_read_enter();
-		ifa = ifa_ifwithaddr(sin6tosa());
-		if ((ia6 = ifatoia6(ifa)) == NULL ||
-		ia6->ia6_flags &
-		(IN6_IFF_ANYCAST | IN6_IFF_NOTREADY)) {
-			pserialize_read_exit(_s);
-			error = EADDRNOTAVAIL;
-			goto exit;
-		}
-		pi->ipi6_addr = srcsock.sin6_addr; /* XXX: this overrides pi */
-		if (ifpp)
-			*ifpp = ifp;
-		*ret_ia6 = ia6->ia_addr.sin6_addr;
-		pserialize_read_exit(_s);
-		goto exit;
-	}
-
-	/*
-	 * If the socket has already bound the source, just use it.  We don't
-	 * care at the moment whether in6_selectif() succeeded above, even
-	 * though it would eventually cause an error.
-	 */
-	if (laddr && !IN6_IS_ADDR_UNSPECIFIED(laddr)) {
-		*ret_ia6 = *laddr;
-		goto exit;
-	}
 
-	/*
-	 * The outgoing interface is crucial in the general selection procedure
-	 * below.  If it is not known at this point, we fail.
-	 */
-	if (ifp == NULL)
-		goto exit;
-
-	/*
-	 * If the address is not yet determined, choose the best one based on
-	 * the outgoing interface and the destination address.
-	 */
-
-#if defined(MIP6) && NMIP > 0
-	/*
-	 * 

CVS commit: src/sys/dev/usb

2016-10-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Oct 31 03:18:41 UTC 2016

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add extra ucom/u3g id for Huawei E353; from Ben Gergely in PR 49302.


To generate a diff of this commit:
cvs rdiff -u -r1.720 -r1.721 src/sys/dev/usb/usbdevs

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/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.720 src/sys/dev/usb/usbdevs:1.721
--- src/sys/dev/usb/usbdevs:1.720	Mon Oct 17 19:58:42 2016
+++ src/sys/dev/usb/usbdevs	Mon Oct 31 03:18:41 2016
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.720 2016/10/17 19:58:42 nat Exp $
+$NetBSD: usbdevs,v 1.721 2016/10/31 03:18:41 dholland Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1790,6 +1790,10 @@ product HUAWEI E1820		0x14ac	Huawei E182
 product HUAWEI E171INIT		0x14fe	Huawei E171 USB CD
 product HUAWEI E171		0x1506	Huawei E171
 product HUAWEI E353		0x1507	Huawei E353
+product HUAWEI E353_HiLink	0x1507	Huawei E353_HiLink
+/* Accessing http://192.168.1.1/html/switchProjectMode.html on 
+   a Huawei HiLink device will switch it to u3g mode */
+product HUAWEI E353 0x1442  Huawei E353
 product HUAWEI K3765INIT	0x1520	Huawei K3765 USB CD
 product HUAWEI E353INIT		0x1f01	Huawei E353 USB CD
 



CVS commit: src/sys/dev/usb

2016-10-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Oct 31 03:18:41 UTC 2016

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add extra ucom/u3g id for Huawei E353; from Ben Gergely in PR 49302.


To generate a diff of this commit:
cvs rdiff -u -r1.720 -r1.721 src/sys/dev/usb/usbdevs

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



CVS commit: src/sys/netinet6

2016-10-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Oct 31 04:57:11 UTC 2016

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

Log Message:
Pull best address selection code out of in6_selectsrc

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/netinet6/in6_src.c

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



Re: CVS commit: src/sys/dev/usb

2016-10-30 Thread David Holland
On Mon, Oct 31, 2016 at 04:15:23AM +, NONAKA Kimihiro wrote:
 > Modified Files:
 >  src/sys/dev/usb: usbdevs
 > 
 > Log Message:
 > Remove duplicated HUAWEI E353 entry.

Woops, sorry about that.

-- 
David A. Holland
dholl...@netbsd.org


CVS commit: src/sys/dev/usb

2016-10-30 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Oct 31 04:16:29 UTC 2016

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.713 -r1.714 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.714 -r1.715 src/sys/dev/usb/usbdevs_data.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/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.713 src/sys/dev/usb/usbdevs.h:1.714
--- src/sys/dev/usb/usbdevs.h:1.713	Mon Oct 31 03:19:23 2016
+++ src/sys/dev/usb/usbdevs.h	Mon Oct 31 04:16:29 2016
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.713 2016/10/31 03:19:23 dholland Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.714 2016/10/31 04:16:29 nonaka Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.721 2016/10/31 03:18:41 dholland Exp
+ *	NetBSD: usbdevs,v 1.722 2016/10/31 04:15:22 nonaka Exp
  */
 
 /*
@@ -1796,7 +1796,6 @@
 #define	USB_PRODUCT_HUAWEI_E1820	0x14ac		/* Huawei E1820 */
 #define	USB_PRODUCT_HUAWEI_E171INIT	0x14fe		/* Huawei E171 USB CD */
 #define	USB_PRODUCT_HUAWEI_E171	0x1506		/* Huawei E171 */
-#define	USB_PRODUCT_HUAWEI_E353	0x1507		/* Huawei E353 */
 #define	USB_PRODUCT_HUAWEI_E353_HiLink	0x1507		/* Huawei E353_HiLink */
 /* Accessing http://192.168.1.1/html/switchProjectMode.html on 
a Huawei HiLink device will switch it to u3g mode */

Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.714 src/sys/dev/usb/usbdevs_data.h:1.715
--- src/sys/dev/usb/usbdevs_data.h:1.714	Mon Oct 31 03:19:23 2016
+++ src/sys/dev/usb/usbdevs_data.h	Mon Oct 31 04:16:29 2016
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.714 2016/10/31 03:19:23 dholland Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.715 2016/10/31 04:16:29 nonaka Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.721 2016/10/31 03:18:41 dholland Exp
+ *	NetBSD: usbdevs,v 1.722 2016/10/31 04:15:22 nonaka Exp
  */
 
 /*
@@ -2310,16 +2310,14 @@ static const uint16_t usb_products[] = {
 	3942, 11076, 4718, 11061, 0,
 	USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E171, 
 	3942, 11076, 0,
-	USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E353, 
-	3942, 11081, 0,
 	USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E353_HiLink, 
-	3942, 11086, 0,
-	USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E353, 
 	3942, 11081, 0,
+	USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E353, 
+	3942, 11093, 0,
 	USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_K3765INIT, 
 	3942, 11064, 4718, 11061, 0,
 	USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E353INIT, 
-	3942, 11081, 4718, 11061, 0,
+	3942, 11093, 4718, 11061, 0,
 	USB_VENDOR_HUAWEI3COM, USB_PRODUCT_HUAWEI3COM_RT2573, 
 	5105, 0,
 	USB_VENDOR_HYUNDAI, USB_PRODUCT_HYUNDAI_PC5740, 
@@ -5271,7 +5269,7 @@ static const char usb_words[] = { "." 
 	"Targus\0" /* 1 refs @ 3918 */
 	"TwinMOS\0" /* 1 refs @ 3925 */
 	"CyberTAN\0" /* 1 refs @ 3933 */
-	"Huawei\0" /* 16 refs @ 3942 */
+	"Huawei\0" /* 15 refs @ 3942 */
 	"Aincomm\0" /* 1 refs @ 3949 */
 	"Mobility\0" /* 1 refs @ 3957 */
 	"Dick\0" /* 1 refs @ 3966 */
@@ -6230,8 +6228,8 @@ static const char usb_words[] = { "." 
 	"K3765\0" /* 2 refs @ 11064 */
 	"E1820\0" /* 1 refs @ 11070 */
 	"E171\0" /* 2 refs @ 11076 */
-	"E353\0" /* 3 refs @ 11081 */
-	"E353_HiLink\0" /* 1 refs @ 11086 */
+	"E353_HiLink\0" /* 1 refs @ 11081 */
+	"E353\0" /* 2 refs @ 11093 */
 	"PC5740\0" /* 1 refs @ 11098 */
 	"EVDO\0" /* 2 refs @ 11105 */
 	"UM175\0" /* 1 refs @ 0 */



CVS commit: src/sys/dev/pci

2016-10-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 31 05:10:45 UTC 2016

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
Decode Resizable BAR.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/pci/pcireg.h

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

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.152 src/sys/dev/pci/pci_subr.c:1.153
--- src/sys/dev/pci/pci_subr.c:1.152	Thu Oct 20 04:11:02 2016
+++ src/sys/dev/pci/pci_subr.c	Mon Oct 31 05:10:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.152 2016/10/20 04:11:02 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.153 2016/10/31 05:10:45 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.152 2016/10/20 04:11:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.153 2016/10/31 05:10:45 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -3023,7 +3023,56 @@ pci_conf_print_page_req_cap(const pcireg
 }
 
 /* XXX pci_conf_print_amd_cap */
-/* XXX pci_conf_print_resiz_bar_cap */
+
+#define MEM_PBUFSIZE	sizeof("999GB")
+
+static void
+pci_conf_print_resizbar_cap(const pcireg_t *regs, int capoff, int extcapoff)
+{
+	pcireg_t cap, ctl;
+	unsigned int bars, i, n;
+	char pbuf[MEM_PBUFSIZE];
+	
+	printf("\n  Resizable BAR\n");
+
+	/* Get Number of Resizable BARs */
+	ctl = regs[o2i(extcapoff + PCI_RESIZBAR_CTL(0))];
+	bars = __SHIFTOUT(ctl, PCI_RESIZBAR_CTL_NUMBAR);
+	printf("Number of Resizable BARs: ");
+	if (bars <= 6)
+		printf("%u\n", bars);
+	else {
+		printf("incorrect (%u)\n", bars);
+		return;
+	}
+
+	for (n = 0; n < 6; n++) {
+		cap = regs[o2i(extcapoff + PCI_RESIZBAR_CAP(n))];
+		printf("Capability register(%u): 0x%08x\n", n, cap);
+		if ((cap & PCI_RESIZBAR_CAP_SIZEMASK) == 0)
+			continue; /* Not Used */
+		printf("  Acceptable BAR sizes:");
+		for (i = 4; i <= 23; i++) {
+			if ((cap & (1 << i)) != 0) {
+humanize_number(pbuf, MEM_PBUFSIZE,
+(int64_t)1024 * 1024 << (i - 4), "B",
+HN_AUTOSCALE, HN_NOSPACE);
+printf(" %s", pbuf);
+			}
+		}
+		printf("\n");
+
+		ctl = regs[o2i(extcapoff + PCI_RESIZBAR_CTL(n))];
+		printf("Control register(%u): 0x%08x\n", n, ctl);
+		printf("  BAR Index: %u\n",
+		(unsigned int)__SHIFTOUT(ctl, PCI_RESIZBAR_CTL_BARIDX));
+		humanize_number(pbuf, MEM_PBUFSIZE,
+		(int64_t)1024 * 1024
+		<< __SHIFTOUT(ctl, PCI_RESIZBAR_CTL_BARSIZ),
+		"B", HN_AUTOSCALE, HN_NOSPACE);
+		printf("  BAR Size: %s\n", pbuf);
+	}
+}
 
 static void
 pci_conf_print_dpa_cap(const pcireg_t *regs, int capoff, int extcapoff)
@@ -3377,7 +3426,7 @@ pci_conf_print_ptm_cap(const pcireg_t *r
 /* XXX pci_conf_print_frsq_cap */
 /* XXX pci_conf_print_rtr_cap */
 /* XXX pci_conf_print_desigvndsp_cap */
-/* XXX pci_conf_print_vf_resiz_bar_cap */
+/* XXX pci_conf_print_vf_resizbar_cap */
 
 #undef	MS
 #undef	SM
@@ -3430,8 +3479,8 @@ static struct {
 	  pci_conf_print_page_req_cap },
 	{ PCI_EXTCAP_AMD,	"Reserved for AMD",
 	  NULL },
-	{ PCI_EXTCAP_RESIZ_BAR,	"Resizable BAR",
-	  NULL },
+	{ PCI_EXTCAP_RESIZBAR,	"Resizable BAR",
+	  pci_conf_print_resizbar_cap },
 	{ PCI_EXTCAP_DPA,	"Dynamic Power Allocation",
 	  pci_conf_print_dpa_cap },
 	{ PCI_EXTCAP_TPH_REQ,	"TPH Requester",
@@ -3460,7 +3509,7 @@ static struct {
 	  NULL },
 	{ PCI_EXTCAP_DESIGVNDSP, "Designated Vendor-Specific",
 	  NULL },
-	{ PCI_EXTCAP_VF_RESIZ_BAR, "VF Resizable BARs",
+	{ PCI_EXTCAP_VF_RESIZBAR, "VF Resizable BARs",
 	  NULL },
 };
 

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.116 src/sys/dev/pci/pcireg.h:1.117
--- src/sys/dev/pci/pcireg.h:1.116	Thu Oct 20 04:11:02 2016
+++ src/sys/dev/pci/pcireg.h	Mon Oct 31 05:10:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.116 2016/10/20 04:11:02 msaitoh Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.117 2016/10/31 05:10:45 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -1396,7 +1396,7 @@ struct pci_rom {
 #define	PCI_EXTCAP_MCAST	0x0012	/* Multicast */
 #define	PCI_EXTCAP_PAGE_REQ	0x0013	/* Page Request */
 #define	PCI_EXTCAP_AMD		0x0014	/* Reserved for AMD */
-#define	PCI_EXTCAP_RESIZ_BAR	0x0015	/* Resizable BAR */
+#define	PCI_EXTCAP_RESIZBAR	0x0015	/* Resizable BAR */
 #define	PCI_EXTCAP_DPA		0x0016	/* Dynamic Power Allocation */
 #define	PCI_EXTCAP_TPH_REQ	0x0017	/* TPH Requester */
 #define	PCI_EXTCAP_LTR		0x0018	/* Latency Tolerance Reporting */
@@ -1411,7 +1411,7 @@ struct pci_rom {
 #define	PCI_EXTCAP_FRSQ		0x0021	/* Function Reading Status Queueing */
 #define	PCI_EXTCAP_RTR		0x0022	/* Readiness Time Reporting */
 #define	PCI_EXTCAP_DESIGVNDSP	0x0023	/* Designated Vendor-Specific */
-#define	PCI_EXTCAP_VF_RESIZ_BAR	0x0024	/* VF Resizable BAR */
+#define	PCI_EXTCAP_VF_RESIZBAR	0x0024	

CVS commit: src/sys/dev/pci

2016-10-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 31 05:10:45 UTC 2016

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
Decode Resizable BAR.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/pci/pcireg.h

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



CVS commit: src/tests/lib/libc/gen

2016-10-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Oct 31 05:08:53 UTC 2016

Modified Files:
src/tests/lib/libc/gen: t_fnmatch.c

Log Message:
Add another case related to the ones from PR 49278: [A-\\].


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/gen/t_fnmatch.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/lib/libc/gen/t_fnmatch.c
diff -u src/tests/lib/libc/gen/t_fnmatch.c:1.6 src/tests/lib/libc/gen/t_fnmatch.c:1.7
--- src/tests/lib/libc/gen/t_fnmatch.c:1.6	Sun Oct 12 22:33:41 2014
+++ src/tests/lib/libc/gen/t_fnmatch.c	Mon Oct 31 05:08:53 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fnmatch.c,v 1.6 2014/10/12 22:33:41 christos Exp $ */
+/* $NetBSD: t_fnmatch.c,v 1.7 2016/10/31 05:08:53 dholland Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_fnmatch.c,v 1.6 2014/10/12 22:33:41 christos Exp $");
+__RCSID("$NetBSD: t_fnmatch.c,v 1.7 2016/10/31 05:08:53 dholland Exp $");
 
 #include 
 #include 
@@ -166,6 +166,7 @@ ATF_TC_BODY(fnmatch_initialbracket, tc)
 	ATF_CHECK(fnmatch("[!]a-]", "b", 0) == 0);
 	ATF_CHECK(fnmatch("[]-_]", "^", 0) == 0); /* range: ']', '^', '_' */
 	ATF_CHECK(fnmatch("[!]-_]", "X", 0) == 0);
+	ATF_CHECK(fnmatch("[A-]", "[", 0) == 0);
 	ATF_CHECK(fnmatch("[a-z]/[a-z]", "a/b", 0) == 0);
 	ATF_CHECK(fnmatch("[*]/b", "*/b", 0) == 0);
 	ATF_CHECK(fnmatch("[?]/b", "?/b", 0) == 0);



CVS commit: src/tests/lib/libc/gen

2016-10-30 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Mon Oct 31 05:08:53 UTC 2016

Modified Files:
src/tests/lib/libc/gen: t_fnmatch.c

Log Message:
Add another case related to the ones from PR 49278: [A-\\].


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/gen/t_fnmatch.c

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



CVS commit: src/sys/netinet6

2016-10-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Oct 31 04:16:25 UTC 2016

Modified Files:
src/sys/netinet6: icmp6.c in6_pcb.c in6_src.c ip6_var.h nd6_nbr.c
raw_ip6.c udp6_output.c

Log Message:
Fix race condition of in6_selectsrc

in6_selectsrc returned a pointer to in6_addr that wan't guaranteed to be
safe by pserialize (or psref), which was racy. Let callers pass a pointer
to in6_addr and in6_selectsrc copy a result to it inside pserialize
critical sections.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.150 -r1.151 src/sys/netinet6/in6_pcb.c
cvs rdiff -u -r1.71 -r1.72 src/sys/netinet6/in6_src.c
cvs rdiff -u -r1.68 -r1.69 src/sys/netinet6/ip6_var.h
cvs rdiff -u -r1.128 -r1.129 src/sys/netinet6/nd6_nbr.c
cvs rdiff -u -r1.151 -r1.152 src/sys/netinet6/raw_ip6.c
cvs rdiff -u -r1.53 -r1.54 src/sys/netinet6/udp6_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/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.199 src/sys/netinet6/icmp6.c:1.200
--- src/sys/netinet6/icmp6.c:1.199	Tue Oct 25 02:45:10 2016
+++ src/sys/netinet6/icmp6.c	Mon Oct 31 04:16:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: icmp6.c,v 1.199 2016/10/25 02:45:10 ozaki-r Exp $	*/
+/*	$NetBSD: icmp6.c,v 1.200 2016/10/31 04:16:25 ozaki-r Exp $	*/
 /*	$KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.199 2016/10/25 02:45:10 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.200 2016/10/31 04:16:25 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1999,9 +1999,9 @@ icmp6_reflect(struct mbuf *m, size_t off
 	int type, code;
 	struct ifnet *outif = NULL;
 	struct in6_addr origdst;
-	const struct in6_addr *src = NULL;
 	struct ifnet *rcvif;
 	int s;
+	bool ip6_src_filled = false;
 
 	/* too short to reflect */
 	if (off < sizeof(struct ip6_hdr)) {
@@ -2069,8 +2069,10 @@ icmp6_reflect(struct mbuf *m, size_t off
 		;
 	else if ((ip6a = ip6_getdstifaddr(m)) != NULL) {
 		if ((ip6a->ip6a_flags &
-		 (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY)) == 0)
-			src = >ip6a_src;
+		 (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY)) == 0) {
+			ip6->ip6_src = ip6a->ip6a_src;
+			ip6_src_filled = true;
+		}
 	} else {
 		union {
 			struct sockaddr_in6 sin6;
@@ -2087,13 +2089,15 @@ icmp6_reflect(struct mbuf *m, size_t off
 		if (ifa != NULL) {
 			ia = ifatoia6(ifa);
 			if ((ia->ia6_flags &
- (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY)) == 0)
-src = >ia_addr.sin6_addr;
+ (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY)) == 0) {
+ip6->ip6_src = ia->ia_addr.sin6_addr;
+ip6_src_filled = true;
+			}
 		}
 		pserialize_read_exit(_s);
 	}
 
-	if (src == NULL) {
+	if (!ip6_src_filled) {
 		int e;
 		struct sockaddr_in6 sin6;
 		struct route ro;
@@ -2107,9 +2111,10 @@ icmp6_reflect(struct mbuf *m, size_t off
 		sockaddr_in6_init(, >ip6_dst, 0, 0, 0);
 
 		memset(, 0, sizeof(ro));
-		src = in6_selectsrc(, NULL, NULL, , NULL, NULL, NULL, );
+		e = in6_selectsrc(, NULL, NULL, , NULL, NULL, NULL,
+		>ip6_src);
 		rtcache_free();
-		if (src == NULL) {
+		if (e != 0) {
 			nd6log(LOG_DEBUG,
 			"source can't be determined: "
 			"dst=%s, error=%d\n",
@@ -2118,7 +2123,6 @@ icmp6_reflect(struct mbuf *m, size_t off
 		}
 	}
 
-	ip6->ip6_src = *src;
 	ip6->ip6_flow = 0;
 	ip6->ip6_vfc &= ~IPV6_VERSION_MASK;
 	ip6->ip6_vfc |= IPV6_VERSION;

Index: src/sys/netinet6/in6_pcb.c
diff -u src/sys/netinet6/in6_pcb.c:1.150 src/sys/netinet6/in6_pcb.c:1.151
--- src/sys/netinet6/in6_pcb.c:1.150	Thu Sep 29 12:19:47 2016
+++ src/sys/netinet6/in6_pcb.c	Mon Oct 31 04:16:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_pcb.c,v 1.150 2016/09/29 12:19:47 roy Exp $	*/
+/*	$NetBSD: in6_pcb.c,v 1.151 2016/10/31 04:16:25 ozaki-r Exp $	*/
 /*	$KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.150 2016/09/29 12:19:47 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.151 2016/10/31 04:16:25 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -444,6 +444,7 @@ in6_pcbconnect(void *v, struct sockaddr_
 {
 	struct in6pcb *in6p = v;
 	struct in6_addr *in6a = NULL;
+	struct in6_addr ia6;
 	struct ifnet *ifp = NULL;	/* outgoing interface */
 	int error = 0;
 	int scope_ambiguous = 0;
@@ -530,10 +531,9 @@ in6_pcbconnect(void *v, struct sockaddr_
 		 * with the address specified by setsockopt(IPV6_PKTINFO).
 		 * Is it the intended behavior?
 		 */
-		in6a = in6_selectsrc(sin6, in6p->in6p_outputopts,
- in6p->in6p_moptions,
- >in6p_route,
- >in6p_laddr, , , );
+		error = in6_selectsrc(sin6, in6p->in6p_outputopts,
+		in6p->in6p_moptions, >in6p_route, >in6p_laddr,
+		, , );
 		if (ifp && scope_ambiguous &&
 		(error = in6_setscope(>sin6_addr, ifp, NULL)) != 0) {
 			if_put(ifp, );
@@ 

CVS commit: src/sys/dev/usb

2016-10-30 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Oct 31 04:15:23 UTC 2016

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Remove duplicated HUAWEI E353 entry.


To generate a diff of this commit:
cvs rdiff -u -r1.721 -r1.722 src/sys/dev/usb/usbdevs

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



CVS commit: src/sys/netinet6

2016-10-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Oct 31 04:16:25 UTC 2016

Modified Files:
src/sys/netinet6: icmp6.c in6_pcb.c in6_src.c ip6_var.h nd6_nbr.c
raw_ip6.c udp6_output.c

Log Message:
Fix race condition of in6_selectsrc

in6_selectsrc returned a pointer to in6_addr that wan't guaranteed to be
safe by pserialize (or psref), which was racy. Let callers pass a pointer
to in6_addr and in6_selectsrc copy a result to it inside pserialize
critical sections.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.150 -r1.151 src/sys/netinet6/in6_pcb.c
cvs rdiff -u -r1.71 -r1.72 src/sys/netinet6/in6_src.c
cvs rdiff -u -r1.68 -r1.69 src/sys/netinet6/ip6_var.h
cvs rdiff -u -r1.128 -r1.129 src/sys/netinet6/nd6_nbr.c
cvs rdiff -u -r1.151 -r1.152 src/sys/netinet6/raw_ip6.c
cvs rdiff -u -r1.53 -r1.54 src/sys/netinet6/udp6_output.c

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



CVS commit: src/sys/dev/usb

2016-10-30 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Oct 31 04:16:29 UTC 2016

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.713 -r1.714 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.714 -r1.715 src/sys/dev/usb/usbdevs_data.h

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



CVS commit: src/sys/dev/usb

2016-10-30 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Oct 31 04:15:23 UTC 2016

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Remove duplicated HUAWEI E353 entry.


To generate a diff of this commit:
cvs rdiff -u -r1.721 -r1.722 src/sys/dev/usb/usbdevs

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/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.721 src/sys/dev/usb/usbdevs:1.722
--- src/sys/dev/usb/usbdevs:1.721	Mon Oct 31 03:18:41 2016
+++ src/sys/dev/usb/usbdevs	Mon Oct 31 04:15:22 2016
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.721 2016/10/31 03:18:41 dholland Exp $
+$NetBSD: usbdevs,v 1.722 2016/10/31 04:15:22 nonaka Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1789,7 +1789,6 @@ product HUAWEI K3765		0x1465	Huawei K376
 product HUAWEI E1820		0x14ac	Huawei E1820
 product HUAWEI E171INIT		0x14fe	Huawei E171 USB CD
 product HUAWEI E171		0x1506	Huawei E171
-product HUAWEI E353		0x1507	Huawei E353
 product HUAWEI E353_HiLink	0x1507	Huawei E353_HiLink
 /* Accessing http://192.168.1.1/html/switchProjectMode.html on 
a Huawei HiLink device will switch it to u3g mode */



CVS commit: src

2016-10-30 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Oct 30 16:17:17 UTC 2016

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/lib/libpthread: Makefile h_common.h t_mutex.c
Added Files:
src/tests/lib/libpthread: t_timedmutex.c

Log Message:
Add new test t_timedmutex

This test is a clone on t_mutex with additional two tests for timed-mutex
specific block.

All simple-mutex (not with the timed property according to the C11 wording)
specific tests are covered by pthread_mutex_timedlock(3) with parameter
ts_lengthy of sufficiently large tv_sec value (right now UINT16_MAX). If,
a test will hang, it won't wait UINT16_MAX seconds, but will be terminated
within the default timeout for ATF tests (right now 300 [sec] in my
NetBSD/amd64 setup).

This test was inspired by a classic selflock test failure of
pthread_mutex_timedlock(3) of the following form:

#include 
#include 
#include 
#include 
#include 

int main(int argc, char **argv)
{
pthread_mutex_t mtx;
struct timespec ts;

ts.tv_sec = 0;
ts.tv_nsec = 1000;
printf("ts{.tv_sec = %d, .tv_nsec=%ld}\n", ts.tv_sec, ts.tv_nsec);
fflush(stdout);

printf("mtx_init\n");
assert(pthread_mutex_init(, NULL) == 0);

printf("mtx_lock\n");
assert(pthread_mutex_lock() == 0);

printf("mtx_timedlock\n");
assert(pthread_mutex_timedlock(, ) == ETIMEDOUT);

printf("mtx_unlock\n");
assert(pthread_mutex_unlock() == 0);

printf("mtx_destroy\n");
assert(pthread_mutex_destroy() == 0);

return 0;
}

Current NetBSD implementation wrongly hangs on this test.

The issue was detected during development of the C11 portable threads.

My local tests in chroot presents that the are further issues:

t_timedmutex (21/25): 10 test cases
mutex1: [0.001142s] Failed: 
/usr/src/tests/lib/libpthread/t_timedmutex.c:75: *param != 20
mutex2: [0.261499s] Passed.
mutex3: [0.261496s] Passed.
mutex4: [0.001204s] Failed: 
/usr/src/tests/lib/libpthread/t_timedmutex.c:265: 
pthread_mutex_timedlock(, _lengthy): Connection timed out
mutex5: [0.001235s] Failed: 
/usr/src/tests/lib/libpthread/t_timedmutex.c:337: 
pthread_mutex_timedlock(, _lengthy): Connection timed out
mutex6: [21.218497s] Failed: 
/usr/src/tests/lib/libpthread/t_timedmutex.c:512: start != 1
mutexattr1: [0.001328s] Passed.
mutexattr2: [0.001175s] Passed.
timedmutex1: [301.119397s] Failed: Test case timed out after 300 seconds
timedmutex2: [301.123081s] Failed: Test case timed out after 300 seconds
[623.990659s]

I'm also receiveing the same failure in the mutex6 test in t_mutex, so
there might be a false positives due to local chroot(8) issues.

Commit approved by .


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.688 -r1.689 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libpthread/Makefile
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libpthread/h_common.h
cvs rdiff -u -r1.10 -r1.11 src/tests/lib/libpthread/t_mutex.c
cvs rdiff -u -r0 -r1.1 src/tests/lib/libpthread/t_timedmutex.c

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

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.167 src/distrib/sets/lists/debug/mi:1.168
--- src/distrib/sets/lists/debug/mi:1.167	Mon Sep  5 02:25:38 2016
+++ src/distrib/sets/lists/debug/mi	Sun Oct 30 16:17:16 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.167 2016/09/05 02:25:38 ozaki-r Exp $
+# $NetBSD: mi,v 1.168 2016/10/30 16:17:16 kamil Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -2159,6 +2159,7 @@
 ./usr/libdata/debug/usr/tests/lib/libpthread/t_sleep.debug		tests-lib-tests		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libpthread/t_status.debug		tests-obsolete		obsolete,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libpthread/t_swapcontext.debug	tests-lib-tests		debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libpthread/t_timedmutex.debug		tests-lib-tests		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/librt/t_sched.debug			tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/librt/t_sem.debug			tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/librumpclient/h_exec.debug			tests-lib-debug		debug,atf,rump

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.688 src/distrib/sets/lists/tests/mi:1.689
--- src/distrib/sets/lists/tests/mi:1.688	Sat Oct 22 14:13:39 2016
+++ src/distrib/sets/lists/tests/mi	Sun Oct 30 16:17:16 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.688 2016/10/22 14:13:39 abhinav Exp $
+# $NetBSD: mi,v 1.689 

CVS commit: src

2016-10-30 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Oct 30 16:17:17 UTC 2016

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/lib/libpthread: Makefile h_common.h t_mutex.c
Added Files:
src/tests/lib/libpthread: t_timedmutex.c

Log Message:
Add new test t_timedmutex

This test is a clone on t_mutex with additional two tests for timed-mutex
specific block.

All simple-mutex (not with the timed property according to the C11 wording)
specific tests are covered by pthread_mutex_timedlock(3) with parameter
ts_lengthy of sufficiently large tv_sec value (right now UINT16_MAX). If,
a test will hang, it won't wait UINT16_MAX seconds, but will be terminated
within the default timeout for ATF tests (right now 300 [sec] in my
NetBSD/amd64 setup).

This test was inspired by a classic selflock test failure of
pthread_mutex_timedlock(3) of the following form:

#include 
#include 
#include 
#include 
#include 

int main(int argc, char **argv)
{
pthread_mutex_t mtx;
struct timespec ts;

ts.tv_sec = 0;
ts.tv_nsec = 1000;
printf("ts{.tv_sec = %d, .tv_nsec=%ld}\n", ts.tv_sec, ts.tv_nsec);
fflush(stdout);

printf("mtx_init\n");
assert(pthread_mutex_init(, NULL) == 0);

printf("mtx_lock\n");
assert(pthread_mutex_lock() == 0);

printf("mtx_timedlock\n");
assert(pthread_mutex_timedlock(, ) == ETIMEDOUT);

printf("mtx_unlock\n");
assert(pthread_mutex_unlock() == 0);

printf("mtx_destroy\n");
assert(pthread_mutex_destroy() == 0);

return 0;
}

Current NetBSD implementation wrongly hangs on this test.

The issue was detected during development of the C11 portable threads.

My local tests in chroot presents that the are further issues:

t_timedmutex (21/25): 10 test cases
mutex1: [0.001142s] Failed: 
/usr/src/tests/lib/libpthread/t_timedmutex.c:75: *param != 20
mutex2: [0.261499s] Passed.
mutex3: [0.261496s] Passed.
mutex4: [0.001204s] Failed: 
/usr/src/tests/lib/libpthread/t_timedmutex.c:265: 
pthread_mutex_timedlock(, _lengthy): Connection timed out
mutex5: [0.001235s] Failed: 
/usr/src/tests/lib/libpthread/t_timedmutex.c:337: 
pthread_mutex_timedlock(, _lengthy): Connection timed out
mutex6: [21.218497s] Failed: 
/usr/src/tests/lib/libpthread/t_timedmutex.c:512: start != 1
mutexattr1: [0.001328s] Passed.
mutexattr2: [0.001175s] Passed.
timedmutex1: [301.119397s] Failed: Test case timed out after 300 seconds
timedmutex2: [301.123081s] Failed: Test case timed out after 300 seconds
[623.990659s]

I'm also receiveing the same failure in the mutex6 test in t_mutex, so
there might be a false positives due to local chroot(8) issues.

Commit approved by .


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.688 -r1.689 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libpthread/Makefile
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libpthread/h_common.h
cvs rdiff -u -r1.10 -r1.11 src/tests/lib/libpthread/t_mutex.c
cvs rdiff -u -r0 -r1.1 src/tests/lib/libpthread/t_timedmutex.c

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



Re: CVS commit: src/sys/dev/pci

2016-10-30 Thread Christos Zoulas
On Oct 30,  6:24pm, p...@whooppee.com (Paul Goyette) wrote:
-- Subject: Re: CVS commit: src/sys/dev/pci

| One more revision.  This one updates the length parameter as well as the 
| dest pointer, so the caller doesn't need to recalculate on each call.
| 
| I've also changed it to return an int value rather than void:
| 
|   x = 0   success
|   x < 0   vsnprintf() failed (for userland code, errno will
|   contain details)
|   x > 0   success, however the output was truncated to avoid
|   overflowing the output buffer.
| 
| This variant seems to work just fine, both in-kernel and userland.

You don't need 2 static decls, you can put all the info in one.

christos


CVS commit: src/sys/ufs/ffs

2016-10-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 30 15:01:46 UTC 2016

Modified Files:
src/sys/ufs/ffs: ffs_alloc.c

Log Message:
Tidy up panic messages, no functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/ufs/ffs/ffs_alloc.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/ufs/ffs/ffs_alloc.c
diff -u src/sys/ufs/ffs/ffs_alloc.c:1.153 src/sys/ufs/ffs/ffs_alloc.c:1.154
--- src/sys/ufs/ffs/ffs_alloc.c:1.153	Fri Oct 28 16:38:12 2016
+++ src/sys/ufs/ffs/ffs_alloc.c	Sun Oct 30 11:01:46 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_alloc.c,v 1.153 2016/10/28 20:38:12 jdolecek Exp $	*/
+/*	$NetBSD: ffs_alloc.c,v 1.154 2016/10/30 15:01:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.153 2016/10/28 20:38:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.154 2016/10/30 15:01:46 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -136,14 +136,13 @@ ffs_check_bad_allocation(const char *fun
 {
 	if ((u_int)size > fs->fs_bsize || ffs_fragoff(fs, size) != 0 ||
 	ffs_fragnum(fs, bno) + ffs_numfrags(fs, size) > fs->fs_frag) {
-		printf("dev = 0x%llx, bno = %" PRId64 " bsize = %d, "
-		"size = %ld, fs = %s\n",
+		panic("%s: bad size: dev = 0x%llx, bno = %" PRId64 
+		" bsize = %d, size = %ld, fs = %s", func,
 		(long long)dev, bno, fs->fs_bsize, size, fs->fs_fsmnt);
-		panic("%s: bad size", func);
 	}
 
 	if (bno >= fs->fs_size) {
-		printf("bad block %" PRId64 ", ino %llu\n", bno,
+		printf("%s: bad block %" PRId64 ", ino %llu\n", func, bno,
 		(unsigned long long)inum);
 		ffs_fserr(fs, NOCRED, "bad block");
 		return EINVAL;
@@ -229,14 +228,13 @@ ffs_alloc(struct inode *ip, daddr_t lbn,
 
 	*bnp = 0;
 #ifdef DIAGNOSTIC
+	if (cred == NOCRED)
+		panic("%s: missing credential", __func__);
 	if ((u_int)size > fs->fs_bsize || ffs_fragoff(fs, size) != 0) {
-		printf("dev = 0x%llx, bsize = %d, size = %d, fs = %s\n",
-		(unsigned long long)ip->i_dev, fs->fs_bsize, size,
-		fs->fs_fsmnt);
-		panic("ffs_alloc: bad size");
+		panic("%s: bad size: dev = 0x%llx, bsize = %d, size = %d, "
+		"fs = %s", __func__, (unsigned long long)ip->i_dev,
+		fs->fs_bsize, size, fs->fs_fsmnt);
 	}
-	if (cred == NOCRED)
-		panic("ffs_alloc: missing credential");
 #endif /* DIAGNOSTIC */
 	if (size == fs->fs_bsize && fs->fs_cstotal.cs_nbfree == 0)
 		goto nospace;
@@ -348,16 +346,15 @@ ffs_realloccg(struct inode *ip, daddr_t 
 #endif
 
 #ifdef DIAGNOSTIC
+	if (cred == NOCRED)
+		panic("%s: missing credential", __func__);
 	if ((u_int)osize > fs->fs_bsize || ffs_fragoff(fs, osize) != 0 ||
 	(u_int)nsize > fs->fs_bsize || ffs_fragoff(fs, nsize) != 0) {
-		printf(
-		"dev = 0x%llx, bsize = %d, osize = %d, nsize = %d, fs = %s\n",
+		panic("%s: bad size: dev = 0x%llx, bsize = %d, osize = %d, "
+		"nsize = %d, fs = %s", __func__,
 		(unsigned long long)ip->i_dev, fs->fs_bsize, osize, nsize,
 		fs->fs_fsmnt);
-		panic("ffs_realloccg: bad size");
 	}
-	if (cred == NOCRED)
-		panic("ffs_realloccg: missing credential");
 #endif /* DIAGNOSTIC */
 	if (freespace(fs, fs->fs_minfree) <= 0 &&
 	kauth_authorize_system(cred, KAUTH_SYSTEM_FS_RESERVEDSPACE, 0, NULL,
@@ -371,10 +368,10 @@ ffs_realloccg(struct inode *ip, daddr_t 
 		bprev = ufs_rw32(ip->i_ffs1_db[lbprev], UFS_FSNEEDSWAP(fs));
 
 	if (bprev == 0) {
-		printf("dev = 0x%llx, bsize = %d, bprev = %" PRId64 ", fs = %s\n",
+		panic("%s: bad bprev: dev = 0x%llx, bsize = %d, bprev = %"
+		PRId64 ", fs = %s", __func__,
 		(unsigned long long)ip->i_dev, fs->fs_bsize, bprev,
 		fs->fs_fsmnt);
-		panic("ffs_realloccg: bad bprev");
 	}
 	mutex_exit(>um_lock);
 
@@ -403,8 +400,11 @@ ffs_realloccg(struct inode *ip, daddr_t 
 		ip->i_flag |= IN_CHANGE | IN_UPDATE;
 
 		if (bpp != NULL) {
-			if (bp->b_blkno != FFS_FSBTODB(fs, bno))
-panic("bad blockno");
+			if (bp->b_blkno != FFS_FSBTODB(fs, bno)) {
+panic("%s: bad blockno %#llx != %#llx",
+__func__, (unsigned long long) bp->b_blkno,
+(unsigned long long)FFS_FSBTODB(fs, bno));
+			}
 			allocbuf(bp, nsize, 1);
 			memset((char *)bp->b_data + osize, 0, nsize - osize);
 			mutex_enter(bp->b_objlock);
@@ -471,9 +471,9 @@ ffs_realloccg(struct inode *ip, daddr_t 
 		fs->fs_optim = FS_OPTSPACE;
 		break;
 	default:
-		printf("dev = 0x%llx, optim = %d, fs = %s\n",
-		(unsigned long long)ip->i_dev, fs->fs_optim, fs->fs_fsmnt);
-		panic("ffs_realloccg: bad optim");
+		panic("%s: bad optim: dev = 0x%llx, optim = %d, fs = %s",
+		__func__, (unsigned long long)ip->i_dev, fs->fs_optim,
+		fs->fs_fsmnt);
 		/* NOTREACHED */
 	}
 	bno = ffs_hashalloc(ip, cg, bpref, request, nsize, 0, ffs_alloccg);
@@ -1324,18 +1324,16 @@ retry:
 		start = 0;
 		loc = skpc(0xff, len, [0]);

CVS commit: src/sys/ufs/ffs

2016-10-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 30 15:01:46 UTC 2016

Modified Files:
src/sys/ufs/ffs: ffs_alloc.c

Log Message:
Tidy up panic messages, no functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/ufs/ffs/ffs_alloc.c

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



CVS commit: src/etc/rc.d

2016-10-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Oct 30 15:47:06 UTC 2016

Modified Files:
src/etc/rc.d: postfix

Log Message:
Handle variable expansion and comma/space separators in postconf.

>From Timo Buhrmester:
https://mail-index.netbsd.org/tech-userlevel/2016/08/20/msg010301.html


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/etc/rc.d/postfix

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

Modified files:

Index: src/etc/rc.d/postfix
diff -u src/etc/rc.d/postfix:1.17 src/etc/rc.d/postfix:1.18
--- src/etc/rc.d/postfix:1.17	Thu Jul 23 17:12:16 2015
+++ src/etc/rc.d/postfix	Sun Oct 30 15:47:06 2016
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postfix,v 1.17 2015/07/23 17:12:16 riz Exp $
+# $NetBSD: postfix,v 1.18 2016/10/30 15:47:06 riastradh Exp $
 #
 
 # PROVIDE: mail
@@ -44,9 +44,10 @@ postfix_precmd()
 		fi
 	done
 
-	for f in $($postconf -h alias_database); do
-		OIFS="${IFS}"
-		IFS="${IFS}:"
+	OIFS="${IFS}"
+	IFS="${IFS},"
+	for f in $($postconf -hx alias_database); do
+		IFS="${OIFS}:"
 		set -- $f
 		IFS="${OIFS}"
 		case "$1" in



CVS commit: src/etc/rc.d

2016-10-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Oct 30 15:47:06 UTC 2016

Modified Files:
src/etc/rc.d: postfix

Log Message:
Handle variable expansion and comma/space separators in postconf.

>From Timo Buhrmester:
https://mail-index.netbsd.org/tech-userlevel/2016/08/20/msg010301.html


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/etc/rc.d/postfix

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