Module Name:    src
Committed By:   phil
Date:           Wed Aug 15 17:07:03 UTC 2018

Modified Files:
        src/sys/arch/amd64/conf [phil-wifi]: TESTWIFI
        src/sys/dev/usb [phil-wifi]: if_urtwn.c if_urtwnvar.h
        src/sys/net80211 [phil-wifi]: ieee80211.c ieee80211_input.c
            ieee80211_ioctl.c ieee80211_ioctl.h ieee80211_netbsd.c
            ieee80211_netbsd.h ieee80211_node.c ieee80211_output.c
            ieee80211_proto.c ieee80211_scan_sta.c ieee80211_sta.c

Log Message:
Final changes for 200 hour contract.  Still a lot of work to do.
With these changes, Station mode works with an open AP.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/amd64/conf/TESTWIFI
cvs rdiff -u -r1.59.2.5 -r1.59.2.6 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.10.16.1 -r1.10.16.2 src/sys/dev/usb/if_urtwnvar.h
cvs rdiff -u -r1.56.18.5 -r1.56.18.6 src/sys/net80211/ieee80211.c
cvs rdiff -u -r1.114.2.4 -r1.114.2.5 src/sys/net80211/ieee80211_input.c
cvs rdiff -u -r1.60.18.6 -r1.60.18.7 src/sys/net80211/ieee80211_ioctl.c
cvs rdiff -u -r1.24.2.4 -r1.24.2.5 src/sys/net80211/ieee80211_ioctl.h
cvs rdiff -u -r1.31.2.6 -r1.31.2.7 src/sys/net80211/ieee80211_netbsd.c
cvs rdiff -u -r1.21.2.7 -r1.21.2.8 src/sys/net80211/ieee80211_netbsd.h
cvs rdiff -u -r1.75.4.4 -r1.75.4.5 src/sys/net80211/ieee80211_node.c
cvs rdiff -u -r1.63.2.3 -r1.63.2.4 src/sys/net80211/ieee80211_output.c
cvs rdiff -u -r1.34.14.6 -r1.34.14.7 src/sys/net80211/ieee80211_proto.c
cvs rdiff -u -r1.1.56.6 -r1.1.56.7 src/sys/net80211/ieee80211_scan_sta.c
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/net80211/ieee80211_sta.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/amd64/conf/TESTWIFI
diff -u src/sys/arch/amd64/conf/TESTWIFI:1.1.2.2 src/sys/arch/amd64/conf/TESTWIFI:1.1.2.3
--- src/sys/arch/amd64/conf/TESTWIFI:1.1.2.2	Fri Aug  3 19:47:25 2018
+++ src/sys/arch/amd64/conf/TESTWIFI	Wed Aug 15 17:07:02 2018
@@ -1,4 +1,4 @@
-# $NetBSD: TESTWIFI,v 1.1.2.2 2018/08/03 19:47:25 phil Exp $
+# $NetBSD: TESTWIFI,v 1.1.2.3 2018/08/15 17:07:02 phil Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1.2.2 $"
+#ident		"GENERIC-$Revision: 1.1.2.3 $"
 
 maxusers	64		# estimated number of users
 
@@ -194,7 +194,7 @@ options 	NFSSERVER	# Network File System
 # Networking options
 #options 	GATEWAY		# packet forwarding
 options 	INET		# IP + ICMP + TCP + UDP
-options 	INET6		# IPV6
+#options 	INET6		# IPV6
 options 	IPSEC		# IP security
 #options 	IPSEC_DEBUG	# debug for IP security
 #options 	MPLS		# MultiProtocol Label Switching (needs mpls)
@@ -1306,7 +1306,7 @@ pseudo-device	gre			# generic L3 over IP
 pseudo-device	gif			# IPv[46] over IPv[46] tunnel (RFC1933)
 pseudo-device	ipsecif			# tunnel interface for routing based ipsec
 #pseudo-device	faith			# IPv[46] tcp relay translation i/f
-pseudo-device	stf			# 6to4 IPv6 over IPv4 encapsulation
+#pseudo-device	stf			# 6to4 IPv6 over IPv4 encapsulation
 pseudo-device	vlan			# IEEE 802.1q encapsulation
 pseudo-device	bridge			# simple inter-network bridging
 #options 	BRIDGE_IPF		# bridge uses IP/IPv6 pfil hooks too

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.59.2.5 src/sys/dev/usb/if_urtwn.c:1.59.2.6
--- src/sys/dev/usb/if_urtwn.c:1.59.2.5	Fri Aug  3 19:47:25 2018
+++ src/sys/dev/usb/if_urtwn.c	Wed Aug 15 17:07:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.59.2.5 2018/08/03 19:47:25 phil Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.59.2.6 2018/08/15 17:07:02 phil Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.5 2018/08/03 19:47:25 phil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.6 2018/08/15 17:07:02 phil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -111,7 +111,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v
 #define	DBG_REG		__BIT(6)
 #define	DBG_ALL		0xffffffffU
 /* NNN Reset urtwn_debug to 0 when done debugging. */
-u_int urtwn_debug = DBG_FN;
+u_int urtwn_debug = 0;
 #define DPRINTFN(n, s)	\
 	do { if (urtwn_debug & (n)) printf s; } while (/*CONSTCOND*/0)
 #else
@@ -342,15 +342,15 @@ static struct ieee80211vap *
 static void	urtwn_vap_delete(struct ieee80211vap *);
 static int	urtwn_ioctl(struct ifnet *, u_long, void *);
 static void	urtwn_parent(struct ieee80211com *);
+static void	urtwn_getradiocaps(struct ieee80211com *, int, int *,
+		    struct ieee80211_channel []);
 static void	urtwn_scan_start(struct ieee80211com *);
 static void	urtwn_scan_end(struct ieee80211com *);
 static void	urtwn_set_channel(struct ieee80211com *);
 static int	urtwn_transmit(struct ieee80211com *, struct mbuf *);
-static int	urtwn_send_mgmt(struct ieee80211_node *, int, int);
 static int	urtwn_raw_xmit(struct ieee80211_node *, struct mbuf *,
 		    const struct ieee80211_bpf_params *);
-static void	urtwn_getradiocaps(struct ieee80211com *, int, int *,
-		    struct ieee80211_channel []);
+//static int	urtwn_send_mgmt(struct ieee80211_node *, int, int);
 
 /* Aliases. */
 #define	urtwn_bb_write	urtwn_write_4
@@ -393,6 +393,14 @@ urtwn_attach(device_t parent, device_t s
 	/* Name the ic. */
 	ic->ic_name = "urtwn";
 
+	/* Driver Send queue, separate from the if send queue*/
+	sc->sc_sendq.ifq_maxlen = 32;
+	/* NNN how should this be initialized? */
+	sc->sc_sendq.ifq_head = sc->sc_sendq.ifq_tail = NULL;
+	sc->sc_sendq.ifq_len = 0;
+	sc->sc_sendq.ifq_drops = 0;
+	IFQ_LOCK_INIT(&sc->sc_sendq);
+
 	sc->chip = 0;
 	dev = urtwn_lookup(urtwn_devs, uaa->uaa_vendor, uaa->uaa_product);
 	if (dev != NULL && ISSET(dev->flags, FLAG_RTL8188E))
@@ -554,7 +562,7 @@ urtwn_attach(device_t parent, device_t s
 	}
 
 	/* Debug all! NNN */
-	vap->iv_debug = IEEE80211_MSG_ANY;
+	// vap->iv_debug = IEEE80211_MSG_ANY;
 
 	bpf_attach2(vap->iv_ifp, DLT_IEEE802_11_RADIO,
 	    sizeof(struct ieee80211_frame) + IEEE80211_RADIOTAP_HDRLEN,
@@ -611,6 +619,10 @@ urtwn_detach(device_t self, int flags)
 		urtwn_close_pipes(sc);
 	}
 
+	/* sendq destroy */
+	IFQ_PURGE(&sc->sc_sendq);
+	IFQ_LOCK_DESTROY(&sc->sc_sendq);
+
 	splx(s);
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev);
@@ -2082,7 +2094,7 @@ urtwn_newstate_cb(struct urtwn_softc *sc
 	case IEEE80211_S_ASSOC:
 		break;
 
-	case IEEE80211_S_RUN:       
+	case IEEE80211_S_RUN:
 		ni = vap->iv_bss;
 
 		/* XXX: Set 20MHz mode */
@@ -2794,6 +2806,7 @@ urtwn_rx_frame(struct urtwn_softc *sc, u
 	/* Finalize mbuf. */
 	m_set_rcvif(m, ifp);
 	wh = (struct ieee80211_frame *)((uint8_t *)&stat[1] + infosz);
+		
 	memcpy(mtod(m, uint8_t *), wh, pktlen);
 	m->m_pkthdr.len = m->m_len = pktlen;
 
@@ -2977,7 +2990,7 @@ urtwn_txeof(struct usbd_xfer *xfer, void
 	}
 
 	ifp->if_opackets++;
-	urtwn_start(ifp);
+	urtwn_start(ifp); 
 	splx(s);
 
 }
@@ -2997,11 +3010,6 @@ urtwn_tx(struct urtwn_softc *sc, struct 
 
 	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
 
-	KASSERT(sc != NULL); // NNN
-	KASSERT(m != NULL);
-	KASSERT(ni != NULL);
-	KASSERT(data != NULL);
-
 	wh = mtod(m, struct ieee80211_frame *);
 	type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
 	txd_len = sizeof(*txd);
@@ -3177,8 +3185,13 @@ urtwn_tx(struct urtwn_softc *sc, struct 
 	xferlen = txd_len + m->m_pkthdr.len + padsize;
 	m_copydata(m, 0, m->m_pkthdr.len, (char *)&txd[0] + txd_len + padsize);
 
-	printf ("urtwn_tx just before splnet()\n");
-	KASSERT(data != NULL);
+	if (data->xfer == NULL) {
+		/* NNN Don't crash ... but what is going on! */
+		printf ("urtwn_tx: data->xfer is NULL\n");
+		m_print(m,"", printf);
+		return -1;
+	}
+	
 	s = splnet();
 	usbd_setup_xfer(data->xfer, data, data->buf, xferlen,
 	    USBD_FORCE_SHORT_XFER, URTWN_TX_TIMEOUT,
@@ -3192,7 +3205,6 @@ urtwn_tx(struct urtwn_softc *sc, struct 
 		return error;
 	}
 	splx(s);
-	printf ("urtwn_tx just before splnet()\n");	
 	return 0;
 }
 
@@ -3252,7 +3264,7 @@ urtwn_start(struct ifnet *ifp)
 			break;
 
 		/* Encapsulate and send data frames. */
-		IFQ_POLL(&ifp->if_snd, m);
+		IFQ_POLL(&sc->sc_sendq, m);
 		if (m == NULL)
 			break;
 
@@ -3275,7 +3287,7 @@ urtwn_start(struct ifnet *ifp)
 				    device_xname(sc->sc_dev)));
 			return;
 		}
-		IFQ_DEQUEUE(&ifp->if_snd, m);
+		IFQ_DEQUEUE(&sc->sc_sendq, m);
 
 		if (m->m_len < (int)sizeof(*eh) &&
 		    (m = m_pullup(m, sizeof(*eh))) == NULL) {
@@ -3292,17 +3304,9 @@ urtwn_start(struct ifnet *ifp)
 			continue;
 		}
 
-		bpf_mtap(ifp, m, BPF_D_OUT);
+		//bpf_mtap(ifp, m, BPF_D_OUT);
 
-		if ((m = ieee80211_encap(vap, ni, m)) == NULL) {
-			ieee80211_free_node(ni);
-			printf("ERROR4\n");
-			ifp->if_oerrors++;
-			continue;
-		}
  sendit:
-		bpf_mtap3(vap->iv_rawbpf, m, BPF_D_OUT);
-
 		if (urtwn_tx(sc, m, ni, data) != 0) {
 			m_freem(m);
 			ieee80211_free_node(ni);
@@ -3317,7 +3321,7 @@ urtwn_start(struct ifnet *ifp)
 	}
 }
 
-static void
+static __unused void
 urtwn_watchdog(struct ifnet *ifp)
 {
 	struct ieee80211vap *vap = ifp->if_softc;
@@ -3368,8 +3372,6 @@ urtwn_vap_create(struct ieee80211com *ic
 		return NULL;
 	}
 
-	printf ("vap_create:  after vap_setup\n");
-
 	/* Local setup */
 	vap->iv_reset = urtwn_reset;
 
@@ -3377,9 +3379,9 @@ urtwn_vap_create(struct ieee80211com *ic
 	ifp->if_init = urtwn_init;
 	ifp->if_ioctl = urtwn_ioctl;
 	ifp->if_start = urtwn_start;
-	ifp->if_watchdog = urtwn_watchdog;
+	// ifp->if_watchdog = urtwn_watchdog;  NNN
 	ifp->if_extflags |= IFEF_MPSAFE;
-	IFQ_SET_READY(&ifp->if_snd);
+	// IFQ_SET_READY(&ifp->if_snd);
 	memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 
 	/* Override state transition machine. */
@@ -3530,7 +3532,6 @@ urtwn_transmit(struct ieee80211com *ic, 
 	struct urtwn_softc *sc = ic->ic_softc;
 	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
 	int s;
-	int error;
 	size_t pktlen = m->m_pkthdr.len;
         bool mcast = (m->m_flags & M_MCAST) != 0;
 
@@ -3538,11 +3539,7 @@ urtwn_transmit(struct ieee80211com *ic, 
 
 	s = splnet();
 
-        IFQ_ENQUEUE(&vap->iv_ifp->if_snd, m, error);
-        if (error != 0) {
-                /* mbuf is already freed */
-                goto out;
-        }
+        IF_ENQUEUE(&sc->sc_sendq, m);
 
         vap->iv_ifp->if_obytes += pktlen;
         if (mcast)
@@ -3550,18 +3547,28 @@ urtwn_transmit(struct ieee80211com *ic, 
 
         if ((vap->iv_ifp->if_flags & IFF_OACTIVE) == 0)
                 if_start_lock(vap->iv_ifp);
-out:
         splx(s);
 
-        return error;
-}
+	urtwn_start(vap->iv_ifp);
 
-static __unused int urtwn_send_mgmt(struct ieee80211_node *ni, int type, int arg)
-{
-	printf ("urtwn_send_mgmt: type %d, arg %d\n", type, arg);
-	return ENOENT;
+        return 0;
 }
 
+#if 0
+static int
+urtwn_send_mgmt(struct ieee80211_node *ni, int arg1, int arg2) {
+#ifdef URTWN_DEBUG
+	// struct ieee80211vap *vap = ni->ni_vap;
+	struct ieee80211com *ic = ni->ni_ic;
+	struct urtwn_softc *sc = ic->ic_softc;
+#endif
+
+	DPRINTFN(DBG_FN, ("%s: %s\n",device_xname(sc->sc_dev), __func__));
+
+	/* Don't know what to do right now. */
+	return ENOTTY;
+}
+#endif	
 
 
 static int

Index: src/sys/dev/usb/if_urtwnvar.h
diff -u src/sys/dev/usb/if_urtwnvar.h:1.10.16.1 src/sys/dev/usb/if_urtwnvar.h:1.10.16.2
--- src/sys/dev/usb/if_urtwnvar.h:1.10.16.1	Mon Jul 16 20:11:11 2018
+++ src/sys/dev/usb/if_urtwnvar.h	Wed Aug 15 17:07:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwnvar.h,v 1.10.16.1 2018/07/16 20:11:11 phil Exp $	*/
+/*	$NetBSD: if_urtwnvar.h,v 1.10.16.2 2018/08/15 17:07:02 phil Exp $	*/
 /*	$OpenBSD: if_urtwnreg.h,v 1.3 2010/11/16 18:02:59 damien Exp $	*/
 
 /*-
@@ -111,8 +111,7 @@ struct urtwn_host_cmd_ring {
 struct urtwn_softc {
 	device_t			sc_dev;
 	struct ieee80211com		sc_ic;
-	//	struct ethercom			sc_ec;
-	//#define sc_if   sc_ec.ec_if
+	struct ifqueue			sc_sendq;
 	int				(*sc_newstate)(struct ieee80211vap *,
 					    enum ieee80211_state, int);
 

Index: src/sys/net80211/ieee80211.c
diff -u src/sys/net80211/ieee80211.c:1.56.18.5 src/sys/net80211/ieee80211.c:1.56.18.6
--- src/sys/net80211/ieee80211.c:1.56.18.5	Sat Jul 28 00:49:43 2018
+++ src/sys/net80211/ieee80211.c	Wed Aug 15 17:07:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211.c,v 1.56.18.5 2018/07/28 00:49:43 phil Exp $ */
+/*	$NetBSD: ieee80211.c,v 1.56.18.6 2018/08/15 17:07:02 phil Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -628,6 +628,7 @@ ieee80211_vap_setup(struct ieee80211com 
 
 	vap->iv_opmode = opmode;
 	vap->iv_caps |= ieee80211_opcap[opmode];
+	/* NNN Done in vap_attach, where is the correct place? */
 	IEEE80211_ADDR_COPY(vap->iv_myaddr, ic->ic_macaddr);
 	switch (opmode) {
 	case IEEE80211_M_WDS:
@@ -755,7 +756,9 @@ ieee80211_vap_attach(struct ieee80211vap
 		ifp->if_baudrate = IF_Mbps(maxrate);
 
 	ether_ifattach(ifp, macaddr);
+	/* NNN also done in vap_setup, which is correct? */
 	IEEE80211_ADDR_COPY(vap->iv_myaddr, IF_LLADDR(ifp));
+
 	/* hook output method setup by ether_ifattach */
 	vap->iv_output = ifp->if_output;
 	ifp->if_output = ieee80211_output;

Index: src/sys/net80211/ieee80211_input.c
diff -u src/sys/net80211/ieee80211_input.c:1.114.2.4 src/sys/net80211/ieee80211_input.c:1.114.2.5
--- src/sys/net80211/ieee80211_input.c:1.114.2.4	Sat Jul 28 00:49:43 2018
+++ src/sys/net80211/ieee80211_input.c	Wed Aug 15 17:07:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_input.c,v 1.114.2.4 2018/07/28 00:49:43 phil Exp $ */
+/*	$NetBSD: ieee80211_input.c,v 1.114.2.5 2018/08/15 17:07:02 phil Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -181,7 +181,6 @@ ieee80211_input_mimo_all(struct ieee8021
 			m = NULL;
 		}
 		ni = ieee80211_ref_node(vap->iv_bss);
-		printf ("ieee80211_input_mimo_all on %s, ni=0x%lx\n", vap->iv_ifp->if_xname, (long)ni);
 		type = ieee80211_input_mimo(ni, mcopy);
 		ieee80211_free_node(ni);
 	}

Index: src/sys/net80211/ieee80211_ioctl.c
diff -u src/sys/net80211/ieee80211_ioctl.c:1.60.18.6 src/sys/net80211/ieee80211_ioctl.c:1.60.18.7
--- src/sys/net80211/ieee80211_ioctl.c:1.60.18.6	Fri Aug  3 19:47:25 2018
+++ src/sys/net80211/ieee80211_ioctl.c	Wed Aug 15 17:07:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_ioctl.c,v 1.60.18.6 2018/08/03 19:47:25 phil Exp $ */
+/*	$NetBSD: ieee80211_ioctl.c,v 1.60.18.7 2018/08/15 17:07:02 phil Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -371,6 +371,119 @@ ieee80211_ioctl_getscanresults(struct ie
 	return error;
 }
 
+#ifdef OLD_IEEE80211_IOC_SCAN_RESULTS
+/* Code to get the old version of scan results, for NetBSD 8.0 and earlier. */
+
+static size_t
+old_scan_space(const struct ieee80211_scan_entry *se, int *ielen)
+{
+	size_t len;
+
+	*ielen = se->se_ies.len;
+	/*
+	 * NB: ie's can be no more than 255 bytes and the max 802.11
+	 * packet is <3Kbytes so we are sure this doesn't overflow
+	 * 16-bits; if this is a concern we can drop the ie's.
+	 */
+	len = sizeof(struct old_ieee80211req_scan_result) + se->se_ssid[1] +
+	    se->se_meshid[1] + *ielen;
+	return roundup(len, sizeof(uint32_t));
+}
+
+static void
+old_get_scan_space(void *arg, const struct ieee80211_scan_entry *se)
+{
+	struct scanreq *req = arg;
+	int ielen;
+
+	req->space += old_scan_space(se, &ielen);
+}
+
+static void
+old_get_scan_result(void *arg, const struct ieee80211_scan_entry *se)
+{
+	struct scanreq *req = arg;
+	struct old_ieee80211req_scan_result *sr;
+	int ielen, len, nr, nxr;
+	uint8_t *cp;
+
+	len = old_scan_space(se, &ielen);
+	if (len > req->space)
+		return;
+
+	sr = (struct old_ieee80211req_scan_result *)req->sr;
+	KASSERT(len <= 65535 && ielen <= 65535,
+	    ("len %u ssid %u ie %u", len, se->se_ssid[1], ielen));
+	sr->isr_len = len;
+	sr->isr_ie_len = ielen;
+	sr->isr_freq = se->se_chan->ic_freq;
+	sr->isr_flags = se->se_chan->ic_flags;
+	sr->isr_rssi = se->se_rssi;
+	sr->isr_noise = se->se_noise;
+	sr->isr_intval = se->se_intval;
+	sr->isr_capinfo = se->se_capinfo;
+	sr->isr_erp = se->se_erp;
+	IEEE80211_ADDR_COPY(sr->isr_bssid, se->se_bssid);
+	nr = min(se->se_rates[1], IEEE80211_RATE_MAXSIZE);
+	memcpy(sr->isr_rates, se->se_rates+2, nr);
+	nxr = min(se->se_xrates[1], IEEE80211_RATE_MAXSIZE - nr);
+	memcpy(sr->isr_rates+nr, se->se_xrates+2, nxr);
+	sr->isr_nrates = nr + nxr;
+	if (sr->isr_nrates > 15)
+		sr->isr_nrates = 15;
+
+	printf ("old_get_scan_results: ssid=%.*s\n", se->se_ssid[1], &se->se_ssid[2]);
+
+	/* copy SSID */
+	sr->isr_ssid_len = se->se_ssid[1];
+	cp = ((uint8_t *)sr) + sizeof(struct old_ieee80211req_scan_result);
+	memcpy(cp, se->se_ssid+2, sr->isr_ssid_len);
+
+	if (ielen)
+		memcpy(cp+sr->isr_ssid_len, se->se_ies.data, ielen);
+
+	req->space -= len;
+	req->sr = (struct ieee80211req_scan_result *)(((uint8_t *)sr) + len);
+}
+
+static int
+old_ieee80211_ioctl_getscanresults(struct ieee80211vap *vap,
+	struct ieee80211req *ireq)
+{
+	struct scanreq req;
+	int error;
+
+	if (ireq->i_len < sizeof(struct scanreq))
+		return EFAULT;
+
+	error = 0;
+	req.space = 0;
+	ieee80211_scan_iterate(vap, old_get_scan_space, &req);
+	if (req.space > ireq->i_len)
+		req.space = ireq->i_len;
+	if (req.space > 0) {
+		uint32_t space;
+		void *p;
+
+		space = req.space;
+		/* XXX M_WAITOK after driver lock released */
+		p = IEEE80211_MALLOC(space, M_TEMP,
+		    IEEE80211_M_NOWAIT | IEEE80211_M_ZERO);
+		if (p == NULL)
+			return ENOMEM;
+		req.sr = p;
+		ieee80211_scan_iterate(vap, old_get_scan_result, &req);
+		ireq->i_len = space - req.space;
+		error = copyout(p, ireq->i_data, ireq->i_len);
+		IEEE80211_FREE(p, M_TEMP);
+	} else
+		ireq->i_len = 0;
+
+	return error;
+}
+
+#endif
+
 struct stainforeq {
 	struct ieee80211req_sta_info *si;
 	size_t	space;
@@ -956,6 +1069,11 @@ ieee80211_ioctl_get80211(struct ieee8021
 	case IEEE80211_IOC_WPAIE2:
 		error = ieee80211_ioctl_getwpaie(vap, ireq, ireq->i_type);
 		break;
+#ifdef OLD_IEEE80211_IOC_SCAN_RESULTS
+	case OLD_IEEE80211_IOC_SCAN_RESULTS:
+		error = old_ieee80211_ioctl_getscanresults(vap, ireq);
+		break;
+#endif
 	case IEEE80211_IOC_SCAN_RESULTS:
 		error = ieee80211_ioctl_getscanresults(vap, ireq);
 		break;
@@ -3015,7 +3133,6 @@ ieee80211_ioctl_set80211(struct ieee8021
 	case IEEE80211_IOC_CHANLIST:
 		error = ieee80211_ioctl_setchanlist(vap, ireq);
 		break;
-#define	OLD_IEEE80211_IOC_SCAN_REQ	23
 #ifdef OLD_IEEE80211_IOC_SCAN_REQ
 	case OLD_IEEE80211_IOC_SCAN_REQ:
 		IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
@@ -3535,16 +3652,15 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon
 #if __NetBSD__
 	struct ieee80211_nwid nwid;
 	//	struct ieee80211_nwkey *nwkey;
-	//	struct ieee80211_power *power;
-	//	struct ieee80211chanreq *chanreq;
+	struct ieee80211_power *power;
+	struct ieee80211chanreq *chanreq;
 	struct ieee80211_bssid *bssid;
+	struct ieee80211_channel *chan;
+	struct ieee80211req ireq;
 
 	ifr = (struct ifreq *)data;
 #endif
 
-	printf ("ieee80211_ioctl: cmd is 0x%lx. ('%c', %ld)\n", cmd,
- 		(char) ((cmd>>8) & 0xff), cmd & 0xff );
-
 	switch (cmd) {
 	case SIOCSIFFLAGS:
 		IEEE80211_LOCK(ic);
@@ -3610,9 +3726,13 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon
 			 */
 			if_addr_rlock(ifp);
 			if ((ifp->if_flags & IFF_UP) == 0 &&
-			    !IEEE80211_ADDR_EQ(vap->iv_myaddr, IF_LLADDR(ifp)))
+			    !IEEE80211_ADDR_EQ(vap->iv_myaddr, IF_LLADDR(ifp))) {
 				IEEE80211_ADDR_COPY(vap->iv_myaddr,
 				    IF_LLADDR(ifp));
+				printf ("vap->iv_myaddr changed in ioctl to %s\n",
+					ether_sprintf(vap->iv_myaddr));
+			}
+
 			if_addr_runlock(ifp);
 		}
 		break;
@@ -3620,6 +3740,9 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon
 	case SIOCDELMULTI:
 		ieee80211_runtask(ic, &ic->ic_mcast_task);
 		break;
+#ifdef OSIOCSIFMEDIA
+	case OSIOCSIFMEDIA:
+#endif
 	case SIOCSIFMEDIA:
 	case SIOCGIFMEDIA:
 		ifr = (struct ifreq *)data;
@@ -3635,13 +3758,18 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon
 			error = ieee80211_ioctl_set80211(vap, cmd,
 					(struct ieee80211req *) data);
 		break;
+#ifdef SIOCG80211ZSTATS	
+	case SIOCG80211ZSTATS:
+#endif		
 	case SIOCG80211STATS:
 		ifr = (struct ifreq *)data;
 #if __FreeBSD__
 		copyout(&vap->iv_stats, ifr_data_get_ptr(ifr),
 		    sizeof (vap->iv_stats));
 #elif__NetBSD__
-		copyout(&vap->iv_stats, ifr->ifr_data, sizeof (vap->iv_stats));
+		copyout(&vap->iv_stats, ifr->ifr_buf,
+			sizeof (vap->iv_stats) <= ifr->ifr_buflen
+			? sizeof (vap->iv_stats) : ifr->ifr_buflen);
 #endif
 		break;
 	case SIOCSIFMTU:
@@ -3722,8 +3850,26 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon
 		error = ENOTTY;
 	        break;
 	case SIOCS80211POWER:
-		printf ("NetBSD POWER ioctl\n"); // NNN
-		error = ENOTTY;
+		power = (struct ieee80211_power *)data;
+		ic->ic_lintval = power->i_maxsleep;
+		if (power->i_enabled != 0) {
+			if ((ic->ic_caps & IEEE80211_C_PMGT) == 0)
+				error = EINVAL;
+			else if ((ic->ic_flags & IEEE80211_F_PMGTON) == 0) {
+				ic->ic_flags |= IEEE80211_F_PMGTON;
+				error = ENETRESET;
+			}
+		} else {
+			if (ic->ic_flags & IEEE80211_F_PMGTON) {
+				ic->ic_flags &= ~IEEE80211_F_PMGTON;
+				error = ENETRESET;
+			}
+		}
+		break;
+	case SIOCG80211POWER:
+		power = (struct ieee80211_power *)data;
+		power->i_enabled = (ic->ic_flags & IEEE80211_F_PMGTON) ? 1 : 0;
+		power->i_maxsleep = ic->ic_lintval;
 		break;
 	case SIOCS80211BSSID:
 		bssid = (struct ieee80211_bssid *)data;
@@ -3759,6 +3905,28 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon
 			memset(bssid->i_bssid, 0, IEEE80211_ADDR_LEN);
 		}
 		break;
+	case SIOCS80211CHANNEL:
+		/* Use deprecated ieee80211_ioctl_setchannel code. NNN? */
+		chanreq = (struct ieee80211chanreq *)data;
+		ireq.i_val = chanreq->i_channel;
+		error = ieee80211_ioctl_setchannel(vap, &ireq);
+		break;
+	case SIOCG80211CHANNEL:
+		chanreq = (struct ieee80211chanreq *)data;
+		switch (vap->iv_state) {
+		case IEEE80211_S_INIT:
+		case IEEE80211_S_SCAN:
+			if (vap->iv_opmode == IEEE80211_M_STA)
+				chan = vap->iv_des_chan;
+			else
+				chan = ic->ic_bsschan;  // NNN ibss chan?
+			break;
+		default:
+			chan = ic->ic_curchan;
+			break;
+		}
+		chanreq->i_channel = ieee80211_chan2ieee(ic, chan);
+		break;
 #endif
 	default:
 		/*
@@ -3769,8 +3937,11 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon
 		    (error = ic->ic_ioctl(ic, cmd, data)) != ENOTTY)
 			break;
 		error = ether_ioctl(ifp, cmd, data);
-		if (error == ENOTTY)
+		if (error == ENOTTY) {
+			printf ("ieee80211_ioctl: cmd is 0x%lx. ('%c', %ld)\n",
+				cmd, (char) ((cmd>>8) & 0xff), cmd & 0xff );
 			printf ("Unknown 802.11 IOCTL.\n"); /* NNN */
+		}
 		break;
 	}
 	return (error);

Index: src/sys/net80211/ieee80211_ioctl.h
diff -u src/sys/net80211/ieee80211_ioctl.h:1.24.2.4 src/sys/net80211/ieee80211_ioctl.h:1.24.2.5
--- src/sys/net80211/ieee80211_ioctl.h:1.24.2.4	Fri Jul 20 20:33:05 2018
+++ src/sys/net80211/ieee80211_ioctl.h	Wed Aug 15 17:07:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_ioctl.h,v 1.24.2.4 2018/07/20 20:33:05 phil Exp $ */
+/*	$NetBSD: ieee80211_ioctl.h,v 1.24.2.5 2018/08/15 17:07:03 phil Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -889,6 +889,32 @@ struct ieee80211_clone_params {
 #define	IEEE80211_CLONE_TDMA		0x0010	/* operate in TDMA mode */
 
 #if __NetBSD__
+
+#define	OLD_IEEE80211_IOC_SCAN_REQ	23
+#define	OLD_IEEE80211_IOC_SCAN_RESULTS	24
+
+/*
+ * Scan result data returned for OLD_IEEE80211_IOC_SCAN_RESULTS.
+ */
+struct old_ieee80211req_scan_result {
+	u_int16_t	isr_len;		/* length (mult of 4) */
+	u_int16_t	isr_freq;		/* MHz */
+	u_int16_t	isr_flags;		/* channel flags */
+	u_int8_t	isr_noise;
+	u_int8_t	isr_rssi;
+	u_int8_t	isr_intval;		/* beacon interval */
+	u_int8_t	isr_capinfo;		/* capabilities */
+	u_int8_t	isr_erp;		/* ERP element */
+	u_int8_t	isr_bssid[IEEE80211_ADDR_LEN];
+	u_int8_t	isr_nrates;
+	u_int8_t	isr_rates[IEEE80211_RATE_MAXSIZE];
+	u_int8_t	isr_ssid_len;		/* SSID length */
+	u_int8_t	isr_ie_len;		/* IE length */
+	u_int8_t	isr_pad[5];
+	/* variable length SSID followed by IE data */
+};
+
+
 /* nwid is pointed at by ifr.ifr_data */
 struct ieee80211_nwid {
 	u_int8_t	i_len;

Index: src/sys/net80211/ieee80211_netbsd.c
diff -u src/sys/net80211/ieee80211_netbsd.c:1.31.2.6 src/sys/net80211/ieee80211_netbsd.c:1.31.2.7
--- src/sys/net80211/ieee80211_netbsd.c:1.31.2.6	Fri Aug  3 19:47:25 2018
+++ src/sys/net80211/ieee80211_netbsd.c	Wed Aug 15 17:07:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_netbsd.c,v 1.31.2.6 2018/08/03 19:47:25 phil Exp $ */
+/*	$NetBSD: ieee80211_netbsd.c,v 1.31.2.7 2018/08/15 17:07:03 phil Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 /*  __FBSDID("$FreeBSD$");  */
-__KERNEL_RCSID(0, "$NetBSD: ieee80211_netbsd.c,v 1.31.2.6 2018/08/03 19:47:25 phil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211_netbsd.c,v 1.31.2.7 2018/08/15 17:07:03 phil Exp $");
 
 /*
  * IEEE 802.11 support (NetBSD-specific code)
@@ -114,7 +114,6 @@ taskqueue_enqueue(struct workqueue *wq, 
 {
 	mutex_enter(&task_item->t_mutex);
 	if (!task_item->t_onqueue) {
-		printf ("taskqueue_enqueue function %s\n", task_item->t_func_name);
 		workqueue_enqueue(wq, &task_item->t_work, NULL);
 		task_item->t_onqueue = 1;
 	}
@@ -124,7 +123,6 @@ taskqueue_enqueue(struct workqueue *wq, 
 void
 taskqueue_drain(struct workqueue *wq, struct task *task_item)
 {
-	printf ("taskqueue_drain called\n");
 	workqueue_wait(wq, &task_item->t_work);
 }
 
@@ -145,8 +143,6 @@ taskqueue_enqueue_timeout(struct workque
 {
 	mutex_enter(&timeout_task->to_task.t_mutex);
 	if (!timeout_task->to_scheduled) {
-		printf ("taskqueue_enqueue_timeout: Scheduling the function %s.\n", 
-			timeout_task->to_task.t_func_name);
 		callout_reset(&timeout_task->to_callout, nticks, 
 		    taskqueue_callout_enqueue, timeout_task);
 		timeout_task->to_scheduled = 1;
@@ -160,7 +156,7 @@ int
 taskqueue_cancel_timeout(struct workqueue *queue, 
     struct timeout_task *timeout_task, u_int *pendp)
 {
-	printf ("taskqueue_cancel_timeout called\n");
+	// printf ("taskqueue_cancel_timeout called\n");
 	return -1;
 }
 
@@ -168,7 +164,7 @@ void
 taskqueue_drain_timeout(struct workqueue *queue, 
     struct timeout_task *timeout_task)
 {
-	printf ("taskqueue_drain_timeout called\n");
+	// printf ("taskqueue_drain_timeout called\n");
 }
 
 
@@ -823,7 +819,7 @@ int
 ieee80211_parent_xmitpkt(struct ieee80211com *ic, struct mbuf *m)
 {
 	int error;
-	printf ("ieee80211_parent_xmitpkt called\n");
+
 	/*
 	 * Assert the IC TX lock is held - this enforces the
 	 * processing -> queuing order is maintained

Index: src/sys/net80211/ieee80211_netbsd.h
diff -u src/sys/net80211/ieee80211_netbsd.h:1.21.2.7 src/sys/net80211/ieee80211_netbsd.h:1.21.2.8
--- src/sys/net80211/ieee80211_netbsd.h:1.21.2.7	Fri Aug  3 19:47:25 2018
+++ src/sys/net80211/ieee80211_netbsd.h	Wed Aug 15 17:07:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_netbsd.h,v 1.21.2.7 2018/08/03 19:47:25 phil Exp $ */
+/*	$NetBSD: ieee80211_netbsd.h,v 1.21.2.8 2018/08/15 17:07:03 phil Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -138,7 +138,7 @@ void taskqueue_drain_timeout(struct work
 #define taskqueue_unblock(queue)      /* */
 
 /*  Other stuff that needs to be fixed NNN */
-#define priv_check(x,y) 1
+#define priv_check(x,y) 0
 
 /* Coult it be this simple? NNN */
 #define if_addr_rlock(ifp) IFNET_LOCK(ifp)
@@ -177,7 +177,7 @@ void       if_inc_counter(struct ifnet *
 	(cnt == IFCOUNTER_OERRORS ? ipf->if_oerrors :   \
 	    (cnt == IFCOUNTER_IERRORS ? ipf->if_ierrors : 0 ))
 
-#define IF_LLADDR(ifp)     IFADDR_FIRST(ifp)
+#define IF_LLADDR(ifp)     (((struct ieee80211vap *)ifp->if_softc)->iv_myaddr)
 
 /* Scanners ... needed because no module support; */
 extern const struct ieee80211_scanner sta_default;

Index: src/sys/net80211/ieee80211_node.c
diff -u src/sys/net80211/ieee80211_node.c:1.75.4.4 src/sys/net80211/ieee80211_node.c:1.75.4.5
--- src/sys/net80211/ieee80211_node.c:1.75.4.4	Fri Aug  3 19:47:25 2018
+++ src/sys/net80211/ieee80211_node.c	Wed Aug 15 17:07:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_node.c,v 1.75.4.4 2018/08/03 19:47:25 phil Exp $ */
+/*	$NetBSD: ieee80211_node.c,v 1.75.4.5 2018/08/15 17:07:03 phil Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -464,27 +464,18 @@ ieee80211_create_ibss(struct ieee80211va
 void
 ieee80211_reset_bss(struct ieee80211vap *vap)
 {
-	printf ("reset_bss: vap is 0x%lx\n", (unsigned long) vap);
 	struct ieee80211com *ic = vap->iv_ic;
 	struct ieee80211_node *ni, *obss;
 
-	printf ("reset_bss: ic is 0x%lx\n", (unsigned long) ic);
-
 	ieee80211_node_table_reset(&ic->ic_sta, vap);
 
-	printf ("reset_bss: after table_reset\n");
 	/* XXX multi-bss: wrong */
 	ieee80211_reset_erp(ic);
 
-	printf ("reset_bss: after reset_erp\n");
-
 	ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr);
 	KASSERT(ni != NULL, ("unable to setup initial BSS node"));
 
-	printf ("reset_bss: after alloc_node\n");
-
 	obss = vap->iv_bss;
-printf ("reset_bss: obss is 0x%lx\n", (unsigned long int)obss);
 	vap->iv_bss = ieee80211_ref_node(ni);
 	if (obss != NULL) {
 		copy_bss(ni, obss);
@@ -492,6 +483,8 @@ printf ("reset_bss: obss is 0x%lx\n", (u
 		ieee80211_free_node(obss);
 	} else
 		IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_myaddr);
+	printf ("reset_bss: macaddr %s, bssid %s\n", 
+		ether_sprintf(ni->ni_macaddr), ether_sprintf(ni->ni_bssid));
 }
 
 static int
@@ -953,6 +946,8 @@ ieee80211_sta_join(struct ieee80211vap *
 		return 0;
 	}
 
+	printf ("ieee80211_sta_join called.\n");
+	
 	/*
 	 * Expand scan state into node's format.
 	 * XXX may not need all this stuff
@@ -1076,6 +1071,9 @@ ieee80211_sta_join(struct ieee80211vap *
 	ieee80211_node_setuptxparms(ni);
 	ieee80211_ratectl_node_init(ni);
 
+	printf ("At end of ieee80211_sta_join, ni is 0x%lx\n", (long)ni);
+	printf ("   macaddr is %s,  bss is %s\n",
+		ether_sprintf(ni->ni_macaddr), ether_sprintf(ni->ni_bssid));
 	return ieee80211_sta_join1(ieee80211_ref_node(ni));
 }
 

Index: src/sys/net80211/ieee80211_output.c
diff -u src/sys/net80211/ieee80211_output.c:1.63.2.3 src/sys/net80211/ieee80211_output.c:1.63.2.4
--- src/sys/net80211/ieee80211_output.c:1.63.2.3	Mon Jul 16 20:11:11 2018
+++ src/sys/net80211/ieee80211_output.c	Wed Aug 15 17:07:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_output.c,v 1.63.2.3 2018/07/16 20:11:11 phil Exp $ */
+/*	$NetBSD: ieee80211_output.c,v 1.63.2.4 2018/08/15 17:07:03 phil Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -1397,7 +1397,7 @@ ieee80211_encap(struct ieee80211vap *vap
 	int meshhdrsize, meshae;
 	uint8_t *qos;
 	int is_amsdu = 0;
-	
+
 	IEEE80211_TX_LOCK_ASSERT(ic);
 
 	is_mcast = !! (m->m_flags & (M_MCAST | M_BCAST));

Index: src/sys/net80211/ieee80211_proto.c
diff -u src/sys/net80211/ieee80211_proto.c:1.34.14.6 src/sys/net80211/ieee80211_proto.c:1.34.14.7
--- src/sys/net80211/ieee80211_proto.c:1.34.14.6	Fri Aug  3 19:47:25 2018
+++ src/sys/net80211/ieee80211_proto.c	Wed Aug 15 17:07:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_proto.c,v 1.34.14.6 2018/08/03 19:47:25 phil Exp $ */
+/*	$NetBSD: ieee80211_proto.c,v 1.34.14.7 2018/08/15 17:07:03 phil Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -1544,7 +1544,9 @@ ieee80211_start_reset_chan(struct ieee80
 void
 ieee80211_start_locked(struct ieee80211vap *vap)
 {
+#if __FreeBSD__	
 	struct ifnet *ifp = vap->iv_ifp;
+#endif
 	struct ieee80211com *ic = vap->iv_ic;
 
 	IEEE80211_LOCK_ASSERT(ic);
@@ -1552,15 +1554,17 @@ ieee80211_start_locked(struct ieee80211v
 	IEEE80211_DPRINTF(vap,
 		IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG,
 		"start running, %d vaps running\n", ic->ic_nrunning);
-
-        printf ("returning from start_locked too soon.\n");
-        return;
+#if __NetBSD__
+	/* NNN may need to change/upgrade this once more than one vap/device. */
+	if (ic->ic_nrunning++ == 0) {
+		/* reset the channel to a known good channel */
+		if (ieee80211_start_check_reset_chan(vap))
+			ieee80211_start_reset_chan(vap);
+	}
+#endif
 
 #if __FreeBSD__
 	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
-#elif __NetBSD__
-	if ((ifp->if_flags & IFF_RUNNING) == 0) {
-#endif
 		/*
 		 * Mark us running.  Note that it's ok to do this first;
 		 * if we need to bring the parent device up we defer that
@@ -1569,17 +1573,14 @@ ieee80211_start_locked(struct ieee80211v
 		 * through ieee80211_start_all at which point we'll come
 		 * back in here and complete the work.
 		 */
-#if __FreeBSD__
+
 		ifp->if_drv_flags |= IFF_DRV_RUNNING;
-#elif __NetBSD__
-		ifp->if_flags |= IFF_RUNNING;
-#endif
+
 		/*
 		 * We are not running; if this we are the first vap
 		 * to be brought up auto-up the parent if necessary.
 		 */
 		if (ic->ic_nrunning++ == 0) {
-			printf ("   calling start_check_reset_chan\n");
 			/* reset the channel to a known good channel */
 			if (ieee80211_start_check_reset_chan(vap))
 				ieee80211_start_reset_chan(vap);
@@ -1632,6 +1633,7 @@ ieee80211_start_locked(struct ieee80211v
 				    IEEE80211_S_SCAN, 0);
 		}
 	}
+#endif
 }
 
 /*
@@ -1871,6 +1873,10 @@ ieee80211_swbmiss(void *arg)
 	IEEE80211_LOCK_ASSERT(ic);
 #elif __NetBSD__
 	IEEE80211_LOCK(ic);
+	if (vap->iv_state < IEEE80211_S_RUN) {  /* NNN should stop it */
+		IEEE80211_UNLOCK(ic);
+		return;
+	}
 #endif
 
 	KASSERT(vap->iv_state >= IEEE80211_S_RUN,

Index: src/sys/net80211/ieee80211_scan_sta.c
diff -u src/sys/net80211/ieee80211_scan_sta.c:1.1.56.6 src/sys/net80211/ieee80211_scan_sta.c:1.1.56.7
--- src/sys/net80211/ieee80211_scan_sta.c:1.1.56.6	Fri Aug  3 19:47:25 2018
+++ src/sys/net80211/ieee80211_scan_sta.c	Wed Aug 15 17:07:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_scan_sta.c,v 1.1.56.6 2018/08/03 19:47:25 phil Exp $ */
+/*	$NetBSD: ieee80211_scan_sta.c,v 1.1.56.7 2018/08/15 17:07:03 phil Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -186,7 +186,6 @@ static int
 sta_attach(struct ieee80211_scan_state *ss)
 {
 	struct sta_table *st;
-	printf ("sta_attach ...\n");
 
 	st = (struct sta_table *) IEEE80211_MALLOC(sizeof(struct sta_table),
 		M_80211_SCAN,
@@ -1025,7 +1024,6 @@ match_bss(struct ieee80211vap *vap,
         uint8_t rate;
         int fail;
 
-	printf ("match_bss, iv_opmode is 0x%x\n", vap->iv_opmode);
 	fail = 0;
 	if (isclr(ic->ic_chan_active, ieee80211_chan2ieee(ic, se->se_chan)))
 		fail |= MATCH_CHANNEL;
@@ -1196,7 +1194,6 @@ match_bss(struct ieee80211vap *vap,
 		printf("%s\n", fail & (MATCH_SSID | MATCH_MESHID) ? "!" : "");
 	}
 #endif
-	printf ("match_bss exit, fail = 0x%x\n", fail);
 	return fail;
 }
 

Index: src/sys/net80211/ieee80211_sta.c
diff -u src/sys/net80211/ieee80211_sta.c:1.1.2.4 src/sys/net80211/ieee80211_sta.c:1.1.2.5
--- src/sys/net80211/ieee80211_sta.c:1.1.2.4	Fri Aug  3 19:47:25 2018
+++ src/sys/net80211/ieee80211_sta.c	Wed Aug 15 17:07:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211_sta.c,v 1.1.2.4 2018/08/03 19:47:25 phil Exp $ */
+/*	$NetBSD: ieee80211_sta.c,v 1.1.2.5 2018/08/15 17:07:03 phil Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -637,6 +637,7 @@ sta_input(struct ieee80211_node *ni, str
 			/* not interested in */
 			IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
 			    bssid, NULL, "%s", "not to bss");
+
 			vap->iv_stats.is_rx_wrongbss++;
 			goto out;
 		}
@@ -660,6 +661,7 @@ sta_input(struct ieee80211_node *ni, str
 			IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
 			    bssid, NULL, "not to cur sta: lladdr=%6D, addr1=%6D",
 			    IF_LLADDR(ifp), ":", wh->i_addr1, ":");
+
 			vap->iv_stats.is_rx_wrongbss++;
 			goto out;
 		}

Reply via email to