Module Name:    src
Committed By:   christos
Date:           Fri Jun 24 16:08:55 UTC 2016

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

Log Message:
diff reduction with openbsd; turn debugging on.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/rt2860.c

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

Modified files:

Index: src/sys/dev/ic/rt2860.c
diff -u src/sys/dev/ic/rt2860.c:1.16 src/sys/dev/ic/rt2860.c:1.17
--- src/sys/dev/ic/rt2860.c:1.16	Fri Jun 17 13:03:20 2016
+++ src/sys/dev/ic/rt2860.c	Fri Jun 24 12:08:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rt2860.c,v 1.16 2016/06/17 17:03:20 christos Exp $	*/
+/*	$NetBSD: rt2860.c,v 1.17 2016/06/24 16:08:54 christos Exp $	*/
 /*	$OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $	*/
 
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.16 2016/06/17 17:03:20 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.17 2016/06/24 16:08:54 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/sockio.h>
@@ -64,7 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1
 #ifdef RAL_DEBUG
 #define DPRINTF(x)	do { if (rt2860_debug > 0) printf x; } while (0)
 #define DPRINTFN(n, x)	do { if (rt2860_debug >= (n)) printf x; } while (0)
-int rt2860_debug = 0;
+int rt2860_debug = 4;
 #else
 #define DPRINTF(x)
 #define DPRINTFN(n, x)
@@ -1776,6 +1776,8 @@ rt2860_start(struct ifnet *ifp)
 			continue;
 		}
 
+		bpf_mtap(ifp, m);
+
 		eh = mtod(m, struct ether_header *);
 		ni = ieee80211_find_txnode(ic, eh->ether_dhost);
 		if (ni == NULL) {
@@ -1784,8 +1786,6 @@ rt2860_start(struct ifnet *ifp)
 			continue;
 		}
 
-		bpf_mtap(ifp, m);
-
 		if ((m = ieee80211_encap(ic, m, ni)) == NULL) {
 			ieee80211_free_node(ni);
 			ifp->if_oerrors++;
@@ -1863,6 +1863,22 @@ rt2860_ioctl(struct ifnet *ifp, u_long c
 		}
 		break;
 
+	case SIOCS80211CHANNEL:
+		/*
+		 * This allows for fast channel switching in monitor mode
+		 * (used by kismet). In IBSS mode, we must explicitly reset
+		 * the interface to generate a new beacon frame.
+		 */
+		error = ieee80211_ioctl(ic, cmd, data);
+		if (error == ENETRESET &&
+		    ic->ic_opmode == IEEE80211_M_MONITOR) {
+			if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) ==
+			    (IFF_UP | IFF_RUNNING))
+				rt2860_switch_chan(sc, ic->ic_ibss_chan);
+			error = 0;
+		}
+		break;
+
 	default:
 		error = ieee80211_ioctl(ic, cmd, data);
 	}
@@ -2753,6 +2769,11 @@ rt2860_set_key(struct ieee80211com *ic, 
 	uint8_t mode, wcid, iv[8];
 	struct ieee80211_key *k = __UNCONST(ck); /* XXX */
 
+	/* defer setting of WEP keys until interface is brought up */
+	if ((ic->ic_if.if_flags & (IFF_UP | IFF_RUNNING)) !=
+	    (IFF_UP | IFF_RUNNING))
+		return 0;
+
 	/* map net80211 cipher to RT2860 security mode */
 	switch (k->wk_cipher->ic_cipher) {
 	case IEEE80211_CIPHER_WEP:

Reply via email to