CVS commit: src/usr.sbin/timed/timed

2018-01-15 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Jan 16 07:57:58 UTC 2018

Modified Files:
src/usr.sbin/timed/timed: slave.c timed-extern.h

Log Message:
Returns void, mark noreturn.

>From Eitan Adler in PR bin/52925


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/timed/timed/slave.c
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/timed/timed/timed-extern.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/timed/timed/slave.c
diff -u src/usr.sbin/timed/timed/slave.c:1.18 src/usr.sbin/timed/timed/slave.c:1.19
--- src/usr.sbin/timed/timed/slave.c:1.18	Fri Jan 26 16:12:41 2007
+++ src/usr.sbin/timed/timed/slave.c	Tue Jan 16 07:57:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: slave.c,v 1.18 2007/01/26 16:12:41 christos Exp $	*/
+/*	$NetBSD: slave.c,v 1.19 2018/01/16 07:57:58 maya Exp $	*/
 
 /*-
  * Copyright (c) 1985, 1993 The Regents of the University of California.
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)slave.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: slave.c,v 1.18 2007/01/26 16:12:41 christos Exp $");
+__RCSID("$NetBSD: slave.c,v 1.19 2018/01/16 07:57:58 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -56,7 +56,7 @@ static void schgdate(struct tsp *, char 
 static void setmaster(struct tsp *);
 static void answerdelay(void);
 
-int
+void
 slave(void)
 {
 	int tries;

Index: src/usr.sbin/timed/timed/timed-extern.h
diff -u src/usr.sbin/timed/timed/timed-extern.h:1.10 src/usr.sbin/timed/timed/timed-extern.h:1.11
--- src/usr.sbin/timed/timed/timed-extern.h:1.10	Wed Aug 31 13:32:41 2011
+++ src/usr.sbin/timed/timed/timed-extern.h	Tue Jan 16 07:57:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: timed-extern.h,v 1.10 2011/08/31 13:32:41 joerg Exp $	*/
+/*	$NetBSD: timed-extern.h,v 1.11 2018/01/16 07:57:58 maya Exp $	*/
 
 /*-
  * Copyright (c) 1993 The Regents of the University of California.
@@ -74,7 +74,7 @@ void	 print(struct tsp *, struct sockadd
 void	 prthp(clock_t);
 void	 rmnetmachs(struct netinfo *);
 void	 setstatus(void);
-int	 slave(void);
+void	 slave(void) __dead;
 void	 slaveack(void);
 void	 spreadtime(void);
 void	 suppress(struct sockaddr_in *, char *, struct netinfo *);



CVS commit: src/sys/netinet6

2018-01-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Jan 16 07:56:55 UTC 2018

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

Log Message:
Revert "Work around softnet_lock handling" as per pgoyette@'s request

We should avoid if (mutex_owned(softnet_lock)).


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/netinet6/nd6_nbr.c

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

Modified files:

Index: src/sys/netinet6/nd6_nbr.c
diff -u src/sys/netinet6/nd6_nbr.c:1.142 src/sys/netinet6/nd6_nbr.c:1.143
--- src/sys/netinet6/nd6_nbr.c:1.142	Wed Jan 10 07:34:31 2018
+++ src/sys/netinet6/nd6_nbr.c	Tue Jan 16 07:56:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6_nbr.c,v 1.142 2018/01/10 07:34:31 ozaki-r Exp $	*/
+/*	$NetBSD: nd6_nbr.c,v 1.143 2018/01/16 07:56:55 ozaki-r Exp $	*/
 /*	$KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.142 2018/01/10 07:34:31 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.143 2018/01/16 07:56:55 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1097,11 +1097,7 @@ nd6_dad_stoptimer(struct dadq *dp)
 #ifdef NET_MPSAFE
 	callout_halt(>dad_timer_ch, NULL);
 #else
-	/* XXX still need the trick for softnet_lock */
-	if (mutex_owned(softnet_lock))
-		callout_halt(>dad_timer_ch, softnet_lock);
-	else
-		callout_halt(>dad_timer_ch, NULL);
+	callout_halt(>dad_timer_ch, softnet_lock);
 #endif
 }
 



CVS commit: src/sys/net80211

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jan 16 07:53:02 UTC 2018

Modified Files:
src/sys/net80211: ieee80211_input.c ieee80211_var.h

Log Message:
Start cleaning up this mess.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/net80211/ieee80211_input.c
cvs rdiff -u -r1.31 -r1.32 src/sys/net80211/ieee80211_var.h

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

Modified files:

Index: src/sys/net80211/ieee80211_input.c
diff -u src/sys/net80211/ieee80211_input.c:1.91 src/sys/net80211/ieee80211_input.c:1.92
--- src/sys/net80211/ieee80211_input.c:1.91	Sun Dec 10 08:56:23 2017
+++ src/sys/net80211/ieee80211_input.c	Tue Jan 16 07:53:02 2018
@@ -1,5 +1,6 @@
-/*	$NetBSD: ieee80211_input.c,v 1.91 2017/12/10 08:56:23 maxv Exp $	*/
-/*-
+/*	$NetBSD: ieee80211_input.c,v 1.92 2018/01/16 07:53:02 maxv Exp $	*/
+
+/*
  * Copyright (c) 2001 Atsushi Onoe
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
  * All rights reserved.
@@ -36,16 +37,13 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.91 2017/12/10 08:56:23 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.92 2018/01/16 07:53:02 maxv Exp $");
 #endif
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
 #endif
 
-#ifdef __NetBSD__
-#endif /* __NetBSD__ */
-
 #include 
 #include 
 #include 
@@ -138,7 +136,7 @@ static struct mbuf *ieee80211_defrag(str
 	struct ieee80211_node *, struct mbuf *, int);
 static struct mbuf *ieee80211_decap(struct ieee80211com *, struct mbuf *, int);
 static void ieee80211_send_error(struct ieee80211com *, struct ieee80211_node *,
-		const u_int8_t *mac, int subtype, int arg);
+	const u_int8_t *mac, int subtype, int arg);
 static void ieee80211_deliver_data(struct ieee80211com *,
 	struct ieee80211_node *, struct mbuf *);
 #ifndef IEEE80211_NO_HOSTAP
@@ -172,7 +170,6 @@ ieee80211_input(struct ieee80211com *ic,
 	struct ether_header *eh;
 	int hdrspace;
 	u_int8_t dir, type, subtype;
-	u_int8_t *bssid;
 	u_int16_t rxseq;
 	IEEE80211_DEBUGVAR(char ebuf[3 * ETHER_ADDR_LEN]);
 
@@ -187,6 +184,7 @@ ieee80211_input(struct ieee80211com *ic,
 		m->m_flags &= ~M_HASFCS;
 	}
 	type = -1;			/* undefined */
+
 	/*
 	 * In monitor mode, send everything directly to bpf.
 	 * XXX may want to include the CRC
@@ -201,6 +199,7 @@ ieee80211_input(struct ieee80211com *ic,
 		ic->ic_stats.is_rx_tooshort++;
 		goto out;
 	}
+
 	/*
 	 * Bit of a cheat here, we use a pointer for a 3-address
 	 * frame format but don't reference fields past outside
@@ -220,7 +219,10 @@ ieee80211_input(struct ieee80211com *ic,
 	dir = wh->i_fc[1] & IEEE80211_FC1_DIR_MASK;
 	type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
 	subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
+
 	if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) {
+		u_int8_t *bssid;
+
 		switch (ic->ic_opmode) {
 		case IEEE80211_M_STA:
 			bssid = wh->i_addr2;
@@ -234,11 +236,12 @@ ieee80211_input(struct ieee80211com *ic,
 goto out;
 			}
 
-			/* Filter out packets not directed to us in case the
-			 * device is in promiscous mode
+			/*
+			 * Filter out packets not directed to us in case the
+			 * device is in promiscuous mode
 			 */
-			if ((! IEEE80211_IS_MULTICAST(wh->i_addr1))
-			&& (! IEEE80211_ADDR_EQ(wh->i_addr1, ic->ic_myaddr))) {
+			if (!IEEE80211_IS_MULTICAST(wh->i_addr1) &&
+			!IEEE80211_ADDR_EQ(wh->i_addr1, ic->ic_myaddr)) {
 IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_INPUT,
 bssid, NULL, "not to cur sta: lladdr=%6D, addr1=%6D",
 ic->ic_myaddr, ":", wh->i_addr1, ":");
@@ -246,6 +249,7 @@ ieee80211_input(struct ieee80211com *ic,
 goto out;
 			}
 			break;
+
 		case IEEE80211_M_IBSS:
 		case IEEE80211_M_AHDEMO:
 		case IEEE80211_M_HOSTAP:
@@ -266,6 +270,7 @@ ieee80211_input(struct ieee80211com *ic,
 			}
 			if (type != IEEE80211_FC0_TYPE_DATA)
 break;
+
 			/*
 			 * Data frame, validate the bssid.
 			 */
@@ -283,9 +288,11 @@ ieee80211_input(struct ieee80211com *ic,
 ic->ic_stats.is_rx_wrongbss++;
 goto out;
 			}
+
 			/*
 			 * For adhoc mode we cons up a node when it doesn't
-			 * exist. This should probably done after an ACL check.
+			 * exist. This should probably be done after an ACL
+			 * check.
 			 */
 			if (ni == ic->ic_bss &&
 			ic->ic_opmode != IEEE80211_M_HOSTAP &&
@@ -295,35 +302,45 @@ ieee80211_input(struct ieee80211com *ic,
  * discovered member of the IBSS.
  */
 ni = ieee80211_fakeup_adhoc_node(>ic_sta,
-		wh->i_addr2);
+wh->i_addr2);
 if (ni == NULL) {
 	/* NB: stat kept for alloc failure */
 	goto err;
 }
 			}
 			break;
+
 		default:
 			goto out;
 		}
+
 		ni->ni_rssi = rssi;
 		ni->ni_rstamp = rstamp;
+
 		if (HAS_SEQ(type) && (ic->ic_opmode != IEEE80211_M_STA ||
 		!IEEE80211_IS_MULTICAST(wh->i_addr1))) {
 			u_int8_t tid, 

CVS commit: src/sys

2018-01-15 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Jan 16 07:34:12 UTC 2018

Modified Files:
src/sys/modules/if_agr: Makefile
src/sys/net/agr: if_agr.c

Log Message:
Fix agr(4) module build. Reviewed by pgoyette@n.o, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/if_agr/Makefile
cvs rdiff -u -r1.44 -r1.45 src/sys/net/agr/if_agr.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/modules/if_agr/Makefile
diff -u src/sys/modules/if_agr/Makefile:1.1 src/sys/modules/if_agr/Makefile:1.2
--- src/sys/modules/if_agr/Makefile:1.1	Sun Aug  7 14:27:38 2016
+++ src/sys/modules/if_agr/Makefile	Tue Jan 16 07:34:12 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2016/08/07 14:27:38 christos Exp $
+# $NetBSD: Makefile,v 1.2 2018/01/16 07:34:12 knakahara Exp $
 
 .include "../Makefile.inc"
 
@@ -25,6 +25,6 @@ if_agrsoftc.c \
 if_agrsubr.c \
 if_agrtimer.c 
 
-CPPFLAGS+=	-DINET
+CPPFLAGS+=	-DINET -DNVLAN=1
 
 .include 

Index: src/sys/net/agr/if_agr.c
diff -u src/sys/net/agr/if_agr.c:1.44 src/sys/net/agr/if_agr.c:1.45
--- src/sys/net/agr/if_agr.c:1.44	Mon Jan 15 11:16:04 2018
+++ src/sys/net/agr/if_agr.c	Tue Jan 16 07:34:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_agr.c,v 1.44 2018/01/15 11:16:04 maxv Exp $	*/
+/*	$NetBSD: if_agr.c,v 1.45 2018/01/16 07:34:12 knakahara Exp $	*/
 
 /*-
  * Copyright (c)2005 YAMAMOTO Takashi,
@@ -27,13 +27,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.44 2018/01/15 11:16:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.45 2018/01/16 07:34:12 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
-#endif
-
 #include "vlan.h"
+#endif
 
 #include 
 #include 
@@ -1168,4 +1167,4 @@ agrport_config_promisc(struct agr_port *
  */
 #include 
 
-IF_MODULE(MODULE_CLASS_DRIVER, agr, "")
+IF_MODULE(MODULE_CLASS_DRIVER, agr, "if_vlan")



CVS commit: src/sys/dev/pci

2018-01-15 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Jan 16 07:23:13 UTC 2018

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

Log Message:
Fix wm_watchdog_txq() lock region.

Not only wm_txeof() but also wm_watchdog_txq() itself requires txq_lock
as it reads Tx descriptor management variables such as "txq_free".

There is almost no influence on performance.


To generate a diff of this commit:
cvs rdiff -u -r1.554 -r1.555 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.554 src/sys/dev/pci/if_wm.c:1.555
--- src/sys/dev/pci/if_wm.c:1.554	Mon Jan 15 04:25:48 2018
+++ src/sys/dev/pci/if_wm.c	Tue Jan 16 07:23:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.554 2018/01/15 04:25:48 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.555 2018/01/16 07:23:13 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.554 2018/01/15 04:25:48 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.555 2018/01/16 07:23:13 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -671,6 +671,7 @@ static bool	wm_suspend(device_t, const p
 static bool	wm_resume(device_t, const pmf_qual_t *);
 static void	wm_watchdog(struct ifnet *);
 static void	wm_watchdog_txq(struct ifnet *, struct wm_txqueue *);
+static void	wm_watchdog_txq_locked(struct ifnet *, struct wm_txqueue *);
 static void	wm_tick(void *);
 static int	wm_ifflags_cb(struct ethercom *);
 static int	wm_ioctl(struct ifnet *, u_long, void *);
@@ -2953,15 +2954,24 @@ wm_watchdog(struct ifnet *ifp)
 static void
 wm_watchdog_txq(struct ifnet *ifp, struct wm_txqueue *txq)
 {
+
+	mutex_enter(txq->txq_lock);
+	wm_watchdog_txq_locked(ifp, txq);
+	mutex_exit(txq->txq_lock);
+}
+
+static void
+wm_watchdog_txq_locked(struct ifnet *ifp, struct wm_txqueue *txq)
+{
 	struct wm_softc *sc = ifp->if_softc;
 
+	KASSERT(mutex_owned(txq->txq_lock));
+
 	/*
 	 * Since we're using delayed interrupts, sweep up
 	 * before we report an error.
 	 */
-	mutex_enter(txq->txq_lock);
 	wm_txeof(sc, txq);
-	mutex_exit(txq->txq_lock);
 
 	if (txq->txq_free != WM_NTXDESC(txq)) {
 #ifdef WM_DEBUG



CVS commit: src/sys/dev/pci

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jan 16 07:05:25 UTC 2018

Modified Files:
src/sys/dev/pci: if_ipw.c if_iwi.c if_iwn.c

Log Message:
Fix overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/pci/if_ipw.c
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/pci/if_iwi.c
cvs rdiff -u -r1.86 -r1.87 src/sys/dev/pci/if_iwn.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_ipw.c
diff -u src/sys/dev/pci/if_ipw.c:1.66 src/sys/dev/pci/if_ipw.c:1.67
--- src/sys/dev/pci/if_ipw.c:1.66	Mon Oct 23 09:31:18 2017
+++ src/sys/dev/pci/if_ipw.c	Tue Jan 16 07:05:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipw.c,v 1.66 2017/10/23 09:31:18 msaitoh Exp $	*/
+/*	$NetBSD: if_ipw.c,v 1.67 2018/01/16 07:05:24 maxv Exp $	*/
 /*	FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.15 2005/11/13 17:17:40 damien Exp 	*/
 
 /*-
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.66 2017/10/23 09:31:18 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.67 2018/01/16 07:05:24 maxv Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2100 MiniPCI driver
@@ -1001,12 +1001,13 @@ ipw_fix_channel(struct ieee80211com *ic,
 	efrm = mtod(m, uint8_t *) + m->m_len;
 
 	frm += 12;	/* skip tstamp, bintval and capinfo fields */
-	while (frm < efrm) {
-		if (*frm == IEEE80211_ELEMID_DSPARMS)
+	while (frm + 2 < efrm) {
+		if (*frm == IEEE80211_ELEMID_DSPARMS) {
 #if IEEE80211_CHAN_MAX < 255
-		if (frm[2] <= IEEE80211_CHAN_MAX)
+			if (frm[2] <= IEEE80211_CHAN_MAX)
 #endif
-			ic->ic_curchan = >ic_channels[frm[2]];
+ic->ic_curchan = >ic_channels[frm[2]];
+		}
 
 		frm += frm[1] + 2;
 	}

Index: src/sys/dev/pci/if_iwi.c
diff -u src/sys/dev/pci/if_iwi.c:1.104 src/sys/dev/pci/if_iwi.c:1.105
--- src/sys/dev/pci/if_iwi.c:1.104	Mon Oct 23 09:28:13 2017
+++ src/sys/dev/pci/if_iwi.c	Tue Jan 16 07:05:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwi.c,v 1.104 2017/10/23 09:28:13 msaitoh Exp $  */
+/*	$NetBSD: if_iwi.c,v 1.105 2018/01/16 07:05:24 maxv Exp $  */
 /*	$OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $	*/
 
 /*-
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.104 2017/10/23 09:28:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.105 2018/01/16 07:05:24 maxv Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@@ -1126,12 +1126,13 @@ iwi_fix_channel(struct ieee80211com *ic,
 	efrm = mtod(m, uint8_t *) + m->m_len;
 
 	frm += 12;	/* skip tstamp, bintval and capinfo fields */
-	while (frm < efrm) {
-		if (*frm == IEEE80211_ELEMID_DSPARMS)
+	while (frm + 2 < efrm) {
+		if (*frm == IEEE80211_ELEMID_DSPARMS) {
 #if IEEE80211_CHAN_MAX < 255
-		if (frm[2] <= IEEE80211_CHAN_MAX)
+			if (frm[2] <= IEEE80211_CHAN_MAX)
 #endif
-			ic->ic_curchan = >ic_channels[frm[2]];
+ic->ic_curchan = >ic_channels[frm[2]];
+		}
 
 		frm += frm[1] + 2;
 	}

Index: src/sys/dev/pci/if_iwn.c
diff -u src/sys/dev/pci/if_iwn.c:1.86 src/sys/dev/pci/if_iwn.c:1.87
--- src/sys/dev/pci/if_iwn.c:1.86	Mon Oct 23 09:31:18 2017
+++ src/sys/dev/pci/if_iwn.c	Tue Jan 16 07:05:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwn.c,v 1.86 2017/10/23 09:31:18 msaitoh Exp $	*/
+/*	$NetBSD: if_iwn.c,v 1.87 2018/01/16 07:05:24 maxv Exp $	*/
 /*	$OpenBSD: if_iwn.c,v 1.135 2014/09/10 07:22:09 dcoppa Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  * adapters.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.86 2017/10/23 09:31:18 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.87 2018/01/16 07:05:24 maxv Exp $");
 
 #define IWN_USE_RBUF	/* Use local storage for RX */
 #undef IWN_HWCRYPTO	/* XXX does not even compile yet */
@@ -6607,12 +6607,13 @@ iwn_fix_channel(struct ieee80211com *ic,
 	efrm = mtod(m, uint8_t *) + m->m_len;
 
 	frm += 12;  /* skip tstamp, bintval and capinfo fields */
-	while (frm < efrm) {
-		if (*frm == IEEE80211_ELEMID_DSPARMS)
+	while (frm + 2 < efrm) {
+		if (*frm == IEEE80211_ELEMID_DSPARMS) {
 #if IEEE80211_CHAN_MAX < 255
-		if (frm[2] <= IEEE80211_CHAN_MAX)
+			if (frm[2] <= IEEE80211_CHAN_MAX)
 #endif
-			ic->ic_curchan = >ic_channels[frm[2]];
+ic->ic_curchan = >ic_channels[frm[2]];
+		}
 
 		frm += frm[1] + 2;
 	}



CVS commit: src/games/bcd

2018-01-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 16 06:43:53 UTC 2018

Modified Files:
src/games/bcd: bcd.6

Log Message:
Neither bcd(6) nor morse(6) produce output containing slashes, and the
-d (decode) option works just fine with dashes.  :)


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/games/bcd/bcd.6

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

Modified files:

Index: src/games/bcd/bcd.6
diff -u src/games/bcd/bcd.6:1.16 src/games/bcd/bcd.6:1.17
--- src/games/bcd/bcd.6:1.16	Thu Aug  7 09:37:04 2003
+++ src/games/bcd/bcd.6	Tue Jan 16 06:43:53 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bcd.6,v 1.16 2003/08/07 09:37:04 agc Exp $
+.\"	$NetBSD: bcd.6,v 1.17 2018/01/16 06:43:53 pgoyette Exp $
 .\"
 .\" Copyright (c) 1988, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)bcd.6	8.1 (Berkeley) 5/31/93
 .\"
-.Dd November 26, 2002
+.Dd January 9, 2018
 .Dt BCD 6
 .Os
 .Sh NAME
@@ -65,7 +65,7 @@ Decode
 .Nm ppt
 output, or
 .Nm morse
-output consisting of dots and slashes (as generated by using the
+output consisting of dots and dashes (as generated by using the
 .Fl s
 option).
 .El



CVS commit: src/sys/net

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jan 16 06:38:42 UTC 2018

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

Log Message:
style


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/sys/net/if_gre.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_gre.c
diff -u src/sys/net/if_gre.c:1.171 src/sys/net/if_gre.c:1.172
--- src/sys/net/if_gre.c:1.171	Sun Oct  2 14:17:07 2016
+++ src/sys/net/if_gre.c	Tue Jan 16 06:38:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.c,v 1.171 2016/10/02 14:17:07 christos Exp $ */
+/*	$NetBSD: if_gre.c,v 1.172 2018/01/16 06:38:42 maxv Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.171 2016/10/02 14:17:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.172 2018/01/16 06:38:42 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_atalk.h"
@@ -155,8 +155,7 @@ static int gre_clone_destroy(struct ifne
 static struct if_clone gre_cloner =
 IF_CLONE_INITIALIZER("gre", gre_clone_create, gre_clone_destroy);
 
-static int gre_input(struct gre_softc *, struct mbuf *, int,
-const struct gre_h *);
+static int gre_input(struct gre_softc *, struct mbuf *, const struct gre_h *);
 static bool gre_is_nullconf(const struct gre_soparm *);
 static int gre_output(struct ifnet *, struct mbuf *,
 			   const struct sockaddr *, const struct rtentry *);
@@ -327,11 +326,14 @@ gre_clone_create(struct if_clone *ifc, i
 	atomic_inc_uint(_count);
 	return 0;
 
-fail1:	cv_destroy(>sc_fp_condvar);
+fail1:
+	cv_destroy(>sc_fp_condvar);
 	cv_destroy(>sc_condvar);
 	mutex_destroy(>sc_mtx);
 	free(sc, M_DEVBUF);
-fail0:	return -1;
+
+fail0:
+	return -1;
 }
 
 static int
@@ -403,7 +405,7 @@ gre_receive(struct socket *so, void *arg
 	}
 	gh = mtod(m, const struct gre_h *);
 
-	if (gre_input(sc, m, 0, gh) == 0) {
+	if (gre_input(sc, m, gh) == 0) {
 		sc->sc_unsupp_ev.ev_count++;
 		GRE_DPRINTF(sc, "dropping unsupported\n");
 		m_freem(m);
@@ -783,19 +785,19 @@ shutdown:
 }
 
 static int
-gre_input(struct gre_softc *sc, struct mbuf *m, int hlen,
-const struct gre_h *gh)
+gre_input(struct gre_softc *sc, struct mbuf *m, const struct gre_h *gh)
 {
 	pktqueue_t *pktq = NULL;
 	struct ifqueue *ifq = NULL;
 	uint16_t flags;
 	uint32_t af;		/* af passed to BPF tap */
 	int isr = 0, s;
+	int hlen;
 
 	sc->sc_if.if_ipackets++;
 	sc->sc_if.if_ibytes += m->m_pkthdr.len;
 
-	hlen += sizeof(struct gre_h);
+	hlen = sizeof(struct gre_h);
 
 	/* process GRE flags as packet can be of variable len */
 	flags = ntohs(gh->flags);
@@ -850,7 +852,7 @@ gre_input(struct gre_softc *sc, struct m
 	if (hlen > m->m_pkthdr.len) {
 		m_freem(m);
 		sc->sc_if.if_ierrors++;
-		return EINVAL;
+		return 1;
 	}
 	m_adj(m, hlen);
 
@@ -885,13 +887,15 @@ gre_input(struct gre_softc *sc, struct m
  */
 static int
 gre_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
-	   const struct rtentry *rt)
+const struct rtentry *rt)
 {
 	int error = 0;
 	struct gre_softc *sc = ifp->if_softc;
 	struct gre_h *gh;
 	uint16_t etype = 0;
 
+	KASSERT((m->m_flags & M_PKTHDR) != 0);
+
 	if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
 		m_freem(m);
 		error = ENETDOWN;
@@ -906,7 +910,8 @@ gre_output(struct ifnet *ifp, struct mbu
 	switch (dst->sa_family) {
 #ifdef INET
 	case AF_INET:
-		/* TBD Extract the IP ToS field and set the
+		/*
+		 * TBD Extract the IP ToS field and set the
 		 * encapsulating protocol's ToS to suit.
 		 */
 		etype = htons(ETHERTYPE_IP);
@@ -930,12 +935,12 @@ gre_output(struct ifnet *ifp, struct mbu
 	}
 
 #ifdef MPLS
-		if (rt != NULL && rt_gettag(rt) != NULL) {
-			union mpls_shim msh;
-			msh.s_addr = MPLS_GETSADDR(rt);
-			if (msh.shim.label != MPLS_LABEL_IMPLNULL)
-etype = htons(ETHERTYPE_MPLS);
-		}
+	if (rt != NULL && rt_gettag(rt) != NULL) {
+		union mpls_shim msh;
+		msh.s_addr = MPLS_GETSADDR(rt);
+		if (msh.shim.label != MPLS_LABEL_IMPLNULL)
+			etype = htons(ETHERTYPE_MPLS);
+	}
 #endif
 
 	M_PREPEND(m, sizeof(*gh), M_DONTWAIT);
@@ -964,7 +969,8 @@ gre_output(struct ifnet *ifp, struct mbu
 		m_freem(m);
 	} else
 		softint_schedule(sc->sc_si);
-  end:
+
+end:
 	if (error)
 		ifp->if_oerrors++;
 	return error;
@@ -1444,7 +1450,7 @@ greattach(int count)
 
 	/*
 	 * Nothing to do here, initialization is handled by the
-	 * module initialization code in greinit() below).
+	 * module initialization code in greinit() below.
 	 */
 }
 



CVS commit: src/games/morse

2018-01-15 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Jan 16 06:20:24 UTC 2018

Modified Files:
src/games/morse: morse.c

Log Message:
Add _, from Eitan Adler in PR bin/52897


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/games/morse/morse.c

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

Modified files:

Index: src/games/morse/morse.c
diff -u src/games/morse/morse.c:1.17 src/games/morse/morse.c:1.18
--- src/games/morse/morse.c:1.17	Tue Jun 19 05:46:08 2012
+++ src/games/morse/morse.c	Tue Jan 16 06:20:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: morse.c,v 1.17 2012/06/19 05:46:08 dholland Exp $	*/
+/*	$NetBSD: morse.c,v 1.18 2018/01/16 06:20:24 maya Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)morse.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: morse.c,v 1.17 2012/06/19 05:46:08 dholland Exp $");
+__RCSID("$NetBSD: morse.c,v 1.18 2018/01/16 06:20:24 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -107,6 +107,7 @@ static const struct punc {
 	{ '"', ".-..-." },
 	{ '=', "-...-" },
 	{ '+', ".-.-." },
+	{ '_', "..--.-" },
 	{ '\0', NULL }
 };
 



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

2018-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan 15 22:38:01 UTC 2018

Modified Files:
src/sys/arch/amd64/stand/prekern: prekern.h

Log Message:
avoid typedef redefinitiones


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/amd64/stand/prekern/prekern.h

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

Modified files:

Index: src/sys/arch/amd64/stand/prekern/prekern.h
diff -u src/sys/arch/amd64/stand/prekern/prekern.h:1.18 src/sys/arch/amd64/stand/prekern/prekern.h:1.19
--- src/sys/arch/amd64/stand/prekern/prekern.h:1.18	Sun Nov 26 06:01:09 2017
+++ src/sys/arch/amd64/stand/prekern/prekern.h	Mon Jan 15 17:38:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: prekern.h,v 1.18 2017/11/26 11:01:09 maxv Exp $	*/
+/*	$NetBSD: prekern.h,v 1.19 2018/01/15 22:38:01 christos Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -38,9 +38,6 @@
 #include "redef.h"
 
 #define ASSERT(a) if (!(a)) fatal("ASSERT");
-typedef uint64_t paddr_t;
-typedef uint64_t vaddr_t;
-typedef uint64_t pt_entry_t;
 typedef uint64_t pte_prot_t;
 #define WHITE_ON_BLACK 0x07
 #define RED_ON_BLACK 0x04



CVS commit: src/usr.bin/xlint/lint1

2018-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan 15 22:14:24 UTC 2018

Modified Files:
src/usr.bin/xlint/lint1: err.c

Log Message:
fix indent


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/xlint/lint1/err.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.51 src/usr.bin/xlint/lint1/err.c:1.52
--- src/usr.bin/xlint/lint1/err.c:1.51	Fri Aug 19 06:19:45 2016
+++ src/usr.bin/xlint/lint1/err.c	Mon Jan 15 17:14:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.c,v 1.51 2016/08/19 10:19:45 christos Exp $	*/
+/*	$NetBSD: err.c,v 1.52 2018/01/15 22:14:24 christos Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.51 2016/08/19 10:19:45 christos Exp $");
+__RCSID("$NetBSD: err.c,v 1.52 2018/01/15 22:14:24 christos Exp $");
 #endif
 
 #include 
@@ -163,11 +163,11 @@ const	char *msgs[] = {
 	"undefined struct/union member: %s",			  /* 101 */
 	"illegal member use: %s",  /* 102 */
 	"left operand of '.' must be struct/union object",	  /* 103 */
-	"left operand of '->' must be pointer to struct/union and is %s",	/* 104 */
+	"left operand of '->' must be pointer to struct/union not %s",/* 104 */
 	"non-unique member requires struct/union %s",		  /* 105 */
 	"left operand of '->' must be pointer",			  /* 106 */
-	"operands of '%s' have incompatible types (%s != %s)",		  /* 107 */
-	"operand of '%s' has incompatible type (%s != %s)",		  /* 108 */
+	"operands of '%s' have incompatible types (%s != %s)",	  /* 107 */
+	"operand of '%s' has incompatible type (%s != %s)",	  /* 108 */
 	"void type illegal in expression",			  /* 109 */
 	"pointer to function is not allowed here",		  /* 110 */
 	"unacceptable operand of '%s'",  /* 111 */



CVS commit: src/usr.bin/xlint/lint1

2018-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan 15 21:58:55 UTC 2018

Modified Files:
src/usr.bin/xlint/lint1: cgram.y scan.l

Log Message:
Add a _Noreturn token


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.79 -r1.80 src/usr.bin/xlint/lint1/scan.l

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

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.94 src/usr.bin/xlint/lint1/cgram.y:1.95
--- src/usr.bin/xlint/lint1/cgram.y:1.94	Mon Mar  6 16:01:39 2017
+++ src/usr.bin/xlint/lint1/cgram.y	Mon Jan 15 16:58:54 2018
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.94 2017/03/06 21:01:39 christos Exp $ */
+/* $NetBSD: cgram.y,v 1.95 2018/01/15 21:58:54 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.94 2017/03/06 21:01:39 christos Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.95 2018/01/15 21:58:54 christos Exp $");
 #endif
 
 #include 
@@ -117,7 +117,7 @@ anonymize(sym_t *s)
 }
 %}
 
-%expect 107
+%expect 138
 
 %union {
 	int	y_int;
@@ -165,6 +165,7 @@ anonymize(sym_t *s)
 %token			T_REAL
 %token			T_IMAG
 %token			T_GENERIC
+%token			T_NORETURN
 
 /* storage classes (extern, static, auto, register and typedef) */
 %token			T_SCLASS
@@ -576,6 +577,8 @@ type_attribute:
 	| T_PACKED {
 		addpacked();
 	}
+	| T_NORETURN {
+	}
 	;
 
 type_attribute_list:

Index: src/usr.bin/xlint/lint1/scan.l
diff -u src/usr.bin/xlint/lint1/scan.l:1.79 src/usr.bin/xlint/lint1/scan.l:1.80
--- src/usr.bin/xlint/lint1/scan.l:1.79	Mon Mar  6 16:01:39 2017
+++ src/usr.bin/xlint/lint1/scan.l	Mon Jan 15 16:58:54 2018
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: scan.l,v 1.79 2017/03/06 21:01:39 christos Exp $ */
+/* $NetBSD: scan.l,v 1.80 2018/01/15 21:58:54 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: scan.l,v 1.79 2017/03/06 21:01:39 christos Exp $");
+__RCSID("$NetBSD: scan.l,v 1.80 2018/01/15 21:58:54 christos Exp $");
 #endif
 
 #include 
@@ -208,6 +208,7 @@ static	struct	kwtab {
 	{ "_Bool",	T_TYPE,		0,	BOOL,	0,	  0,1,0,0,1 },
 	{ "_Complex",	T_TYPE,		0,	COMPLEX,0,	  0,1,0,0,1 },
 	{ "_Generic",	T_GENERIC,	0,	0,	0,	  0,1,0,0,1 },
+	{ "_Noreturn",	T_NORETURN,	0,	0,	0,	  0,1,0,0,1 },
 	{ "alias",	T_AT_ALIAS,	0,	0,	0,	  0,0,1,1,5 },
 	{ "aligned",	T_AT_ALIGNED,	0,	0,	0,	  0,0,1,1,5 },
 	{ "alignof",	T_ALIGNOF,	0,	0,	0,	  0,0,0,0,4 },



CVS commit: src/sys/arch/sparc/sparc

2018-01-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Jan 15 21:25:25 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc: cache.c

Log Message:
vcache_flush_* event counters are not interrupt type.  mark them misc.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/sparc/sparc/cache.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/sparc/sparc/cache.c
diff -u src/sys/arch/sparc/sparc/cache.c:1.98 src/sys/arch/sparc/sparc/cache.c:1.99
--- src/sys/arch/sparc/sparc/cache.c:1.98	Fri Dec  1 22:57:07 2017
+++ src/sys/arch/sparc/sparc/cache.c	Mon Jan 15 21:25:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.c,v 1.98 2017/12/01 22:57:07 mrg Exp $ */
+/*	$NetBSD: cache.c,v 1.99 2018/01/15 21:25:25 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.98 2017/12/01 22:57:07 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.99 2018/01/15 21:25:25 mrg Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_sparc_arch.h"
@@ -78,19 +78,19 @@ __KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.
 #include 
 
 struct evcnt vcache_flush_pg =
-	EVCNT_INITIALIZER(EVCNT_TYPE_INTR,0,"vcfl","pg");
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC,0,"vcfl","pg");
 EVCNT_ATTACH_STATIC(vcache_flush_pg);
 struct evcnt vcache_flush_seg =
-	EVCNT_INITIALIZER(EVCNT_TYPE_INTR,0,"vcfl","seg");
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC,0,"vcfl","seg");
 EVCNT_ATTACH_STATIC(vcache_flush_seg);
 struct evcnt vcache_flush_reg =
-	EVCNT_INITIALIZER(EVCNT_TYPE_INTR,0,"vcfl","reg");
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC,0,"vcfl","reg");
 EVCNT_ATTACH_STATIC(vcache_flush_reg);
 struct evcnt vcache_flush_ctx =
-	EVCNT_INITIALIZER(EVCNT_TYPE_INTR,0,"vcfl","ctx");
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC,0,"vcfl","ctx");
 EVCNT_ATTACH_STATIC(vcache_flush_ctx);
 struct evcnt vcache_flush_range =
-	EVCNT_INITIALIZER(EVCNT_TYPE_INTR,0,"vcfl","rng");
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC,0,"vcfl","rng");
 EVCNT_ATTACH_STATIC(vcache_flush_range);
 
 int cache_alias_dist;		/* Cache anti-aliasing constants */



CVS commit: src

2018-01-15 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Jan 15 20:39:53 UTC 2018

Modified Files:
src: build.sh

Log Message:
Restore formatting/indentation of the configure call in rebuildmake()
to what it used to be.


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

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.322 src/build.sh:1.323
--- src/build.sh:1.322	Mon Jan 15 19:52:54 2018
+++ src/build.sh	Mon Jan 15 20:39:53 2018
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.322 2018/01/15 19:52:54 uwe Exp $
+#	$NetBSD: build.sh,v 1.323 2018/01/15 20:39:53 uwe Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1661,13 +1661,8 @@ rebuildmake()
 
 	statusmsg "Bootstrapping ${toolprefix}make"
 	${runcmd} cd "${tmpdir}"
-	${runcmd} env \
-\
-CC="${HOST_CC-cc}" \
-CPPFLAGS="${HOST_CPPFLAGS}" \
-CFLAGS="${HOST_CFLAGS--O}" \
-LDFLAGS="${HOST_LDFLAGS}" \
-\
+	${runcmd} env CC="${HOST_CC-cc}" CPPFLAGS="${HOST_CPPFLAGS}" \
+		CFLAGS="${HOST_CFLAGS--O}" LDFLAGS="${HOST_LDFLAGS}" \
 	${HOST_SH} "${TOP}/tools/make/configure" ||
 	( cp ${tmpdir}/config.log ${tmpdir}-config.log
 	  bomb "Configure of ${toolprefix}make failed, see ${tmpdir}-config.log for details" )
@@ -1938,7 +1933,7 @@ createmakewrapper()
 	eval cat <

CVS commit: src/tools/make

2018-01-15 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Jan 15 20:14:49 UTC 2018

Modified Files:
src/tools/make: buildmake.sh.in

Log Message:
Do not use HOST_CFLAGS to link the make binary.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tools/make/buildmake.sh.in

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

Modified files:

Index: src/tools/make/buildmake.sh.in
diff -u src/tools/make/buildmake.sh.in:1.10 src/tools/make/buildmake.sh.in:1.11
--- src/tools/make/buildmake.sh.in:1.10	Mon Jan 15 19:57:49 2018
+++ src/tools/make/buildmake.sh.in	Mon Jan 15 20:14:49 2018
@@ -1,5 +1,5 @@
 #! /bin/sh
-#	$NetBSD: buildmake.sh.in,v 1.10 2018/01/15 19:57:49 uwe Exp $
+#	$NetBSD: buildmake.sh.in,v 1.11 2018/01/15 20:14:49 uwe Exp $
 #
 # buildmake.sh.in - Autoconf-processed shell script for building make(1).
 #
@@ -22,4 +22,4 @@ for f in $MKSRCDIR/*.c $MKSRCDIR/lst.lib
 	docmd "${HOST_CC} ${HOST_CFLAGS} @DEFS@ -c $f"
 done
 
-docmd "${HOST_CC} ${HOST_CFLAGS} -o ${_TOOL_PREFIX:-nb}make *.o ${HOST_LDFLAGS}"
+docmd "${HOST_CC} -o ${_TOOL_PREFIX:-nb}make *.o ${HOST_LDFLAGS}"



CVS commit: src/tools/make

2018-01-15 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Jan 15 19:57:49 UTC 2018

Modified Files:
src/tools/make: buildmake.sh.in

Log Message:
G/c unused runcmd.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tools/make/buildmake.sh.in

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

Modified files:

Index: src/tools/make/buildmake.sh.in
diff -u src/tools/make/buildmake.sh.in:1.9 src/tools/make/buildmake.sh.in:1.10
--- src/tools/make/buildmake.sh.in:1.9	Mon Jan 15 19:52:54 2018
+++ src/tools/make/buildmake.sh.in	Mon Jan 15 19:57:49 2018
@@ -1,5 +1,5 @@
 #! /bin/sh
-#	$NetBSD: buildmake.sh.in,v 1.9 2018/01/15 19:52:54 uwe Exp $
+#	$NetBSD: buildmake.sh.in,v 1.10 2018/01/15 19:57:49 uwe Exp $
 #
 # buildmake.sh.in - Autoconf-processed shell script for building make(1).
 #
@@ -9,7 +9,6 @@
 : ${HOST_CC="@CC@"}
 : ${HOST_CFLAGS="@CPPFLAGS@ @CFLAGS@"}
 : ${HOST_LDFLAGS="@LDFLAGS@ @LIBS@"}
-: ${runcmd=""}
 
 docmd () {
 	echo "$1"



CVS commit: src

2018-01-15 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Jan 15 19:52:54 UTC 2018

Modified Files:
src: build.sh
src/tools/make: buildmake.sh.in

Log Message:
Make sure nbmake is always built with the right _PATH_DEFSYSPATH.


To generate a diff of this commit:
cvs rdiff -u -r1.321 -r1.322 src/build.sh
cvs rdiff -u -r1.8 -r1.9 src/tools/make/buildmake.sh.in

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.321 src/build.sh:1.322
--- src/build.sh:1.321	Sun Oct  8 01:05:13 2017
+++ src/build.sh	Mon Jan 15 19:52:54 2018
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.321 2017/10/08 01:05:13 kre Exp $
+#	$NetBSD: build.sh,v 1.322 2018/01/15 19:52:54 uwe Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1664,7 +1664,7 @@ rebuildmake()
 	${runcmd} env \
 \
 CC="${HOST_CC-cc}" \
-CPPFLAGS="${HOST_CPPFLAGS} -D_PATH_DEFSYSPATH="'\"'${NETBSDSRCDIR}/share/mk'\"' \
+CPPFLAGS="${HOST_CPPFLAGS}" \
 CFLAGS="${HOST_CFLAGS--O}" \
 LDFLAGS="${HOST_LDFLAGS}" \
 \
@@ -1938,7 +1938,7 @@ createmakewrapper()
 	eval cat <

CVS commit: src/doc

2018-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan 15 19:01:55 UTC 2018

Modified Files:
src/doc: CHANGES

Log Message:
add date


To generate a diff of this commit:
cvs rdiff -u -r1.2345 -r1.2346 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.2345 src/doc/CHANGES:1.2346
--- src/doc/CHANGES:1.2345	Sun Jan 14 15:07:02 2018
+++ src/doc/CHANGES	Mon Jan 15 14:01:55 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2345 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2346 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -98,3 +98,4 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	ovadvise: Remove the old vadvise syscall header [kamil 20171219]
 	dhcpcd(8): Import dhcpcd-7.0.0 [roy 20180101]
 	mdnsd(8), dns-sd(1), libdns_sd: import mDNSResponder 878.1
+		[christos 20180114]



CVS commit: src/sys/net

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan 15 16:36:51 UTC 2018

Modified Files:
src/sys/net: if_ether.h if_vlan.c if_vlanvar.h

Log Message:
Mostly style, and add a bunch of KASSERTs.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/net/if_ether.h
cvs rdiff -u -r1.123 -r1.124 src/sys/net/if_vlan.c
cvs rdiff -u -r1.12 -r1.13 src/sys/net/if_vlanvar.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/net/if_ether.h
diff -u src/sys/net/if_ether.h:1.70 src/sys/net/if_ether.h:1.71
--- src/sys/net/if_ether.h:1.70	Wed Nov 22 03:45:15 2017
+++ src/sys/net/if_ether.h	Mon Jan 15 16:36:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.70 2017/11/22 03:45:15 msaitoh Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.71 2018/01/15 16:36:51 maxv Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -301,9 +301,8 @@ struct ether_multistep {
 static inline void
 vlan_set_tag(struct mbuf *m, uint16_t vlantag)
 {
-
 	/* VLAN tag contains priority, CFI and VLAN ID */
-
+	KASSERT((m->m_flags & M_PKTHDR) != 0);
 	m->m_pkthdr.ether_vtag = vlantag;
 	m->m_flags |= M_VLANTAG;
 	return;
@@ -319,6 +318,7 @@ vlan_has_tag(struct mbuf *m)
 static inline uint16_t
 vlan_get_tag(struct mbuf *m)
 {
+	KASSERT((m->m_flags & M_PKTHDR) != 0);
 	KASSERT(m->m_flags & M_VLANTAG);
 	return m->m_pkthdr.ether_vtag;
 }

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.123 src/sys/net/if_vlan.c:1.124
--- src/sys/net/if_vlan.c:1.123	Mon Jan 15 08:45:19 2018
+++ src/sys/net/if_vlan.c	Mon Jan 15 16:36:51 2018
@@ -1,6 +1,6 @@
-/*	$NetBSD: if_vlan.c,v 1.123 2018/01/15 08:45:19 maxv Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.124 2018/01/15 16:36:51 maxv Exp $	*/
 
-/*-
+/*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.123 2018/01/15 08:45:19 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.124 2018/01/15 16:36:51 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -250,9 +250,11 @@ static inline int
 vlan_safe_ifpromisc(struct ifnet *ifp, int pswitch)
 {
 	int e;
+
 	KERNEL_LOCK_UNLESS_NET_MPSAFE();
 	e = ifpromisc(ifp, pswitch);
 	KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
+
 	return e;
 }
 
@@ -260,9 +262,11 @@ static inline int
 vlan_safe_ifpromisc_locked(struct ifnet *ifp, int pswitch)
 {
 	int e;
+
 	KERNEL_LOCK_UNLESS_NET_MPSAFE();
 	e = ifpromisc_locked(ifp, pswitch);
 	KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
+
 	return e;
 }
 
@@ -272,7 +276,7 @@ vlanattach(int n)
 
 	/*
 	 * Nothing to do here, initialization is handled by the
-	 * module initialization code in vlaninit() below).
+	 * module initialization code in vlaninit() below.
 	 */
 }
 
@@ -293,15 +297,16 @@ vlaninit(void)
 static int
 vlandetach(void)
 {
-	int error = 0;
+	bool is_empty;
+	int error;
 
 	mutex_enter(_list.lock);
-	if (!LIST_EMPTY(_list.list)) {
-		mutex_exit(_list.lock);
-		return EBUSY;
-	}
+	is_empty = LIST_EMPTY(_list.list);
 	mutex_exit(_list.lock);
 
+	if (!is_empty)
+		return EBUSY;
+
 	error = vlan_hash_fini();
 	if (error != 0)
 		return error;
@@ -411,7 +416,7 @@ vlan_clone_destroy(struct ifnet *ifp)
 	mutex_destroy(>ifv_lock);
 	free(ifv, M_DEVBUF);
 
-	return (0);
+	return 0;
 }
 
 /*
@@ -423,9 +428,9 @@ vlan_config(struct ifvlan *ifv, struct i
 	struct ifnet *ifp = >ifv_if;
 	struct ifvlan_linkmib *nmib = NULL;
 	struct ifvlan_linkmib *omib = NULL;
-	struct ifvlan_linkmib *checkmib = NULL;
+	struct ifvlan_linkmib *checkmib;
 	struct psref_target *nmib_psref = NULL;
-	uint16_t vid = EVL_VLANOFTAG(tag);
+	const uint16_t vid = EVL_VLANOFTAG(tag);
 	int error = 0;
 	int idx;
 	bool omib_cleanup = false;
@@ -436,7 +441,6 @@ vlan_config(struct ifvlan *ifv, struct i
 		return EINVAL;
 
 	nmib = kmem_alloc(sizeof(*nmib), KM_SLEEP);
-
 	mutex_enter(>ifv_lock);
 	omib = ifv->ifv_mib;
 
@@ -461,7 +465,7 @@ vlan_config(struct ifvlan *ifv, struct i
 	switch (p->if_type) {
 	case IFT_ETHER:
 	{
-		struct ethercom *ec = (void *) p;
+		struct ethercom *ec = (void *)p;
 		nmib->ifvm_msw = _ether_multisw;
 		nmib->ifvm_encaplen = ETHER_VLAN_ENCAP_LEN;
 		nmib->ifvm_mintu = ETHERMIN;
@@ -496,7 +500,7 @@ vlan_config(struct ifvlan *ifv, struct i
 		 * offload.
 		 */
 		if (ec->ec_capabilities & ETHERCAP_VLAN_HWTAGGING) {
-		ec->ec_capenable |= ETHERCAP_VLAN_HWTAGGING;
+			ec->ec_capenable |= ETHERCAP_VLAN_HWTAGGING;
 			ifp->if_capabilities = p->if_capabilities &
 			(IFCAP_TSOv4 | IFCAP_TSOv6 |
 			 IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_IPv4_Rx|
@@ -504,7 +508,8 @@ vlan_config(struct ifvlan *ifv, struct i
 			 IFCAP_CSUM_UDPv4_Tx|IFCAP_CSUM_UDPv4_Rx|
 			 IFCAP_CSUM_TCPv6_Tx|IFCAP_CSUM_TCPv6_Rx|
 			 IFCAP_CSUM_UDPv6_Tx|IFCAP_CSUM_UDPv6_Rx);
-}
+		}
+
 		/*
 		 * We inherit the parent's Ethernet address.
 		 */
@@ -547,10 +552,8 @@ done:
 
 	if (nmib_psref)
 		

CVS commit: src/usr.sbin/autofs

2018-01-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan 15 14:38:06 UTC 2018

Modified Files:
src/usr.sbin/autofs: automount.c

Log Message:
avoid passing literal string to unconst.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/autofs/automount.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/autofs/automount.c
diff -u src/usr.sbin/autofs/automount.c:1.2 src/usr.sbin/autofs/automount.c:1.3
--- src/usr.sbin/autofs/automount.c:1.2	Sun Jan 14 19:46:16 2018
+++ src/usr.sbin/autofs/automount.c	Mon Jan 15 09:38:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: automount.c,v 1.2 2018/01/15 00:46:16 christos Exp $	*/
+/*	$NetBSD: automount.c,v 1.3 2018/01/15 14:38:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: automount.c,v 1.2 2018/01/15 00:46:16 christos Exp $");
+__RCSID("$NetBSD: automount.c,v 1.3 2018/01/15 14:38:06 christos Exp $");
 
 #include 
 #include 
@@ -155,6 +155,7 @@ mount_unmount(struct node *root)
 	struct statvfs *mntbuf;
 	struct node *n, *n2;
 	int i, nitems;
+	static char rootdir[] = "/";
 
 	nitems = getmntinfo(, MNT_WAIT);
 	if (nitems <= 0)
@@ -192,7 +193,7 @@ mount_unmount(struct node *root)
 
 		TAILQ_FOREACH(n2, >n_children, n_next) {
 			mount_if_not_already(n2, n->n_map, n->n_options,
-			"/", mntbuf, nitems);
+			rootdir, mntbuf, nitems);
 		}
 	}
 }



CVS commit: src/sys/net

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan 15 14:00:34 UTC 2018

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

Log Message:
Style, and fix a bug in the AppleTalk path: we're doing
M_PREPEND(M_DONTWAIT), but we forgot to NULL-check the mbuf afterwards.


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

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

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.255 src/sys/net/if_ethersubr.c:1.256
--- src/sys/net/if_ethersubr.c:1.255	Mon Jan 15 13:14:18 2018
+++ src/sys/net/if_ethersubr.c	Mon Jan 15 14:00:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.255 2018/01/15 13:14:18 maxv Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.256 2018/01/15 14:00:34 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.255 2018/01/15 13:14:18 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.256 2018/01/15 14:00:34 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -187,12 +187,11 @@ static	int ether_output(struct ifnet *, 
  */
 static int
 ether_output(struct ifnet * const ifp0, struct mbuf * const m0,
-	const struct sockaddr * const dst,
-	const struct rtentry *rt)
+const struct sockaddr * const dst, const struct rtentry *rt)
 {
+	uint8_t esrc[ETHER_ADDR_LEN], edst[ETHER_ADDR_LEN];
 	uint16_t etype = 0;
 	int error = 0, hdrcmplt = 0;
-	uint8_t esrc[6], edst[6];
 	struct mbuf *m = m0;
 	struct mbuf *mcopy = NULL;
 	struct ether_header *eh;
@@ -240,7 +239,7 @@ ether_output(struct ifnet * const ifp0, 
 #ifdef INET
 	case AF_INET:
 		if (m->m_flags & M_BCAST)
-			(void)memcpy(edst, etherbroadcastaddr, sizeof(edst));
+			memcpy(edst, etherbroadcastaddr, sizeof(edst));
 		else if (m->m_flags & M_MCAST)
 			ETHER_MAP_IP_MULTICAST((dst)->sin_addr, edst);
 		else if ((error = arpresolve(ifp, rt, m, dst, edst,
@@ -249,14 +248,14 @@ ether_output(struct ifnet * const ifp0, 
 		}
 		/* If broadcasting on a simplex interface, loopback a copy */
 		if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX))
-			mcopy = m_copy(m, 0, (int)M_COPYALL);
+			mcopy = m_copy(m, 0, M_COPYALL);
 		etype = htons(ETHERTYPE_IP);
 		break;
 
 	case AF_ARP:
 		ah = mtod(m, struct arphdr *);
 		if (m->m_flags & M_BCAST)
-			(void)memcpy(edst, etherbroadcastaddr, sizeof(edst));
+			memcpy(edst, etherbroadcastaddr, sizeof(edst));
 		else {
 			void *tha = ar_tha(ah);
 
@@ -281,13 +280,13 @@ ether_output(struct ifnet * const ifp0, 
 		default:
 			etype = htons(ETHERTYPE_ARP);
 		}
-
 		break;
 #endif
+
 #ifdef INET6
 	case AF_INET6:
 		if (m->m_flags & M_BCAST)
-			(void)memcpy(edst, etherbroadcastaddr, sizeof(edst));
+			memcpy(edst, etherbroadcastaddr, sizeof(edst));
 		else if (m->m_flags & M_MCAST) {
 			ETHER_MAP_IPV6_MULTICAST((dst)->sin6_addr,
 			edst);
@@ -300,19 +299,22 @@ ether_output(struct ifnet * const ifp0, 
 		etype = htons(ETHERTYPE_IPV6);
 		break;
 #endif
+
 #ifdef NETATALK
 	case AF_APPLETALK: {
 		struct ifaddr *ifa;
 		int s;
 
 		KERNEL_LOCK(1, NULL);
+
 		if (!aarpresolve(ifp, m, (const struct sockaddr_at *)dst, edst)) {
 #ifdef NETATALKDEBUG
 			printf("aarpresolv failed\n");
-#endif /* NETATALKDEBUG */
+#endif
 			KERNEL_UNLOCK_ONE(NULL);
 			return (0);
 		}
+
 		/*
 		 * ifaddr is the first thing in at_ifaddr
 		 */
@@ -321,6 +323,7 @@ ether_output(struct ifnet * const ifp0, 
 		if (ifa == NULL) {
 			pserialize_read_exit(s);
 			KERNEL_UNLOCK_ONE(NULL);
+			/* XXX error? */
 			goto bad;
 		}
 		aa = (struct at_ifaddr *)ifa;
@@ -335,6 +338,11 @@ ether_output(struct ifnet * const ifp0, 
 			struct llc llc;
 
 			M_PREPEND(m, sizeof(struct llc), M_DONTWAIT);
+			if (m == NULL) {
+KERNEL_UNLOCK_ONE(NULL);
+senderr(ENOBUFS);
+			}
+
 			llc.llc_dsap = llc.llc_ssap = LLC_SNAP_LSAP;
 			llc.llc_control = LLC_UI;
 			memcpy(llc.llc_snap_org_code, at_org_code,
@@ -349,6 +357,7 @@ ether_output(struct ifnet * const ifp0, 
 		break;
 	}
 #endif /* NETATALK */
+
 	case pseudo_AF_HDRCMPLT:
 		hdrcmplt = 1;
 		memcpy(esrc,
@@ -387,20 +396,24 @@ ether_output(struct ifnet * const ifp0, 
 	if (mcopy)
 		(void)looutput(ifp, mcopy, dst, rt);
 
-	/* If no ether type is set, this must be a 802.2 formatted packet.
+	KASSERT((m->m_flags & M_PKTHDR) != 0);
+
+	/*
+	 * If no ether type is set, this must be a 802.2 formatted packet.
 	 */
 	if (etype == 0)
 		etype = htons(m->m_pkthdr.len);
+
 	/*
-	 * Add local net header.  If no space in first mbuf,
-	 * allocate another.
+	 * Add local net header. If no space in first mbuf, allocate another.
 	 */
-	M_PREPEND(m, sizeof (struct ether_header), M_DONTWAIT);
-	if (m == 0)
+	M_PREPEND(m, sizeof(struct ether_header), M_DONTWAIT);
+	if (m == NULL)
 		senderr(ENOBUFS);
+
 	eh = mtod(m, struct ether_header *);
 	/* Note: etype is already in network 

CVS commit: src/sys/net

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan 15 13:14:18 UTC 2018

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

Log Message:
Fix two bugs in altq_etherclassify. When scanning the mbuf chain we need
to make sure that m_next is not NULL, otherwise NULL deref. After that,
we must not touch m->m_pkthdr, given that 'm' may not be the first mbuf
of the chain anymore.

Declare mtop, and add a KASSERT to make sure it has M_PKTHDR set.


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

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

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.254 src/sys/net/if_ethersubr.c:1.255
--- src/sys/net/if_ethersubr.c:1.254	Mon Jan 15 12:17:05 2018
+++ src/sys/net/if_ethersubr.c	Mon Jan 15 13:14:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.254 2018/01/15 12:17:05 maxv Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.255 2018/01/15 13:14:18 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.254 2018/01/15 12:17:05 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.255 2018/01/15 13:14:18 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -463,10 +463,13 @@ void
 altq_etherclassify(struct ifaltq *ifq, struct mbuf *m)
 {
 	struct ether_header *eh;
+	struct mbuf *mtop = m;
 	uint16_t ether_type;
 	int hlen, af, hdrsize;
 	void *hdr;
 
+	KASSERT((mtop->m_flags & M_PKTHDR) != 0);
+
 	hlen = ETHER_HDR_LEN;
 	eh = mtod(m, struct ether_header *);
 
@@ -508,7 +511,10 @@ altq_etherclassify(struct ifaltq *ifq, s
 	while (m->m_len <= hlen) {
 		hlen -= m->m_len;
 		m = m->m_next;
+		if (m == NULL)
+			goto bad;
 	}
+
 	if (m->m_len < (hlen + hdrsize)) {
 		/*
 		 * protocol header not in a single mbuf.
@@ -527,11 +533,12 @@ altq_etherclassify(struct ifaltq *ifq, s
 
 	hdr = mtod(m, void *);
 
-	if (ALTQ_NEEDS_CLASSIFY(ifq))
-		m->m_pkthdr.pattr_class =
+	if (ALTQ_NEEDS_CLASSIFY(ifq)) {
+		mtop->m_pkthdr.pattr_class =
 		(*ifq->altq_classify)(ifq->altq_clfier, m, af);
-	m->m_pkthdr.pattr_af = af;
-	m->m_pkthdr.pattr_hdr = hdr;
+	}
+	mtop->m_pkthdr.pattr_af = af;
+	mtop->m_pkthdr.pattr_hdr = hdr;
 
 	m->m_data -= hlen;
 	m->m_len += hlen;
@@ -539,9 +546,9 @@ altq_etherclassify(struct ifaltq *ifq, s
 	return;
 
 bad:
-	m->m_pkthdr.pattr_class = NULL;
-	m->m_pkthdr.pattr_hdr = NULL;
-	m->m_pkthdr.pattr_af = AF_UNSPEC;
+	mtop->m_pkthdr.pattr_class = NULL;
+	mtop->m_pkthdr.pattr_hdr = NULL;
+	mtop->m_pkthdr.pattr_af = AF_UNSPEC;
 }
 #endif /* ALTQ */
 



CVS commit: src/sys/net

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan 15 13:05:40 UTC 2018

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

Log Message:
Add a KASSERT in IFQ_CLASSIFY, we really need to make sure the given
mbuf is the top of the chain.


To generate a diff of this commit:
cvs rdiff -u -r1.257 -r1.258 src/sys/net/if.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/net/if.h
diff -u src/sys/net/if.h:1.257 src/sys/net/if.h:1.258
--- src/sys/net/if.h:1.257	Mon Dec 18 08:24:29 2017
+++ src/sys/net/if.h	Mon Jan 15 13:05:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.257 2017/12/18 08:24:29 ozaki-r Exp $	*/
+/*	$NetBSD: if.h,v 1.258 2018/01/15 13:05:40 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -986,6 +986,7 @@ do {	\
 
 #define	IFQ_CLASSIFY(ifq, m, af)	\
 do {	\
+	KASSERT((m->m_flags & M_PKTHDR) != 0);\
 	mutex_enter((ifq)->ifq_lock);	\
 	if (ALTQ_IS_ENABLED((ifq))) {	\
 		if (ALTQ_NEEDS_CLASSIFY((ifq)))\



CVS commit: src/sys/dev/pci

2018-01-15 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Jan 15 12:58:06 UTC 2018

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

Log Message:
indent to magic logic


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/mpii.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/mpii.c
diff -u src/sys/dev/pci/mpii.c:1.10 src/sys/dev/pci/mpii.c:1.11
--- src/sys/dev/pci/mpii.c:1.10	Mon Oct  9 23:24:22 2017
+++ src/sys/dev/pci/mpii.c	Mon Jan 15 12:58:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.10 2017/10/09 23:24:22 maya Exp $ */
+/* $NetBSD: mpii.c,v 1.11 2018/01/15 12:58:06 maya Exp $ */
 /*	OpenBSD: mpii.c,v 1.51 2012/04/11 13:29:14 naddy Exp 	*/
 /*
  * Copyright (c) 2010 Mike Belopuhov 
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.10 2017/10/09 23:24:22 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.11 2018/01/15 12:58:06 maya Exp $");
 
 #include "bio.h"
 
@@ -4043,7 +4043,7 @@ mpii_dmamem_alloc(struct mpii_softc *sc,
 
 	mdm = malloc(sizeof(*mdm), M_DEVBUF, M_NOWAIT | M_ZERO);
 	if (mdm == NULL)
-	return (NULL);
+		return (NULL);
 
 	mdm->mdm_size = size;
 



CVS commit: src/sys/dev/pci

2018-01-15 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Jan 15 12:43:43 UTC 2018

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

Log Message:
malloc+memset zero to malloc(, |M_ZERO);

ok rkujawa


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pci/ahd_pci.c

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

Modified files:

Index: src/sys/dev/pci/ahd_pci.c
diff -u src/sys/dev/pci/ahd_pci.c:1.35 src/sys/dev/pci/ahd_pci.c:1.36
--- src/sys/dev/pci/ahd_pci.c:1.35	Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/ahd_pci.c	Mon Jan 15 12:43:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahd_pci.c,v 1.35 2014/03/29 19:28:24 christos Exp $	*/
+/*	$NetBSD: ahd_pci.c,v 1.36 2018/01/15 12:43:42 maya Exp $	*/
 
 /*
  * Product specific probe and attach routines for:
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahd_pci.c,v 1.35 2014/03/29 19:28:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahd_pci.c,v 1.36 2018/01/15 12:43:42 maya Exp $");
 
 #define AHD_PCI_IOADDR	PCI_MAPREG_START	/* I/O Address */
 #define AHD_PCI_MEMADDR	(PCI_MAPREG_START + 4)	/* Mem I/O Address */
@@ -337,13 +337,12 @@ ahd_pci_attach(device_t parent, device_t
 		return;
 
 	/* Keep information about the PCI bus */
-	bd = malloc(sizeof (struct ahd_pci_busdata), M_DEVBUF, M_NOWAIT);
+	bd = malloc(sizeof (struct ahd_pci_busdata), M_DEVBUF, M_NOWAIT|M_ZERO);
 	if (bd == NULL) {
 		aprint_error("%s: unable to allocate bus-specific data\n",
 		ahd_name(ahd));
 		return;
 	}
-	memset(bd, 0, sizeof(struct ahd_pci_busdata));
 
 	bd->pc = pa->pa_pc;
 	bd->tag = pa->pa_tag;
@@ -355,12 +354,11 @@ ahd_pci_attach(device_t parent, device_t
 	ahd->description = entry->name;
 
 	ahd->seep_config = malloc(sizeof(*ahd->seep_config),
-  M_DEVBUF, M_NOWAIT);
+  M_DEVBUF, M_NOWAIT|M_ZERO);
 	if (ahd->seep_config == NULL) {
 		aprint_error("%s: cannot malloc seep_config!\n", ahd_name(ahd));
 		return;
 	}
-	memset(ahd->seep_config, 0, sizeof(*ahd->seep_config));
 
 	LIST_INIT(>pending_scbs);
 	ahd_timer_init(>reset_timer);



CVS commit: src/sbin/gpt

2018-01-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jan 15 12:20:47 UTC 2018

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

Log Message:
Explain what suffixes are accepted when specifying a size.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sbin/gpt/gpt.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/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.56 src/sbin/gpt/gpt.8:1.57
--- src/sbin/gpt/gpt.8:1.56	Tue Oct  3 06:55:04 2017
+++ src/sbin/gpt/gpt.8	Mon Jan 15 12:20:47 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.56 2017/10/03 06:55:04 mlelstv Exp $
+.\" $NetBSD: gpt.8,v 1.57 2018/01/15 12:20:47 sborrill Exp $
 .\"
 .\" Copyright (c) 2002 Marcel Moolenaar
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD: src/sbin/gpt/gpt.8,v 1.17 2006/06/22 22:22:32 marcel Exp $
 .\"
-.Dd August 3, 2017
+.Dd January 15, 2018
 .Dt GPT 8
 .Os
 .Sh NAME
@@ -154,6 +154,15 @@ or
 .Sq S
 then size is in sectors, otherwise size is in bytes which must be
 a multiple of the device's sector size.
+Accepted suffix units are
+.Sq b
+to denote bytes,
+.Sq k
+to denote kilobytes,
+.Sq m
+to denote megabytes and
+.Sq g
+to denote gigabytes.
 The minimum size is 1 sector.
 .Pp
 The
@@ -465,6 +474,15 @@ or
 .Sq S
 then size is in sectors, otherwise size is in bytes which must be
 a multiple of the device's sector size.
+Accepted suffix units are
+.Sq b
+to denote bytes,
+.Sq k
+to denote kilobytes,
+.Sq m
+to denote megabytes and
+.Sq g
+to denote gigabytes.
 The minimum size is 1 sector.
 If the
 .Fl a
@@ -494,6 +512,15 @@ or
 .Sq S
 then size is in sectors, otherwise size is in bytes which must be
 a multiple of the device's sector size.
+Accepted suffix units are
+.Sq b
+to denote bytes,
+.Sq k
+to denote kilobytes,
+.Sq m
+to denote megabytes and
+.Sq g
+to denote gigabytes.
 Using the
 .Fl s
 option allows you to move the backup copy prior to resizing the medium.



CVS commit: src/sys/net

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan 15 12:17:05 UTC 2018

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

Log Message:
Fix a bug in the VLAN path: there's an inverted logic, the mbuf needs to
be bigger than struct ether_vlan_header, not smaller.

Meanwhile add a KASSERT in the LLC path.


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

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

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.253 src/sys/net/if_ethersubr.c:1.254
--- src/sys/net/if_ethersubr.c:1.253	Mon Jan 15 11:57:27 2018
+++ src/sys/net/if_ethersubr.c	Mon Jan 15 12:17:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.253 2018/01/15 11:57:27 maxv Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.254 2018/01/15 12:17:05 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.253 2018/01/15 11:57:27 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.254 2018/01/15 12:17:05 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -699,7 +699,7 @@ ether_input(struct ifnet *ifp, struct mb
 		 * just being used to store the priority.  Extract the ether
 		 * type, and if IP or IPV6, let them deal with it.
 		 */
-		if (m->m_len <= sizeof(*evl) &&
+		if (m->m_len >= sizeof(*evl) &&
 		EVL_VLANOFTAG(evl->evl_tag) == 0) {
 			etype = ntohs(evl->evl_proto);
 			ehlen = sizeof(*evl);
@@ -843,11 +843,13 @@ ether_input(struct ifnet *ifp, struct mb
 			return;
 		}
 	} else {
+		KASSERT(ehlen == sizeof(*eh));
 #if defined (LLC) || defined (NETATALK)
-		if (m->m_len < ehlen + sizeof(struct llc)) {
+		if (m->m_len < sizeof(*eh) + sizeof(struct llc)) {
 			goto dropanyway;
 		}
 		l = (struct llc *)(eh+1);
+
 		switch (l->llc_dsap) {
 #ifdef NETATALK
 		case LLC_SNAP_LSAP:
@@ -873,10 +875,10 @@ ether_input(struct ifnet *ifp, struct mb
 sizeof(aarp_org_code)) == 0 &&
 ntohs(l->llc_snap_ether_type) ==
 ETHERTYPE_AARP) {
-	m_adj( m, sizeof(struct ether_header)
+	m_adj(m, sizeof(struct ether_header)
 	+ sizeof(struct llc));
 	aarpinput(ifp, m); /* XXX */
-return;
+	return;
 }
 
 			default:



CVS commit: src/sys/net

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan 15 11:57:27 UTC 2018

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

Log Message:
Style, make the code more readable, and add a KASSERT (we expect the mbuf
to have M_PKTHDR set).


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

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

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.252 src/sys/net/if_ethersubr.c:1.253
--- src/sys/net/if_ethersubr.c:1.252	Mon Jan 15 10:27:51 2018
+++ src/sys/net/if_ethersubr.c	Mon Jan 15 11:57:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.252 2018/01/15 10:27:51 maxv Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.253 2018/01/15 11:57:27 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.252 2018/01/15 10:27:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.253 2018/01/15 11:57:27 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -566,6 +566,7 @@ ether_input(struct ifnet *ifp, struct mb
 #endif
 
 	KASSERT(!cpu_intr_p());
+	KASSERT((m->m_flags & M_PKTHDR) != 0);
 
 	if ((ifp->if_flags & IFF_UP) == 0) {
 		m_freem(m);
@@ -639,7 +640,7 @@ ether_input(struct ifnet *ifp, struct mb
 		(uint8_t *)>ether_dhost, eh->ether_type) == 0)
 			return;
 	}
-#endif /* NCARP > 0 */
+#endif
 
 	if ((m->m_flags & (M_BCAST | M_MCAST | M_PROMISC)) == 0 &&
 	(ifp->if_flags & IFF_PROMISC) != 0 &&
@@ -656,7 +657,6 @@ ether_input(struct ifnet *ifp, struct mb
 
 		eh = mtod(m, struct ether_header *);
 		etype = ntohs(eh->ether_type);
-		ehlen = sizeof(*eh);
 	}
 
 #if NAGR > 0
@@ -666,7 +666,7 @@ ether_input(struct ifnet *ifp, struct mb
 		agr_input(ifp, m);
 		return;
 	}
-#endif /* NAGR > 0 */
+#endif
 
 	/*
 	 * If VLANs are configured on the interface, check to
@@ -693,48 +693,52 @@ ether_input(struct ifnet *ifp, struct mb
 	switch (etype) {
 	case ETHERTYPE_VLAN: {
 		struct ether_vlan_header *evl = (void *)eh;
+
 		/*
 		 * If there is a tag of 0, then the VLAN header was probably
 		 * just being used to store the priority.  Extract the ether
 		 * type, and if IP or IPV6, let them deal with it.
 		 */
-		if (m->m_len <= sizeof(*evl)
-		&& EVL_VLANOFTAG(evl->evl_tag) == 0) {
+		if (m->m_len <= sizeof(*evl) &&
+		EVL_VLANOFTAG(evl->evl_tag) == 0) {
 			etype = ntohs(evl->evl_proto);
 			ehlen = sizeof(*evl);
-			if ((m->m_flags & M_PROMISC) == 0
-			&& (etype == ETHERTYPE_IP
-|| etype == ETHERTYPE_IPV6))
+			if ((m->m_flags & M_PROMISC) == 0 &&
+			(etype == ETHERTYPE_IP ||
+			 etype == ETHERTYPE_IPV6))
 break;
 		}
+
 #if NVLAN > 0
 		/*
 		 * vlan_input() will either recursively call ether_input()
 		 * or drop the packet.
 		 */
-		if (((struct ethercom *)ifp)->ec_nvlans != 0)
+		if (ec->ec_nvlans != 0)
 			vlan_input(ifp, m);
 		else
-#endif /* NVLAN > 0 */
+#endif
 			m_freem(m);
+
 		return;
 	}
+
 #if NPPPOE > 0
 	case ETHERTYPE_PPPOEDISC:
 		pppoedisc_input(ifp, m);
 		return;
+
 	case ETHERTYPE_PPPOE:
 		pppoe_input(ifp, m);
 		return;
-#endif /* NPPPOE > 0 */
+#endif
+
 	case ETHERTYPE_SLOWPROTOCOLS: {
 		uint8_t subtype;
 
-#if defined(DIAGNOSTIC)
-		if (m->m_pkthdr.len < sizeof(*eh) + sizeof(subtype)) {
-			panic("ether_input: too short slow protocol packet");
-		}
-#endif
+		KASSERTMSG((m->m_pkthdr.len < sizeof(*eh) + sizeof(subtype)),
+			"too short slow protocol packet");
+
 		m_copydata(m, sizeof(*eh), sizeof(subtype), );
 		switch (subtype) {
 #if NAGR > 0
@@ -752,6 +756,7 @@ ether_input(struct ifnet *ifp, struct mb
 			}
 			break;
 #endif /* NAGR > 0 */
+
 		default:
 			if (subtype == 0 || subtype > 10) {
 /* illegal value */
@@ -763,6 +768,7 @@ ether_input(struct ifnet *ifp, struct mb
 		}
 		/* FALLTHROUGH */
 	}
+
 	default:
 		if (m->m_flags & M_PROMISC) {
 			m_freem(m);
@@ -776,7 +782,7 @@ ether_input(struct ifnet *ifp, struct mb
 		m->m_flags &= ~M_HASFCS;
 	}
 
-	if (etype > ETHERMTU + sizeof (struct ether_header)) {
+	if (etype > ETHERMTU + sizeof(struct ether_header)) {
 		/* Strip off the Ethernet header. */
 		m_adj(m, ehlen);
 
@@ -799,6 +805,7 @@ ether_input(struct ifnet *ifp, struct mb
 			revarpinput(m);	/* XXX queue? */
 			return;
 #endif
+
 #ifdef INET6
 		case ETHERTYPE_IPV6:
 			if (__predict_false(!in6_present)) {
@@ -812,22 +819,25 @@ ether_input(struct ifnet *ifp, struct mb
 			pktq = ip6_pktq;
 			break;
 #endif
+
 #ifdef NETATALK
 		case ETHERTYPE_ATALK:
 			isr = NETISR_ATALK;
 			inq = 
 			break;
+
 		case ETHERTYPE_AARP:
-			/* probably this should be done with a NETISR as well */
-			aarpinput(ifp, m); /* XXX */
+			aarpinput(ifp, m); /* XXX queue? */
 			return;
-#endif /* NETATALK */
+#endif
+
 #ifdef MPLS
 		case ETHERTYPE_MPLS:
 			isr = NETISR_MPLS;
 			inq = 
 			break;
 #endif
+
 		default:
 			

CVS commit: src/bin/sh

2018-01-15 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jan 15 11:27:39 UTC 2018

Modified Files:
src/bin/sh: sh.1

Log Message:
Paul Goyette suggested improvements to parts of the description of
LINENO ... this is what resulted (with thanks for the grammar lessons,
and sundry references provided!)

No date (Dd) bump - there is no change of substance here, just (hopefully)
a clearer way of saying the same thing.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.174 src/bin/sh/sh.1:1.175
--- src/bin/sh/sh.1:1.174	Sun Nov 19 03:23:01 2017
+++ src/bin/sh/sh.1	Mon Jan 15 11:27:39 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.174 2017/11/19 03:23:01 kre Exp $
+.\"	$NetBSD: sh.1,v 1.175 2018/01/15 11:27:39 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -3808,14 +3808,16 @@ integer value. and can be expanded using
 mentioned above which can be used for any other variable.
 .Pp
 .Ev LINENO
-can be exported,
-made readonly (which prevents attempts to assign to it,
-and to unset it, but which does not change the value,
-that is the current line number, from being obtained when
-.Ev LINENO
-is referenced,)
-and can be unset.
-All of those act as they would with any other variable.
+can be exported, made readonly, or unset, as with any other
+variable, with similar effects.
+Note that while being readonly prevents later attempts to
+set, or unset,
+.Ev LINENO ,
+it does not prevent its value changing.
+References to
+.Ev LINENO
+.Pq "when not unset"
+always obtain the current line number.
 However,
 .Ev LINENO
 should normally not ever be set or unset.



CVS commit: src/sys/net/agr

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan 15 11:16:04 UTC 2018

Modified Files:
src/sys/net/agr: if_agr.c

Log Message:
Mmh, fix a weird mistake: the guy who added #if NVLAN > 0 forgot to
actually include vlan.h, so the branches are never compiled.

They don't compile, by the way, so fix that too, by reproducing the vlan
input path of ether_input().


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/net/agr/if_agr.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/agr/if_agr.c
diff -u src/sys/net/agr/if_agr.c:1.43 src/sys/net/agr/if_agr.c:1.44
--- src/sys/net/agr/if_agr.c:1.43	Wed Dec  6 07:40:16 2017
+++ src/sys/net/agr/if_agr.c	Mon Jan 15 11:16:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_agr.c,v 1.43 2017/12/06 07:40:16 ozaki-r Exp $	*/
+/*	$NetBSD: if_agr.c,v 1.44 2018/01/15 11:16:04 maxv Exp $	*/
 
 /*-
  * Copyright (c)2005 YAMAMOTO Takashi,
@@ -27,12 +27,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.43 2017/12/06 07:40:16 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.44 2018/01/15 11:16:04 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
 #endif
 
+#include "vlan.h"
+
 #include 
 #include 
 #include 
@@ -53,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1
 #include 
 #include 
 #include 
+#include 
 
 #if defined(INET)
 #include 
@@ -146,11 +149,9 @@ agrdetach(void)
 void
 agr_input(struct ifnet *ifp_port, struct mbuf *m)
 {
+	struct ethercom *ec = (struct ethercom *)ifp_port;
 	struct agr_port *port;
 	struct ifnet *ifp;
-#if NVLAN > 0
-	struct m_tag *mtag;
-#endif
 
 	port = ifp_port->if_agrprivate;
 	KASSERT(port);
@@ -163,26 +164,19 @@ agr_input(struct ifnet *ifp_port, struct
 
 	m_set_rcvif(m, ifp);
 
-#define DNH_DEBUG
+	/*
+	 * If VLANs are configured on the interface, check to
+	 * see if the device performed the decapsulation and
+	 * provided us with the tag.
+	 */
+	if (ec->ec_nvlans && vlan_has_tag(m)) {
 #if NVLAN > 0
-	/* got a vlan packet? */
-	if ((mtag = m_tag_find(m, PACKET_TAG_VLAN, NULL)) != NULL) {
-#ifdef DNH_DEBUG 
-		printf("%s: vlan tag %d attached\n",
-			ifp->if_xname,
-			htole16((*(u_int *)(mtag + 1)) & 0x));
-		printf("%s: vlan input\n", ifp->if_xname);
-#endif
 		vlan_input(ifp, m);
-		return;
-#ifdef DNH_DEBUG 
-	} else {
-		struct ethercom *ec = (void *)ifp;
-		printf("%s: no vlan tag attached, ec_nvlans=%d\n",
-			ifp->if_xname, ec->ec_nvlans);
+#else
+		m_freem(m);
 #endif
+		return;
 	}
-#endif
 
 	if_percpuq_enqueue(ifp->if_percpuq, m);
 }



CVS commit: src/sys/net

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan 15 10:27:51 UTC 2018

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

Log Message:
Several fixes:
 - Style and typos
 - Use kmem_zalloc, in case there is a padding between the fields of
   the structures
 - Use ETHER_ADDR_LEN instead of a hard-coded '6'
 - kmem_alloc(KM_SLEEP) can't fail
 - Simplify ether_aton_r
 - Use mutex_obj_free, not to leak memory


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

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

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.251 src/sys/net/if_ethersubr.c:1.252
--- src/sys/net/if_ethersubr.c:1.251	Mon Jan 15 07:59:48 2018
+++ src/sys/net/if_ethersubr.c	Mon Jan 15 10:27:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.251 2018/01/15 07:59:48 maxv Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.252 2018/01/15 10:27:51 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.251 2018/01/15 07:59:48 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.252 2018/01/15 10:27:51 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -998,9 +998,7 @@ ether_ifdetach(struct ifnet *ifp)
 	if (ifp->if_bridge)
 		bridge_ifdetach(ifp);
 #endif
-
 	bpf_detach(ifp);
-
 #if NVLAN > 0
 	if (ec->ec_nvlans)
 		vlan_ifdetach(ifp);
@@ -1014,7 +1012,7 @@ ether_ifdetach(struct ifnet *ifp)
 	}
 	ETHER_UNLOCK(ec);
 
-	mutex_destroy(ec->ec_lock);
+	mutex_obj_free(ec->ec_lock);
 
 	ifp->if_mowner = NULL;
 	MOWNER_DETACH(>ec_rx_mowner);
@@ -1127,17 +1125,18 @@ ether_aton_r(u_char *dest, size_t len, c
 	while (*cp) {
 		if (!isxdigit(*cp))
 			return EINVAL;
+
 		*dest = atox(*cp);
 		cp++;
 		if (isxdigit(*cp)) {
 			*dest = (*dest << 4) | atox(*cp);
-			dest++;
 			cp++;
-		} else {
-			dest++;
 		}
+		dest++;
+
 		if (dest == ep)
-			return *cp == '\0' ? 0 : ENAMETOOLONG;
+			return (*cp == '\0') ? 0 : ENAMETOOLONG;
+
 		switch (*cp) {
 		case ':':
 		case '-':
@@ -1183,8 +1182,7 @@ ether_multiaddr(const struct sockaddr *s
 			 */
 			memcpy(addrlo, ether_ipmulticast_min, ETHER_ADDR_LEN);
 			memcpy(addrhi, ether_ipmulticast_max, ETHER_ADDR_LEN);
-		}
-		else {
+		} else {
 			ETHER_MAP_IP_MULTICAST(>sin_addr, addrlo);
 			memcpy(addrhi, addrlo, ETHER_ADDR_LEN);
 		}
@@ -1229,8 +1227,6 @@ ether_addmulti(const struct sockaddr *sa
 
 	/* Allocate out of lock */
 	enm = kmem_alloc(sizeof(*enm), KM_SLEEP);
-	if (enm == NULL)
-		return ENOBUFS;
 
 	ETHER_LOCK(ec);
 	error = ether_multiaddr(sa, addrlo, addrhi);
@@ -1244,6 +1240,7 @@ ether_addmulti(const struct sockaddr *sa
 		error = EINVAL;
 		goto out;
 	}
+
 	/*
 	 * See if the address range is already in the list.
 	 */
@@ -1256,20 +1253,23 @@ ether_addmulti(const struct sockaddr *sa
 		error = 0;
 		goto out;
 	}
+
 	/*
 	 * Link a new multicast record into the interface's multicast list.
 	 */
-	memcpy(enm->enm_addrlo, addrlo, 6);
-	memcpy(enm->enm_addrhi, addrhi, 6);
+	memcpy(enm->enm_addrlo, addrlo, ETHER_ADDR_LEN);
+	memcpy(enm->enm_addrhi, addrhi, ETHER_ADDR_LEN);
 	enm->enm_refcount = 1;
 	LIST_INSERT_HEAD(>ec_multiaddrs, enm, enm_list);
 	ec->ec_multicnt++;
+
 	/*
 	 * Return ENETRESET to inform the driver that the list has changed
 	 * and its reception filter should be adjusted accordingly.
 	 */
 	error = ENETRESET;
 	enm = NULL;
+
 out:
 	ETHER_UNLOCK(ec);
 	if (enm != NULL)
@@ -1294,7 +1294,7 @@ ether_delmulti(const struct sockaddr *sa
 		goto error;
 
 	/*
-	 * Look ur the address in our list.
+	 * Look up the address in our list.
 	 */
 	ETHER_LOOKUP_MULTI(addrlo, addrhi, ec, enm);
 	if (enm == NULL) {
@@ -1308,19 +1308,21 @@ ether_delmulti(const struct sockaddr *sa
 		error = 0;
 		goto error;
 	}
+
 	/*
 	 * No remaining claims to this record; unlink and free it.
 	 */
 	LIST_REMOVE(enm, enm_list);
 	ec->ec_multicnt--;
 	ETHER_UNLOCK(ec);
-
 	kmem_free(enm, sizeof(*enm));
+
 	/*
 	 * Return ENETRESET to inform the driver that the list has changed
 	 * and its reception filter should be adjusted accordingly.
 	 */
 	return ENETRESET;
+
 error:
 	ETHER_UNLOCK(ec);
 	return error;
@@ -1361,7 +1363,7 @@ ether_ioctl(struct ifnet *ifp, u_long cm
 #ifdef INET
 		if (ifa->ifa_addr->sa_family == AF_INET)
 			arp_ifinit(ifp, ifa);
-#endif /* INET */
+#endif
 		return 0;
 	}
 
@@ -1565,7 +1567,7 @@ retry:
 		goto out;
 	}
 
-	addrs = kmem_alloc(sizeof(*addrs) * multicnt, KM_SLEEP);
+	addrs = kmem_zalloc(sizeof(*addrs) * multicnt, KM_SLEEP);
 
 	ETHER_LOCK(ec);
 	if (multicnt != ec->ec_multicnt) {



CVS commit: src/sys/arch/sparc/include

2018-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 15 10:06:49 UTC 2018

Modified Files:
src/sys/arch/sparc/include: reg.h

Log Message:
Redo previous: apply the alignement to the whole struct fpstate - everything
in there is properly aligned, and we need to have fs_queue double aligned
as well.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sparc/include/reg.h

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

Modified files:

Index: src/sys/arch/sparc/include/reg.h
diff -u src/sys/arch/sparc/include/reg.h:1.10 src/sys/arch/sparc/include/reg.h:1.11
--- src/sys/arch/sparc/include/reg.h:1.10	Sun Jan 14 11:55:33 2018
+++ src/sys/arch/sparc/include/reg.h	Mon Jan 15 10:06:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: reg.h,v 1.10 2018/01/14 11:55:33 martin Exp $ */
+/*	$NetBSD: reg.h,v 1.11 2018/01/15 10:06:49 martin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -106,18 +106,19 @@ struct fp_qentry {
 struct fpreg {
 	u_int	fr_regs[32];		/* our view is 32 32-bit registers */
 	int	fr_fsr;			/* %fsr */
-}
-#ifdef _KERNEL
- __aligned(8)/* asm code uses std instructions */
-#endif
-;
+};
+
 struct fpstate {
 	struct fpreg fs_reg;
 #define fs_regs fs_reg.fr_regs
 #define fs_fsr	fs_reg.fr_fsr
 	int	fs_qsize;		/* actual queue depth */
 	struct	fp_qentry fs_queue[FP_QSIZE];	/* queue contents */
-};
+}
+#ifdef _KERNEL
+ __aligned(8)/* asm code uses std instructions */
+#endif
+;
 
 /*
  * The actual FP registers are made accessible (c.f. ptrace(2)) through



CVS commit: src/sys/net

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan 15 09:49:16 UTC 2018

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

Log Message:
If the bridge is not running, don't call bridge_stop. Otherwise the
following commands will crash the kernel:

ifconfig bridge0 create
ifconfig bridge0 destroy


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/sys/net/if_bridge.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_bridge.c
diff -u src/sys/net/if_bridge.c:1.147 src/sys/net/if_bridge.c:1.148
--- src/sys/net/if_bridge.c:1.147	Thu Dec 28 07:06:36 2017
+++ src/sys/net/if_bridge.c	Mon Jan 15 09:49:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.147 2017/12/28 07:06:36 ozaki-r Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.148 2018/01/15 09:49:16 maxv Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.147 2017/12/28 07:06:36 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.148 2018/01/15 09:49:16 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -469,7 +469,8 @@ bridge_clone_destroy(struct ifnet *ifp)
 	struct bridge_softc *sc = ifp->if_softc;
 	struct bridge_iflist *bif;
 
-	bridge_stop(ifp, 1);
+	if ((ifp->if_flags & IFF_RUNNING) != 0)
+		bridge_stop(ifp, 1);
 
 	BRIDGE_LOCK(sc);
 	for (;;) {



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

2018-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 15 09:48:28 UTC 2018

Modified Files:
src/sys/arch/sparc/conf: GENERIC

Log Message:
Enable DIAGNOSTIC


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/sys/arch/sparc/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/sparc/conf/GENERIC
diff -u src/sys/arch/sparc/conf/GENERIC:1.256 src/sys/arch/sparc/conf/GENERIC:1.257
--- src/sys/arch/sparc/conf/GENERIC:1.256	Thu Sep 14 07:58:43 2017
+++ src/sys/arch/sparc/conf/GENERIC	Mon Jan 15 09:48:28 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.256 2017/09/14 07:58:43 mrg Exp $
+# $NetBSD: GENERIC,v 1.257 2018/01/15 09:48:28 martin Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/sparc/conf/std.sparc"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.256 $"
+#ident 		"GENERIC-$Revision: 1.257 $"
 
 maxusers	32
 
@@ -125,7 +125,7 @@ options 	DDB_HISTORY_SIZE=100	# enable h
 ## Adds code to the kernel that does internal consistency checks, and will
 ## cause the kernel to panic if corruption of internal data structures
 ## is detected.
-#options 	DIAGNOSTIC	# extra kernel sanity checking
+options 	DIAGNOSTIC	# extra kernel sanity checking
 
 ## Enable (possibly expensive) debugging code that may also display messages
 ## on the system console



CVS commit: src/sys/net

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan 15 09:26:21 UTC 2018

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

Log Message:
Fix spl leak.

ifconfig gif0 create
ifconfig gif0 destroy
WARNING: SPL NOT LOWERED ON ...


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/net/if_gif.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_gif.c
diff -u src/sys/net/if_gif.c:1.137 src/sys/net/if_gif.c:1.138
--- src/sys/net/if_gif.c:1.137	Thu Dec 21 09:35:38 2017
+++ src/sys/net/if_gif.c	Mon Jan 15 09:26:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.137 2017/12/21 09:35:38 knakahara Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.138 2018/01/15 09:26:21 maxv Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.137 2017/12/21 09:35:38 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.138 2018/01/15 09:26:21 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1126,6 +1126,9 @@ gif_delete_tunnel(struct ifnet *ifp)
 		mutex_exit(>gif_lock);
 		encap_lock_exit();
 		kmem_free(nvar, sizeof(*nvar));
+#ifndef GIF_MPSAFE
+		splx(s);
+#endif
 		return;
 	}
 



CVS commit: src/sys/net

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan 15 08:45:19 UTC 2018

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

Log Message:
Style, improve comment, and add KASSERTs on the assumptions.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/net/if_vlan.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_vlan.c
diff -u src/sys/net/if_vlan.c:1.122 src/sys/net/if_vlan.c:1.123
--- src/sys/net/if_vlan.c:1.122	Sun Jan 14 16:50:37 2018
+++ src/sys/net/if_vlan.c	Mon Jan 15 08:45:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.122 2018/01/14 16:50:37 maxv Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.123 2018/01/15 08:45:19 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.122 2018/01/14 16:50:37 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.123 2018/01/15 08:45:19 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -191,9 +191,9 @@ static int	vlan_ether_delmulti(struct if
 static void	vlan_ether_purgemulti(struct ifvlan *);
 
 const struct vlan_multisw vlan_ether_multisw = {
-	vlan_ether_addmulti,
-	vlan_ether_delmulti,
-	vlan_ether_purgemulti,
+	.vmsw_addmulti = vlan_ether_addmulti,
+	.vmsw_delmulti = vlan_ether_delmulti,
+	.vmsw_purgemulti = vlan_ether_purgemulti,
 };
 
 static int	vlan_clone_create(struct if_clone *, int);
@@ -1160,11 +1160,15 @@ vlan_ether_addmulti(struct ifvlan *ifv, 
 	}
 
 	/*
-	 * As ether_addmulti() returns ENETRESET, following two
-	 * statement shouldn't fail.
+	 * Since ether_addmulti() returns ENETRESET, the following two
+	 * statements shouldn't fail. Here ifv_ec is implicitly protected
+	 * by the ifv_lock lock.
 	 */
-	(void)ether_multiaddr(sa, addrlo, addrhi);
+	error = ether_multiaddr(sa, addrlo, addrhi);
+	KASSERT(error == 0);
 	ETHER_LOOKUP_MULTI(addrlo, addrhi, >ifv_ec, mc->mc_enm);
+	KASSERT(mc->mc_enm != NULL);
+
 	memcpy(>mc_addr, sa, sa->sa_len);
 	LIST_INSERT_HEAD(>ifv_mc_listhead, mc, mc_entries);
 



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

2018-01-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jan 15 08:17:20 UTC 2018

Modified Files:
src/sys/arch/x86/include: specialreg.h

Log Message:
 Add IA32_SPEC_CTRL MSR and IA32_PRED_CMD MSR.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/x86/include/specialreg.h

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.110 src/sys/arch/x86/include/specialreg.h:1.111
--- src/sys/arch/x86/include/specialreg.h:1.110	Mon Jan 15 07:19:00 2018
+++ src/sys/arch/x86/include/specialreg.h	Mon Jan 15 08:17:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.110 2018/01/15 07:19:00 msaitoh Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.111 2018/01/15 08:17:20 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -599,6 +599,8 @@
 #define MSR_EBL_CR_POWERON	0x02a
 #define MSR_EBC_FREQUENCY_ID	0x02c	/* PIV only */
 #define MSR_TEST_CTL		0x033
+#define MSR_IA32_SPEC_CTRL	0x048
+#define MSR_IA32_PRED_CMD	0x049
 #define MSR_BIOS_UPDT_TRIG	0x079
 #define MSR_BBL_CR_D0		0x088	/* PII+ only */
 #define MSR_BBL_CR_D1		0x089	/* PII+ only */



CVS commit: src/sys

2018-01-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Jan 15 08:17:35 UTC 2018

Modified Files:
src/sys/netinet: in.c
src/sys/netinet6: in6.c

Log Message:
Remove extra pserialize_perform from in_purgeaddr

It's already performed in ifa_remove. Note so there (in in6_unlink_ifa too).


To generate a diff of this commit:
cvs rdiff -u -r1.214 -r1.215 src/sys/netinet/in.c
cvs rdiff -u -r1.257 -r1.258 src/sys/netinet6/in6.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/in.c
diff -u src/sys/netinet/in.c:1.214 src/sys/netinet/in.c:1.215
--- src/sys/netinet/in.c:1.214	Wed Jan 10 10:56:30 2018
+++ src/sys/netinet/in.c	Mon Jan 15 08:17:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: in.c,v 1.214 2018/01/10 10:56:30 knakahara Exp $	*/
+/*	$NetBSD: in.c,v 1.215 2018/01/15 08:17:34 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.214 2018/01/10 10:56:30 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.215 2018/01/15 08:17:34 ozaki-r Exp $");
 
 #include "arp.h"
 
@@ -855,9 +855,7 @@ in_purgeaddr(struct ifaddr *ifa)
 	TAILQ_REMOVE(_ifaddrhead, ia, ia_list);
 	IN_ADDRLIST_WRITER_REMOVE(ia);
 	ifa_remove(ifp, >ia_ifa);
-#ifdef NET_MPSAFE
-	pserialize_perform(in_ifaddrhash_psz);
-#endif
+	/* Assume ifa_remove called pserialize_perform and psref_destroy */
 	mutex_exit(_ifaddr_lock);
 	IN_ADDRHASH_ENTRY_DESTROY(ia);
 	IN_ADDRLIST_ENTRY_DESTROY(ia);

Index: src/sys/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.257 src/sys/netinet6/in6.c:1.258
--- src/sys/netinet6/in6.c:1.257	Wed Jan 10 10:56:30 2018
+++ src/sys/netinet6/in6.c	Mon Jan 15 08:17:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.257 2018/01/10 10:56:30 knakahara Exp $	*/
+/*	$NetBSD: in6.c,v 1.258 2018/01/15 08:17:35 ozaki-r Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.257 2018/01/10 10:56:30 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.258 2018/01/15 08:17:35 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1423,6 +1423,7 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st
 	mutex_enter(_ifaddr_lock);
 	IN6_ADDRLIST_WRITER_REMOVE(ia);
 	ifa_remove(ifp, >ia_ifa);
+	/* Assume ifa_remove called pserialize_perform and psref_destroy */
 	mutex_exit(_ifaddr_lock);
 
 	/*



CVS commit: src/sys/net

2018-01-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan 15 07:59:48 UTC 2018

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

Log Message:
Fix the net.ether.multicast sysctl. If there is no multicast address
don't kmem_alloc(0) (which panics the kernel), and if the number of
multicast addresses has decreased don't copyout uninitialized kernel
data.


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

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

Modified files:

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.250 src/sys/net/if_ethersubr.c:1.251
--- src/sys/net/if_ethersubr.c:1.250	Sat Dec  9 10:51:30 2017
+++ src/sys/net/if_ethersubr.c	Mon Jan 15 07:59:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.250 2017/12/09 10:51:30 maxv Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.251 2018/01/15 07:59:48 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.250 2017/12/09 10:51:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.251 2018/01/15 07:59:48 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1553,16 +1553,23 @@ ether_multicast_sysctl(SYSCTLFN_ARGS)
 
 	/*
 	 * ec->ec_lock is a spin mutex so we cannot call sysctl_copyout, which
-	 * is sleepable, with holding it. Copy data to a local buffer first
-	 * with holding it and then call sysctl_copyout without holding it.
+	 * is sleepable, while holding it. Copy data to a local buffer first
+	 * with the lock taken and then call sysctl_copyout without holding it.
 	 */
 retry:
 	multicnt = ec->ec_multicnt;
+
+	if (multicnt == 0) {
+		if_put(ifp, );
+		*oldlenp = 0;
+		goto out;
+	}
+
 	addrs = kmem_alloc(sizeof(*addrs) * multicnt, KM_SLEEP);
 
 	ETHER_LOCK(ec);
-	if (multicnt < ec->ec_multicnt) {
-		/* The number of multicast addresses have increased */
+	if (multicnt != ec->ec_multicnt) {
+		/* The number of multicast addresses has changed */
 		ETHER_UNLOCK(ec);
 		kmem_free(addrs, sizeof(*addrs) * multicnt);
 		goto retry;