Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Oct 2004 21:56:19 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 63951 for review
Message-ID:  <200410292156.i9TLuJh7001449@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=63951

Change 63951 by sam@sam_ebb on 2004/10/29 21:55:55

	fixup manual scanning and a reverse some copyout parameters
	to fix a couple of other ioctl's

Affected files ...

.. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#7 edit

Differences ...

==== //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#7 (text+ko) ====

@@ -401,9 +401,8 @@
  * the active list as the place to start the scan.
  */
 static int
-ieee80211_setupscan(struct ieee80211com *ic)
+ieee80211_setupscan(struct ieee80211com *ic, const u_int8_t chanlist[])
 {
-	u_char *chanlist = ic->ic_chan_active;
 	int i;
 
 	/*
@@ -430,6 +429,14 @@
 	if (ic->ic_bss->ni_chan == IEEE80211_CHAN_ANYC ||
 	    isclr(chanlist, ieee80211_chan2ieee(ic, ic->ic_bss->ni_chan)))
 		ic->ic_bss->ni_chan = ic->ic_ibss_chan;
+	memcpy(ic->ic_chan_active, chanlist, sizeof(ic->ic_chan_active));
+	/*
+	 * We force the state to INIT before calling ieee80211_new_state
+	 * to get ieee80211_begin_scan called.  We really want to scan w/o
+	 * altering the current state but that's not possible right now.
+	 */
+	/* XXX handle proberequest case */
+	ic->ic_state = IEEE80211_S_INIT;	/* XXX bypass state machine */
 	return 0;
 }
 
@@ -727,7 +734,7 @@
 	case WI_RID_SCAN_REQ:			/* XXX wicontrol */
 		if (ic->ic_opmode == IEEE80211_M_HOSTAP)
 			break;
-		error = ieee80211_setupscan(ic);
+		error = ieee80211_setupscan(ic, ic->ic_chan_avail);
 		if (error == 0)
 			error = ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
 		break;
@@ -759,9 +766,7 @@
 			}
 			setbit(chanlist, i);
 		}
-		memcpy(ic->ic_chan_active, chanlist,
-		    sizeof(ic->ic_chan_active));
-		error = ieee80211_setupscan(ic);
+		error = ieee80211_setupscan(ic, chanlist);
 		if (wreq.wi_type == WI_RID_CHANNEL_LIST) {
 			/* NB: ignore error from ieee80211_setupscan */
 			error = ENETRESET;
@@ -1156,7 +1161,7 @@
 		/* NB: truncate, caller can check length */
 		if (ireq->i_len > ic->ic_opt_ie_len)
 			ireq->i_len = ic->ic_opt_ie_len;
-		error = copyout(ireq->i_data, ic->ic_opt_ie, ireq->i_len);
+		error = copyout(ic->ic_opt_ie, ireq->i_data, ireq->i_len);
 		break;
 	case IEEE80211_IOC_WPAKEY:
 		error = ieee80211_ioctl_getkey(ic, ireq);
@@ -1167,11 +1172,10 @@
 	case IEEE80211_IOC_BSSID:
 		if (ireq->i_len != IEEE80211_ADDR_LEN)
 			return EINVAL;
-		error = copyout(ireq->i_data,
-				ic->ic_state == IEEE80211_S_RUN ?
+		error = copyout(ic->ic_state == IEEE80211_S_RUN ?
 					ic->ic_bss->ni_bssid :
 					ic->ic_des_bssid,
-				ireq->i_len);
+				ireq->i_data, ireq->i_len);
 		break;
 	case IEEE80211_IOC_WPAIE:
 		error = ieee80211_ioctl_getwpaie(ic, ireq);
@@ -1809,7 +1813,7 @@
 	case IEEE80211_IOC_SCAN_REQ:
 		if (ic->ic_opmode == IEEE80211_M_HOSTAP)
 			break;
-		error = ieee80211_setupscan(ic);
+		error = ieee80211_setupscan(ic, ic->ic_chan_avail);
 		if (error == 0)
 			error = ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
 		break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200410292156.i9TLuJh7001449>