Re: [PATCH] cfg80211: set conn.state properly in the connect() case

Johannes Berg
2009-07-01T10:58:38Z

[-- Attachment #1: Type: text/plain, Size: 1887 bytes --]

On Tue, 2009-06-30 at 17:35 +0200, Samuel Ortiz wrote:
> We need to set the conn.state to ASSOCIATING for the ->connect() path. By
> default, it is set to 0, i.e. SCANNING, which causes sme_scan_done() to
> eventually call conn_do_work(), which then would call assoc() and auth()
> blindly. That's why we also bug on those hooks not being defined there.

Maybe it would be better to have a default IDLE state for this state
machine as well, instead?

johannes

> Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com>
> ---
> net/wireless/sme.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> Index: iwm-2.6/net/wireless/sme.c
> ===================================================================
> --- iwm-2.6.orig/net/wireless/sme.c 2009-06-30 16:39:58.000000000 +0200
> +++ iwm-2.6/net/wireless/sme.c 2009-06-30 17:17:14.000000000 +0200
> @@ -103,6 +103,7 @@ static int cfg80211_conn_do_work(struct
> u.auth_req.ie = NULL;
> u.auth_req.ie_len = 0;
> wdev->conn.state = CFG80211_CONN_AUTHENTICATING;
> + BUG_ON(!drv->ops->auth);
> return drv->ops->auth(wdev->wiphy, wdev->netdev, &u.auth_req);
> case CFG80211_CONN_ASSOCIATE_NEXT:
> u.assoc_req.chan = wdev->conn.params.channel;
> @@ -115,6 +116,7 @@ static int cfg80211_conn_do_work(struct
> memcpy(&u.assoc_req.crypto, &wdev->conn.params.crypto,
> sizeof(u.assoc_req.crypto));
> wdev->conn.state = CFG80211_CONN_ASSOCIATING;
> + BUG_ON(!drv->ops->assoc);
> return drv->ops->assoc(wdev->wiphy, wdev->netdev,
> &u.assoc_req);
> default:
> @@ -455,6 +457,7 @@ int cfg80211_connect(struct cfg80211_reg
> return err;
> } else {
> wdev->sme_state = CFG80211_SME_CONNECTING;
> + wdev->conn.state = CFG80211_CONN_ASSOCIATING;
> err = rdev->ops->connect(&rdev->wiphy, dev, connect);
> if (err) {
> wdev->sme_state = CFG80211_SME_IDLE;

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]