CVS commit: src/sys/dev/pci

2017-02-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Feb 17 07:21:28 UTC 2017

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

Log Message:
more fix about IFF_OACTIVE.

fix TODO of r1.479 and reduce IFF_OACTIVE manipulation.


To generate a diff of this commit:
cvs rdiff -u -r1.481 -r1.482 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.481 src/sys/dev/pci/if_wm.c:1.482
--- src/sys/dev/pci/if_wm.c:1.481	Fri Feb 17 05:20:01 2017
+++ src/sys/dev/pci/if_wm.c	Fri Feb 17 07:21:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.481 2017/02/17 05:20:01 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.482 2017/02/17 07:21:28 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.481 2017/02/17 05:20:01 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.482 2017/02/17 07:21:28 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -6525,12 +6525,12 @@ wm_send_common_locked(struct ifnet *ifp,
 	bus_size_t seglen, curlen;
 	uint32_t cksumcmd;
 	uint8_t cksumfields;
-	struct wm_queue *wmq = container_of(txq, struct wm_queue, wmq_txq);
-	int qid = wmq->wmq_id;
 
 	KASSERT(mutex_owned(txq->txq_lock));
 
-	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
+		return;
+	if ((ifp->if_flags & IFF_OACTIVE) != 0 && !is_transmit)
 		return;
 	if ((txq->txq_flags & WM_TXQ_NO_SPACE) != 0)
 		return;
@@ -6642,7 +6642,7 @@ wm_send_common_locked(struct ifnet *ifp,
 			("%s: TX: need %d (%d) descriptors, have %d\n",
 			device_xname(sc->sc_dev), dmamap->dm_nsegs,
 			segs_needed, txq->txq_free - 1));
-			if (qid == 0)
+			if (!is_transmit)
 ifp->if_flags |= IFF_OACTIVE;
 			txq->txq_flags |= WM_TXQ_NO_SPACE;
 			bus_dmamap_unload(sc->sc_dmat, dmamap);
@@ -6660,7 +6660,7 @@ wm_send_common_locked(struct ifnet *ifp,
 			DPRINTF(WM_DEBUG_TX,
 			("%s: TX: 82547 Tx FIFO bug detected\n",
 			device_xname(sc->sc_dev)));
-			if (qid == 0)
+			if (!is_transmit)
 ifp->if_flags |= IFF_OACTIVE;
 			txq->txq_flags |= WM_TXQ_NO_SPACE;
 			bus_dmamap_unload(sc->sc_dmat, dmamap);
@@ -6806,7 +6806,7 @@ wm_send_common_locked(struct ifnet *ifp,
 	}
 
 	if (m0 != NULL) {
-		if (qid == 0)
+		if (!is_transmit)
 			ifp->if_flags |= IFF_OACTIVE;
 		txq->txq_flags |= WM_TXQ_NO_SPACE;
 		WM_Q_EVCNT_INCR(txq, txdrop);
@@ -6817,7 +6817,7 @@ wm_send_common_locked(struct ifnet *ifp,
 
 	if (txq->txq_sfree == 0 || txq->txq_free <= 2) {
 		/* No more slots; notify upper layer. */
-		if (qid == 0)
+		if (!is_transmit)
 			ifp->if_flags |= IFF_OACTIVE;
 		txq->txq_flags |= WM_TXQ_NO_SPACE;
 	}
@@ -7118,12 +7118,12 @@ wm_nq_send_common_locked(struct ifnet *i
 	bus_dmamap_t dmamap;
 	int error, nexttx, lasttx = -1, seg, segs_needed;
 	bool do_csum, sent;
-	struct wm_queue *wmq = container_of(txq, struct wm_queue, wmq_txq);
-	int qid = wmq->wmq_id;
 
 	KASSERT(mutex_owned(txq->txq_lock));
 
-	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
+		return;
+	if ((ifp->if_flags & IFF_OACTIVE) != 0 && !is_transmit)
 		return;
 	if ((txq->txq_flags & WM_TXQ_NO_SPACE) != 0)
 		return;
@@ -7213,7 +7213,7 @@ wm_nq_send_common_locked(struct ifnet *i
 			("%s: TX: need %d (%d) descriptors, have %d\n",
 			device_xname(sc->sc_dev), dmamap->dm_nsegs,
 			segs_needed, txq->txq_free - 1));
-			if (qid == 0)
+			if (!is_transmit)
 ifp->if_flags |= IFF_OACTIVE;
 			txq->txq_flags |= WM_TXQ_NO_SPACE;
 			bus_dmamap_unload(sc->sc_dmat, dmamap);
@@ -7372,7 +7372,7 @@ wm_nq_send_common_locked(struct ifnet *i
 	}
 
 	if (m0 != NULL) {
-		if (qid == 0)
+		if (!is_transmit)
 			ifp->if_flags |= IFF_OACTIVE;
 		txq->txq_flags |= WM_TXQ_NO_SPACE;
 		WM_Q_EVCNT_INCR(txq, txdrop);
@@ -7383,7 +7383,7 @@ wm_nq_send_common_locked(struct ifnet *i
 
 	if (txq->txq_sfree == 0 || txq->txq_free <= 2) {
 		/* No more slots; notify upper layer. */
-		if (qid == 0)
+		if (!is_transmit)
 			ifp->if_flags |= IFF_OACTIVE;
 		txq->txq_flags |= WM_TXQ_NO_SPACE;
 	}



CVS commit: src/sys/dev/pci

2017-02-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Feb 17 05:20:02 UTC 2017

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

Log Message:
refactor: functionize deferred_start code holding locks.


To generate a diff of this commit:
cvs rdiff -u -r1.480 -r1.481 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.480 src/sys/dev/pci/if_wm.c:1.481
--- src/sys/dev/pci/if_wm.c:1.480	Fri Feb 17 04:51:01 2017
+++ src/sys/dev/pci/if_wm.c	Fri Feb 17 05:20:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.480 2017/02/17 04:51:01 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.481 2017/02/17 05:20:01 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.480 2017/02/17 04:51:01 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.481 2017/02/17 05:20:01 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -710,6 +710,7 @@ static int	wm_nq_transmit(struct ifnet *
 static void	wm_nq_transmit_locked(struct ifnet *, struct wm_txqueue *);
 static void	wm_nq_send_common_locked(struct ifnet *, struct wm_txqueue *, bool);
 static void	wm_deferred_start(struct ifnet *);
+static void	wm_deferred_start_locked(struct wm_txqueue *);
 /* Interrupt */
 static int	wm_txeof(struct wm_softc *, struct wm_txqueue *);
 static void	wm_rxeof(struct wm_rxqueue *);
@@ -7416,23 +7417,36 @@ wm_deferred_start(struct ifnet *ifp)
 		 * if we use mutex_tryenter() here.
 		 */
 		mutex_enter(txq->txq_lock);
-		if (txq->txq_stopping) {
-			mutex_exit(txq->txq_lock);
-			return;
-		}
+		wm_deferred_start_locked(txq);
+		mutex_exit(txq->txq_lock);
+	}
+}
 
-		if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) {
-			/* XXX need for ALTQ */
-			if (qid == 0)
-wm_nq_start_locked(ifp);
-			wm_nq_transmit_locked(ifp, txq);
-		} else {
-			/* XXX need for ALTQ */
-			if (qid == 0)
-wm_start_locked(ifp);
-			wm_transmit_locked(ifp, txq);
-		}
+static void
+wm_deferred_start_locked(struct wm_txqueue *txq)
+{
+	struct wm_softc *sc = txq->txq_sc;
+	struct ifnet *ifp = >sc_ethercom.ec_if;
+	struct wm_queue *wmq = container_of(txq, struct wm_queue, wmq_txq);
+	int qid = wmq->wmq_id;
+
+	KASSERT(mutex_owned(txq->txq_lock));
+
+	if (txq->txq_stopping) {
 		mutex_exit(txq->txq_lock);
+		return;
+	}
+
+	if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) {
+		/* XXX need for ALTQ */
+		if (qid == 0)
+			wm_nq_start_locked(ifp);
+		wm_nq_transmit_locked(ifp, txq);
+	} else {
+		/* XXX need for ALTQ */
+		if (qid == 0)
+			wm_start_locked(ifp);
+		wm_transmit_locked(ifp, txq);
 	}
 }
 



CVS commit: src/sys/dev/pci

2017-02-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Feb 17 04:51:01 UTC 2017

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

Log Message:
refactor: functionize txrxintr disable/enable code.


To generate a diff of this commit:
cvs rdiff -u -r1.479 -r1.480 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.479 src/sys/dev/pci/if_wm.c:1.480
--- src/sys/dev/pci/if_wm.c:1.479	Thu Feb 16 05:36:41 2017
+++ src/sys/dev/pci/if_wm.c	Fri Feb 17 04:51:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.479 2017/02/16 05:36:41 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.480 2017/02/17 04:51:01 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.479 2017/02/16 05:36:41 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.480 2017/02/17 04:51:01 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -718,6 +718,8 @@ static void	wm_linkintr_tbi(struct wm_so
 static void	wm_linkintr_serdes(struct wm_softc *, uint32_t);
 static void	wm_linkintr(struct wm_softc *, uint32_t);
 static int	wm_intr_legacy(void *);
+static inline void	wm_txrxintr_disable(struct wm_queue *);
+static inline void	wm_txrxintr_enable(struct wm_queue *);
 static int	wm_txrxintr_msix(void *);
 static int	wm_linkintr_msix(void *);
 
@@ -8296,6 +8298,32 @@ wm_intr_legacy(void *arg)
 	return handled;
 }
 
+static inline void
+wm_txrxintr_disable(struct wm_queue *wmq)
+{
+	struct wm_softc *sc = wmq->wmq_txq.txq_sc;
+
+	if (sc->sc_type == WM_T_82574)
+		CSR_WRITE(sc, WMREG_IMC, ICR_TXQ(wmq->wmq_id) | ICR_RXQ(wmq->wmq_id));
+	else if (sc->sc_type == WM_T_82575)
+		CSR_WRITE(sc, WMREG_EIMC, EITR_TX_QUEUE(wmq->wmq_id) | EITR_RX_QUEUE(wmq->wmq_id));
+	else
+		CSR_WRITE(sc, WMREG_EIMC, 1 << wmq->wmq_intr_idx);
+}
+
+static inline void
+wm_txrxintr_enable(struct wm_queue *wmq)
+{
+	struct wm_softc *sc = wmq->wmq_txq.txq_sc;
+
+	if (sc->sc_type == WM_T_82574)
+		CSR_WRITE(sc, WMREG_IMS, ICR_TXQ(wmq->wmq_id) | ICR_RXQ(wmq->wmq_id));
+	else if (sc->sc_type == WM_T_82575)
+		CSR_WRITE(sc, WMREG_EIMS, EITR_TX_QUEUE(wmq->wmq_id) | EITR_RX_QUEUE(wmq->wmq_id));
+	else
+		CSR_WRITE(sc, WMREG_EIMS, 1 << wmq->wmq_intr_idx);
+}
+
 static int
 wm_txrxintr_msix(void *arg)
 {
@@ -8310,12 +8338,7 @@ wm_txrxintr_msix(void *arg)
 	DPRINTF(WM_DEBUG_TX,
 	("%s: TX: got Tx intr\n", device_xname(sc->sc_dev)));
 
-	if (sc->sc_type == WM_T_82574)
-		CSR_WRITE(sc, WMREG_IMC, ICR_TXQ(wmq->wmq_id) | ICR_RXQ(wmq->wmq_id));
-	else if (sc->sc_type == WM_T_82575)
-		CSR_WRITE(sc, WMREG_EIMC, EITR_TX_QUEUE(wmq->wmq_id) | EITR_RX_QUEUE(wmq->wmq_id));
-	else
-		CSR_WRITE(sc, WMREG_EIMC, 1 << wmq->wmq_intr_idx);
+	wm_txrxintr_disable(wmq);
 
 	mutex_enter(txq->txq_lock);
 
@@ -8352,12 +8375,7 @@ wm_txrxintr_msix(void *arg)
 	wm_rxeof(rxq);
 	mutex_exit(rxq->rxq_lock);
 
-	if (sc->sc_type == WM_T_82574)
-		CSR_WRITE(sc, WMREG_IMS, ICR_TXQ(wmq->wmq_id) | ICR_RXQ(wmq->wmq_id));
-	else if (sc->sc_type == WM_T_82575)
-		CSR_WRITE(sc, WMREG_EIMS, EITR_TX_QUEUE(wmq->wmq_id) | EITR_RX_QUEUE(wmq->wmq_id));
-	else
-		CSR_WRITE(sc, WMREG_EIMS, 1 << wmq->wmq_intr_idx);
+	wm_txrxintr_enable(wmq);
 
 	return 1;
 }



CVS commit: src/sys/netinet

2017-02-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Feb 17 04:32:10 UTC 2017

Modified Files:
src/sys/netinet: ip_icmp.c ip_icmp.h ip_input.c

Log Message:
Protect sysctl_net_inet_ip_pmtudto with icmp_mtx instead of softnet_lock


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/netinet/ip_icmp.c
cvs rdiff -u -r1.34 -r1.35 src/sys/netinet/ip_icmp.h
cvs rdiff -u -r1.349 -r1.350 src/sys/netinet/ip_input.c

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

Modified files:

Index: src/sys/netinet/ip_icmp.c
diff -u src/sys/netinet/ip_icmp.c:1.158 src/sys/netinet/ip_icmp.c:1.159
--- src/sys/netinet/ip_icmp.c:1.158	Mon Feb 13 07:18:20 2017
+++ src/sys/netinet/ip_icmp.c	Fri Feb 17 04:32:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_icmp.c,v 1.158 2017/02/13 07:18:20 ozaki-r Exp $	*/
+/*	$NetBSD: ip_icmp.c,v 1.159 2017/02/17 04:32:10 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -94,7 +94,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.158 2017/02/13 07:18:20 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.159 2017/02/17 04:32:10 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -205,6 +205,20 @@ icmp_init(void)
 	icmp_wqinput = wqinput_create("icmp", _icmp_input);
 }
 
+void
+icmp_mtudisc_lock(void)
+{
+
+	mutex_enter(_mtx);
+}
+
+void
+icmp_mtudisc_unlock(void)
+{
+
+	mutex_exit(_mtx);
+}
+
 /*
  * Register a Path MTU Discovery callback.
  */

Index: src/sys/netinet/ip_icmp.h
diff -u src/sys/netinet/ip_icmp.h:1.34 src/sys/netinet/ip_icmp.h:1.35
--- src/sys/netinet/ip_icmp.h:1.34	Wed Feb 18 17:00:15 2015
+++ src/sys/netinet/ip_icmp.h	Fri Feb 17 04:32:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_icmp.h,v 1.34 2015/02/18 17:00:15 christos Exp $	*/
+/*	$NetBSD: ip_icmp.h,v 1.35 2017/02/17 04:32:10 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -248,6 +248,8 @@ int	icmp_sysctl(int *, u_int, void *, si
 
 void	icmp_mtudisc_callback_register(void (*)(struct in_addr));
 int	icmp_ratelimit(const struct in_addr *, const int, const int);
+void	icmp_mtudisc_lock(void);
+void	icmp_mtudisc_unlock(void);
 #endif
 
 

Index: src/sys/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.349 src/sys/netinet/ip_input.c:1.350
--- src/sys/netinet/ip_input.c:1.349	Tue Feb  7 02:38:08 2017
+++ src/sys/netinet/ip_input.c	Fri Feb 17 04:32:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.349 2017/02/07 02:38:08 ozaki-r Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.350 2017/02/17 04:32:10 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.349 2017/02/07 02:38:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.350 2017/02/17 04:32:10 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1601,24 +1601,25 @@ sysctl_net_inet_ip_pmtudto(SYSCTLFN_ARGS
 	int error, tmp;
 	struct sysctlnode node;
 
+	icmp_mtudisc_lock();
+
 	node = *rnode;
 	tmp = ip_mtudisc_timeout;
 	node.sysctl_data = 
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if (error || newp == NULL)
-		return (error);
-	if (tmp < 0)
-		return (EINVAL);
-
-	/* XXX NOMPSAFE still need softnet_lock */
-	mutex_enter(softnet_lock);
+		goto out;
+	if (tmp < 0) {
+		error = EINVAL;
+		goto out;
+	}
 
 	ip_mtudisc_timeout = tmp;
 	rt_timer_queue_change(ip_mtudisc_timeout_q, ip_mtudisc_timeout);
-
-	mutex_exit(softnet_lock);
-
-	return (0);
+	error = 0;
+out:
+	icmp_mtudisc_unlock();
+	return 0;
 }
 
 static int



CVS commit: src/sys

2017-02-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Feb 17 04:31:34 UTC 2017

Modified Files:
src/sys/net: route.c
src/sys/netinet: ip_output.c

Log Message:
Make NOMPSAFE comments informative


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/net/route.c
cvs rdiff -u -r1.270 -r1.271 src/sys/netinet/ip_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/net/route.c
diff -u src/sys/net/route.c:1.190 src/sys/net/route.c:1.191
--- src/sys/net/route.c:1.190	Fri Feb 10 13:48:06 2017
+++ src/sys/net/route.c	Fri Feb 17 04:31:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.190 2017/02/10 13:48:06 ozaki-r Exp $	*/
+/*	$NetBSD: route.c,v 1.191 2017/02/17 04:31:34 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.190 2017/02/10 13:48:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.191 2017/02/17 04:31:34 ozaki-r Exp $");
 
 #include 
 #ifdef RTFLUSH_DEBUG
@@ -1163,7 +1163,7 @@ rt_getifa(struct rt_addrinfo *info, stru
 		return NULL;
 got:
 	if (ifa->ifa_getifa != NULL) {
-		/* FIXME NOMPSAFE */
+		/* FIXME ifa_getifa is NOMPSAFE */
 		ifa = (*ifa->ifa_getifa)(ifa, dst);
 		if (ifa == NULL)
 			return NULL;

Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.270 src/sys/netinet/ip_output.c:1.271
--- src/sys/netinet/ip_output.c:1.270	Mon Feb 13 04:06:39 2017
+++ src/sys/netinet/ip_output.c	Fri Feb 17 04:31:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.270 2017/02/13 04:06:39 ozaki-r Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.271 2017/02/17 04:31:34 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.270 2017/02/13 04:06:39 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.271 2017/02/17 04:31:34 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -432,7 +432,7 @@ ip_output(struct mbuf *m0, struct mbuf *
 			xifa = >ia_ifa;
 			if (xifa->ifa_getifa != NULL) {
 ia4_release(xia, &_psref);
-/* FIXME NOMPSAFE */
+/* FIXME ifa_getifa is NOMPSAFE */
 xia = ifatoia((*xifa->ifa_getifa)(xifa, rdst));
 if (xia == NULL) {
 	error = EADDRNOTAVAIL;
@@ -502,7 +502,7 @@ ip_output(struct mbuf *m0, struct mbuf *
 		xifa = >ia_ifa;
 		if (xifa->ifa_getifa != NULL) {
 			ia4_release(ia, _ia);
-			/* FIXME NOMPSAFE */
+			/* FIXME ifa_getifa is NOMPSAFE */
 			ia = ifatoia((*xifa->ifa_getifa)(xifa, rdst));
 			if (ia == NULL) {
 error = EADDRNOTAVAIL;



CVS commit: src/sys

2017-02-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Feb 17 03:57:18 UTC 2017

Modified Files:
src/sys/net: if.c if.h
src/sys/netinet6: icmp6.c in6_src.c ip6_output.c

Log Message:
Rename if_acquire_NOMPSAFE to if_acquire

It can be used in MP-safe ways. So let's remove the confusing postfix.
If it's used in a unsafe way, warn NOMPSAFE in a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.379 -r1.380 src/sys/net/if.c
cvs rdiff -u -r1.233 -r1.234 src/sys/net/if.h
cvs rdiff -u -r1.209 -r1.210 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.78 -r1.79 src/sys/netinet6/in6_src.c
cvs rdiff -u -r1.183 -r1.184 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/net/if.c
diff -u src/sys/net/if.c:1.379 src/sys/net/if.c:1.380
--- src/sys/net/if.c:1.379	Thu Feb 16 08:13:43 2017
+++ src/sys/net/if.c	Fri Feb 17 03:57:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.379 2017/02/16 08:13:43 knakahara Exp $	*/
+/*	$NetBSD: if.c,v 1.380 2017/02/17 03:57:17 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.379 2017/02/16 08:13:43 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.380 2017/02/17 03:57:17 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2663,12 +2663,12 @@ if_get_byindex(u_int idx, struct psref *
 }
 
 /*
- * XXX it's safe only if the passed ifp is guaranteed to not be freed,
- * for example the ifp is already held or some other object is held which
- * guarantes the ifp to not be freed indirectly.
+ * Note that it's safe only if the passed ifp is guaranteed to not be freed,
+ * for example using pserialize or the ifp is already held or some other
+ * object is held which guarantes the ifp to not be freed indirectly.
  */
 void
-if_acquire_NOMPSAFE(struct ifnet *ifp, struct psref *psref)
+if_acquire(struct ifnet *ifp, struct psref *psref)
 {
 
 	KASSERT(ifp->if_index != 0);

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.233 src/sys/net/if.h:1.234
--- src/sys/net/if.h:1.233	Thu Dec 22 03:46:51 2016
+++ src/sys/net/if.h	Fri Feb 17 03:57:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.233 2016/12/22 03:46:51 ozaki-r Exp $	*/
+/*	$NetBSD: if.h,v 1.234 2017/02/17 03:57:17 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -971,7 +971,7 @@ struct	ifnet *if_get(const char *, struc
 ifnet_t *if_byindex(u_int);
 ifnet_t *if_get_byindex(u_int, struct psref *);
 void	if_put(const struct ifnet *, struct psref *);
-void	if_acquire_NOMPSAFE(struct ifnet *, struct psref *);
+void	if_acquire(struct ifnet *, struct psref *);
 
 static inline if_index_t
 if_get_index(const struct ifnet *ifp)

Index: src/sys/netinet6/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.209 src/sys/netinet6/icmp6.c:1.210
--- src/sys/netinet6/icmp6.c:1.209	Mon Feb 13 07:18:20 2017
+++ src/sys/netinet6/icmp6.c	Fri Feb 17 03:57:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: icmp6.c,v 1.209 2017/02/13 07:18:20 ozaki-r Exp $	*/
+/*	$NetBSD: icmp6.c,v 1.210 2017/02/17 03:57:17 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.209 2017/02/13 07:18:20 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.210 2017/02/17 03:57:17 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1793,7 +1793,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st
 			addrsofif++; /* count the address */
 		}
 		if (iffound) {
-			if_acquire_NOMPSAFE(ifp, psref);
+			if_acquire(ifp, psref);
 			pserialize_read_exit(s);
 			*ifpp = ifp;
 			return (addrsofif);

Index: src/sys/netinet6/in6_src.c
diff -u src/sys/netinet6/in6_src.c:1.78 src/sys/netinet6/in6_src.c:1.79
--- src/sys/netinet6/in6_src.c:1.78	Mon Jan 16 15:44:47 2017
+++ src/sys/netinet6/in6_src.c	Fri Feb 17 03:57:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_src.c,v 1.78 2017/01/16 15:44:47 christos Exp $	*/
+/*	$NetBSD: in6_src.c,v 1.79 2017/02/17 03:57:17 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.78 2017/01/16 15:44:47 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.79 2017/02/17 03:57:17 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -773,7 +773,7 @@ getroute:
 	!if_is_deactivated(rt->rt_ifa->ifa_ifp)) {
 		if_put(*retifp, psref);
 		*retifp = rt->rt_ifa->ifa_ifp;
-		if_acquire_NOMPSAFE(*retifp, psref);
+		if_acquire(*retifp, psref);
 	}
 out:
 	rtcache_unref(rt, ro);

Index: src/sys/netinet6/ip6_output.c
diff -u src/sys/netinet6/ip6_output.c:1.183 src/sys/netinet6/ip6_output.c:1.184
--- src/sys/netinet6/ip6_output.c:1.183	Tue Feb 14 03:05:06 2017
+++ src/sys/netinet6/ip6_output.c	Fri Feb 17 03:57:17 2017
@@ -1,4 +1,4 @@

CVS commit: src/sys/net

2017-02-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Feb 17 02:56:53 UTC 2017

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

Log Message:
Fill rmx_locks too

Otherwise userland sees garbage in it.

This should fix t_mtudisc6 failing on babylon5.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/net/rtsock.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/rtsock.c
diff -u src/sys/net/rtsock.c:1.200 src/sys/net/rtsock.c:1.201
--- src/sys/net/rtsock.c:1.200	Thu Jan 19 06:58:55 2017
+++ src/sys/net/rtsock.c	Fri Feb 17 02:56:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.200 2017/01/19 06:58:55 ozaki-r Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.201 2017/02/17 02:56:53 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.200 2017/01/19 06:58:55 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.201 2017/02/17 02:56:53 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1001,6 +1001,7 @@ rtm_setmetrics(const struct rtentry *in,
 	metric(rmx_rttvar);
 	metric(rmx_hopcount);
 	metric(rmx_mtu);
+	metric(rmx_locks);
 #undef metric
 	out->rtm_rmx.rmx_expire = in->rt_rmx.rmx_expire ?
 	time_mono_to_wall(in->rt_rmx.rmx_expire) : 0;



CVS commit: src/sys/sys

2017-02-16 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Feb 17 01:49:24 UTC 2017

Modified Files:
src/sys/sys: siginfo.h

Log Message:
Commit TRAP_HWWPT -> TRAP_DBREG switch in 

This is integral part of the previous two commits.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/sys/siginfo.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/sys/siginfo.h
diff -u src/sys/sys/siginfo.h:1.30 src/sys/sys/siginfo.h:1.31
--- src/sys/sys/siginfo.h:1.30	Sun Jan 15 21:42:03 2017
+++ src/sys/sys/siginfo.h	Fri Feb 17 01:49:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: siginfo.h,v 1.30 2017/01/15 21:42:03 kamil Exp $	 */
+/*	$NetBSD: siginfo.h,v 1.31 2017/02/17 01:49:24 kamil Exp $	 */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -213,7 +213,7 @@ typedef union siginfo {
 #define	TRAP_EXEC	3	/* Process exec trap			*/
 #define	TRAP_CHLD	4	/* Process child trap			*/
 #define	TRAP_LWP	5	/* Process lwp trap			*/
-#define	TRAP_HWWPT	6	/* Process hardware assisted watchpoint	*/
+#define	TRAP_DBREG	6	/* Process hardware debug register trap	*/
 
 /* SIGCHLD */
 #define	CLD_EXITED	1	/* Child has exited			*/



CVS commit: src

2017-02-16 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Feb 17 01:42:59 UTC 2017

Modified Files:
src: UPDATING

Log Message:
Note TRAP_HWWPT -> TRAP_DBREG rename manual steps for build.sh -u


To generate a diff of this commit:
cvs rdiff -u -r1.281 -r1.282 src/UPDATING

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

Modified files:

Index: src/UPDATING
diff -u src/UPDATING:1.281 src/UPDATING:1.282
--- src/UPDATING:1.281	Sat Feb 11 15:27:08 2017
+++ src/UPDATING	Fri Feb 17 01:42:59 2017
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.281 2017/02/11 15:27:08 roy Exp $
+$NetBSD: UPDATING,v 1.282 2017/02/17 01:42:59 kamil Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -19,6 +19,11 @@ See also: BUILDING, build.sh, Makefile.
 Recent changes:
 ^^^
 
+20170217:
+	TRAP_HWWPT renamed to TRAP_DBREG, remove obj copy of siginfo.c
+	(usr.bin/kdump/siginfo.c and rescue/kdump/siginfo.c) to regenerate
+	if you build.sh -u
+
 20170211:
 	a new terminfo database has been imported.
 	The structure of it has changed slightly from prior versions and



CVS commit: src

2017-02-16 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Feb 17 01:14:31 UTC 2017

Modified Files:
src/doc: CHANGES
src/share/man/man2: siginfo.2
src/sys/arch/amd64/amd64: trap.c
src/sys/arch/i386/i386: trap.c

Log Message:
Add new si_code TRAP_DBREG

It replaces previous TRAP_HWWPT and is designed to be used for debug
register traps (both watchpoints and breakpoints).

TRAP_HWWPT wasn't documented in siginfo(2) neither noted in doc/CHANGES -
- document it and add new entry in CHANGES. This move is a step towards
switch the watchpoint ptrace(2) api to PT_*DBREGS.

This code was introduced recently and has no impact on stable releases.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.2254 -r1.2255 src/doc/CHANGES
cvs rdiff -u -r1.21 -r1.22 src/share/man/man2/siginfo.2
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/amd64/amd64/trap.c
cvs rdiff -u -r1.282 -r1.283 src/sys/arch/i386/i386/trap.c

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2254 src/doc/CHANGES:1.2255
--- src/doc/CHANGES:1.2254	Thu Feb 16 08:48:34 2017
+++ src/doc/CHANGES	Fri Feb 17 01:14:31 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2254 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2255 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -472,3 +472,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 		PT_GET_SIGMASK and PT_SET_SIGMASK [kamil 20170212]
 	postfix(1): Import version 3.1.4. [christos 20170213]
 	l2tp(4): Add L2TPv3 interface. [knakahara 20170216]
+	siginfo(2): Add new si_code for SIGTRAP: TRAP_DBREG [kamil 20170217]

Index: src/share/man/man2/siginfo.2
diff -u src/share/man/man2/siginfo.2:1.21 src/share/man/man2/siginfo.2:1.22
--- src/share/man/man2/siginfo.2:1.21	Sat Jan 14 06:55:40 2017
+++ src/share/man/man2/siginfo.2	Fri Feb 17 01:14:31 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: siginfo.2,v 1.21 2017/01/14 06:55:40 kamil Exp $
+.\"	$NetBSD: siginfo.2,v 1.22 2017/02/17 01:14:31 kamil Exp $
 .\"
 .\" Copyright (c) 2003 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -231,6 +231,8 @@ Object-specific hardware error
 Process breakpoint
 .It TRAP_CHLD
 Process child trap
+.It TRAP_DBREG
+Process hardware debug register trap
 .It TRAP_EXEC
 Process exec trap
 .It TRAP_LWP
@@ -370,21 +372,27 @@ are
 extensions.
 .Pp
 The
+.Dv TRAP_CHLD ,
+.Dv TRAP_DBREG ,
 .Dv TRAP_EXEC
-signal specific reason of
+and
+.Dv TRAP_LWP
+signal specific reasons of
 .Dv SIGTRAP
-is
+are
 .Nx
-extension.
+extensions.
 .Sh HISTORY
 The
 .Nm
 functionality first appeared in
 .At V.4 .
 .Pp
-.Dv TRAP_CHLD
-and
+.Dv TRAP_CHLD ,
+.Dv TRAP_DBREG ,
 .Dv TRAP_EXEC
+and
+.Dv TRAP_LWP
 first appeared
 in
 .Nx 8 .

Index: src/sys/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.90 src/sys/arch/amd64/amd64/trap.c:1.91
--- src/sys/arch/amd64/amd64/trap.c:1.90	Tue Feb 14 09:11:05 2017
+++ src/sys/arch/amd64/amd64/trap.c	Fri Feb 17 01:14:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.90 2017/02/14 09:11:05 maxv Exp $	*/
+/*	$NetBSD: trap.c,v 1.91 2017/02/17 01:14:31 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.90 2017/02/14 09:11:05 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.91 2017/02/17 01:14:31 kamil Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -711,7 +711,7 @@ faultcommon:
 			ksi.ksi_signo = SIGTRAP;
 			ksi.ksi_trap = type & ~T_USER;
 			if ((wptnfo = user_trap_x86_hw_watchpoint())) {
-ksi.ksi_code = TRAP_HWWPT;
+ksi.ksi_code = TRAP_DBREG;
 ksi.ksi_trap2 = x86_hw_watchpoint_reg(wptnfo);
 ksi.ksi_trap3 = x86_hw_watchpoint_type(wptnfo);
 			} else if (type == (T_BPTFLT|T_USER))

Index: src/sys/arch/i386/i386/trap.c
diff -u src/sys/arch/i386/i386/trap.c:1.282 src/sys/arch/i386/i386/trap.c:1.283
--- src/sys/arch/i386/i386/trap.c:1.282	Wed Jan 18 05:11:59 2017
+++ src/sys/arch/i386/i386/trap.c	Fri Feb 17 01:14:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.282 2017/01/18 05:11:59 kamil Exp $	*/
+/*	$NetBSD: trap.c,v 1.283 2017/02/17 01:14:31 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.282 2017/01/18 05:11:59 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.283 2017/02/17 01:14:31 kamil Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -701,7 +701,7 @@ faultcommon:
 			ksi.ksi_signo = SIGTRAP;
 			ksi.ksi_trap = type & ~T_USER;
 			if ((wptnfo = user_trap_x86_hw_watchpoint())) {
-ksi.ksi_code = TRAP_HWWPT;
+ksi.ksi_code = TRAP_DBREG;
 ksi.ksi_trap2 = x86_hw_watchpoint_reg(wptnfo);
 ksi.ksi_trap3 = x86_hw_watchpoint_type(wptnfo);
 			} else if (type == (T_BPTFLT|T_USER))



CVS commit: src/tests/net/if

2017-02-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Feb 17 00:51:53 UTC 2017

Modified Files:
src/tests/net/if: t_ifconfig.sh

Log Message:
Make the test more stable


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/net/if/t_ifconfig.sh

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

Modified files:

Index: src/tests/net/if/t_ifconfig.sh
diff -u src/tests/net/if/t_ifconfig.sh:1.16 src/tests/net/if/t_ifconfig.sh:1.17
--- src/tests/net/if/t_ifconfig.sh:1.16	Tue Feb 14 08:43:06 2017
+++ src/tests/net/if/t_ifconfig.sh	Fri Feb 17 00:51:52 2017
@@ -1,4 +1,4 @@
-# $NetBSD: t_ifconfig.sh,v 1.16 2017/02/14 08:43:06 ozaki-r Exp $
+# $NetBSD: t_ifconfig.sh,v 1.17 2017/02/17 00:51:52 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -343,10 +343,10 @@ ifconfig_up_down_common()
 	# work for both IPv4 and IPv6
 	if [ $family = inet6 ]; then
 		atf_check -s exit:0 -o ignore \
-		rump.sysctl -w net.inet6.ip6.dad_count=3
+		rump.sysctl -w net.inet6.ip6.dad_count=5
 	else
 		atf_check -s exit:0 -o ignore \
-		rump.sysctl -w net.inet.ip.dad_count=3
+		rump.sysctl -w net.inet.ip.dad_count=5
 	fi
 
 	#



CVS commit: src/tests/net/if_l2tp

2017-02-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Feb 17 00:51:25 UTC 2017

Modified Files:
src/tests/net/if_l2tp: t_l2tp.sh

Log Message:
Make test names self-descriptive


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_l2tp/t_l2tp.sh

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

Modified files:

Index: src/tests/net/if_l2tp/t_l2tp.sh
diff -u src/tests/net/if_l2tp/t_l2tp.sh:1.1 src/tests/net/if_l2tp/t_l2tp.sh:1.2
--- src/tests/net/if_l2tp/t_l2tp.sh:1.1	Thu Feb 16 08:44:47 2017
+++ src/tests/net/if_l2tp/t_l2tp.sh	Fri Feb 17 00:51:25 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_l2tp.sh,v 1.1 2017/02/16 08:44:47 knakahara Exp $
+#	$NetBSD: t_l2tp.sh,v 1.2 2017/02/17 00:51:25 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -401,7 +401,7 @@ add_test()
 	lan_mode=$3
 	wan_mode=$4
 
-	name="${category}${lan_mode}over${wan_mode}"
+	name="l2tp_${category}_${lan_mode}over${wan_mode}"
 	fulldesc="Does ${lan_mode} over ${wan_mode} if_l2tp ${desc}"
 
 	atf_test_case ${name} cleanup



CVS commit: src/usr.sbin/makefs

2017-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 16 22:44:06 UTC 2017

Modified Files:
src/usr.sbin/makefs: msdos.c

Log Message:
allow 0 timestamp


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/makefs/msdos.c

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

Modified files:

Index: src/usr.sbin/makefs/msdos.c
diff -u src/usr.sbin/makefs/msdos.c:1.17 src/usr.sbin/makefs/msdos.c:1.18
--- src/usr.sbin/makefs/msdos.c:1.17	Thu Feb 16 13:50:04 2017
+++ src/usr.sbin/makefs/msdos.c	Thu Feb 16 17:44:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdos.c,v 1.17 2017/02/16 18:50:04 christos Exp $	*/
+/*	$NetBSD: msdos.c,v 1.18 2017/02/16 22:44:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: msdos.c,v 1.17 2017/02/16 18:50:04 christos Exp $");
+__RCSID("$NetBSD: msdos.c,v 1.18 2017/02/16 22:44:06 christos Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -134,7 +134,10 @@ msdos_parse_opts(const char *option, fsi
 	else if (strcmp(msdos_options[rv].name, "hidden_sectors") == 0)
 		msdos_opt->hidden_sectors_set = 1;
 
-	msdos_opt->timestamp = stampst.st_ino ? stampst.st_mtime : 0;
+	if (stampst.st_ino) {
+		msdos_opt->timestamp_set = 1;
+		msdos_opt->timestamp = stampst.st_mtime;
+	}
 
 	return 1;
 }



CVS commit: src/sbin/newfs_msdos

2017-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 16 22:42:25 UTC 2017

Modified Files:
src/sbin/newfs_msdos: mkfs_msdos.c mkfs_msdos.h newfs_msdos.c

Log Message:
Allow 0 timestamp


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sbin/newfs_msdos/mkfs_msdos.c
cvs rdiff -u -r1.4 -r1.5 src/sbin/newfs_msdos/mkfs_msdos.h
cvs rdiff -u -r1.44 -r1.45 src/sbin/newfs_msdos/newfs_msdos.c

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

Modified files:

Index: src/sbin/newfs_msdos/mkfs_msdos.c
diff -u src/sbin/newfs_msdos/mkfs_msdos.c:1.11 src/sbin/newfs_msdos/mkfs_msdos.c:1.12
--- src/sbin/newfs_msdos/mkfs_msdos.c:1.11	Thu Feb 16 13:49:31 2017
+++ src/sbin/newfs_msdos/mkfs_msdos.c	Thu Feb 16 17:42:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkfs_msdos.c,v 1.11 2017/02/16 18:49:31 christos Exp $	*/
+/*	$NetBSD: mkfs_msdos.c,v 1.12 2017/02/16 22:42:25 christos Exp $	*/
 
 /*
  * Copyright (c) 1998 Robert Nordier
@@ -37,7 +37,7 @@
 static const char rcsid[] =
   "$FreeBSD: src/sbin/newfs_msdos/newfs_msdos.c,v 1.15 2000/10/10 01:49:37 wollman Exp $";
 #else
-__RCSID("$NetBSD: mkfs_msdos.c,v 1.11 2017/02/16 18:49:31 christos Exp $");
+__RCSID("$NetBSD: mkfs_msdos.c,v 1.12 2017/02/16 22:42:25 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -621,7 +621,7 @@ mkfs_msdos(const char *fname, const char
 	printf("MBR type: %d\n", ch);
 print_bpb();
 if (!o.no_create) {
-	if (o.timestamp) {
+	if (o.timestamp_set) {
 		tv.tv_sec = now = o.timestamp;
 		tv.tv_usec = 0;
 		tm = gmtime();

Index: src/sbin/newfs_msdos/mkfs_msdos.h
diff -u src/sbin/newfs_msdos/mkfs_msdos.h:1.4 src/sbin/newfs_msdos/mkfs_msdos.h:1.5
--- src/sbin/newfs_msdos/mkfs_msdos.h:1.4	Thu Feb 16 13:49:31 2017
+++ src/sbin/newfs_msdos/mkfs_msdos.h	Thu Feb 16 17:42:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkfs_msdos.h,v 1.4 2017/02/16 18:49:31 christos Exp $	*/
+/*	$NetBSD: mkfs_msdos.h,v 1.5 2017/02/16 22:42:25 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -61,6 +61,7 @@ struct msdos_options {
 ALLOPTS
 #undef AOPT	
 	time_t	timestamp;
+	uint32_t timestamp_set:1;
 	uint32_t volume_id_set:1;
 	uint32_t media_descriptor_set:1;
 	uint32_t hidden_sectors_set:1;

Index: src/sbin/newfs_msdos/newfs_msdos.c
diff -u src/sbin/newfs_msdos/newfs_msdos.c:1.44 src/sbin/newfs_msdos/newfs_msdos.c:1.45
--- src/sbin/newfs_msdos/newfs_msdos.c:1.44	Thu Feb 16 13:49:31 2017
+++ src/sbin/newfs_msdos/newfs_msdos.c	Thu Feb 16 17:42:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: newfs_msdos.c,v 1.44 2017/02/16 18:49:31 christos Exp $	*/
+/*	$NetBSD: newfs_msdos.c,v 1.45 2017/02/16 22:42:25 christos Exp $	*/
 
 /*
  * Copyright (c) 1998 Robert Nordier
@@ -33,7 +33,7 @@
 static const char rcsid[] =
   "$FreeBSD: src/sbin/newfs_msdos/newfs_msdos.c,v 1.15 2000/10/10 01:49:37 wollman Exp $";
 #else
-__RCSID("$NetBSD: newfs_msdos.c,v 1.44 2017/02/16 18:49:31 christos Exp $");
+__RCSID("$NetBSD: newfs_msdos.c,v 1.45 2017/02/16 22:42:25 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -170,6 +170,7 @@ main(int argc, char *argv[])
 	o.size = argto4(optarg, 1, "file system size");
 	break;
 	case 'T':
+	o.timestamp_set = 1;
 	o.timestamp = get_tstamp(optarg);
 	break;
 	case 'u':



CVS commit: src/sbin/gpt

2017-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 16 22:40:19 UTC 2017

Modified Files:
src/sbin/gpt: gpt.h gpt_uuid.c main.c

Log Message:
allow 0 timestamp


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sbin/gpt/gpt.h
cvs rdiff -u -r1.14 -r1.15 src/sbin/gpt/gpt_uuid.c
cvs rdiff -u -r1.9 -r1.10 src/sbin/gpt/main.c

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

Modified files:

Index: src/sbin/gpt/gpt.h
diff -u src/sbin/gpt/gpt.h:1.34 src/sbin/gpt/gpt.h:1.35
--- src/sbin/gpt/gpt.h:1.34	Wed Feb 15 22:32:17 2017
+++ src/sbin/gpt/gpt.h	Thu Feb 16 17:40:19 2017
@@ -80,6 +80,7 @@ gpt_t	gpt_open(const char *, int, int, o
 #define GPT_QUIET	0x04
 #define GPT_NOSYNC	0x08
 #define GPT_FILE	0x10
+#define GPT_TIMESTAMP	0x20
 
 void*	gpt_read(gpt_t, off_t, size_t);
 off_t	gpt_last(gpt_t);

Index: src/sbin/gpt/gpt_uuid.c
diff -u src/sbin/gpt/gpt_uuid.c:1.14 src/sbin/gpt/gpt_uuid.c:1.15
--- src/sbin/gpt/gpt_uuid.c:1.14	Wed Feb 15 22:32:17 2017
+++ src/sbin/gpt/gpt_uuid.c	Thu Feb 16 17:40:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gpt_uuid.c,v 1.14 2017/02/16 03:32:17 christos Exp $	*/
+/*	$NetBSD: gpt_uuid.c,v 1.15 2017/02/16 22:40:19 christos Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$NetBSD: gpt_uuid.c,v 1.14 2017/02/16 03:32:17 christos Exp $");
+__RCSID("$NetBSD: gpt_uuid.c,v 1.15 2017/02/16 22:40:19 christos Exp $");
 #endif
 
 #include 
@@ -301,10 +301,10 @@ gpt_uuid_generate(gpt_t gpt, gpt_uuid_t 
 {
 	int rv;
 	struct dce_uuid u;
-	if (gpt->timestamp == 0)
-		rv = gpt_uuid_random(gpt, , sizeof(u));
-	else
+	if (gpt->flags & GPT_TIMESTAMP)
 		rv = gpt_uuid_tstamp(gpt, , sizeof(u));
+	else
+		rv = gpt_uuid_random(gpt, , sizeof(u));
 
 	if (rv == -1)
 		return -1;

Index: src/sbin/gpt/main.c
diff -u src/sbin/gpt/main.c:1.9 src/sbin/gpt/main.c:1.10
--- src/sbin/gpt/main.c:1.9	Wed Feb 15 22:32:17 2017
+++ src/sbin/gpt/main.c	Thu Feb 16 17:40:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.9 2017/02/16 03:32:17 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.10 2017/02/16 22:40:19 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002 Marcel Moolenaar
@@ -34,7 +34,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$NetBSD: main.c,v 1.9 2017/02/16 03:32:17 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.10 2017/02/16 22:40:19 christos Exp $");
 #endif
 
 #include 
@@ -206,6 +206,7 @@ main(int argc, char *argv[])
 usage();
 			break;
 		case 'T':
+			flags |= GPT_TIMESTAMP;
 			timestamp = get_tstamp(optarg);
 			break;
 		case 'v':



CVS commit: src/usr.sbin/makefs/ffs

2017-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 16 22:10:50 UTC 2017

Modified Files:
src/usr.sbin/makefs/ffs: buf.h

Log Message:
need 


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/makefs/ffs/buf.h

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/makefs/ffs/buf.h
diff -u src/usr.sbin/makefs/ffs/buf.h:1.11 src/usr.sbin/makefs/ffs/buf.h:1.12
--- src/usr.sbin/makefs/ffs/buf.h:1.11	Thu Feb 16 14:11:13 2017
+++ src/usr.sbin/makefs/ffs/buf.h	Thu Feb 16 17:10:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.h,v 1.11 2017/02/16 19:11:13 christos Exp $	*/
+/*	$NetBSD: buf.h,v 1.12 2017/02/16 22:10:50 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,6 +40,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 



CVS commit: src/usr.sbin/makefs/ffs

2017-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 16 19:11:13 UTC 2017

Modified Files:
src/usr.sbin/makefs/ffs: buf.h

Log Message:
fix msdos reproducible builds!


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/makefs/ffs/buf.h

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/makefs/ffs/buf.h
diff -u src/usr.sbin/makefs/ffs/buf.h:1.10 src/usr.sbin/makefs/ffs/buf.h:1.11
--- src/usr.sbin/makefs/ffs/buf.h:1.10	Sun Mar 29 01:52:59 2015
+++ src/usr.sbin/makefs/ffs/buf.h	Thu Feb 16 14:11:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.h,v 1.10 2015/03/29 05:52:59 agc Exp $	*/
+/*	$NetBSD: buf.h,v 1.11 2017/02/16 19:11:13 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -87,7 +87,20 @@ struct buf *	getblk(struct vnode *, dadd
 #define	BC_AGE		0
 
 #define min(a, b) MIN((a), (b))
-#define microtime(tv) gettimeofday((tv), NULL)
+
+static inline void
+microtime(struct timeval *tv)
+{
+	extern struct stat stampst;
+
+	if (stampst.st_ino) {
+		tv->tv_sec = stampst.st_mtime;
+		tv->tv_usec = 0;
+	} else {
+	gettimeofday((tv), NULL);
+	}
+}
+
 #define KASSERT(a)
 #define IO_SYNC	1
 



CVS commit: src/usr.sbin/makefs

2017-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 16 18:50:05 UTC 2017

Modified Files:
src/usr.sbin/makefs: msdos.c
src/usr.sbin/makefs/msdos: msdosfs_vnops.c

Log Message:
start fixing msdosfs for reproducible builds; does not work yet.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/makefs/msdos.c
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/makefs/msdos/msdosfs_vnops.c

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

Modified files:

Index: src/usr.sbin/makefs/msdos.c
diff -u src/usr.sbin/makefs/msdos.c:1.16 src/usr.sbin/makefs/msdos.c:1.17
--- src/usr.sbin/makefs/msdos.c:1.16	Sat Jan 30 04:59:27 2016
+++ src/usr.sbin/makefs/msdos.c	Thu Feb 16 13:50:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdos.c,v 1.16 2016/01/30 09:59:27 mlelstv Exp $	*/
+/*	$NetBSD: msdos.c,v 1.17 2017/02/16 18:50:04 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: msdos.c,v 1.16 2016/01/30 09:59:27 mlelstv Exp $");
+__RCSID("$NetBSD: msdos.c,v 1.17 2017/02/16 18:50:04 christos Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -133,6 +133,9 @@ msdos_parse_opts(const char *option, fsi
 		msdos_opt->media_descriptor_set = 1;
 	else if (strcmp(msdos_options[rv].name, "hidden_sectors") == 0)
 		msdos_opt->hidden_sectors_set = 1;
+
+	msdos_opt->timestamp = stampst.st_ino ? stampst.st_mtime : 0;
+
 	return 1;
 }
 

Index: src/usr.sbin/makefs/msdos/msdosfs_vnops.c
diff -u src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.17 src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.18
--- src/usr.sbin/makefs/msdos/msdosfs_vnops.c:1.17	Sat Jan 30 04:59:27 2016
+++ src/usr.sbin/makefs/msdos/msdosfs_vnops.c	Thu Feb 16 13:50:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vnops.c,v 1.17 2016/01/30 09:59:27 mlelstv Exp $ */
+/*	$NetBSD: msdosfs_vnops.c,v 1.18 2017/02/16 18:50:05 christos Exp $ */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -51,7 +51,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.17 2016/01/30 09:59:27 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.18 2017/02/16 18:50:05 christos Exp $");
 
 #include 
 #include 
@@ -98,12 +98,20 @@ static void
 msdosfs_times(struct msdosfsmount *pmp, struct denode *dep,
 const struct stat *st)
 {
+	struct timespec at;
+	struct timespec mt;
+
+	if (stampst.st_ino) 
+	st = 
+
 #ifndef HAVE_NBTOOL_CONFIG_H
-	struct timespec at = st->st_atimespec;
-	struct timespec mt = st->st_mtimespec;
+	at = st->st_atimespec;
+	mt = st->st_mtimespec;
 #else
-	struct timespec at = { st->st_atime, 0 };
-	struct timespec mt = { st->st_mtime, 0 };
+	at.tv_sec = st->st_atime;
+	at.tv_nsec = 0;
+	mt.tv_sec = st->st_mtime;
+	mt.tv_nsec = 0;
 #endif
 	unix2dostime(, pmp->pm_gmtoff, >de_ADate, NULL, NULL);
 	unix2dostime(, pmp->pm_gmtoff, >de_MDate, >de_MTime, NULL);



CVS commit: src/sbin/newfs_msdos

2017-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 16 18:49:31 UTC 2017

Modified Files:
src/sbin/newfs_msdos: mkfs_msdos.c mkfs_msdos.h newfs_msdos.8
newfs_msdos.c

Log Message:
add -T for reproducible builds (used in makefs)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/newfs_msdos/mkfs_msdos.c
cvs rdiff -u -r1.3 -r1.4 src/sbin/newfs_msdos/mkfs_msdos.h
cvs rdiff -u -r1.21 -r1.22 src/sbin/newfs_msdos/newfs_msdos.8
cvs rdiff -u -r1.43 -r1.44 src/sbin/newfs_msdos/newfs_msdos.c

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

Modified files:

Index: src/sbin/newfs_msdos/mkfs_msdos.c
diff -u src/sbin/newfs_msdos/mkfs_msdos.c:1.10 src/sbin/newfs_msdos/mkfs_msdos.c:1.11
--- src/sbin/newfs_msdos/mkfs_msdos.c:1.10	Sun Apr  3 07:00:13 2016
+++ src/sbin/newfs_msdos/mkfs_msdos.c	Thu Feb 16 13:49:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkfs_msdos.c,v 1.10 2016/04/03 11:00:13 mlelstv Exp $	*/
+/*	$NetBSD: mkfs_msdos.c,v 1.11 2017/02/16 18:49:31 christos Exp $	*/
 
 /*
  * Copyright (c) 1998 Robert Nordier
@@ -37,7 +37,7 @@
 static const char rcsid[] =
   "$FreeBSD: src/sbin/newfs_msdos/newfs_msdos.c,v 1.15 2000/10/10 01:49:37 wollman Exp $";
 #else
-__RCSID("$NetBSD: mkfs_msdos.c,v 1.10 2016/04/03 11:00:13 mlelstv Exp $");
+__RCSID("$NetBSD: mkfs_msdos.c,v 1.11 2017/02/16 18:49:31 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -621,9 +621,15 @@ mkfs_msdos(const char *fname, const char
 	printf("MBR type: %d\n", ch);
 print_bpb();
 if (!o.no_create) {
-	gettimeofday(, NULL);
-	now = tv.tv_sec;
-	tm = localtime();
+	if (o.timestamp) {
+		tv.tv_sec = now = o.timestamp;
+		tv.tv_usec = 0;
+		tm = gmtime();
+	} else {
+		gettimeofday(, NULL);
+		now = tv.tv_sec;
+		tm = localtime();
+	}
 	if (!(img = malloc(bpb.bps)))
 	err(1, NULL);
 	dir = bpb.res + (bpb.spf ? bpb.spf : bpb.bspf) * bpb.nft;

Index: src/sbin/newfs_msdos/mkfs_msdos.h
diff -u src/sbin/newfs_msdos/mkfs_msdos.h:1.3 src/sbin/newfs_msdos/mkfs_msdos.h:1.4
--- src/sbin/newfs_msdos/mkfs_msdos.h:1.3	Fri Oct 16 13:38:17 2015
+++ src/sbin/newfs_msdos/mkfs_msdos.h	Thu Feb 16 13:49:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkfs_msdos.h,v 1.3 2015/10/16 17:38:17 christos Exp $	*/
+/*	$NetBSD: mkfs_msdos.h,v 1.4 2017/02/16 18:49:31 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -60,6 +60,7 @@ struct msdos_options {
 #define AOPT(_opt, _type, _name, _min, _desc) _type _name;
 ALLOPTS
 #undef AOPT	
+	time_t	timestamp;
 	uint32_t volume_id_set:1;
 	uint32_t media_descriptor_set:1;
 	uint32_t hidden_sectors_set:1;

Index: src/sbin/newfs_msdos/newfs_msdos.8
diff -u src/sbin/newfs_msdos/newfs_msdos.8:1.21 src/sbin/newfs_msdos/newfs_msdos.8:1.22
--- src/sbin/newfs_msdos/newfs_msdos.8:1.21	Mon Sep 12 01:09:39 2016
+++ src/sbin/newfs_msdos/newfs_msdos.8	Thu Feb 16 13:49:31 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: newfs_msdos.8,v 1.21 2016/09/12 05:09:39 sevan Exp $
+.\" $NetBSD: newfs_msdos.8,v 1.22 2017/02/16 18:49:31 christos Exp $
 .\"
 .\" Copyright (c) 1998 Robert Nordier
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\"
 .\" From: $FreeBSD: src/sbin/newfs_msdos/newfs_msdos.8,v 1.13 2001/08/14 10:01:48 ru Exp $
 .\"
-.Dd September 12, 2016
+.Dd February 16, 2017
 .Dt NEWFS_MSDOS 8
 .Os
 .Sh NAME
@@ -57,6 +57,7 @@
 .Op Fl o Ar hidden
 .Op Fl r Ar reserved
 .Op Fl s Ar total
+.Op Fl T Ar timestamp
 .Op Fl u Ar track-size
 .Ar special
 .Op Ar disktype
@@ -147,6 +148,13 @@ Number of hidden sectors.
 Number of reserved sectors.
 .It Fl s Ar total
 File system size.
+.It Fl T At timestamp
+Specify a timestamp to be used for filesystem creation so that
+it can be consistent for reproducible builds.
+The timestamp can be a pathname, where the timestamps are derived from
+that file, a parseable date for parsedate(3) (this option is not
+yet available in the tools build), or an integer value interpreted
+as the number of seconds from the Epoch.
 .It Fl u Ar track-size
 Number of sectors per track.
 .El

Index: src/sbin/newfs_msdos/newfs_msdos.c
diff -u src/sbin/newfs_msdos/newfs_msdos.c:1.43 src/sbin/newfs_msdos/newfs_msdos.c:1.44
--- src/sbin/newfs_msdos/newfs_msdos.c:1.43	Thu Apr 23 09:27:14 2015
+++ src/sbin/newfs_msdos/newfs_msdos.c	Thu Feb 16 13:49:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: newfs_msdos.c,v 1.43 2015/04/23 13:27:14 abs Exp $	*/
+/*	$NetBSD: newfs_msdos.c,v 1.44 2017/02/16 18:49:31 christos Exp $	*/
 
 /*
  * Copyright (c) 1998 Robert Nordier
@@ -33,11 +33,12 @@
 static const char rcsid[] =
   "$FreeBSD: src/sbin/newfs_msdos/newfs_msdos.c,v 1.15 2000/10/10 01:49:37 wollman Exp $";
 #else
-__RCSID("$NetBSD: newfs_msdos.c,v 1.43 2015/04/23 13:27:14 abs Exp $");
+__RCSID("$NetBSD: newfs_msdos.c,v 1.44 2017/02/16 18:49:31 christos Exp $");
 #endif
 #endif /* not lint */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -45,6 +46,7 @@ __RCSID("$NetBSD: newfs_msdos.c,v 1.43 2
 #include 
 #include 
 

CVS commit: src/crypto/external/bsd/openssh/dist

2017-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 16 17:56:07 UTC 2017

Modified Files:
src/crypto/external/bsd/openssh/dist: auth2-pubkey.c

Log Message:
PR/51973: Use proper fd for AuthorizedKeysCommand


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \
src/crypto/external/bsd/openssh/dist/auth2-pubkey.c

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

Modified files:

Index: src/crypto/external/bsd/openssh/dist/auth2-pubkey.c
diff -u src/crypto/external/bsd/openssh/dist/auth2-pubkey.c:1.15 src/crypto/external/bsd/openssh/dist/auth2-pubkey.c:1.16
--- src/crypto/external/bsd/openssh/dist/auth2-pubkey.c:1.15	Sat Dec 24 19:07:46 2016
+++ src/crypto/external/bsd/openssh/dist/auth2-pubkey.c	Thu Feb 16 12:56:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: auth2-pubkey.c,v 1.15 2016/12/25 00:07:46 christos Exp $	*/
+/*	$NetBSD: auth2-pubkey.c,v 1.16 2017/02/16 17:56:07 christos Exp $	*/
 /* $OpenBSD: auth2-pubkey.c,v 1.60 2016/11/30 02:57:40 djm Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include "includes.h"
-__RCSID("$NetBSD: auth2-pubkey.c,v 1.15 2016/12/25 00:07:46 christos Exp $");
+__RCSID("$NetBSD: auth2-pubkey.c,v 1.16 2017/02/16 17:56:07 christos Exp $");
 #include 
 #include 
 #include 
@@ -839,13 +839,6 @@ check_authkeys_file(FILE *f, char *file,
 	}
 	}
 #endif
-	debug("trying public key file %s", file);
-	f = auth_openkeyfile(file, pw, options.strict_modes);
-
-	if (!f) {
-		restore_uid();
-		return 0;
-	}
 
 	found_key = 0;
 



CVS commit: src

2017-02-16 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Feb 16 17:15:26 UTC 2017

Modified Files:
src: BUILDING
src/share/man/man5: mk.conf.5

Log Message:
The default values for MKPIC are yes and no for sh3 and m68000, respectively.
Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/BUILDING
cvs rdiff -u -r1.71 -r1.72 src/share/man/man5/mk.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/BUILDING
diff -u src/BUILDING:1.122 src/BUILDING:1.123
--- src/BUILDING:1.122	Fri Jan 29 13:51:13 2016
+++ src/BUILDING	Thu Feb 16 17:15:26 2017
@@ -349,7 +349,7 @@ CONFIGURATION
  statically linked.
 
  Default: Platform dependent.  As of this writing, all
- platforms except sh3 default to ``yes''.
+ platforms except m68000 default to ``yes''.
 
  MKPICINSTALL
  Can be set to ``yes'' or ``no''.  Indicates whether the ar(1)
@@ -1108,4 +1108,4 @@ CAVEATS
  files in object directories.  Instead, one may have to manually remove
  the files.  Consult the UPDATING file for notices concerning this.
 
-NetBSD January 29, 2016 NetBSD
+NetBSD February 16, 2017NetBSD

Index: src/share/man/man5/mk.conf.5
diff -u src/share/man/man5/mk.conf.5:1.71 src/share/man/man5/mk.conf.5:1.72
--- src/share/man/man5/mk.conf.5:1.71	Thu Jul 23 08:03:26 2015
+++ src/share/man/man5/mk.conf.5	Thu Feb 16 17:15:26 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mk.conf.5,v 1.71 2015/07/23 08:03:26 mrg Exp $
+.\"	$NetBSD: mk.conf.5,v 1.72 2017/02/16 17:15:26 rin Exp $
 .\"
 .\"  Copyright (c) 1999-2003 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 April 7, 2015
+.Dd February 16, 2017
 .Dt MK.CONF 5
 .Os
 .\" turn off hyphenation
@@ -671,8 +671,6 @@ the entire built system will be statical
 Platform dependent.
 As of this writing, all platforms except
 .Sy m68000
-and
-.Sy sh3
 default to
 .Dq yes .
 .Pp



CVS commit: src/tests/kernel

2017-02-16 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Feb 16 15:57:45 UTC 2017

Modified Files:
src/tests/kernel: t_ptrace_wait.h
src/tests/kernel/arch/amd64: t_ptrace_wait.c

Log Message:
Switch back arch/amd64/t_ptrace_wait.c to r1.6 and restore original DBREGS

This is preparation to replace watchpoint API to dbregs.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/kernel/t_ptrace_wait.h
cvs rdiff -u -r1.11 -r1.12 src/tests/kernel/arch/amd64/t_ptrace_wait.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/kernel/t_ptrace_wait.h
diff -u src/tests/kernel/t_ptrace_wait.h:1.8 src/tests/kernel/t_ptrace_wait.h:1.9
--- src/tests/kernel/t_ptrace_wait.h:1.8	Wed Feb 15 20:58:22 2017
+++ src/tests/kernel/t_ptrace_wait.h	Thu Feb 16 15:57:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.h,v 1.8 2017/02/15 20:58:22 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.h,v 1.9 2017/02/16 15:57:45 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -429,9 +429,3 @@ check_happy(unsigned n)
 #else
 #define ATF_TP_ADD_TC_PT_STEP(a,b)
 #endif
-
-#if defined(__HAVE_PTRACE_WATCHPOINTS)
-#define ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(a,b)	ATF_TP_ADD_TC(a,b)
-#else
-#define ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS(a,b)
-#endif

Index: src/tests/kernel/arch/amd64/t_ptrace_wait.c
diff -u src/tests/kernel/arch/amd64/t_ptrace_wait.c:1.11 src/tests/kernel/arch/amd64/t_ptrace_wait.c:1.12
--- src/tests/kernel/arch/amd64/t_ptrace_wait.c:1.11	Wed Jan 18 05:14:34 2017
+++ src/tests/kernel/arch/amd64/t_ptrace_wait.c	Thu Feb 16 15:57:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.11 2017/01/18 05:14:34 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.12 2017/02/16 15:57:45 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.11 2017/01/18 05:14:34 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.12 2017/02/16 15:57:45 kamil Exp $");
 
 #include 
 #include 
@@ -37,7 +37,6 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.11
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -50,11 +49,41 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.11
 
 #include 
 
-#include "h_macros.h"
+#include "../../../h_macros.h"
 
 #include "../../t_ptrace_wait.h"
 
 
+union u {
+	long raw;
+	struct {
+		long local_dr0_breakpoint : 1;	/* 0 */
+		long global_dr0_breakpoint : 1;	/* 1 */
+		long local_dr1_breakpoint : 1;	/* 2 */
+		long global_dr1_breakpoint : 1;	/* 3 */
+		long local_dr2_breakpoint : 1;	/* 4 */
+		long global_dr2_breakpoint : 1;	/* 5 */
+		long local_dr3_breakpoint : 1;	/* 6 */
+		long global_dr3_breakpoint : 1;	/* 7 */
+		long local_exact_breakpt : 1;	/* 8 */
+		long global_exact_breakpt : 1;	/* 9 */
+		long reserved_10 : 1;		/* 10 */
+		long rest_trans_memory : 1;	/* 11 */
+		long reserved_12 : 1;		/* 12 */
+		long general_detect_enable : 1;	/* 13 */
+		long reserved_14 : 1;		/* 14 */
+		long reserved_15 : 1;		/* 15 */
+		long condition_dr0 : 2;		/* 16-17 */
+		long len_dr0 : 2;		/* 18-19 */
+		long condition_dr1 : 2;		/* 20-21 */
+		long len_dr1 : 2;		/* 22-23 */
+		long condition_dr2 : 2;		/* 24-25 */
+		long len_dr2 : 2;		/* 26-27 */
+		long condition_dr3 : 2;		/* 28-29 */
+		long len_dr3 : 2;		/* 30-31 */
+	} bits;
+};
+
 #if defined(HAVE_GPREGS)
 ATF_TC(regs1);
 ATF_TC_HEAD(regs1, tc)
@@ -138,15 +167,15 @@ ATF_TC_BODY(regs1, tc)
 }
 #endif
 
-#if defined(__HAVE_PTRACE_WATCHPOINTS)
-ATF_TC(watchpoint_count);
-ATF_TC_HEAD(watchpoint_count, tc)
+#if defined(HAVE_DBREGS)
+ATF_TC(dbregs_print);
+ATF_TC_HEAD(dbregs_print, tc)
 {
 	atf_tc_set_md_var(tc, "descr",
-	"Call PT_COUNT_WATCHPOINTS and assert four available watchpoints");
+	"Verify plain PT_GETDBREGS with printing Debug Registers");
 }
 
-ATF_TC_BODY(watchpoint_count, tc)
+ATF_TC_BODY(dbregs_print, tc)
 {
 	const int exitval = 5;
 	const int sigval = SIGSTOP;
@@ -154,7 +183,8 @@ ATF_TC_BODY(watchpoint_count, tc)
 #if defined(TWAIT_HAVE_STATUS)
 	int status;
 #endif
-	int N;
+	struct dbreg r;
+	size_t i;
 
 	printf("Before forking process PID=%d\n", getpid());
 	ATF_REQUIRE((child = fork()) != -1);
@@ -173,13 +203,14 @@ ATF_TC_BODY(watchpoint_count, tc)
 	printf("Before calling %s() for the child\n", TWAIT_FNAME);
 	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
 
-	validate_status_stopped(status, sigval);
+	validate_status_stopped(status, sigval);	
 
-	printf("Call GETREGS for the child process\n");
-	ATF_REQUIRE((N = ptrace(PT_COUNT_WATCHPOINTS, child, NULL, 0)) != -1);
-	printf("Reported %d watchpoints\n", N);
+	printf("Call GETDBREGS for the child process\n");
+	ATF_REQUIRE(ptrace(PT_GETDBREGS, child, , 0) != -1);
 
-	ATF_REQUIRE_EQ_MSG(N, 4, "Expected 4 hw watchpoints - got %d", N);
+	printf("State of the debug registers:\n");
+	for (i = 0; i < __arraycount(r.dbregs); i++)

CVS commit: xsrc/external/mit/xf86-video-chips/dist/src

2017-02-16 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Feb 16 15:05:57 UTC 2017

Modified Files:
xsrc/external/mit/xf86-video-chips/dist/src: ct_BltHiQV.h ct_exa.c

Log Message:
set pixmap pitch alignment to 8 bytes - the blitter will lock up otherwise
which isn't mentioned anywhere in the manual.
Leave in #ifdef DEBUG code to trace blitter timeouts just in case


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.2 \
xsrc/external/mit/xf86-video-chips/dist/src/ct_BltHiQV.h
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/xf86-video-chips/dist/src/ct_exa.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-chips/dist/src/ct_BltHiQV.h
diff -u xsrc/external/mit/xf86-video-chips/dist/src/ct_BltHiQV.h:1.1.1.3 xsrc/external/mit/xf86-video-chips/dist/src/ct_BltHiQV.h:1.2
--- xsrc/external/mit/xf86-video-chips/dist/src/ct_BltHiQV.h:1.1.1.3	Sat Aug 14 08:33:13 2010
+++ xsrc/external/mit/xf86-video-chips/dist/src/ct_BltHiQV.h	Thu Feb 16 15:05:57 2017
@@ -65,6 +65,8 @@
  * Note that BR04[31] can't be used as some C chipsets lockup when reading
  * the BRxx registers.
  */
+
+#if 0
 #define ctBLTWAIT \
  {int timeout; \
  timeout = 0; \
@@ -79,7 +81,35 @@
  if ((cPtr->Chipset < CHIPS_CT69000 && \
 			 (timeout > 10)) || timeout > 30) { \
 			unsigned char tmp; \
-ErrorF("timeout\n"); \
+ErrorF("%s: timeout %d (%d, %d, %d x %d) -> %d, %d \n", __func__, last_op, lx, ly, lw, lh, dx, dy); \
+ErrorF("dir %d %d, pitch %d %d\n", xdir, ydir, lsp, ldp); \
+			tmp = cPtr->readXR(cPtr, 0x20); \
+			cPtr->writeXR(cPtr, 0x20, ((tmp & 0xFD) | 0x2)); \
+usleep(1); \
+cPtr->writeXR(cPtr, 0x20, (tmp & 0xFD)); \
+			break; \
+ } \
+		  } \
+		}
+#endif
+
+/*
+ * XXX
+ * we only care about C 6555x which can safely use BR04
+ */
+
+#ifdef DEBUG
+#define ctBLTWAIT \
+ {int timeout; \
+ timeout = 0; \
+		 for (;;) { \
+		 if (!(MMIO_IN32(cPtr->MMIOBase,BR(0x4))&(1<<31)))\
+ break; \
+ timeout++; \
+ if (timeout > 30) { \
+			unsigned char tmp; \
+ErrorF("%s: timeout %d (%d, %d, %d x %d) -> %d, %d \n", __func__, last_op, lx, ly, lw, lh, dx, dy); \
+ErrorF("dir %d %d, pitch %d %d\n", xdir, ydir, lsp, ldp); \
 			tmp = cPtr->readXR(cPtr, 0x20); \
 			cPtr->writeXR(cPtr, 0x20, ((tmp & 0xFD) | 0x2)); \
 usleep(1); \
@@ -89,6 +119,28 @@
 		  } \
 		}
 
+#else
+#define ctBLTWAIT \
+ {int timeout; \
+ timeout = 0; \
+		 for (;;) { \
+		 if (!(MMIO_IN32(cPtr->MMIOBase,BR(0x4))&(1<<31)))\
+ break; \
+ timeout++; \
+ if (timeout > 30) { \
+			unsigned char tmp; \
+ErrorF("%s: timeout\n", __func__); \
+			tmp = cPtr->readXR(cPtr, 0x20); \
+			cPtr->writeXR(cPtr, 0x20, ((tmp & 0xFD) | 0x2)); \
+usleep(1); \
+cPtr->writeXR(cPtr, 0x20, (tmp & 0xFD)); \
+			break; \
+ } \
+		  } \
+		}
+
+#endif
+
 #if X_BYTE_ORDER == X_BIG_ENDIAN
 # define TWEAK_24_BE(c) \
 c = ((c & 0xFF) >> 16) | (c & 0xFF00) | (( c & 0xFF) << 16)

Index: xsrc/external/mit/xf86-video-chips/dist/src/ct_exa.c
diff -u xsrc/external/mit/xf86-video-chips/dist/src/ct_exa.c:1.2 xsrc/external/mit/xf86-video-chips/dist/src/ct_exa.c:1.3
--- xsrc/external/mit/xf86-video-chips/dist/src/ct_exa.c:1.2	Tue Jan 24 15:47:01 2017
+++ xsrc/external/mit/xf86-video-chips/dist/src/ct_exa.c	Thu Feb 16 15:05:57 2017
@@ -21,7 +21,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-/* $NetBSD: ct_exa.c,v 1.2 2017/01/24 15:47:01 christos Exp $ */
+/* $NetBSD: ct_exa.c,v 1.3 2017/02/16 15:05:57 macallan Exp $ */
 
 #include 
 
@@ -43,6 +43,7 @@
 #ifdef DEBUG
 #define ENTER xf86Msg(X_ERROR, "%s\n", __func__)
 #define LEAVE xf86Msg(X_ERROR, "%s done\n", __func__)
+int last_op = 0, lx, ly, lw, lh, dx, dy, xdir, ydir, lsp, ldp;
 #else
 #define ENTER
 #define LEAVE
@@ -130,12 +131,29 @@ ctCopy
 ctSETDSTADDR(dst);
 ctSETHEIGHTWIDTHGO(h, w * cAcl->BytesPerPixel);
 LEAVE;
+#ifdef DEBUG
+last_op = 1;
+lx = srcX;
+ly = srcY;
+lw = w;
+lh = h;
+dx = dstX;
+dy = dstY;
+xdir = cAcl->xdir;
+ydir = cAcl->ydir;
+lsp = cAcl->srcpitch;
+ldp = dstpitch;
+#endif
 }
 
 static void
 ctDoneCopy(PixmapPtr pDstPixmap)
 {
 ENTER;

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

2017-02-16 Thread Thor Lancelot Simon
Module Name:src
Committed By:   tls
Date:   Thu Feb 16 15:00:30 UTC 2017

Modified Files:
src/sys/arch/x86/x86: identcpu.c

Log Message:
On i386 (but not on amd64) we can enable SSE comparatively very late, when
probing/attaching the FPU.  This is a problem for cpu_rng with the VIA
processors because, by design, cpu_rng attaches, and the entropy subsystem
starts up, very early.

If SSE is not enabled, calls to any "PadLock" instructions (ACE, RNG)
on the VIA processors will trap, per the manual:
linux.via.com.tw/support/beginDownload.action?eleid=181=261

All VIA CPUs with PadLock, or which match the model/stepping test as
possibly having PadLock, have SSE.  Just unconditionally enable it before
trying to turn the crypto block on.

Fixes crash at RNG attach time reported by Andrus V.; fix proposed by
jak@.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/x86/x86/identcpu.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/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.52 src/sys/arch/x86/x86/identcpu.c:1.53
--- src/sys/arch/x86/x86/identcpu.c:1.52	Thu Feb  2 08:57:04 2017
+++ src/sys/arch/x86/x86/identcpu.c	Thu Feb 16 15:00:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.52 2017/02/02 08:57:04 maxv Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.53 2017/02/16 15:00:30 tls Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.52 2017/02/02 08:57:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.53 2017/02/16 15:00:30 tls Exp $");
 
 #include "opt_xen.h"
 
@@ -551,7 +551,19 @@ cpu_probe_c3(struct cpu_info *ci)
 			}
 		}
 
-		/* Actually do the enables. */
+		/*
+		 * Actually do the enables.  It's a little gross,
+		 * but per the PadLock programming guide, "Enabling
+		 * PadLock", condition 3, we must enable SSE too or
+		 * else the first use of RNG or ACE instructions
+		 * will generate a trap.
+		 *
+		 * We must do this early because of kernel RNG
+		 * initialization but it is safe without the full
+		 * FPU-detect as all these CPUs have SSE.
+		 */
+		lcr4(rcr4() | CR4_OSFXSR);
+
 		if (rng_enable) {
 			msr = rdmsr(MSR_VIA_RNG);
 			msr |= MSR_VIA_RNG_ENABLE;



CVS commit: src/share/man/man4

2017-02-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Feb 16 14:00:26 UTC 2017

Modified Files:
src/share/man/man4: l2tp.4

Log Message:
New sentence, new line.
Remove superfluous macros and whitespace.
Some wording improvements.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/l2tp.4

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

Modified files:

Index: src/share/man/man4/l2tp.4
diff -u src/share/man/man4/l2tp.4:1.1 src/share/man/man4/l2tp.4:1.2
--- src/share/man/man4/l2tp.4:1.1	Thu Feb 16 08:32:21 2017
+++ src/share/man/man4/l2tp.4	Thu Feb 16 14:00:26 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: l2tp.4,v 1.1 2017/02/16 08:32:21 knakahara Exp $
+.\"	$NetBSD: l2tp.4,v 1.2 2017/02/16 14:00:26 wiz Exp $
 .\"
 .\" Copyright (C) 2017 Internet Initiative Japan Inc.
 .\" All rights reserved.
@@ -38,34 +38,37 @@
 .Sh DESCRIPTION
 The
 .Nm
-interface is a version 3 of the Layer Two Tunneling Protocol(L2TPv3)
-pseudo device. It can tunnel layer 2 protocol traffic over IPv4 or IPv6,
-as specified in
+interface is a version 3 of the Layer Two Tunneling Protocol (L2TPv3)
+pseudo device.
+It can tunnel layer 2 protocol traffic over IPv4 or IPv6, as specified in
 .Li RFC3931 .
 .Pp
-L2TPv3 protocol is comprised of two types of messages, control messages
-and data messages. Control messages are used in the establishment,
+The L2TPv3 protocol is comprised of two types of messages, control messages
+and data messages.
+Control messages are used in the establishment,
 maintenace, and clearing of control connections and sessions.
-.Xr l2tp 4
-interface can send control messages and data messages, furthermore
+The
+.Nm
+interface can send control messages and data messages; furthermore
 the management of control messages is entrusted to userland daemon.
-Without management daemon,
-.Xr l2tp 4
-interface can send data messages by using
+Without a management daemon, the
+.Nm
+interface can send data messages using the
 .Xr ifconfig 8
 .Cm tunnel
 and
 .Cm session
-subcommands, or
+subcommands, or the
 .Dv SIOCSIFPHYADDR
 and
 .Dv SIOCSL2TPSESSION
-ioctls. Additionally, it can use cookie specified in
+ioctls.
+Additionally, it can use cookies specified in
 .Li RFC3931
-by using
+by using the
 .Xr ifconfig 8
 .Cm cookie
-subcommand, or
+subcommand, or the
 .Dv SIOCSL2TPCOOKIE
 ioctl.
 .Ss Packet format
@@ -80,7 +83,6 @@ Host X--NetBSD A  tunnel
\\  |
 \\/
  +-Router BRouter C-+
-
 .Ed
 configuration example without cookies,
 .Pp
@@ -100,7 +102,6 @@ system A
 # ifconfig bridge0 up
 .Ed
 .Pp
-.Ed
 On
 .Nx
 system B
@@ -136,7 +137,6 @@ system A
 # ifconfig bridge0 up
 .Ed
 .Pp
-.Ed
 On
 .Nx
 system B
@@ -153,7 +153,6 @@ system B
 # ifconfig wm1 up
 # ifconfig bridge0 up
 .Ed
-
 .Sh SEE ALSO
 .Xr inet 4 ,
 .Xr inet6 4 ,
@@ -173,6 +172,6 @@ The
 device first appeared in
 .Nx 8.0 .
 .Sh BUGS
-Currently,
+Currently, the
 .Nm
-interface support ethernet frame over IPv4 or IPv6 only.
+interface supports Ethernet frames over IPv4 or IPv6 only.



CVS commit: src/sbin/ifconfig

2017-02-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Feb 16 13:51:08 UTC 2017

Modified Files:
src/sbin/ifconfig: ifconfig.8

Log Message:
New sentence, new line.
Remove superfluous Oc and merge line to make it less likely to happen again.
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sbin/ifconfig/ifconfig.8

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

Modified files:

Index: src/sbin/ifconfig/ifconfig.8
diff -u src/sbin/ifconfig/ifconfig.8:1.113 src/sbin/ifconfig/ifconfig.8:1.114
--- src/sbin/ifconfig/ifconfig.8:1.113	Thu Feb 16 08:32:21 2017
+++ src/sbin/ifconfig/ifconfig.8	Thu Feb 16 13:51:08 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ifconfig.8,v 1.113 2017/02/16 08:32:21 knakahara Exp $
+.\"	$NetBSD: ifconfig.8,v 1.114 2017/02/16 13:51:08 wiz Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -509,8 +509,7 @@ flag may be used to display long SSIDs.
 also causes received information elements to be displayed symbolically.
 The interface must be up before any scanning operation.
 Only the super-user can use this command.
-.It Cm tunnel Ar src_addr Ns Oo Ar ,src_port Oc Ar dest_addr Ns Oo Ar ,dest_port
-.Oc
+.It Cm tunnel Ar src_addr Ns Oo Ar ,src_port Oc Ar dest_addr Ns Oo Ar ,dest_port Oc
 .Pq IP tunnel devices only
 Configure the physical source and destination address for IP tunnel
 interfaces, including
@@ -535,21 +534,20 @@ Unconfigure the physical source and dest
 interfaces previously configured with
 .Cm tunnel .
 .It Cm session Ar local_session Ar remote_session
-.Oc
 .Pq L2TPv3 devices only
 Configure local session id and remote session id for L2TPv3
-interface. The length of session id is 4 bytes.
+interface.
+The length of session id is 4 bytes.
 .It Cm deletesession
 Unconfigure the local session id and remote session id for
 L2TPv3 interface previously configured with
 .Cm session .
 .It Cm cookie Ar local_cookie_length Ar local_cookie  Ar remote_cookie_length Ar remote_cookie
-.Oc
 .Pq L2TPv3 devices only
 Configure local cookie and remote cookie for L2TPv3 interface.
 The cookie length must be 4 or 8 bytes.
-Generally, cookies are mangaed by daemon. So, this command would
-be used for test or debug only.
+Generally, cookies are managed by daemon.
+So, this command would be used for test or debug only.
 .It Cm deletecookie
 Unconfigure the local cookie and remote cookie for L2TPv3
 interface previously configured with



CVS commit: src/etc/etc.luna68k

2017-02-16 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Feb 16 13:13:39 UTC 2017

Modified Files:
src/etc/etc.luna68k: MAKEDEV.conf

Log Message:
Make sure to prepare /dev/xp node entry.

Missed in the initial xp(4) support import:
 http://mail-index.netbsd.org/source-changes/2016/12/03/msg079493.html


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/etc/etc.luna68k/MAKEDEV.conf

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

Modified files:

Index: src/etc/etc.luna68k/MAKEDEV.conf
diff -u src/etc/etc.luna68k/MAKEDEV.conf:1.9 src/etc/etc.luna68k/MAKEDEV.conf:1.10
--- src/etc/etc.luna68k/MAKEDEV.conf:1.9	Sat Dec  3 17:38:02 2016
+++ src/etc/etc.luna68k/MAKEDEV.conf	Thu Feb 16 13:13:39 2017
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.9 2016/12/03 17:38:02 tsutsui Exp $
+# $NetBSD: MAKEDEV.conf,v 1.10 2017/02/16 13:13:39 tsutsui Exp $
 
 all_md)
 	makedev ttya sd0 sd1 sd2 sd3 cd0 cd1 st0 st1
@@ -21,3 +21,8 @@ ramdisk)
 	makedev ttyEcfg ttyE0 wskbd0
 	makedev scsibus0 scsibus1
 	;;
+
+xp)
+	major=40; minor=0; mode=0644
+	mkdev xp c $major $minor $mode
+	;;



CVS commit: src/doc

2017-02-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Feb 16 08:48:34 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
update doc/CHAGES


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2253 src/doc/CHANGES:1.2254
--- src/doc/CHANGES:1.2253	Tue Feb 14 01:18:39 2017
+++ src/doc/CHANGES	Thu Feb 16 08:48:34 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2253 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2254 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -471,3 +471,4 @@ Changes from NetBSD 7.0 to NetBSD 8.0:
 	ptrace(2): Add signal mask information accessors API:
 		PT_GET_SIGMASK and PT_SET_SIGMASK [kamil 20170212]
 	postfix(1): Import version 3.1.4. [christos 20170213]
+	l2tp(4): Add L2TPv3 interface. [knakahara 20170216]



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

2017-02-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Feb 16 08:45:43 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: ALL GENERIC

Log Message:
add l2tp(4) to amd64/GENERIC and amd64/ALL config.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.450 -r1.451 src/sys/arch/amd64/conf/GENERIC

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

Modified files:

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.49 src/sys/arch/amd64/conf/ALL:1.50
--- src/sys/arch/amd64/conf/ALL:1.49	Thu Jan 12 05:24:36 2017
+++ src/sys/arch/amd64/conf/ALL	Thu Feb 16 08:45:42 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.49 2017/01/12 05:24:36 ryo Exp $
+# $NetBSD: ALL,v 1.50 2017/02/16 08:45:42 knakahara Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.49 $"
+#ident		"ALL-$Revision: 1.50 $"
 
 maxusers	64		# estimated number of users
 
@@ -1573,6 +1573,7 @@ pseudo-device	vlan			# IEEE 802.1q encap
 pseudo-device	bridge			# simple inter-network bridging
 options 	BRIDGE_IPF		# bridge uses IP/IPv6 pfil hooks too
 pseudo-device	agr			# IEEE 802.3ad link aggregation
+pseudo-device	l2tp			# L2TPv3 interface
 #pseudo-device	pf			# PF packet filter
 #pseudo-device	pflog			# PF log if
 #pseudo-device	pfsync			# PF sync if

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.450 src/sys/arch/amd64/conf/GENERIC:1.451
--- src/sys/arch/amd64/conf/GENERIC:1.450	Thu Jan 12 05:24:36 2017
+++ src/sys/arch/amd64/conf/GENERIC	Thu Feb 16 08:45:42 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.450 2017/01/12 05:24:36 ryo Exp $
+# $NetBSD: GENERIC,v 1.451 2017/02/16 08:45:42 knakahara Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.450 $"
+#ident		"GENERIC-$Revision: 1.451 $"
 
 maxusers	64		# estimated number of users
 
@@ -1271,6 +1271,7 @@ pseudo-device	vlan			# IEEE 802.1q encap
 pseudo-device	bridge			# simple inter-network bridging
 #options 	BRIDGE_IPF		# bridge uses IP/IPv6 pfil hooks too
 pseudo-device	agr			# IEEE 802.3ad link aggregation
+pseudo-device	l2tp			# L2TPv3 interface
 #pseudo-device	pf			# PF packet filter
 #pseudo-device	pflog			# PF log if
 #pseudo-device	pfsync			# PF sync if



CVS commit: src

2017-02-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Feb 16 08:44:48 UTC 2017

Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/tests/net: Makefile
Added Files:
src/tests/net/if_l2tp: Makefile t_l2tp.sh

Log Message:
add l2tp(4) basic test.


To generate a diff of this commit:
cvs rdiff -u -r1.720 -r1.721 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.139 -r1.140 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.30 -r1.31 src/tests/net/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/net/if_l2tp/Makefile \
src/tests/net/if_l2tp/t_l2tp.sh

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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.720 src/distrib/sets/lists/tests/mi:1.721
--- src/distrib/sets/lists/tests/mi:1.720	Sat Feb 11 18:47:36 2017
+++ src/distrib/sets/lists/tests/mi	Thu Feb 16 08:44:47 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.720 2017/02/11 18:47:36 nakayama Exp $
+# $NetBSD: mi,v 1.721 2017/02/16 08:44:47 knakahara Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3252,6 +3252,10 @@
 ./usr/tests/net/if_gif/Atffile			tests-net-tests		atf,rump
 ./usr/tests/net/if_gif/Kyuafile			tests-net-tests		atf,rump,kyua
 ./usr/tests/net/if_gif/t_gif			tests-net-tests		atf,rump
+./usr/tests/net/if_l2tptests-net-tests		compattestfile,atf
+./usr/tests/net/if_l2tp/Atffile			tests-net-tests		atf,rump
+./usr/tests/net/if_l2tp/Kyuafile		tests-net-tests		atf,rump,kyua
+./usr/tests/net/if_l2tp/t_l2tp			tests-net-tests		atf,rump
 ./usr/tests/net/if_looptests-net-tests		compattestfile,atf
 ./usr/tests/net/if_loop/Atffile			tests-net-tests		atf,rump
 ./usr/tests/net/if_loop/Kyuafile		tests-net-tests		atf,rump,kyua

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.139 src/etc/mtree/NetBSD.dist.tests:1.140
--- src/etc/mtree/NetBSD.dist.tests:1.139	Mon Jan  2 20:37:12 2017
+++ src/etc/mtree/NetBSD.dist.tests	Thu Feb 16 08:44:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.139 2017/01/02 20:37:12 martin Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.140 2017/02/16 08:44:47 knakahara Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -339,6 +339,7 @@
 ./usr/tests/net/if
 ./usr/tests/net/if_bridge
 ./usr/tests/net/if_gif
+./usr/tests/net/if_l2tp
 ./usr/tests/net/if_loop
 ./usr/tests/net/if_pppoe
 ./usr/tests/net/if_tap

Index: src/tests/net/Makefile
diff -u src/tests/net/Makefile:1.30 src/tests/net/Makefile:1.31
--- src/tests/net/Makefile:1.30	Sat Nov 26 03:19:48 2016
+++ src/tests/net/Makefile	Thu Feb 16 08:44:47 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.30 2016/11/26 03:19:48 ozaki-r Exp $
+# $NetBSD: Makefile,v 1.31 2017/02/16 08:44:47 knakahara Exp $
 
 .include 
 
@@ -6,8 +6,9 @@ TESTSDIR=	${TESTSBASE}/net
 
 TESTS_SUBDIRS=		fdpass in_cksum net sys
 .if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE)
-TESTS_SUBDIRS+=		arp bpf bpfilter carp icmp if if_bridge if_gif if_loop
-TESTS_SUBDIRS+=		if_pppoe if_tap if_tun mcast mpls ndp npf route if_vlan
+TESTS_SUBDIRS+=		arp bpf bpfilter carp icmp if if_bridge if_gif if_l2tp
+TESTS_SUBDIRS+=		 if_loop if_pppoe if_tap if_tun mcast mpls ndp npf route
+TESTS_SUBDIRS+=		 if_vlan
 .if (${MKSLJIT} != "no")
 TESTS_SUBDIRS+=		bpfjit
 .endif

Added files:

Index: src/tests/net/if_l2tp/Makefile
diff -u /dev/null src/tests/net/if_l2tp/Makefile:1.1
--- /dev/null	Thu Feb 16 08:44:48 2017
+++ src/tests/net/if_l2tp/Makefile	Thu Feb 16 08:44:47 2017
@@ -0,0 +1,13 @@
+# $NetBSD: Makefile,v 1.1 2017/02/16 08:44:47 knakahara Exp $
+#
+
+.include 
+
+TESTSDIR=	${TESTSBASE}/net/if_l2tp
+
+.for name in l2tp
+TESTS_SH+=		t_${name}
+TESTS_SH_SRC_t_${name}=	../net_common.sh t_${name}.sh
+.endfor
+
+.include 
Index: src/tests/net/if_l2tp/t_l2tp.sh
diff -u /dev/null src/tests/net/if_l2tp/t_l2tp.sh:1.1
--- /dev/null	Thu Feb 16 08:44:48 2017
+++ src/tests/net/if_l2tp/t_l2tp.sh	Thu Feb 16 08:44:47 2017
@@ -0,0 +1,440 @@
+#	$NetBSD: t_l2tp.sh,v 1.1 2017/02/16 08:44:47 knakahara Exp $
+#
+# Copyright (c) 2017 Internet Initiative Japan Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# 

CVS commit: src

2017-02-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Feb 16 08:39:10 UTC 2017

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/comp: mi shl.mi
src/distrib/sets/lists/debug: mi shl.mi
src/sys/rump/net: Makefile.rumpnetcomp
src/sys/rump/net/lib/libnet: net_component.c
Added Files:
src/sys/rump/include/opt: l2tp.h
src/sys/rump/net/lib/libl2tp: L2TP.ioconf Makefile l2tp_component.c

Log Message:
l2tp(4) support rump.


To generate a diff of this commit:
cvs rdiff -u -r1.802 -r1.803 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.2109 -r1.2110 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.300 -r1.301 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.199 -r1.200 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.162 -r1.163 src/distrib/sets/lists/debug/shl.mi
cvs rdiff -u -r0 -r1.1 src/sys/rump/include/opt/l2tp.h
cvs rdiff -u -r1.16 -r1.17 src/sys/rump/net/Makefile.rumpnetcomp
cvs rdiff -u -r0 -r1.1 src/sys/rump/net/lib/libl2tp/L2TP.ioconf \
src/sys/rump/net/lib/libl2tp/Makefile \
src/sys/rump/net/lib/libl2tp/l2tp_component.c
cvs rdiff -u -r1.8 -r1.9 src/sys/rump/net/lib/libnet/net_component.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/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.802 src/distrib/sets/lists/base/shl.mi:1.803
--- src/distrib/sets/lists/base/shl.mi:1.802	Fri Feb 10 18:11:56 2017
+++ src/distrib/sets/lists/base/shl.mi	Thu Feb 16 08:39:10 2017
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.802 2017/02/10 18:11:56 christos Exp $
+# $NetBSD: shl.mi,v 1.803 2017/02/16 08:39:10 knakahara Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -700,6 +700,9 @@
 ./usr/lib/librumpnet_gif.so			base-rump-shlib		rump
 ./usr/lib/librumpnet_gif.so.0			base-rump-shlib		rump
 ./usr/lib/librumpnet_gif.so.0.0			base-rump-shlib		rump
+./usr/lib/librumpnet_l2tp.so			base-rump-shlib		rump
+./usr/lib/librumpnet_l2tp.so.0			base-rump-shlib		rump
+./usr/lib/librumpnet_l2tp.so.0.0		base-rump-shlib		rump
 ./usr/lib/librumpnet_local.so			base-rump-shlib		rump
 ./usr/lib/librumpnet_local.so.0			base-rump-shlib		rump
 ./usr/lib/librumpnet_local.so.0.0		base-rump-shlib		rump

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2109 src/distrib/sets/lists/comp/mi:1.2110
--- src/distrib/sets/lists/comp/mi:1.2109	Thu Feb 16 08:12:43 2017
+++ src/distrib/sets/lists/comp/mi	Thu Feb 16 08:39:10 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2109 2017/02/16 08:12:43 knakahara Exp $
+#	$NetBSD: mi,v 1.2110 2017/02/16 08:39:10 knakahara Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -3552,6 +3552,8 @@
 ./usr/lib/librumpnet_bridge_p.a			comp-c-proflib		rump,profile
 ./usr/lib/librumpnet_gif.a			comp-c-lib		rump
 ./usr/lib/librumpnet_gif_p.a			comp-c-proflib		rump,profile
+./usr/lib/librumpnet_l2tp.a			comp-c-lib		rump
+./usr/lib/librumpnet_l2tp_p.a			comp-c-proflib		rump,profile
 ./usr/lib/librumpnet_local.a			comp-c-lib		rump
 ./usr/lib/librumpnet_local_p.a			comp-c-proflib		rump,profile
 ./usr/lib/librumpnet_net.a			comp-c-lib		rump

Index: src/distrib/sets/lists/comp/shl.mi
diff -u src/distrib/sets/lists/comp/shl.mi:1.300 src/distrib/sets/lists/comp/shl.mi:1.301
--- src/distrib/sets/lists/comp/shl.mi:1.300	Wed Feb  8 03:44:40 2017
+++ src/distrib/sets/lists/comp/shl.mi	Thu Feb 16 08:39:10 2017
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.300 2017/02/08 03:44:40 kamil Exp $
+# $NetBSD: shl.mi,v 1.301 2017/02/16 08:39:10 knakahara Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -218,6 +218,7 @@
 ./usr/lib/librumpnet_bpfjit_pic.a		comp-c-piclib		picinstall,rump,sljit
 ./usr/lib/librumpnet_bridge_pic.a		comp-c-piclib		picinstall,rump
 ./usr/lib/librumpnet_gif_pic.a			comp-c-piclib		picinstall,rump
+./usr/lib/librumpnet_l2tp_pic.a			comp-c-piclib		picinstall,rump
 ./usr/lib/librumpnet_local_pic.a		comp-c-piclib		picinstall,rump
 ./usr/lib/librumpnet_net80211_pic.a		comp-c-piclib		picinstall,rump
 ./usr/lib/librumpnet_net_pic.a			comp-c-piclib		picinstall,rump

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.199 src/distrib/sets/lists/debug/mi:1.200
--- src/distrib/sets/lists/debug/mi:1.199	Thu Feb  9 03:29:55 2017
+++ src/distrib/sets/lists/debug/mi	Thu Feb 16 08:39:10 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.199 2017/02/09 03:29:55 christos Exp $
+# $NetBSD: mi,v 1.200 2017/02/16 08:39:10 knakahara 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
@@ -210,6 +210,7 @@
 ./usr/lib/librumpnet_bridge_g.a			comp-c-debuglib		debuglib,rump
 ./usr/lib/librumpnet_g.a			

CVS commit: src

2017-02-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Feb 16 08:32:21 UTC 2017

Modified Files:
src/distrib/sets/lists/man: mi
src/sbin/ifconfig: ifconfig.8
src/share/man/man4: Makefile
Added Files:
src/share/man/man4: l2tp.4

Log Message:
add man for l2tp(4).


To generate a diff of this commit:
cvs rdiff -u -r1.1548 -r1.1549 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.112 -r1.113 src/sbin/ifconfig/ifconfig.8
cvs rdiff -u -r1.632 -r1.633 src/share/man/man4/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man4/l2tp.4

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/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1548 src/distrib/sets/lists/man/mi:1.1549
--- src/distrib/sets/lists/man/mi:1.1548	Mon Feb  6 16:06:38 2017
+++ src/distrib/sets/lists/man/mi	Thu Feb 16 08:32:21 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1548 2017/02/06 16:06:38 christos Exp $
+# $NetBSD: mi,v 1.1549 2017/02/16 08:32:21 knakahara Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1360,6 +1360,7 @@
 ./usr/share/man/cat4/ksyms.0			man-sys-catman		.cat
 ./usr/share/man/cat4/kttcp.0			man-sys-catman		.cat
 ./usr/share/man/cat4/kue.0			man-sys-catman		.cat
+./usr/share/man/cat4/l2tp.0			man-sys-catman		.cat
 ./usr/share/man/cat4/lc.0			man-sys-catman		.cat
 ./usr/share/man/cat4/ld.0			man-sys-catman		.cat
 ./usr/share/man/cat4/le.0			man-sys-catman		.cat
@@ -4433,6 +4434,7 @@
 ./usr/share/man/html4/ksyms.html		man-sys-htmlman		html
 ./usr/share/man/html4/kttcp.html		man-sys-htmlman		html
 ./usr/share/man/html4/kue.html			man-sys-htmlman		html
+./usr/share/man/html4/l2tp.html			man-sys-htmlman		html
 ./usr/share/man/html4/lc.html			man-sys-htmlman		html
 ./usr/share/man/html4/ld.html			man-sys-htmlman		html
 ./usr/share/man/html4/le.html			man-sys-htmlman		html
@@ -7346,6 +7348,7 @@
 ./usr/share/man/man4/ksyms.4			man-sys-man		.man
 ./usr/share/man/man4/kttcp.4			man-sys-man		.man
 ./usr/share/man/man4/kue.4			man-sys-man		.man
+./usr/share/man/man4/l2tp.4			man-sys-man		.man
 ./usr/share/man/man4/lc.4			man-sys-man		.man
 ./usr/share/man/man4/ld.4			man-sys-man		.man
 ./usr/share/man/man4/le.4			man-sys-man		.man

Index: src/sbin/ifconfig/ifconfig.8
diff -u src/sbin/ifconfig/ifconfig.8:1.112 src/sbin/ifconfig/ifconfig.8:1.113
--- src/sbin/ifconfig/ifconfig.8:1.112	Wed Jan 18 22:07:25 2017
+++ src/sbin/ifconfig/ifconfig.8	Thu Feb 16 08:32:21 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ifconfig.8,v 1.112 2017/01/18 22:07:25 abhinav Exp $
+.\"	$NetBSD: ifconfig.8,v 1.113 2017/02/16 08:32:21 knakahara Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)ifconfig.8	8.4 (Berkeley) 6/1/94
 .\"
-.Dd January 7, 2016
+.Dd January 19, 2017
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -534,6 +534,26 @@ UDP header.
 Unconfigure the physical source and destination address for IP tunnel
 interfaces previously configured with
 .Cm tunnel .
+.It Cm session Ar local_session Ar remote_session
+.Oc
+.Pq L2TPv3 devices only
+Configure local session id and remote session id for L2TPv3
+interface. The length of session id is 4 bytes.
+.It Cm deletesession
+Unconfigure the local session id and remote session id for
+L2TPv3 interface previously configured with
+.Cm session .
+.It Cm cookie Ar local_cookie_length Ar local_cookie  Ar remote_cookie_length Ar remote_cookie
+.Oc
+.Pq L2TPv3 devices only
+Configure local cookie and remote cookie for L2TPv3 interface.
+The cookie length must be 4 or 8 bytes.
+Generally, cookies are mangaed by daemon. So, this command would
+be used for test or debug only.
+.It Cm deletecookie
+Unconfigure the local cookie and remote cookie for L2TPv3
+interface previously configured with
+.Cm cookie .
 .It Cm create
 Create the specified network pseudo-device.
 .It Cm destroy

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.632 src/share/man/man4/Makefile:1.633
--- src/share/man/man4/Makefile:1.632	Sat Jan 21 20:21:57 2017
+++ src/share/man/man4/Makefile	Thu Feb 16 08:32:21 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.632 2017/01/21 20:21:57 jdolecek Exp $
+#	$NetBSD: Makefile,v 1.633 2017/02/16 08:32:21 knakahara Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -38,7 +38,7 @@ MAN=	aac.4 ac97.4 acardide.4 aceride.4 a
 	ixpide.4 \
 	jme.4 jmide.4 joy.4 \
 	kloader.4 kse.4 ksyms.4 kttcp.4 \
-	lc.4 ld.4 lii.4 lo.4 lua.4 lxtphy.4 \
+	l2tp.4 lc.4 ld.4 lii.4 lo.4 lua.4 lxtphy.4 \
 	mainbus.4 makphy.4 malo.4 mbe.4 mca.4 mcclock.4 md.4 mfb.4 \
 	mfi.4 mhzc.4 \
 	micphy.4 midi.4 mii.4 mk48txx.4 mlx.4 mly.4 mpls.4 mpii.4 mpt.4 mpu.4 mtd.4 \

Added files:

Index: src/share/man/man4/l2tp.4
diff -u /dev/null src/share/man/man4/l2tp.4:1.1
--- /dev/null	Thu Feb 16 08:32:21 2017
+++ 

CVS commit: src/sbin/ifconfig

2017-02-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Feb 16 08:28:03 UTC 2017

Modified Files:
src/sbin/ifconfig: Makefile.common
Added Files:
src/sbin/ifconfig: l2tp.c

Log Message:
add l2tp(4) subcomands to ifconfig(8).

originally implemented by IIJ SEIL team.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sbin/ifconfig/Makefile.common
cvs rdiff -u -r0 -r1.1 src/sbin/ifconfig/l2tp.c

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

Modified files:

Index: src/sbin/ifconfig/Makefile.common
diff -u src/sbin/ifconfig/Makefile.common:1.3 src/sbin/ifconfig/Makefile.common:1.4
--- src/sbin/ifconfig/Makefile.common:1.3	Wed Feb  8 23:34:15 2017
+++ src/sbin/ifconfig/Makefile.common	Thu Feb 16 08:28:03 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.common,v 1.3 2017/02/08 23:34:15 rin Exp $
+#	$NetBSD: Makefile.common,v 1.4 2017/02/16 08:28:03 knakahara Exp $
 
 # shared stuff with src/distrib/utils/x_ifconfig for install media.
 # stuff not required by install media should be into Makefile.
@@ -12,4 +12,4 @@ LDADD+=		-lutil -lprop
 
 INCS+=		af_inetany.h env.h extern.h media.h parse.h util.h
 SRCS+=		af_inet.c af_inetany.c agr.c env.c ether.c ieee80211.c \
-		ifconfig.c media.c parse.c tunnel.c util.c vlan.c
+		ifconfig.c l2tp.c media.c parse.c tunnel.c util.c vlan.c

Added files:

Index: src/sbin/ifconfig/l2tp.c
diff -u /dev/null src/sbin/ifconfig/l2tp.c:1.1
--- /dev/null	Thu Feb 16 08:28:03 2017
+++ src/sbin/ifconfig/l2tp.c	Thu Feb 16 08:28:03 2017
@@ -0,0 +1,270 @@
+/*	$NetBSD: l2tp.c,v 1.1 2017/02/16 08:28:03 knakahara Exp $	*/
+
+/*
+ * Copyright (c) 2017 Internet Initiative Japan Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__RCSID("$NetBSD: l2tp.c,v 1.1 2017/02/16 08:28:03 knakahara Exp $");
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "env.h"
+#include "extern.h"
+#include "util.h"
+
+static status_func_t status;
+static usage_func_t usage;
+static cmdloop_branch_t branch;
+
+static void l2tp_constructor(void) __attribute__((constructor));
+static void l2tp_status(prop_dictionary_t, prop_dictionary_t);
+
+static int setl2tpsession(prop_dictionary_t, prop_dictionary_t);
+static int deletel2tpsession(prop_dictionary_t, prop_dictionary_t);
+static int setl2tpcookie(prop_dictionary_t, prop_dictionary_t);
+static int deletel2tpcookie(prop_dictionary_t, prop_dictionary_t);
+
+struct pinteger l2tpremotesession = PINTEGER_INITIALIZER1(,
+"remote session id", 0, UINT_MAX, 10, setl2tpsession, "l2tpremotesession",
+_root.pb_parser);
+
+struct pinteger l2tplocalsession = PINTEGER_INITIALIZER1(,
+"local session id", 0, UINT_MAX, 10, NULL, "l2tplocalsession",
+_parser);
+
+struct pinteger l2tpremotecookie = PINTEGER_INITIALIZER1(,
+"remote cookie", INT64_MIN, INT64_MAX, 10, setl2tpcookie, "l2tpremotecookie",
+_root.pb_parser);
+
+struct pinteger l2tpremotecookielen = PINTEGER_INITIALIZER1(,
+"remote cookie length", 0, UINT16_MAX, 10, NULL, "l2tpremotecookielen",
+_parser);
+
+struct pinteger l2tplocalcookie = PINTEGER_INITIALIZER1(,
+"local cookie", INT64_MIN, INT64_MAX, 10, NULL, "l2tplocalcookie",
+_parser);
+
+struct pinteger l2tplocalcookielen = PINTEGER_INITIALIZER1(,
+"local cookie length", 0, UINT16_MAX, 10, NULL, "l2tplocalcookielen",
+_parser);
+
+static const struct kwinst l2tpkw[] = {
+	 {.k_word = "cookie", .k_nextparser = _parser}
+	,{.k_word = "deletecookie", .k_exec = deletel2tpcookie,
+	  .k_nextparser = _root.pb_parser}
+	,{.k_word = 

CVS commit: src/sys

2017-02-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Feb 16 08:23:36 UTC 2017

Added Files:
src/sys/modules/if_l2tp: Makefile l2tp.ioconf
src/sys/net: if_l2tp.c if_l2tp.h
src/sys/netinet: in_l2tp.c in_l2tp.h
src/sys/netinet6: in6_l2tp.c in6_l2tp.h

Log Message:
add missing files.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/modules/if_l2tp/Makefile \
src/sys/modules/if_l2tp/l2tp.ioconf
cvs rdiff -u -r0 -r1.1 src/sys/net/if_l2tp.c src/sys/net/if_l2tp.h
cvs rdiff -u -r0 -r1.1 src/sys/netinet/in_l2tp.c src/sys/netinet/in_l2tp.h
cvs rdiff -u -r0 -r1.1 src/sys/netinet6/in6_l2tp.c \
src/sys/netinet6/in6_l2tp.h

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

Added files:

Index: src/sys/modules/if_l2tp/Makefile
diff -u /dev/null src/sys/modules/if_l2tp/Makefile:1.1
--- /dev/null	Thu Feb 16 08:23:36 2017
+++ src/sys/modules/if_l2tp/Makefile	Thu Feb 16 08:23:35 2017
@@ -0,0 +1,14 @@
+# $NetBSD: Makefile,v 1.1 2017/02/16 08:23:35 knakahara Exp $
+
+.include "../Makefile.inc"
+
+.PATH:  ${S}/net ${S}/netinet ${S}/netinet6
+
+KMOD=		if_l2tp
+IOCONF=		l2tp.ioconf
+SRCS=		if_l2tp.c in_l2tp.c in6_l2tp.c
+
+CPPFLAGS+=	-DINET
+CPPFLAGS+=	-DINET6
+
+.include 
Index: src/sys/modules/if_l2tp/l2tp.ioconf
diff -u /dev/null src/sys/modules/if_l2tp/l2tp.ioconf:1.1
--- /dev/null	Thu Feb 16 08:23:36 2017
+++ src/sys/modules/if_l2tp/l2tp.ioconf	Thu Feb 16 08:23:35 2017
@@ -0,0 +1,7 @@
+#	$NetBSD: l2tp.ioconf,v 1.1 2017/02/16 08:23:35 knakahara Exp $
+
+ioconf		l2tp
+
+include		"conf/files"
+
+pseudo-device   l2tp

Index: src/sys/net/if_l2tp.c
diff -u /dev/null src/sys/net/if_l2tp.c:1.1
--- /dev/null	Thu Feb 16 08:23:36 2017
+++ src/sys/net/if_l2tp.c	Thu Feb 16 08:23:35 2017
@@ -0,0 +1,1502 @@
+/*	$NetBSD: if_l2tp.c,v 1.1 2017/02/16 08:23:35 knakahara Exp $	*/
+
+/*
+ * Copyright (c) 2017 Internet Initiative Japan Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * L2TPv3 kernel interface
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.1 2017/02/16 08:23:35 knakahara Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_inet.h"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#ifdef	INET
+#include 
+#include 
+#endif	/* INET */
+#ifdef INET6
+#include 
+#endif
+
+#include 
+
+#if NVLAN > 0
+#include 
+#endif
+
+/* TODO: IP_TCPMSS support */
+#undef IP_TCPMSS
+#ifdef IP_TCPMSS
+#include 
+#endif
+
+#include 
+#include 
+
+/*
+ * l2tp global variable definitions
+ */
+LIST_HEAD(l2tp_sclist, l2tp_softc);
+static struct {
+	struct l2tp_sclist list;
+	kmutex_t lock;
+} l2tp_softcs __cacheline_aligned;
+
+
+#if !defined(L2TP_ID_HASH_SIZE)
+#define L2TP_ID_HASH_SIZE 64
+#endif
+static struct {
+	kmutex_t lock;
+	struct pslist_head *lists;
+} l2tp_hash __cacheline_aligned = {
+	.lists = NULL,
+};
+
+pserialize_t l2tp_psz __read_mostly;
+struct psref_class *lv_psref_class __read_mostly;
+
+static void	l2tp_ro_init_pc(void *, void *, struct cpu_info *);
+static void	l2tp_ro_fini_pc(void *, void *, struct cpu_info *);
+
+static int	l2tp_clone_create(struct if_clone *, int);
+static int	l2tp_clone_destroy(struct ifnet *);
+
+struct if_clone l2tp_cloner =
+IF_CLONE_INITIALIZER("l2tp", l2tp_clone_create, l2tp_clone_destroy);
+
+static int	l2tp_output(struct ifnet *, 

CVS commit: src/sys/net

2017-02-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Feb 16 08:13:43 UTC 2017

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

Log Message:
support interface name which includes digit.


To generate a diff of this commit:
cvs rdiff -u -r1.378 -r1.379 src/sys/net/if.c

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

Modified files:

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.378 src/sys/net/if.c:1.379
--- src/sys/net/if.c:1.378	Wed Feb 15 01:48:44 2017
+++ src/sys/net/if.c	Thu Feb 16 08:13:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.378 2017/02/15 01:48:44 ozaki-r Exp $	*/
+/*	$NetBSD: if.c,v 1.379 2017/02/16 08:13:43 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.378 2017/02/15 01:48:44 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.379 2017/02/16 08:13:43 knakahara Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -188,6 +188,7 @@ struct psref_class		*ifa_psref_class __r
 
 static int	if_delroute_matcher(struct rtentry *, void *);
 
+static bool if_is_unit(const char *);
 static struct if_clone *if_clone_lookup(const char *, int *);
 
 static LIST_HEAD(, if_clone) if_cloners = LIST_HEAD_INITIALIZER(if_cloners);
@@ -1594,6 +1595,19 @@ if_clone_destroy(const char *name)
 	return (*ifc->ifc_destroy)(ifp);
 }
 
+static bool
+if_is_unit(const char *name)
+{
+
+	while(*name != '\0') {
+		if (*name < '0' || *name > '9')
+			return false;
+		name++;
+	}
+
+	return true;
+}
+
 /*
  * Look up a network interface cloner.
  */
@@ -1609,8 +1623,9 @@ if_clone_lookup(const char *name, int *u
 
 	strcpy(ifname, "if_");
 	/* separate interface name from unit */
+	/* TODO: search unit number from backward */
 	for (dp = ifname + 3, cp = name; cp - name < IFNAMSIZ &&
-	*cp && (*cp < '0' || *cp > '9');)
+	*cp && !if_is_unit(cp);)
 		*dp++ = *cp++;
 
 	if (cp == name || cp - name == IFNAMSIZ || !*cp)



CVS commit: src

2017-02-16 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Feb 16 08:12:44 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: mi
src/distrib/sets/lists/modules: mi
src/sys/conf: files
src/sys/modules: Makefile
src/sys/net: Makefile files.net if_bridge.c if_types.h
src/sys/netinet: Makefile in.h in_proto.c ip_var.h
src/sys/netinet6: Makefile in6_ifattach.c in6_proto.c

Log Message:
add l2tp(4) L2TPv3 interface.

originally implemented by IIJ SEIL team.


To generate a diff of this commit:
cvs rdiff -u -r1.2108 -r1.2109 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.107 -r1.108 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r1.1169 -r1.1170 src/sys/conf/files
cvs rdiff -u -r1.188 -r1.189 src/sys/modules/Makefile
cvs rdiff -u -r1.32 -r1.33 src/sys/net/Makefile
cvs rdiff -u -r1.12 -r1.13 src/sys/net/files.net
cvs rdiff -u -r1.132 -r1.133 src/sys/net/if_bridge.c
cvs rdiff -u -r1.26 -r1.27 src/sys/net/if_types.h
cvs rdiff -u -r1.27 -r1.28 src/sys/netinet/Makefile
cvs rdiff -u -r1.99 -r1.100 src/sys/netinet/in.h
cvs rdiff -u -r1.121 -r1.122 src/sys/netinet/in_proto.c
cvs rdiff -u -r1.116 -r1.117 src/sys/netinet/ip_var.h
cvs rdiff -u -r1.8 -r1.9 src/sys/netinet6/Makefile
cvs rdiff -u -r1.110 -r1.111 src/sys/netinet6/in6_ifattach.c
cvs rdiff -u -r1.115 -r1.116 src/sys/netinet6/in6_proto.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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2108 src/distrib/sets/lists/comp/mi:1.2109
--- src/distrib/sets/lists/comp/mi:1.2108	Wed Feb  8 03:44:40 2017
+++ src/distrib/sets/lists/comp/mi	Thu Feb 16 08:12:43 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2108 2017/02/08 03:44:40 kamil Exp $
+#	$NetBSD: mi,v 1.2109 2017/02/16 08:12:43 knakahara Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -2215,6 +2215,7 @@
 ./usr/include/net/if_hippi.h			comp-c-include
 ./usr/include/net/if_ieee1394.h			comp-c-include
 ./usr/include/net/if_ieee80211.h		comp-obsolete		obsolete
+./usr/include/net/if_l2tp.h			comp-c-include
 ./usr/include/net/if_llc.h			comp-c-include
 ./usr/include/net/if_media.h			comp-c-include
 ./usr/include/net/if_mpls.h			comp-c-include
@@ -2296,6 +2297,7 @@
 ./usr/include/netinet/igmp_var.h		comp-c-include
 ./usr/include/netinet/in.h			comp-c-include
 ./usr/include/netinet/in_gif.h			comp-c-include
+./usr/include/netinet/in_l2tp.h			comp-c-include
 ./usr/include/netinet/in_pcb.h			comp-c-include
 ./usr/include/netinet/in_pcb_hdr.h		comp-c-include
 ./usr/include/netinet/in_route.h		comp-obsolete		obsolete
@@ -2349,6 +2351,7 @@
 ./usr/include/netinet6/in6_gif.h		comp-c-include
 ./usr/include/netinet6/in6_ifattach.h		comp-c-include
 ./usr/include/netinet6/in6_pcb.h		comp-c-include
+./usr/include/netinet6/in6_l2tp.h		comp-c-include
 ./usr/include/netinet6/in6_var.h		comp-c-include
 ./usr/include/netinet6/ip6.h			comp-obsolete		obsolete
 ./usr/include/netinet6/ip6_mroute.h		comp-c-include

Index: src/distrib/sets/lists/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.107 src/distrib/sets/lists/modules/mi:1.108
--- src/distrib/sets/lists/modules/mi:1.107	Wed Jan  4 15:45:18 2017
+++ src/distrib/sets/lists/modules/mi	Thu Feb 16 08:12:43 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.107 2017/01/04 15:45:18 christos Exp $
+# $NetBSD: mi,v 1.108 2017/02/16 08:12:43 knakahara Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -150,6 +150,8 @@
 ./@MODULEDIR@/if_gif/if_gif.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/if_grebase-kernel-modules	kmod
 ./@MODULEDIR@/if_gre/if_gre.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/if_l2tpbase-kernel-modules	kmod
+./@MODULEDIR@/if_l2tp/if_l2tp.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/if_loopbase-kernel-modules	kmod
 ./@MODULEDIR@/if_loop/if_loop.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/if_mplsbase-kernel-modules	kmod

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1169 src/sys/conf/files:1.1170
--- src/sys/conf/files:1.1169	Thu Feb  2 19:50:35 2017
+++ src/sys/conf/files	Thu Feb 16 08:12:43 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1169 2017/02/02 19:50:35 macallan Exp $
+#	$NetBSD: files,v 1.1170 2017/02/16 08:12:43 knakahara Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20150846
@@ -120,6 +120,8 @@ defflag	opt_fileassoc.h		FILEASSOC
 
 defflag	opt_gre.h		GRE_DEBUG
 
+defparam opt_l2tp.h		L2TP_ID_HASH_SIZE
+
 # Write Ahead Physical Block Logging
 defflag opt_wapbl.h		WAPBL WAPBL_DEBUG
 defparam opt_wapbl.h		WAPBL_DEBUG_PRINT
@@ -1435,6 +1437,7 @@ defpseudo stf:		ifnet
 defpseudodev tap:	ifnet, ether, arp
 defpseudo carp:		ifnet, ether, arp
 defpseudodev etherip:	ifnet, ether, arp
+defpseudodev l2tp:	ifnet, ether, arp
 
 defpseudo sequencer
 defpseudo clockctl

Index: src/sys/modules/Makefile
diff -u 

CVS commit: src/tests/net

2017-02-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Feb 16 08:12:47 UTC 2017

Modified Files:
src/tests/net: net_common.sh
src/tests/net/net: t_mtudisc.sh

Log Message:
Use nc instead of ftp/httpd

ftp with rumphijack is unstable probably because ftp uses siglongjmp from
a signal hander. So stop using ftp and use nc instead. This fixes test
failures of t_mtudisc on some environments such as my development machine
(amd64) and anita on sparc64.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/net/net_common.sh
cvs rdiff -u -r1.8 -r1.9 src/tests/net/net/t_mtudisc.sh

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

Modified files:

Index: src/tests/net/net_common.sh
diff -u src/tests/net/net_common.sh:1.11 src/tests/net/net_common.sh:1.12
--- src/tests/net/net_common.sh:1.11	Tue Jan 10 05:55:34 2017
+++ src/tests/net/net_common.sh	Thu Feb 16 08:12:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: net_common.sh,v 1.11 2017/01/10 05:55:34 ozaki-r Exp $
+#	$NetBSD: net_common.sh,v 1.12 2017/02/16 08:12:47 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -29,7 +29,8 @@
 # Common utility functions for tests/net
 #
 
-HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so RUMPHIJACK=sysctl=yes"
+HIJACKING="env LD_PRELOAD=/usr/lib/librumphijack.so \
+RUMPHIJACK=path=/rump,socket=all:nolocal,sysctl=yes"
 
 extract_new_packets()
 {
@@ -132,6 +133,39 @@ stop_httpd()
 	fi
 }
 
+NC_PID=./.__nc.pid
+start_nc_server()
+{
+	local sock=$1
+	local port=$2
+	local outfile=$3
+	local backup=$RUMP_SERVER
+	local pid=
+
+	export RUMP_SERVER=$sock
+
+	env LD_PRELOAD=/usr/lib/librumphijack.so \
+	nc -l $port > $outfile &
+	pid=$!
+	echo $pid > $NC_PID
+
+	$DEBUG && rump.netstat -a -f inet
+
+	export RUMP_SERVER=$backup
+
+	sleep 1
+}
+
+stop_nc_server()
+{
+
+	if [ -f $NC_PID ]; then
+		kill -9 $(cat $NC_PID)
+		rm -f $NC_PID
+		sleep 1
+	fi
+}
+
 BASIC_LIBS="-lrumpnet -lrumpnet_net -lrumpnet_netinet \
 -lrumpnet_shmif -lrumpdev"
 FS_LIBS="$BASIC_LIBS -lrumpvfs -lrumpfs_ffs"

Index: src/tests/net/net/t_mtudisc.sh
diff -u src/tests/net/net/t_mtudisc.sh:1.8 src/tests/net/net/t_mtudisc.sh:1.9
--- src/tests/net/net/t_mtudisc.sh:1.8	Wed Dec 21 01:16:18 2016
+++ src/tests/net/net/t_mtudisc.sh	Thu Feb 16 08:12:47 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_mtudisc.sh,v 1.8 2016/12/21 01:16:18 ozaki-r Exp $
+#	$NetBSD: t_mtudisc.sh,v 1.9 2017/02/16 08:12:47 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -28,7 +28,6 @@
 SOCKLOCAL=unix://commsock1
 SOCKGATEWAY=unix://commsock2
 SOCKREMOTE=unix://commsock3
-HTML_FILE=index.html
 
 DEBUG=${DEBUG:-false}
 
@@ -37,7 +36,7 @@ atf_test_case mtudisc_basic cleanup
 mtudisc_basic_head()
 {
 	atf_set "descr" "Tests for IPv4 Path MTU Dicorvery basic behavior"
-	atf_set "require.progs" "rump_server"
+	atf_set "require.progs" "rump_server nc"
 }
 
 setup_server()
@@ -57,7 +56,7 @@ setup_server()
 	$DEBUG && rump.ifconfig $if
 }
 
-prepare_download_file()
+prepare_file()
 {
 	local file=$1
 	local data="0123456789"
@@ -69,17 +68,6 @@ prepare_download_file()
 	done
 }
 
-do_http_get()
-{
-	local ip=$1
-	local ret=$2
-	local timeout=5
-
-	# get the webpage
-	atf_check -s exit:$ret env LD_PRELOAD=/usr/lib/librumphijack.so	\
-	ftp -q $timeout -o ./out http://$ip/$HTML_FILE
-}
-
 mtudisc_basic_body()
 {
 	local pkt=
@@ -88,6 +76,10 @@ mtudisc_basic_body()
 	local gateway_remote_ip=10.0.1.1
 	local remote_ip=10.0.1.2
 	local prefixlen=24
+	local port=1234
+	local pid=
+	local file_send=./file.send
+	local file_recv=./file.recv
 
 	rump_server_start $SOCKLOCAL
 	rump_server_start $SOCKGATEWAY
@@ -96,9 +88,9 @@ mtudisc_basic_body()
 	#
 	# Setup servers
 	#
-	# [local server] [gateway server]  [remote server with httpd]
+	# [local server] [gateway server]  [remote server]
 	#   | 10.0.0.210.0.0.1 |  | 10.0.1.1   10.0.1.2 |
-	# shmif0(mtu=1500) - shmif1(mtu=1280)   shmif0(mtu=1500) - shmif0(mtu=1500)
+	# shmif0(mtu=1500) - shmif0(mtu=1500)   shmif1(mtu=1280) - shmif0(mtu=1500)
 	#
 
 	# Assign IP addresses
@@ -111,8 +103,7 @@ mtudisc_basic_body()
 	export RUMP_SERVER=$SOCKGATEWAY
 
 	# Set mtu of shmif0 to 1280
-	export RUMP_SERVER=$SOCKGATEWAY
-	atf_check -s exit:0 rump.ifconfig shmif0 mtu 1280
+	atf_check -s exit:0 rump.ifconfig shmif1 mtu 1280
 
 	# Enable IPv4 forwarding
 	atf_check -s exit:0 rump.sysctl -w -q net.inet.ip.forwarding=1
@@ -123,58 +114,61 @@ mtudisc_basic_body()
 	# Check default value
 	atf_check -s exit:0 -o match:"1" rump.sysctl -n net.inet.ip.mtudisc
 
-	# Start httpd daemon
-	prepare_download_file $HTML_FILE
-	start_httpd $SOCKREMOTE $remote_ip
-	$DEBUG && rump.netstat -a -f inet
-
-	# Teach the peer thar 10.0.0.2(local serer) is behind 10.0.1.1(gateway server)
+	# Teach the peer thar 10.0.0.2(local 

CVS commit: src/lib/librumphijack

2017-02-16 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Feb 16 08:08:01 UTC 2017

Modified Files:
src/lib/librumphijack: hijack.c

Log Message:
Support paccept for nc


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/lib/librumphijack/hijack.c

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

Modified files:

Index: src/lib/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.121 src/lib/librumphijack/hijack.c:1.122
--- src/lib/librumphijack/hijack.c:1.121	Fri Dec  2 20:53:36 2016
+++ src/lib/librumphijack/hijack.c	Thu Feb 16 08:08:01 2017
@@ -1,4 +1,4 @@
-/*  $NetBSD: hijack.c,v 1.121 2016/12/02 20:53:36 christos Exp $	*/
+/*  $NetBSD: hijack.c,v 1.122 2017/02/16 08:08:01 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -34,7 +34,7 @@
 #include 
 
 #if !defined(lint)
-__RCSID("$NetBSD: hijack.c,v 1.121 2016/12/02 20:53:36 christos Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.122 2017/02/16 08:08:01 ozaki-r Exp $");
 #endif
 
 #include 
@@ -89,7 +89,8 @@ __RCSID("$NetBSD: hijack.c,v 1.121 2016/
 enum dualcall {
 	DUALCALL_WRITE, DUALCALL_WRITEV, DUALCALL_PWRITE, DUALCALL_PWRITEV,
 	DUALCALL_IOCTL, DUALCALL_FCNTL,
-	DUALCALL_SOCKET, DUALCALL_ACCEPT, DUALCALL_BIND, DUALCALL_CONNECT,
+	DUALCALL_SOCKET, DUALCALL_ACCEPT, DUALCALL_PACCEPT,
+	DUALCALL_BIND, DUALCALL_CONNECT,
 	DUALCALL_GETPEERNAME, DUALCALL_GETSOCKNAME, DUALCALL_LISTEN,
 	DUALCALL_RECVFROM, DUALCALL_RECVMSG,
 	DUALCALL_SENDTO, DUALCALL_SENDMSG,
@@ -267,6 +268,7 @@ struct sysnames {
 } syscnames[] = {
 	{ DUALCALL_SOCKET,	S(REALSOCKET),	RSYS_NAME(SOCKET)	},
 	{ DUALCALL_ACCEPT,	"accept",	RSYS_NAME(ACCEPT)	},
+	{ DUALCALL_PACCEPT,	"paccept",	RSYS_NAME(PACCEPT)	},
 	{ DUALCALL_BIND,	"bind",		RSYS_NAME(BIND)		},
 	{ DUALCALL_CONNECT,	"connect",	RSYS_NAME(CONNECT)	},
 	{ DUALCALL_GETPEERNAME,	"getpeername",	RSYS_NAME(GETPEERNAME)	},
@@ -1334,6 +1336,35 @@ accept(int s, struct sockaddr *addr, soc
 	return fd;
 }
 
+int
+paccept(int s, struct sockaddr *addr, socklen_t *addrlen,
+const sigset_t * restrict sigmask, int flags)
+{
+	int (*op_paccept)(int, struct sockaddr *, socklen_t *,
+	const sigset_t * restrict, int);
+	int fd;
+	bool isrump;
+
+	isrump = fd_isrump(s);
+
+	DPRINTF(("paccept -> %d", s));
+	if (isrump) {
+		op_paccept = GETSYSCALL(rump, PACCEPT);
+		s = fd_host2rump(s);
+	} else {
+		op_paccept = GETSYSCALL(host, PACCEPT);
+	}
+	fd = op_paccept(s, addr, addrlen, sigmask, flags);
+	if (fd != -1 && isrump)
+		fd = fd_rump2host(fd);
+	else
+		fd = fd_host2host(fd);
+
+	DPRINTF((" <- %d\n", fd));
+
+	return fd;
+}
+
 /*
  * ioctl() and fcntl() are varargs calls and need special treatment.
  */



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

2017-02-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Feb 16 08:01:11 UTC 2017

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
 Do if_snd check even if IXGBE_LEGACY_TX is used. It's used by ALTQ.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.77 src/sys/dev/pci/ixgbe/ixgbe.c:1.78
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.77	Thu Feb 16 07:58:21 2017
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Feb 16 08:01:11 2017
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 302384 2016-07-07 03:39:18Z sbruno $*/
-/*$NetBSD: ixgbe.c,v 1.77 2017/02/16 07:58:21 msaitoh Exp $*/
+/*$NetBSD: ixgbe.c,v 1.78 2017/02/16 08:01:11 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1572,10 +1572,11 @@ ixgbe_handle_que(void *context)
 #ifndef IXGBE_LEGACY_TX
 		if (pcq_peek(txr->txr_interq) != NULL)
 			ixgbe_mq_start_locked(ifp, txr);
-#else
-		if (!IFQ_IS_EMPTY(>if_snd))
-			ixgbe_start_locked(txr, ifp);
 #endif
+		/* Only for queue 0 */
+		if ((>queues[0] == que)
+		&& (!IFQ_IS_EMPTY(>if_snd)))
+			ixgbe_start_locked(txr, ifp);
 		IXGBE_TX_UNLOCK(txr);
 	}
 

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.53 src/sys/dev/pci/ixgbe/ixv.c:1.54
--- src/sys/dev/pci/ixgbe/ixv.c:1.53	Mon Feb 13 10:37:37 2017
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Feb 16 08:01:11 2017
@@ -31,7 +31,7 @@
 
 **/
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 302384 2016-07-07 03:39:18Z sbruno $*/
-/*$NetBSD: ixv.c,v 1.53 2017/02/13 10:37:37 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.54 2017/02/16 08:01:11 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -886,10 +886,11 @@ ixv_handle_que(void *context)
 #ifndef IXGBE_LEGACY_TX
 		if (pcq_peek(txr->txr_interq) != NULL)
 			ixgbe_mq_start_locked(ifp, txr);
-#else
-		if (!IFQ_IS_EMPTY(>if_snd))
-			ixgbe_start_locked(txr, ifp);
 #endif
+		/* Only for queue 0 */
+		if ((>queues[0] == que)
+		&& (!IFQ_IS_EMPTY(>if_snd)))
+			ixgbe_start_locked(txr, ifp);
 		IXGBE_TX_UNLOCK(txr);
 		if (more) {
 			adapter->req.ev_count++;