Skip to content

Commit

Permalink
cfg80211: Allow reassociation to be requested with internal SME
Browse files Browse the repository at this point in the history
If the user space issues a NL80211_CMD_CONNECT with
NL80211_ATTR_PREV_BSSID when there is already a connection, allow this
to proceed as a reassociation instead of rejecting the new connect
command with EALREADY.

Signed-off-by: Jouni Malinen <[email protected]>
[validate prev_bssid]
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
jmalinen authored and jmberg-intel committed Apr 6, 2016
1 parent ba6fbac commit 4ce2bd9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -8151,7 +8151,8 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
}

wdev_lock(dev->ieee80211_ptr);
err = cfg80211_connect(rdev, dev, &connect, connkeys, NULL);
err = cfg80211_connect(rdev, dev, &connect, connkeys,
connect.prev_bssid);
wdev_unlock(dev->ieee80211_ptr);
if (err)
kzfree(connkeys);
Expand Down
14 changes: 12 additions & 2 deletions net/wireless/sme.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,18 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev,
if (!rdev->ops->auth || !rdev->ops->assoc)
return -EOPNOTSUPP;

if (wdev->current_bss)
return -EALREADY;
if (wdev->current_bss) {
if (!prev_bssid)
return -EALREADY;
if (prev_bssid &&
!ether_addr_equal(prev_bssid, wdev->current_bss->pub.bssid))
return -ENOTCONN;
cfg80211_unhold_bss(wdev->current_bss);
cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub);
wdev->current_bss = NULL;

cfg80211_sme_free(wdev);
}

if (WARN_ON(wdev->conn))
return -EINPROGRESS;
Expand Down

0 comments on commit 4ce2bd9

Please sign in to comment.