Commit 8bc77a4d authored by Bing Zhao's avatar Bing Zhao Committed by John W. Linville

mwifiex: don't try to associate when bss_mode is not STA

We have blocked association attempts on interfaces configured in
AP and AD-HOC modes. P2P mode should be blocked too.

Furthermore, an error code must be returned if we are unable to
associate.
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 4587eea5
...@@ -1666,17 +1666,13 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, ...@@ -1666,17 +1666,13 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_connect_params *sme) struct cfg80211_connect_params *sme)
{ {
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
int ret = 0; int ret;
if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
wiphy_err(wiphy, "received infra assoc request "
"when station is in ibss mode\n");
goto done;
}
if (priv->bss_mode == NL80211_IFTYPE_AP) { if (priv->bss_mode != NL80211_IFTYPE_STATION) {
wiphy_err(wiphy, "skip association request for AP interface\n"); wiphy_err(wiphy,
goto done; "%s: reject infra assoc request in non-STA mode\n",
dev->name);
return -EINVAL;
} }
wiphy_dbg(wiphy, "info: Trying to associate to %s and bssid %pM\n", wiphy_dbg(wiphy, "info: Trying to associate to %s and bssid %pM\n",
...@@ -1684,7 +1680,6 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, ...@@ -1684,7 +1680,6 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
ret = mwifiex_cfg80211_assoc(priv, sme->ssid_len, sme->ssid, sme->bssid, ret = mwifiex_cfg80211_assoc(priv, sme->ssid_len, sme->ssid, sme->bssid,
priv->bss_mode, sme->channel, sme, 0); priv->bss_mode, sme->channel, sme, 0);
done:
if (!ret) { if (!ret) {
cfg80211_connect_result(priv->netdev, priv->cfg_bssid, NULL, 0, cfg80211_connect_result(priv->netdev, priv->cfg_bssid, NULL, 0,
NULL, 0, WLAN_STATUS_SUCCESS, NULL, 0, WLAN_STATUS_SUCCESS,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment