From owner-freebsd-current@FreeBSD.ORG Mon Feb 27 19:18:45 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 23D8516A422 for ; Mon, 27 Feb 2006 19:18:45 +0000 (GMT) (envelope-from sam@errno.com) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id 13F2A43D58 for ; Mon, 27 Feb 2006 19:18:41 +0000 (GMT) (envelope-from sam@errno.com) Received: from [10.0.0.248] (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.12.9/8.12.6) with ESMTP id k1RJIeo7092964 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 27 Feb 2006 11:18:41 -0800 (PST) (envelope-from sam@errno.com) Message-ID: <44035151.8050703@errno.com> Date: Mon, 27 Feb 2006 11:21:53 -0800 From: Sam Leffler User-Agent: Thunderbird 1.5 (X11/20060210) MIME-Version: 1.0 To: Yamamoto Shigeru References: <43F3FAF3.7010000@errno.com> <20060217.122420.38719049.shigeru@iij.ad.jp> <43F60C99.2090006@errno.com> <20060227.212918.78702145.shigeru@iij.ad.jp> <440333E6.7010300@errno.com> In-Reply-To: <440333E6.7010300@errno.com> Content-Type: multipart/mixed; boundary="------------020900090702050603020406" Cc: freebsd-current@freebsd.org Subject: Re: HEADSUP: new ath+hal [patch] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Feb 2006 19:18:45 -0000 This is a multi-part message in MIME format. --------------020900090702050603020406 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sam Leffler wrote: > Yamamoto Shigeru wrote: >> Hi, sam, >> >> I install 20060130 current to same note PC to compare 'current >> 20060130' and >> 'current 20060222'. >> After installing, I watch control message with >> 'tcpdump -n -i ath0 -y IEEE802_11'. >> >> When using '20060130 current', I can watch "Probe request" from my >> note PC. >> But I can't watch "Probe request" when using '20060222 current'. >> >> I add 'printf()' to codes and I check when 'IEEE80211_CHAN_PASSIVE' is >> set. >> I found ath_getchannels() at @src/sys/dev/ath/if_ath.c sets >> 'IEEE80211_CHAN_PASSIVE', because 'CHANNEL_PASSIVE' in channelFlags is >> set. >> >> I think ath driver send "Probe request" if ignore 'CHANNEL_PASSIVE' in >> channelFlags. >> So I add a code to ignore 'CHANNEL_PASSIVE' and to unset >> 'IEEE80211_CHAN_PASSIVE'. >> I test this test code at "broadcast SSID in beacon", and my note PC can >> associate an AP. >> >> It seems me current ath hal returns 'CHANNEL_PASSIVE' for all channels. >> In @src/sys/contrib/dev/ath/ah.h, comment for 'CHANNEL_PASSIVE' is "Only >> passive scan allowed in the channel". >> Does it mean my note PC can't send a probe message? > > Thanks for digging. When you hit a problem like this it's very helpful > to know the regulatory domain and country code in your code; sysctl > dev.ath.0 will show that. > > When a channel is marked for passive scan a station cannot send frames > unless it knows the channel is being used for 802.11 traffic. What we > need to do is listen first then if we see 802.11 traffic mark the > channel as "ok to transmit on". Then the next time we come to the > channel we'll be able to send a probe request frame. I've been meaning > to get that code into cvs for a while; I'll see about making that happen. > > In the meantime you may be able to specify the ap's bssid to associate > (can't recall if the current scanning code requires an ssid match and > bssid is just used to discriminate between multiple ap's with the same > ssid). Please try the attached patch against head. Sam --------------020900090702050603020406 Content-Type: text/x-patch; name="probe.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="probe.diff" Index: ieee80211_input.c =================================================================== RCS file: /usr/ncvs/src/sys/net80211/ieee80211_input.c,v retrieving revision 1.87 diff -u -r1.87 ieee80211_input.c --- ieee80211_input.c 23 Jan 2006 21:02:48 -0000 1.87 +++ ieee80211_input.c 27 Feb 2006 18:56:17 -0000 @@ -1953,6 +1953,18 @@ * If scanning, just pass information to the scan module. */ if (ic->ic_flags & IEEE80211_F_SCAN) { + if (ic->ic_flags_ext & IEEE80211_FEXT_PROBECHAN) { + /* + * Actively scanning a channel marked passive; + * send a probe request now that we know there + * is 802.11 traffic present. + * + * XXX check if the beacon we recv'd gives + * us what we need and suppress the probe req + */ + ieee80211_probe_curchan(ic, 1); + ic->ic_flags_ext &= ~IEEE80211_FEXT_PROBECHAN; + } ieee80211_add_scan(ic, &scan, wh, subtype, rssi, rstamp); return; Index: ieee80211_node.c =================================================================== RCS file: /usr/ncvs/src/sys/net80211/ieee80211_node.c,v retrieving revision 1.72 diff -u -r1.72 ieee80211_node.c --- ieee80211_node.c 18 Jan 2006 19:56:17 -0000 1.72 +++ ieee80211_node.c 27 Feb 2006 19:00:09 -0000 @@ -321,6 +321,7 @@ * flushing anything queued in the driver and below. */ ic->ic_mgt_timer = 0; + ic->ic_flags_ext &= ~IEEE80211_FEXT_PROBECHAN; chan = ic->ic_curchan; do { @@ -347,6 +348,31 @@ return 0; } +/* + * Probe the curent channel, if allowed, while scanning. + * If the channel is not marked passive-only then send + * a probe request immediately. Otherwise mark state and + * listen for beacons on the channel; if we receive something + * then we'll transmit a probe request. + */ +void +ieee80211_probe_curchan(struct ieee80211com *ic, int force) +{ + struct ifnet *ifp = ic->ic_ifp; + + if ((ic->ic_curchan->ic_flags & IEEE80211_CHAN_PASSIVE) == 0 || force) { + /* + * XXX send both broadcast+directed probe request + */ + ieee80211_send_probereq(ic->ic_bss, + ic->ic_myaddr, ifp->if_broadcastaddr, + ifp->if_broadcastaddr, + ic->ic_des_essid, ic->ic_des_esslen, + ic->ic_opt_ie, ic->ic_opt_ie_len); + } else + ic->ic_flags_ext |= IEEE80211_FEXT_PROBECHAN; +} + static __inline void copy_bss(struct ieee80211_node *nbss, const struct ieee80211_node *obss) { @@ -596,6 +622,7 @@ (ic->ic_flags & IEEE80211_F_ASCAN) ? "active" : "passive"); ic->ic_flags &= ~(IEEE80211_F_SCAN | IEEE80211_F_ASCAN); + ic->ic_flags_ext &= ~IEEE80211_FEXT_PROBECHAN; } /* Index: ieee80211_node.h =================================================================== RCS file: /usr/ncvs/src/sys/net80211/ieee80211_node.h,v retrieving revision 1.23 diff -u -r1.23 ieee80211_node.h --- ieee80211_node.h 4 Dec 2005 04:50:27 -0000 1.23 +++ ieee80211_node.h 27 Feb 2006 18:45:21 -0000 @@ -187,6 +187,7 @@ void ieee80211_begin_scan(struct ieee80211com *, int); int ieee80211_next_scan(struct ieee80211com *); +void ieee80211_probe_curchan(struct ieee80211com *, int); void ieee80211_create_ibss(struct ieee80211com*, struct ieee80211_channel *); void ieee80211_reset_bss(struct ieee80211com *); void ieee80211_cancel_scan(struct ieee80211com *); Index: ieee80211_proto.c =================================================================== RCS file: /usr/ncvs/src/sys/net80211/ieee80211_proto.c,v retrieving revision 1.28 diff -u -r1.28 ieee80211_proto.c --- ieee80211_proto.c 23 Jan 2006 21:02:49 -0000 1.28 +++ ieee80211_proto.c 27 Feb 2006 19:00:25 -0000 @@ -978,19 +978,11 @@ break; case IEEE80211_S_SCAN: /* - * Scan next. If doing an active scan and the - * channel is not marked passive-only then send - * a probe request. Otherwise just listen for - * beacons on the channel. + * Scan next. If doing an active scan probe + * for the requested ap (if any). */ - if ((ic->ic_flags & IEEE80211_F_ASCAN) && - (ic->ic_curchan->ic_flags & IEEE80211_CHAN_PASSIVE) == 0) { - ieee80211_send_probereq(ni, - ic->ic_myaddr, ifp->if_broadcastaddr, - ifp->if_broadcastaddr, - ic->ic_des_essid, ic->ic_des_esslen, - ic->ic_opt_ie, ic->ic_opt_ie_len); - } + if (ic->ic_flags & IEEE80211_F_ASCAN) + ieee80211_probe_curchan(ic, 0); break; case IEEE80211_S_RUN: /* beacon miss */ Index: ieee80211_var.h =================================================================== RCS file: /usr/ncvs/src/sys/net80211/ieee80211_var.h,v retrieving revision 1.39 diff -u -r1.39 ieee80211_var.h --- ieee80211_var.h 14 Feb 2006 17:48:56 -0000 1.39 +++ ieee80211_var.h 27 Feb 2006 18:56:00 -0000 @@ -254,6 +254,7 @@ #define IEEE80211_FEXT_BGSCAN 0x00000008 /* STATUS: enable full bgscan completion */ #define IEEE80211_FEXT_ERPUPDATE 0x00000200 /* STATUS: update ERP element */ #define IEEE80211_FEXT_SWBMISS 0x00000400 /* CONF: do bmiss in s/w */ +#define IEEE80211_FEXT_PROBECHAN 0x00020000 /* CONF: probe passive channel*/ /* ic_caps */ #define IEEE80211_C_WEP 0x00000001 /* CAPABILITY: WEP available */ --------------020900090702050603020406--