From owner-p4-projects@FreeBSD.ORG Thu Nov 24 01:48:45 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id EA93F16A421; Thu, 24 Nov 2005 01:48:44 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ADA6716A41F for ; Thu, 24 Nov 2005 01:48:44 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4D28043D67 for ; Thu, 24 Nov 2005 01:48:44 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id jAO1mi3q029719 for ; Thu, 24 Nov 2005 01:48:44 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id jAO1mhCq029716 for perforce@freebsd.org; Thu, 24 Nov 2005 01:48:43 GMT (envelope-from sam@freebsd.org) Date: Thu, 24 Nov 2005 01:48:43 GMT Message-Id: <200511240148.jAO1mhCq029716@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 87165 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Nov 2005 01:48:45 -0000 http://perforce.freebsd.org/chv.cgi?CH=87165 Change 87165 by sam@sam_ebb on 2005/11/24 01:48:18 explicitly sync scanner state when we move directly to RUN state (i.e. w/o scanning) Affected files ... .. //depot/projects/wifi/sys/net80211/ieee80211_proto.c#38 edit .. //depot/projects/wifi/sys/net80211/ieee80211_scan.c#6 edit .. //depot/projects/wifi/sys/net80211/ieee80211_scan.h#4 edit Differences ... ==== //depot/projects/wifi/sys/net80211/ieee80211_proto.c#38 (text+ko) ==== @@ -1011,9 +1011,11 @@ ic->ic_opmode == IEEE80211_M_AHDEMO) && ic->ic_des_chan != IEEE80211_CHAN_ANYC) { /* - * AP operation and we already have a channel; - * bypass the scan and startup immediately. + * Already have a channel; bypass the + * scan and startup immediately. Because + * of this explicitly sync the scanner state. */ + ieee80211_scan_update(ic); ieee80211_create_ibss(ic, ic->ic_des_chan); } else { ieee80211_check_scan(ic, @@ -1143,8 +1145,10 @@ ic->ic_opmode == IEEE80211_M_HOSTAP) { /* * Already have a channel; bypass the - * scan and startup immediately. + * scan and startup immediately. Because + * of this explicitly sync the scanner state. */ + ieee80211_scan_update(ic); ieee80211_create_ibss(ic, ic->ic_curchan); break; } ==== //depot/projects/wifi/sys/net80211/ieee80211_scan.c#6 (text+ko) ==== @@ -193,6 +193,45 @@ scanners[m] = NULL; } +/* + * Update common scanner state to reflect the current + * operating mode. This is called when the state machine + * is transitioned to RUN state w/o scanning--e.g. when + * operating in monitor mode. The purpose of this is to + * ensure later callbacks find ss_ops set to properly + * reflect current operating mode. + */ +int +ieee80211_scan_update(struct ieee80211com *ic) +{ + struct ieee80211_scan_state *ss = ic->ic_scan; + const struct ieee80211_scanner *scan; + + scan = ieee80211_scanner_get(ic->ic_opmode); + IEEE80211_LOCK(ic); + if (scan == NULL) { + IEEE80211_DPRINTF(ic, IEEE80211_MSG_SCAN, + "%s: no scanner support for mode %u\n", + __func__, ic->ic_opmode); + /* XXX stat */ + } + ss->ss_ic = ic; + if (ss->ss_ops != scan) { + /* switch scanners; detach old, attach new */ + if (ss->ss_ops != NULL) + ss->ss_ops->scan_detach(ss); + if (scan != NULL && !scan->scan_attach(ss)) { + /* XXX attach failure */ + /* XXX stat+msg */ + ss->ss_ops = NULL; + } else + ss->ss_ops = scan; + } + IEEE80211_UNLOCK(ic); + + return (scan != NULL); +} + static void change_channel(struct ieee80211com *ic, struct ieee80211_channel *chan) ==== //depot/projects/wifi/sys/net80211/ieee80211_scan.h#4 (text+ko) ==== @@ -80,6 +80,7 @@ void ieee80211_scan_dump_channels(const struct ieee80211_scan_state *); +int ieee80211_scan_update(struct ieee80211com *); #define IEEE80211_SCAN_FOREVER 0x7fffffff int ieee80211_start_scan(struct ieee80211com *, int flags, u_int duration, u_int nssid, const struct ieee80211_scan_ssid ssids[]);