CVS commit: src/sys/dev/usb

2017-01-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 21 07:39:31 UTC 2017

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

Log Message:
Fix a kmem_{zalloc,free} size


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/usb/xhci.c

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

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.69 src/sys/dev/usb/xhci.c:1.70
--- src/sys/dev/usb/xhci.c:1.69	Thu Jan 19 20:35:44 2017
+++ src/sys/dev/usb/xhci.c	Sat Jan 21 07:39:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.69 2017/01/19 20:35:44 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.70 2017/01/21 07:39:30 skrll Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.69 2017/01/19 20:35:44 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.70 2017/01/21 07:39:30 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -614,7 +614,8 @@ xhci_detach(struct xhci_softc *sc, int f
 
 	kmem_free(sc->sc_slots, sizeof(*sc->sc_slots) * sc->sc_maxslots);
 
-	kmem_free(sc->sc_ctlrportbus, sc->sc_maxports * sizeof(uint8_t) / NBBY);
+	kmem_free(sc->sc_ctlrportbus, 
+	howmany(sc->sc_maxports * sizeof(uint8_t), NBBY));
 	kmem_free(sc->sc_ctlrportmap, sc->sc_maxports * sizeof(int));
 
 	for (size_t j = 0; j < __arraycount(sc->sc_rhportmap); j++) {
@@ -958,7 +959,8 @@ xhci_init(struct xhci_softc *sc)
 	aprint_debug_dev(sc->sc_dev, "xECP %x\n", XHCI_HCC_XECP(hcc) * 4);
 
 	/* default all ports to bus 0, i.e. usb 3 */
-	sc->sc_ctlrportbus = kmem_zalloc(sc->sc_maxports * sizeof(uint8_t) / NBBY, KM_SLEEP);
+	sc->sc_ctlrportbus = kmem_zalloc(
+	howmany(sc->sc_maxports * sizeof(uint8_t), NBBY), KM_SLEEP);
 	sc->sc_ctlrportmap = kmem_zalloc(sc->sc_maxports * sizeof(int), KM_SLEEP);
 
 	/* controller port to bus roothub port map */



CVS commit: src/sys/dev/pci

2017-01-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Jan 21 05:58:49 UTC 2017

Modified Files:
src/sys/dev/pci: if_iwmvar.h

Log Message:
Remove unused iwm_softc member.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/if_iwmvar.h

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

Modified files:

Index: src/sys/dev/pci/if_iwmvar.h
diff -u src/sys/dev/pci/if_iwmvar.h:1.15 src/sys/dev/pci/if_iwmvar.h:1.16
--- src/sys/dev/pci/if_iwmvar.h:1.15	Fri Jan 13 11:21:47 2017
+++ src/sys/dev/pci/if_iwmvar.h	Sat Jan 21 05:58:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwmvar.h,v 1.15 2017/01/13 11:21:47 nonaka Exp $	*/
+/*	$NetBSD: if_iwmvar.h,v 1.16 2017/01/21 05:58:49 nonaka Exp $	*/
 /*	OpenBSD: if_iwmvar.h,v 1.24 2016/09/21 13:53:18 stsp Exp 	*/
 
 /*
@@ -356,7 +356,6 @@ struct iwm_softc {
 	struct ieee80211com sc_ic;
 
 	int (*sc_newstate)(struct ieee80211com *, enum ieee80211_state, int);
-	int sc_newstate_pending;
 
 	struct ieee80211_amrr sc_amrr;
 	struct callout sc_calib_to;



CVS commit: src/sys/dev/pci

2017-01-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Jan 21 05:54:06 UTC 2017

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

Log Message:
PR/51797: initialize hardware completely when receiving a deauth frame from AP.

avoid "iwm0: fatal firmware error".


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/pci/if_iwm.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_iwm.c
diff -u src/sys/dev/pci/if_iwm.c:1.68 src/sys/dev/pci/if_iwm.c:1.69
--- src/sys/dev/pci/if_iwm.c:1.68	Sat Jan 21 05:46:57 2017
+++ src/sys/dev/pci/if_iwm.c	Sat Jan 21 05:54:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwm.c,v 1.68 2017/01/21 05:46:57 nonaka Exp $	*/
+/*	$NetBSD: if_iwm.c,v 1.69 2017/01/21 05:54:06 nonaka Exp $	*/
 /*	OpenBSD: if_iwm.c,v 1.148 2016/11/19 21:07:08 stsp Exp	*/
 #define IEEE80211_NO_HT
 /*
@@ -107,7 +107,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.68 2017/01/21 05:46:57 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.69 2017/01/21 05:54:06 nonaka Exp $");
 
 #include 
 #include 
@@ -1032,7 +1032,7 @@ iwm_nic_lock(struct iwm_softc *sc)
 	 | IWM_CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP, 15000)) {
 		rv = 1;
 	} else {
-		aprint_error_dev(sc->sc_dev, "resetting device via NMI\n");
+		DPRINTF(("%s: resetting device via NMI\n", DEVNAME(sc)));
 		IWM_WRITE(sc, IWM_CSR_RESET, IWM_CSR_RESET_REG_FLAG_FORCE_NMI);
 	}
 
@@ -5864,23 +5864,22 @@ iwm_do_newstate(struct ieee80211com *ic,
 	/* Reset the device if moving out of AUTH, ASSOC, or RUN. */
 	/* XXX Is there a way to switch states without a full reset? */
 	if (ostate > IEEE80211_S_SCAN && nstate < ostate) {
-		iwm_stop_device(sc);
-		iwm_init_hw(sc);
-
 		/*
 		 * Upon receiving a deauth frame from AP the net80211 stack
 		 * puts the driver into AUTH state. This will fail with this
 		 * driver so bring the FSM from RUN to SCAN in this case.
 		 */
-		if (nstate == IEEE80211_S_SCAN ||
-		nstate == IEEE80211_S_AUTH ||
-		nstate == IEEE80211_S_ASSOC) {
+		if (nstate != IEEE80211_S_INIT) {
 			DPRINTF(("Force transition to INIT; MGT=%d\n", arg));
 			/* Always pass arg as -1 since we can't Tx right now. */
 			sc->sc_newstate(ic, IEEE80211_S_INIT, -1);
-			DPRINTF(("Going INIT->SCAN\n"));
-			nstate = IEEE80211_S_SCAN;
+			iwm_stop(ifp, 0);
+			iwm_init(ifp);
+			return 0;
 		}
+
+		iwm_stop_device(sc);
+		iwm_init_hw(sc);
 	}
 
 	switch (nstate) {
@@ -5896,7 +5895,8 @@ iwm_do_newstate(struct ieee80211com *ic,
 		else
 			err = iwm_lmac_scan(sc);
 		if (err) {
-			DPRINTF(("%s: could not initiate scan\n", DEVNAME(sc)));
+			DPRINTF(("%s: could not initiate scan: %d\n",
+			DEVNAME(sc), err));
 			return err;
 		}
 		SET(sc->sc_flags, IWM_FLAG_SCANNING);



CVS commit: src/sys/dev/pci

2017-01-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Jan 21 05:46:57 UTC 2017

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

Log Message:
more block network interrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/pci/if_iwm.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_iwm.c
diff -u src/sys/dev/pci/if_iwm.c:1.67 src/sys/dev/pci/if_iwm.c:1.68
--- src/sys/dev/pci/if_iwm.c:1.67	Sat Jan 21 05:43:24 2017
+++ src/sys/dev/pci/if_iwm.c	Sat Jan 21 05:46:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwm.c,v 1.67 2017/01/21 05:43:24 nonaka Exp $	*/
+/*	$NetBSD: if_iwm.c,v 1.68 2017/01/21 05:46:57 nonaka Exp $	*/
 /*	OpenBSD: if_iwm.c,v 1.148 2016/11/19 21:07:08 stsp Exp	*/
 #define IEEE80211_NO_HT
 /*
@@ -107,7 +107,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.67 2017/01/21 05:43:24 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.68 2017/01/21 05:46:57 nonaka Exp $");
 
 #include 
 #include 
@@ -5489,6 +5489,7 @@ iwm_rx_missed_beacons_notif(struct iwm_s
 	struct iwm_rx_packet *pkt, struct iwm_rx_data *data)
 {
 	struct iwm_missed_beacons_notif *mb = (void *)pkt->data;
+	int s;
 
 	DPRINTF(("missed bcn mac_id=%u, consecutive=%u (%u, %u, %u)\n",
 	le32toh(mb->mac_id),
@@ -5502,8 +5503,11 @@ iwm_rx_missed_beacons_notif(struct iwm_s
 	 * and/or in case of a CS flow on one of the other AP vifs.
 	 */
 	if (le32toh(mb->consec_missed_beacons_since_last_rx) >
-	IWM_MISSED_BEACONS_THRESHOLD)
+	IWM_MISSED_BEACONS_THRESHOLD) {
+		s = splnet();
 		ieee80211_beacon_miss(>sc_ic);
+		splx(s);
+	}
 }
 
 static int
@@ -7286,7 +7290,7 @@ iwm_softintr(void *arg)
 	struct iwm_softc *sc = arg;
 	struct ifnet *ifp = IC2IFP(>sc_ic);
 	uint32_t r1;
-	int isperiodic = 0;
+	int isperiodic = 0, s;
 
 	r1 = atomic_swap_32(>sc_soft_flags, 0);
 
@@ -7311,8 +7315,10 @@ iwm_softintr(void *arg)
 
 		aprint_error_dev(sc->sc_dev, "fatal firmware error\n");
  fatal:
+		s = splnet();
 		ifp->if_flags &= ~IFF_UP;
 		iwm_stop(ifp, 1);
+		splx(s);
 		/* Don't restore interrupt mask */
 		return;
 
@@ -7332,10 +7338,8 @@ iwm_softintr(void *arg)
 	}
 
 	if (r1 & IWM_CSR_INT_BIT_RF_KILL) {
-		if (iwm_check_rfkill(sc) && (ifp->if_flags & IFF_UP)) {
-			ifp->if_flags &= ~IFF_UP;
-			iwm_stop(ifp, 1);
-		}
+		if (iwm_check_rfkill(sc) && (ifp->if_flags & IFF_UP))
+			goto fatal;
 	}
 
 	if (r1 & IWM_CSR_INT_BIT_RX_PERIODIC) {



CVS commit: src/sys/dev/pci

2017-01-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Jan 21 05:43:24 UTC 2017

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

Log Message:
increase command response timeout value.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/pci/if_iwm.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_iwm.c
diff -u src/sys/dev/pci/if_iwm.c:1.66 src/sys/dev/pci/if_iwm.c:1.67
--- src/sys/dev/pci/if_iwm.c:1.66	Sat Jan 21 05:40:47 2017
+++ src/sys/dev/pci/if_iwm.c	Sat Jan 21 05:43:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwm.c,v 1.66 2017/01/21 05:40:47 nonaka Exp $	*/
+/*	$NetBSD: if_iwm.c,v 1.67 2017/01/21 05:43:24 nonaka Exp $	*/
 /*	OpenBSD: if_iwm.c,v 1.148 2016/11/19 21:07:08 stsp Exp	*/
 #define IEEE80211_NO_HT
 /*
@@ -107,7 +107,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.66 2017/01/21 05:40:47 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.67 2017/01/21 05:43:24 nonaka Exp $");
 
 #include 
 #include 
@@ -3998,7 +3998,7 @@ iwm_send_cmd(struct iwm_softc *sc, struc
 
 	if (!async) {
 		int generation = sc->sc_generation;
-		err = tsleep(desc, PCATCH, "iwmcmd", mstohz(1000));
+		err = tsleep(desc, PCATCH, "iwmcmd", mstohz(2000));
 		if (err == 0) {
 			/* if hardware is no longer up, return error */
 			if (generation != sc->sc_generation) {



CVS commit: src/sys/dev/pci

2017-01-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Jan 21 05:40:47 UTC 2017

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

Log Message:
include  for softint(9).


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pci/if_iwm.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_iwm.c
diff -u src/sys/dev/pci/if_iwm.c:1.65 src/sys/dev/pci/if_iwm.c:1.66
--- src/sys/dev/pci/if_iwm.c:1.65	Thu Jan 19 11:24:05 2017
+++ src/sys/dev/pci/if_iwm.c	Sat Jan 21 05:40:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwm.c,v 1.65 2017/01/19 11:24:05 nonaka Exp $	*/
+/*	$NetBSD: if_iwm.c,v 1.66 2017/01/21 05:40:47 nonaka Exp $	*/
 /*	OpenBSD: if_iwm.c,v 1.148 2016/11/19 21:07:08 stsp Exp	*/
 #define IEEE80211_NO_HT
 /*
@@ -107,7 +107,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.65 2017/01/19 11:24:05 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.66 2017/01/21 05:40:47 nonaka Exp $");
 
 #include 
 #include 
@@ -125,7 +125,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 



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

2017-01-20 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Fri Jan 20 23:00:30 UTC 2017

Modified Files:
src/usr.sbin/npf/npfctl: npf_parse.y

Log Message:
npfctl: fix shift/reduce conflicts, thanks to riastradh@.


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

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf_parse.y
diff -u src/usr.sbin/npf/npfctl/npf_parse.y:1.43 src/usr.sbin/npf/npfctl/npf_parse.y:1.44
--- src/usr.sbin/npf/npfctl/npf_parse.y:1.43	Fri Jan 20 03:16:40 2017
+++ src/usr.sbin/npf/npfctl/npf_parse.y	Fri Jan 20 23:00:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_parse.y,v 1.43 2017/01/20 03:16:40 kre Exp $	*/
+/*	$NetBSD: npf_parse.y,v 1.44 2017/01/20 23:00:30 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2011-2017 The NetBSD Foundation, Inc.
@@ -180,7 +180,7 @@ yyerror(const char *fmt, ...)
 %type			element, list_elems, list, value
 %type		mapseg
 %type		filt_opts, all_or_filt_opts
-%type		opt_proto
+%type		proto opt_proto
 %type		group_opts
 %type			onoff
 
@@ -357,7 +357,11 @@ map
 	{
 		npfctl_build_natseg($3, $6, $2, &$5, &$7, &$9, &$10, $4);
 	}
-	| MAP ifref map_sd map_algo opt_proto mapseg map_type mapseg
+	| MAP ifref map_sd map_algo mapseg map_type mapseg
+	{
+		npfctl_build_natseg($3, $6, $2, &$5, &$7, NULL, NULL, $4);
+	}
+	| MAP ifref map_sd map_algo proto mapseg map_type mapseg
 	{
 		npfctl_build_natseg($3, $7, $2, &$6, &$8, &$5, NULL, $4);
 	}
@@ -546,7 +550,7 @@ opt_family
 	|			{ $$ = AF_UNSPEC; }
 	;
 
-opt_proto
+proto
 	: PROTO TCP tcp_flags_and_mask
 	{
 		$$.op_proto = IPPROTO_TCP;
@@ -572,6 +576,10 @@ opt_proto
 		$$.op_proto = $2;
 		$$.op_opts = NULL;
 	}
+	;
+
+opt_proto
+	: proto			{ $$ = $1; }
 	|
 	{
 		$$.op_proto = -1;



CVS commit: src/lib/libm

2017-01-20 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Jan 20 22:10:38 UTC 2017

Modified Files:
src/lib/libm: shlib_version

Log Message:
add a wishlist for a major bump. isinff and compatibility cabs.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libm/shlib_version

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

Modified files:

Index: src/lib/libm/shlib_version
diff -u src/lib/libm/shlib_version:1.14 src/lib/libm/shlib_version:1.15
--- src/lib/libm/shlib_version:1.14	Fri Oct 10 00:48:18 2014
+++ src/lib/libm/shlib_version	Fri Jan 20 22:10:38 2017
@@ -1,5 +1,8 @@
-#	$NetBSD: shlib_version,v 1.14 2014/10/10 00:48:18 christos Exp $
+#	$NetBSD: shlib_version,v 1.15 2017/01/20 22:10:38 maya Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
+# things we wish to do on next major version bump:
+# - remove compatibility cabs
+# - hide isinff
 major=0
 minor=11



CVS commit: src/tests/lib/libm

2017-01-20 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Jan 20 21:15:56 UTC 2017

Modified Files:
src/tests/lib/libm: t_pow.c

Log Message:
use isinf instead of isinff. this doesn't introduce a functional change -
isinf works for float as well, and is more portable.

from Ngie Cooper in PR bin/51838


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libm/t_pow.c

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

Modified files:

Index: src/tests/lib/libm/t_pow.c
diff -u src/tests/lib/libm/t_pow.c:1.4 src/tests/lib/libm/t_pow.c:1.5
--- src/tests/lib/libm/t_pow.c:1.4	Tue Sep  8 05:24:27 2015
+++ src/tests/lib/libm/t_pow.c	Fri Jan 20 21:15:56 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pow.c,v 1.4 2015/09/08 05:24:27 dholland Exp $ */
+/* $NetBSD: t_pow.c,v 1.5 2017/01/20 21:15:56 maya Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_pow.c,v 1.4 2015/09/08 05:24:27 dholland Exp $");
+__RCSID("$NetBSD: t_pow.c,v 1.5 2017/01/20 21:15:56 maya Exp $");
 
 #include 
 #include 
@@ -379,12 +379,12 @@ ATF_TC_BODY(powf_inf_neg_x, tc)
 	 */
 	z = powf(x, 3.0);
 
-	if (isinff(z) == 0 || signbit(z) == 0)
+	if (isinf(z) == 0 || signbit(z) == 0)
 		atf_tc_fail_nonfatal("powf(-Inf, 3.0) != -Inf");
 
 	z = powf(x, 4.0);
 
-	if (isinff(z) == 0 || signbit(z) != 0)
+	if (isinf(z) == 0 || signbit(z) != 0)
 		atf_tc_fail_nonfatal("powf(-Inf, 4.0) != +Inf");
 
 	/*
@@ -421,7 +421,7 @@ ATF_TC_BODY(powf_inf_neg_y, tc)
 	 */
 	z = powf(0.1, y);
 
-	if (isinff(z) == 0 || signbit(z) != 0)
+	if (isinf(z) == 0 || signbit(z) != 0)
 		atf_tc_fail_nonfatal("powf(0.1, -Inf) != +Inf");
 
 	z = powf(1.1, y);
@@ -452,7 +452,7 @@ ATF_TC_BODY(powf_inf_pos_x, tc)
 
 	z = powf(x, 2.0);
 
-	if (isinff(z) == 0 || signbit(z) != 0)
+	if (isinf(z) == 0 || signbit(z) != 0)
 		atf_tc_fail_nonfatal("powf(+Inf, 2.0) != +Inf");
 }
 
@@ -478,7 +478,7 @@ ATF_TC_BODY(powf_inf_pos_y, tc)
 
 	z = powf(1.1, y);
 
-	if (isinff(z) == 0 || signbit(z) != 0)
+	if (isinf(z) == 0 || signbit(z) != 0)
 		atf_tc_fail_nonfatal("powf(1.1, +Inf) != +Inf");
 }
 
@@ -496,8 +496,8 @@ ATF_TC_BODY(powf_one_neg_x, tc)
 	/*
 	 * If x is -1.0, and y is +-Inf, 1.0 shall be returned.
 	 */
-	ATF_REQUIRE(isinff(infp) != 0);
-	ATF_REQUIRE(isinff(infn) != 0);
+	ATF_REQUIRE(isinf(infp) != 0);
+	ATF_REQUIRE(isinf(infn) != 0);
 
 	if (powf(-1.0, infp) != 1.0) {
 		atf_tc_expect_fail("PR lib/45372");



CVS commit: src/sys/netinet

2017-01-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan 20 19:21:01 UTC 2017

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

Log Message:
Make sure the protocol address length equals that of IPv4. Also, make sure
the hardware address length equals that of the interface we received the
packet on. Otherwise a packet could easily set them both to zero and make
the kernel read beyond the allocated mbuf, which is terrible.

Note: for the latter we drop the packet instead of replying, since it is
malformed.

Note: I also added an ugly hack in CARP, since it apparently expects at
least six bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.237 -r1.238 src/sys/netinet/if_arp.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/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.237 src/sys/netinet/if_arp.c:1.238
--- src/sys/netinet/if_arp.c:1.237	Fri Jan 20 17:50:52 2017
+++ src/sys/netinet/if_arp.c	Fri Jan 20 19:21:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.237 2017/01/20 17:50:52 maxv Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.238 2017/01/20 19:21:01 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.237 2017/01/20 17:50:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.238 2017/01/20 19:21:01 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1040,6 +1040,9 @@ in_arpinput(struct mbuf *m)
 		break;
 	}
 
+	if (ah->ar_pln != sizeof(struct in_addr))
+		goto drop;
+
 	memcpy(, ar_spa(ah), sizeof(isaddr));
 	memcpy(, ar_tpa(ah), sizeof(itaddr));
 
@@ -1060,7 +1063,8 @@ in_arpinput(struct mbuf *m)
 		((ia->ia_ifp->if_flags & (IFF_UP|IFF_RUNNING)) ==
 		(IFF_UP|IFF_RUNNING))) {
 			index++;
-			if (ia->ia_ifp == rcvif &&
+			/* XXX: ar_hln? */
+			if (ia->ia_ifp == rcvif && (ah->ar_hln >= 6) &&
 			carp_iamatch(ia, ar_sha(ah),
 			, index)) {
 break;
@@ -1096,6 +1100,14 @@ in_arpinput(struct mbuf *m)
 		ia4_acquire(ia, _ia);
 	pserialize_read_exit(s);
 
+	if (ah->ar_hln != ifp->if_addrlen) {
+		ARP_STATINC(ARP_STAT_RCVBADLEN);
+		log(LOG_WARNING,
+		"arp from %s: addr len: new %d, i/f %d (ignored)\n",
+		in_fmtaddr(ipbuf, isaddr), ah->ar_hln, ifp->if_addrlen);
+		goto out;
+	}
+
 	if (ia == NULL) {
 		ia = in_get_ia_on_iface_psref(isaddr, rcvif, _ia);
 		if (ia == NULL) {
@@ -1211,15 +1223,6 @@ in_arpinput(struct mbuf *m)
 	}
 #endif
 
-	if (ifp->if_addrlen != ah->ar_hln) {
-		ARP_STATINC(ARP_STAT_RCVBADLEN);
-		log(LOG_WARNING,
-		"arp from %s: addr len: new %d, i/f %d (ignored)\n",
-		in_fmtaddr(ipbuf, isaddr), ah->ar_hln,
-		ifp->if_addrlen);
-		goto reply;
-	}
-
 #if NTOKEN > 0
 	/*
 	 * XXX uses m_data and assumes the complete answer including



CVS commit: src/sys/netinet

2017-01-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan 20 17:50:52 UTC 2017

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

Log Message:
Style


To generate a diff of this commit:
cvs rdiff -u -r1.236 -r1.237 src/sys/netinet/if_arp.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/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.236 src/sys/netinet/if_arp.c:1.237
--- src/sys/netinet/if_arp.c:1.236	Fri Jan 20 17:45:42 2017
+++ src/sys/netinet/if_arp.c	Fri Jan 20 17:50:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.236 2017/01/20 17:45:42 maxv Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.237 2017/01/20 17:50:52 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.236 2017/01/20 17:45:42 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.237 2017/01/20 17:50:52 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -979,18 +979,17 @@ out:
 }
 
 /*
- * ARP for Internet protocols on 10 Mb/s Ethernet.
- * Algorithm is that given in RFC 826.
- * In addition, a sanity check is performed on the sender
- * protocol address, to catch impersonators.
- * We no longer handle negotiations for use of trailer protocol:
- * Formerly, ARP replied for protocol type ETHERTYPE_TRAIL sent
- * along with IP replies if we wanted trailers sent to us,
- * and also sent them in response to IP replies.
- * This allowed either end to announce the desire to receive
- * trailer packets.
- * We no longer reply to requests for ETHERTYPE_TRAIL protocol either,
- * but formerly didn't normally send requests.
+ * ARP for Internet protocols on 10 Mb/s Ethernet. Algorithm is that given in
+ * RFC 826. In addition, a sanity check is performed on the sender protocol
+ * address, to catch impersonators.
+ *
+ * We no longer handle negotiations for use of trailer protocol: formerly, ARP
+ * replied for protocol type ETHERTYPE_TRAIL sent along with IP replies if we
+ * wanted trailers sent to us, and also sent them in response to IP replies.
+ * This allowed either end to announce the desire to receive trailer packets.
+ *
+ * We no longer reply to requests for ETHERTYPE_TRAIL protocol either, but
+ * formerly didn't normally send requests.
  */
 static void
 in_arpinput(struct mbuf *m)
@@ -1023,9 +1022,10 @@ in_arpinput(struct mbuf *m)
 	rcvif = ifp = m_get_rcvif_psref(m, );
 	if (__predict_false(rcvif == NULL))
 		goto drop;
+
 	/*
-	 * Fix up ah->ar_hrd if necessary, before using ar_tha() or
-	 * ar_tpa().
+	 * Fix up ah->ar_hrd if necessary, before using ar_tha() or ar_tpa().
+	 * XXX check ar_hrd more strictly?
 	 */
 	switch (ifp->if_type) {
 	case IFT_IEEE1394:
@@ -1033,22 +1033,19 @@ in_arpinput(struct mbuf *m)
 			;
 		else {
 			/* XXX this is to make sure we compute ar_tha right */
-			/* XXX check ar_hrd more strictly? */
 			ah->ar_hrd = htons(ARPHRD_IEEE1394);
 		}
 		break;
 	default:
-		/* XXX check ar_hrd? */
 		break;
 	}
 
-	memcpy(, ar_spa(ah), sizeof (isaddr));
-	memcpy(, ar_tpa(ah), sizeof (itaddr));
+	memcpy(, ar_spa(ah), sizeof(isaddr));
+	memcpy(, ar_tpa(ah), sizeof(itaddr));
 
 	if (m->m_flags & (M_BCAST|M_MCAST))
 		ARP_STATINC(ARP_STAT_RCVMCAST);
 
-
 	/*
 	 * Search for a matching interface address
 	 * or any address on the interface to use
@@ -1137,7 +1134,7 @@ in_arpinput(struct mbuf *m)
 
 	/*
 	 * If the target IP address is zero, ignore the packet.
-	 * This prevents the code below from tring to answer
+	 * This prevents the code below from trying to answer
 	 * when we are using IP address zero (booting).
 	 */
 	if (in_nullhost(itaddr)) {
@@ -1252,7 +1249,7 @@ in_arpinput(struct mbuf *m)
 #endif /* NTOKEN > 0 */
 
 	KASSERT(sizeof(la->ll_addr) >= ifp->if_addrlen);
-	(void)memcpy(>ll_addr, ar_sha(ah), ifp->if_addrlen);
+	memcpy(>ll_addr, ar_sha(ah), ifp->if_addrlen);
 	la->la_flags |= LLE_VALID;
 	if ((la->la_flags & LLE_STATIC) == 0) {
 		la->la_expire = time_uptime + arpt_keep;
@@ -1299,7 +1296,7 @@ reply:
 	}
 	ARP_STATINC(ARP_STAT_RCVREQUEST);
 	if (in_hosteq(itaddr, myaddr)) {
-		/* If our address is unuseable, don't reply */
+		/* If our address is unusable, don't reply */
 		if (ia->ia4_flags & (IN_IFF_NOTREADY | IN_IFF_DETACHED))
 			goto out;
 		/* I am the target */



CVS commit: src/sys/netinet

2017-01-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jan 20 17:45:42 UTC 2017

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

Log Message:
Reput a nullcheck that was mistakenly removed in rev1.204. ar_hrd is
packet-controlled.


To generate a diff of this commit:
cvs rdiff -u -r1.235 -r1.236 src/sys/netinet/if_arp.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/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.235 src/sys/netinet/if_arp.c:1.236
--- src/sys/netinet/if_arp.c:1.235	Mon Jan 16 15:14:16 2017
+++ src/sys/netinet/if_arp.c	Fri Jan 20 17:45:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.235 2017/01/16 15:14:16 christos Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.236 2017/01/20 17:45:42 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.235 2017/01/16 15:14:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.236 2017/01/20 17:45:42 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1327,8 +1327,9 @@ reply:
 		IF_AFDATA_RUNLOCK(ifp);
 
 		if ((lle != NULL) && (lle->la_flags & LLE_PUB)) {
-			(void)memcpy(tha, ar_sha(ah), ah->ar_hln);
-			(void)memcpy(ar_sha(ah), >ll_addr, ah->ar_hln);
+			if (tha)
+memcpy(tha, ar_sha(ah), ah->ar_hln);
+			memcpy(ar_sha(ah), >ll_addr, ah->ar_hln);
 			LLE_RUNLOCK(lle);
 		} else {
 			if (lle != NULL)



CVS commit: src/external/gpl2/xcvs/dist/doc

2017-01-20 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Fri Jan 20 16:54:11 UTC 2017

Modified Files:
src/external/gpl2/xcvs/dist/doc: cvs.1 cvs.texinfo

Log Message:
Fix a spelling: s/regestring/registering


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl2/xcvs/dist/doc/cvs.1
cvs rdiff -u -r1.2 -r1.3 src/external/gpl2/xcvs/dist/doc/cvs.texinfo

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

Modified files:

Index: src/external/gpl2/xcvs/dist/doc/cvs.1
diff -u src/external/gpl2/xcvs/dist/doc/cvs.1:1.3 src/external/gpl2/xcvs/dist/doc/cvs.1:1.4
--- src/external/gpl2/xcvs/dist/doc/cvs.1:1.3	Wed Dec 21 21:26:28 2016
+++ src/external/gpl2/xcvs/dist/doc/cvs.1	Fri Jan 20 16:54:11 2017
@@ -1490,7 +1490,7 @@ cannot commit to a specific revision on 
 Refuse to commit files unless the user has registered a valid edit on the
 file via \fBcvs edit\fR.  This is most useful when \fBcommit -c\fR
 and \fBedit -c\fR have been placed in all \fB.cvsrc\fR files.
-A commit can be forced anyways by either regestering an edit retroactively
+A commit can be forced anyways by either registering an edit retroactively
 via \fBcvs edit\fR (no changes to the file will be lost) or using the
 \fB-f\fR option to commit.  Support for \fBcommit -c\fR requires both
 client and a server versions 1.12.10 or greater.

Index: src/external/gpl2/xcvs/dist/doc/cvs.texinfo
diff -u src/external/gpl2/xcvs/dist/doc/cvs.texinfo:1.2 src/external/gpl2/xcvs/dist/doc/cvs.texinfo:1.3
--- src/external/gpl2/xcvs/dist/doc/cvs.texinfo:1.2	Sat Sep 24 12:02:58 2011
+++ src/external/gpl2/xcvs/dist/doc/cvs.texinfo	Fri Jan 20 16:54:11 2017
@@ -9541,7 +9541,7 @@ cannot commit to a specific revision on 
 Refuse to commit files unless the user has registered a valid edit on the
 file via @code{cvs edit}.  This is most useful when @samp{commit -c}
 and @samp{edit -c} have been placed in all @file{.cvsrc} files.
-A commit can be forced anyways by either regestering an edit retroactively
+A commit can be forced anyways by either registering an edit retroactively
 via @code{cvs edit} (no changes to the file will be lost) or using the
 @code{-f} option to commit.  Support for @code{commit -c} requires both
 client and a server versions 1.12.10 or greater.



CVS commit: src/libexec/httpd

2017-01-20 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Fri Jan 20 16:14:44 UTC 2017

Modified Files:
src/libexec/httpd: bozohttpd.8

Log Message:
Fix typo: s/suport/support


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/libexec/httpd/bozohttpd.8

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

Modified files:

Index: src/libexec/httpd/bozohttpd.8
diff -u src/libexec/httpd/bozohttpd.8:1.63 src/libexec/httpd/bozohttpd.8:1.64
--- src/libexec/httpd/bozohttpd.8:1.63	Wed Dec 21 09:33:08 2016
+++ src/libexec/httpd/bozohttpd.8	Fri Jan 20 16:14:44 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bozohttpd.8,v 1.63 2016/12/21 09:33:08 abhinav Exp $
+.\"	$NetBSD: bozohttpd.8,v 1.64 2017/01/20 16:14:44 abhinav Exp $
 .\"
 .\"	$eterna: bozohttpd.8,v 1.101 2011/11/18 01:25:11 mrg Exp $
 .\"
@@ -384,7 +384,7 @@ user transformations (NO_USER_SUPPORT),
 directory index support (NO_DIRINDEX_SUPPORT),
 daemon mode support (NO_DAEMON_MODE),
 dynamic MIME content (NO_DYNAMIC_CONTENT),
-Lua suport (NO_LUA_SUPPORT),
+Lua support (NO_LUA_SUPPORT),
 and SSL support (NO_SSL_SUPPORT)
 by defining the listed macros when building
 .Nm .



CVS commit: src/sys

2017-01-20 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Jan 20 12:25:07 UTC 2017

Modified Files:
src/sys/dev/drm: vbox_drv.c
src/sys/dev/gpio: gpiolock.c gpiopwm.c gpiosim.c
src/sys/dev/pci: gffb.c ibmcd.c pwdog.c r128fb.c
src/sys/dev/podulebus: sec.c
src/sys/dev/usb: irmce.c
src/sys/external/bsd/drm/dist/bsd-core: i915_drv.c
src/sys/external/bsd/drm2/radeon: radeondrmkmsfb.c
src/sys/modules/lua: lua.c

Log Message:
Check pmf_device_register return value. NFC
Appeases static analyzers.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/drm/vbox_drv.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/gpio/gpiolock.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/gpio/gpiopwm.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/gpio/gpiosim.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/gffb.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/ibmcd.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/pwdog.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pci/r128fb.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/podulebus/sec.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/usb/irmce.c
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm/dist/bsd-core/i915_drv.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/radeon/radeondrmkmsfb.c
cvs rdiff -u -r1.18 -r1.19 src/sys/modules/lua/lua.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/drm/vbox_drv.c
diff -u src/sys/dev/drm/vbox_drv.c:1.2 src/sys/dev/drm/vbox_drv.c:1.3
--- src/sys/dev/drm/vbox_drv.c:1.2	Sun Aug 28 17:18:31 2011
+++ src/sys/dev/drm/vbox_drv.c	Fri Jan 20 12:25:07 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: vbox_drv.c,v 1.2 2011/08/28 17:18:31 jmcneill Exp $ */
+/* $NetBSD: vbox_drv.c,v 1.3 2017/01/20 12:25:07 maya Exp $ */
 
 /*
  * Copyright (c) 2011 Jared D. McNeill 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vbox_drv.c,v 1.2 2011/08/28 17:18:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vbox_drv.c,v 1.3 2017/01/20 12:25:07 maya Exp $");
 
 #include "drmP.h"
 #include "drm.h"
@@ -69,7 +69,8 @@ vboxdrm_attach(device_t parent, device_t
 	struct pci_attach_args *pa = opaque;
 	struct drm_device *dev = device_private(self);
 
-	pmf_device_register(self, NULL, NULL);
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
 
 	dev->driver = kmem_zalloc(sizeof(struct drm_driver_info), KM_SLEEP);
 	if (dev->driver == NULL) {

Index: src/sys/dev/gpio/gpiolock.c
diff -u src/sys/dev/gpio/gpiolock.c:1.3 src/sys/dev/gpio/gpiolock.c:1.4
--- src/sys/dev/gpio/gpiolock.c:1.3	Sun Dec  6 22:33:44 2009
+++ src/sys/dev/gpio/gpiolock.c	Fri Jan 20 12:25:07 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: gpiolock.c,v 1.3 2009/12/06 22:33:44 dyoung Exp $ */
+/* $NetBSD: gpiolock.c,v 1.4 2017/01/20 12:25:07 maya Exp $ */
 
 /*
  * Copyright (c) 2009 Marc Balmer 
@@ -123,7 +123,8 @@ gpiolock_attach(device_t parent, device_
 		goto fail;
 	}
 #endif
-	pmf_device_register(self, NULL, NULL);
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
 
 	aprint_normal("\n");
 	return;

Index: src/sys/dev/gpio/gpiopwm.c
diff -u src/sys/dev/gpio/gpiopwm.c:1.5 src/sys/dev/gpio/gpiopwm.c:1.6
--- src/sys/dev/gpio/gpiopwm.c:1.5	Thu Jul 14 04:00:45 2016
+++ src/sys/dev/gpio/gpiopwm.c	Fri Jan 20 12:25:07 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: gpiopwm.c,v 1.5 2016/07/14 04:00:45 msaitoh Exp $ */
+/* $NetBSD: gpiopwm.c,v 1.6 2017/01/20 12:25:07 maya Exp $ */
 
 /*
  * Copyright (c) 2011 Marc Balmer 
@@ -104,7 +104,8 @@ gpiopwm_attach(device_t parent, device_t
 		return;
 	}
 	aprint_normal(" [%d]", sc->sc_map.pm_map[0]);
-	pmf_device_register(self, NULL, NULL);
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
 
 	callout_init(>sc_pulse, CALLOUT_MPSAFE);
 	callout_setfunc(>sc_pulse, gpiopwm_pulse, sc);

Index: src/sys/dev/gpio/gpiosim.c
diff -u src/sys/dev/gpio/gpiosim.c:1.19 src/sys/dev/gpio/gpiosim.c:1.20
--- src/sys/dev/gpio/gpiosim.c:1.19	Thu Jul 14 04:00:45 2016
+++ src/sys/dev/gpio/gpiosim.c	Fri Jan 20 12:25:07 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: gpiosim.c,v 1.19 2016/07/14 04:00:45 msaitoh Exp $ */
+/* $NetBSD: gpiosim.c,v 1.20 2017/01/20 12:25:07 maya Exp $ */
 /*  $OpenBSD: gpiosim.c,v 1.1 2008/11/23 18:46:49 mbalmer Exp $	*/
 
 /*
@@ -121,7 +121,8 @@ gpiosim_attach(device_t parent, device_t
 	gba.gba_pins = sc->sc_gpio_pins;
 	gba.gba_npins = GPIOSIM_NPINS;
 
-	pmf_device_register(self, NULL, NULL);
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
 
 sysctl_createv(>sc_log, 0, NULL, ,
 0,

Index: src/sys/dev/pci/gffb.c
diff -u src/sys/dev/pci/gffb.c:1.11 src/sys/dev/pci/gffb.c:1.12
--- src/sys/dev/pci/gffb.c:1.11	Mon Jul 11 11:31:51 2016
+++ src/sys/dev/pci/gffb.c	

CVS commit: src/sys/kern

2017-01-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 20 09:45:13 UTC 2017

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

Log Message:
Fix build


To generate a diff of this commit:
cvs rdiff -u -r1.268 -r1.269 src/sys/kern/vfs_bio.c

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

Modified files:

Index: src/sys/kern/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.268 src/sys/kern/vfs_bio.c:1.269
--- src/sys/kern/vfs_bio.c:1.268	Fri Jan 20 08:16:31 2017
+++ src/sys/kern/vfs_bio.c	Fri Jan 20 09:45:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.268 2017/01/20 08:16:31 skrll Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.269 2017/01/20 09:45:13 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.268 2017/01/20 08:16:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.269 2017/01/20 09:45:13 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -1970,8 +1970,9 @@ getiobuf(struct vnode *vp, bool waitok)
 
 	if ((bp->b_vp = vp) != NULL) {
 		bp->b_objlock = vp->v_interlock;
-	else
+	} else {
 		KASSERT(bp->b_objlock == _lock);
+	}
 	
 	return bp;
 }



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

2017-01-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Jan 20 08:48:14 UTC 2017

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

Log Message:
Bump date for previous.


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

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.47 src/usr.sbin/npf/npfctl/npf.conf.5:1.48
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.47	Thu Jan 19 20:18:17 2017
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Fri Jan 20 08:48:14 2017
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.47 2017/01/19 20:18:17 rmind Exp $
+.\"$NetBSD: npf.conf.5,v 1.48 2017/01/20 08:48:14 wiz Exp $
 .\"
 .\" Copyright (c) 2009-2017 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 January 3, 2017
+.Dd January 19, 2017
 .Dt NPF.CONF 5
 .Os
 .Sh NAME



CVS commit: src

2017-01-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jan 20 08:35:33 UTC 2017

Modified Files:
src/sys/net: if.c
src/sys/rump/net/lib/libnetinet: netinet_component.c
src/tests/net/if: t_ifconfig.sh

Log Message:
Protect if_clone data with if_clone_mtx

To this end, carpattach needs to be delayed from RUMP_COMPONENT_NET to
RUMP_COMPONENT_NET_IF on rump_server. Otherwise mutex_enter via carpattach
for if_clone_mtx is called before mutex_init for it in ifinit1.


To generate a diff of this commit:
cvs rdiff -u -r1.371 -r1.372 src/sys/net/if.c
cvs rdiff -u -r1.7 -r1.8 src/sys/rump/net/lib/libnetinet/netinet_component.c
cvs rdiff -u -r1.14 -r1.15 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/sys/net/if.c
diff -u src/sys/net/if.c:1.371 src/sys/net/if.c:1.372
--- src/sys/net/if.c:1.371	Tue Jan 10 08:45:45 2017
+++ src/sys/net/if.c	Fri Jan 20 08:35:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.371 2017/01/10 08:45:45 ozaki-r Exp $	*/
+/*	$NetBSD: if.c,v 1.372 2017/01/20 08:35:33 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.371 2017/01/10 08:45:45 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.372 2017/01/20 08:35:33 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1537,6 +1537,8 @@ if_clone_create(const char *name)
 	struct ifnet *ifp;
 	struct psref psref;
 
+	KASSERT(mutex_owned(_clone_mtx));
+
 	ifc = if_clone_lookup(name, );
 	if (ifc == NULL)
 		return EINVAL;
@@ -1560,6 +1562,8 @@ if_clone_destroy(const char *name)
 	struct ifnet *ifp;
 	struct psref psref;
 
+	KASSERT(mutex_owned(_clone_mtx));
+
 	ifc = if_clone_lookup(name, NULL);
 	if (ifc == NULL)
 		return EINVAL;
@@ -1596,6 +1600,8 @@ if_clone_lookup(const char *name, int *u
 	char *dp, ifname[IFNAMSIZ + 3];
 	int unit;
 
+	KASSERT(mutex_owned(_clone_mtx));
+
 	strcpy(ifname, "if_");
 	/* separate interface name from unit */
 	for (dp = ifname + 3, cp = name; cp - name < IFNAMSIZ &&
@@ -1641,8 +1647,10 @@ void
 if_clone_attach(struct if_clone *ifc)
 {
 
+	mutex_enter(_clone_mtx);
 	LIST_INSERT_HEAD(_cloners, ifc, ifc_list);
 	if_cloners_count++;
+	mutex_exit(_clone_mtx);
 }
 
 /*
@@ -1652,6 +1660,7 @@ void
 if_clone_detach(struct if_clone *ifc)
 {
 
+	KASSERT(mutex_owned(_clone_mtx));
 	LIST_REMOVE(ifc, ifc_list);
 	if_cloners_count--;
 }
@@ -1666,14 +1675,17 @@ if_clone_list(int buf_count, char *buffe
 	struct if_clone *ifc;
 	int count, error = 0;
 
+	mutex_enter(_clone_mtx);
 	*total = if_cloners_count;
 	if ((dst = buffer) == NULL) {
 		/* Just asking how many there are. */
-		return 0;
+		goto out;
 	}
 
-	if (buf_count < 0)
-		return EINVAL;
+	if (buf_count < 0) {
+		error = EINVAL;
+		goto out;
+	}
 
 	count = (if_cloners_count < buf_count) ?
 	if_cloners_count : buf_count;
@@ -1681,13 +1693,17 @@ if_clone_list(int buf_count, char *buffe
 	for (ifc = LIST_FIRST(_cloners); ifc != NULL && count != 0;
 	 ifc = LIST_NEXT(ifc, ifc_list), count--, dst += IFNAMSIZ) {
 		(void)strncpy(outbuf, ifc->ifc_name, sizeof(outbuf));
-		if (outbuf[sizeof(outbuf) - 1] != '\0')
-			return ENAMETOOLONG;
+		if (outbuf[sizeof(outbuf) - 1] != '\0') {
+			error = ENAMETOOLONG;
+			goto out;
+		}
 		error = copyout(outbuf, dst, sizeof(outbuf));
 		if (error != 0)
 			break;
 	}
 
+out:
+	mutex_exit(_clone_mtx);
 	return error;
 }
 

Index: src/sys/rump/net/lib/libnetinet/netinet_component.c
diff -u src/sys/rump/net/lib/libnetinet/netinet_component.c:1.7 src/sys/rump/net/lib/libnetinet/netinet_component.c:1.8
--- src/sys/rump/net/lib/libnetinet/netinet_component.c:1.7	Sat Aug 13 11:19:35 2016
+++ src/sys/rump/net/lib/libnetinet/netinet_component.c	Fri Jan 20 08:35:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: netinet_component.c,v 1.7 2016/08/13 11:19:35 christos Exp $	*/
+/*	$NetBSD: netinet_component.c,v 1.8 2017/01/20 08:35:33 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netinet_component.c,v 1.7 2016/08/13 11:19:35 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netinet_component.c,v 1.8 2017/01/20 08:35:33 ozaki-r Exp $");
 
 #include 
 #include 
@@ -45,8 +45,6 @@ __KERNEL_RCSID(0, "$NetBSD: netinet_comp
 #include 
 #include 
 
-int carpattach(int);
-
 RUMP_COMPONENT(RUMP_COMPONENT_NET)
 {
 	extern struct domain arpdomain, inetdomain;
@@ -54,11 +52,17 @@ RUMP_COMPONENT(RUMP_COMPONENT_NET)
 	domain_attach();
 	domain_attach();
 
-	carpattach(1);
-
 	rump_netisr_register(NETISR_ARP, arpintr);
 }
 
+int carpattach(int);
+
+RUMP_COMPONENT(RUMP_COMPONENT_NET_IF)
+{
+
+	carpattach(1);
+}
+
 RUMP_COMPONENT(RUMP_COMPONENT_NET_IFCFG)
 {
 	struct ifaliasreq ia;

Index: src/tests/net/if/t_ifconfig.sh
diff -u src/tests/net/if/t_ifconfig.sh:1.14 

CVS commit: src/sys/kern

2017-01-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 20 08:16:31 UTC 2017

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

Log Message:
Simplify getiobuf.  buf_init already does bp->b_objlock == _lock


To generate a diff of this commit:
cvs rdiff -u -r1.267 -r1.268 src/sys/kern/vfs_bio.c

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

Modified files:

Index: src/sys/kern/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.267 src/sys/kern/vfs_bio.c:1.268
--- src/sys/kern/vfs_bio.c:1.267	Wed Dec 28 06:25:40 2016
+++ src/sys/kern/vfs_bio.c	Fri Jan 20 08:16:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.267 2016/12/28 06:25:40 pgoyette Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.268 2017/01/20 08:16:31 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.267 2016/12/28 06:25:40 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.268 2017/01/20 08:16:31 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -1968,10 +1968,10 @@ getiobuf(struct vnode *vp, bool waitok)
 
 	buf_init(bp);
 
-	if ((bp->b_vp = vp) == NULL)
-		bp->b_objlock = _lock;
-	else
+	if ((bp->b_vp = vp) != NULL) {
 		bp->b_objlock = vp->v_interlock;
+	else
+		KASSERT(bp->b_objlock == _lock);
 	
 	return bp;
 }