linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave <kilroyd@googlemail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [RFC 5/5] cfg80211: scan before connect if we don't have the bss
Date: Wed, 19 Aug 2009 20:30:05 +0100	[thread overview]
Message-ID: <4A8C52BD.5070609@gmail.com> (raw)
In-Reply-To: <1250668113.16393.25.camel@johannes.local>

Johannes Berg wrote:
> On Wed, 2009-08-19 at 01:04 +0100, David Kilroy wrote:
>> @@ -791,18 +824,55 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev,
>> +		bss = cfg80211_get_bss(wdev->wiphy, NULL, connect->bssid,
>> +				       connect->ssid, connect->ssid_len,
>> +				       WLAN_CAPABILITY_ESS,
>> +				       WLAN_CAPABILITY_ESS);
> 
> Hmm. What if the bssid isn't set? Then the card might select a different
> BSS than the one we have on the scan list.

That's correct. For the Agere driver that's also true when bssid is set
- we can't specify which AP the firmware connects to.

>> +			/* Failed to clone (or scan), so we can't
>> +			 * delay the connect. Free everything up and
>> +			 * go ahead with the connect */
>> +			if (wdev->conn)
>> +				kfree(wdev->conn->ie);
>> +			kfree(wdev->conn);
>> +			wdev->conn = NULL;
> 
> and that would then run into the warning and the problem anyway? Better
> to just reject with -ENOMEM I think? Also, I really don't think you
> should use wdev->conn anywhere in this code path, because some code
> looks at that to figure out whether or not the cfg80211 SME is used.

I thought that might be the case.

>> +		} else {
>> +			cfg80211_put_bss(bss);
> 
>>  		err = rdev->ops->connect(&rdev->wiphy, dev, connect);
> 
> And it's all racy too -- by the time the driver calls connect_result(),
> the BSS might have expired after it was found here now.

Agreed, but with a 15s expiry period I wouldn't expect this to be a
problem in practice.

> I don't think this is really feasible to implement in cfg80211.

cfg80211 seemed like the appropriate place because it avoids different
(fullmac) drivers having to re-implement this.

> Couldn't
> the driver do a probe to the BSS that the device selected, and report
> that before the connect result?

Yes, that's possible. If we went this way it would make sense to encode
this in the interface by changing the cfg80211_connect_result prototype to:

void cfg80211_connect_result(struct net_device *dev,
                             const struct bss *bss,
			     const u8 *req_ie, size_t req_ie_len,
			     const u8 *resp_ie, size_t resp_ie_len,
			     u16 status, gfp_t gfp);

So on connecting:

 * the driver has to call cfg80211_get_bss() to get the bss pointer.

 * if it is not available, scan/probe to get the information, call
cfg80211_inform_bss(), and then use the returned pointer in the
cfg80211_connect_result call.

This means the driver may have to hold onto the IE info to use after the
scan returns.

Another alternative is for cfg80211_connect_result to trigger the scan
if it doesn't have the bss, and only complete the connect when the scan
returns. I think I like the sound of this best.



Dave.

  reply	other threads:[~2009-08-19 19:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-19  0:04 [RFC v2 0/5] orinoco: use cfg80211 for key manipulation David Kilroy
2009-08-19  0:04 ` [RFC 1/5] orinoco: add cfg80211 connect and disconnect David Kilroy
2009-08-19  0:04 ` [RFC 2/5] orinoco: add cfg80211 join_ibss and leave_ibss David Kilroy
2009-08-19  0:04 ` [RFC 3/5] orinoco: implement cfg80211 key manipulation functions David Kilroy
2009-08-19  0:04 ` [RFC 4/5] orinoco: do WE via cfg80211 David Kilroy
2009-08-19  0:04 ` [RFC 5/5] cfg80211: scan before connect if we don't have the bss David Kilroy
2009-08-19  7:48   ` Johannes Berg
2009-08-19 19:30     ` Dave [this message]
2009-08-19 19:37       ` Johannes Berg
2009-08-20 18:01         ` Dave
2009-08-20  6:39       ` Jussi Kivilinna
2009-08-31 17:59 ` [RFC v2 0/5] orinoco: use cfg80211 for key manipulation John W. Linville
2009-09-12 23:54   ` Dave Kilroy
2009-10-23 19:05     ` Dave
2009-10-26 13:17       ` Only device wlan1 but no connection Fritz!WLAN USB stick N2.4 Ed Vaessen
2009-10-26 14:57         ` Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A8C52BD.5070609@gmail.com \
    --to=kilroyd@googlemail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).