summaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-04-20 18:43:46 +0200
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:57:17 -0400
commit9d308429a9fd0fa644f0b748f6241631f74a6cda (patch)
tree944b813829d21665f05e579bd97fd5c070f7ddf8 /net/wireless
parentb9a5f8cab751d362f7c2d94899ca788c22fcd1ef (diff)
downloadlinux-9d308429a9fd0fa644f0b748f6241631f74a6cda.tar.bz2
cfg80211: clear WEXT SSID when clearing IBSS
When we leave an IBSS, we should clear the SSID and not just the BSSID, but since WEXT allows configuring while the interface is down we must not clear it when leaving due to taking the iface down, so some complications are needed. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/core.c2
-rw-r--r--net/wireless/core.h4
-rw-r--r--net/wireless/ibss.c21
-rw-r--r--net/wireless/nl80211.c4
4 files changed, 19 insertions, 12 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c
index f256b4f7e833..2006a4ee60eb 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -464,7 +464,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
break;
if (!dev->ieee80211_ptr->ssid_len)
break;
- cfg80211_leave_ibss(rdev, dev);
+ cfg80211_leave_ibss(rdev, dev, true);
break;
case NETDEV_UP:
#ifdef CONFIG_WIRELESS_EXT
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 89a8159ef0b1..3e49d3399311 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -147,8 +147,8 @@ void cfg80211_bss_age(struct cfg80211_registered_device *dev,
int cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
struct net_device *dev,
struct cfg80211_ibss_params *params);
-void cfg80211_clear_ibss(struct net_device *dev);
+void cfg80211_clear_ibss(struct net_device *dev, bool nowext);
int cfg80211_leave_ibss(struct cfg80211_registered_device *rdev,
- struct net_device *dev);
+ struct net_device *dev, bool nowext);
#endif /* __NET_WIRELESS_CORE_H */
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index 4e1fcb0c9e4c..b5c601e1b1b7 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -76,7 +76,7 @@ int cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
return 0;
}
-void cfg80211_clear_ibss(struct net_device *dev)
+void cfg80211_clear_ibss(struct net_device *dev, bool nowext)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
@@ -88,10 +88,14 @@ void cfg80211_clear_ibss(struct net_device *dev)
wdev->current_bss = NULL;
wdev->ssid_len = 0;
memset(wdev->bssid, 0, ETH_ALEN);
+#ifdef CONFIG_WIRELESS_EXT
+ if (!nowext)
+ wdev->wext.ssid_len = 0;
+#endif
}
int cfg80211_leave_ibss(struct cfg80211_registered_device *rdev,
- struct net_device *dev)
+ struct net_device *dev, bool nowext)
{
int err;
@@ -100,7 +104,7 @@ int cfg80211_leave_ibss(struct cfg80211_registered_device *rdev,
if (err)
return err;
- cfg80211_clear_ibss(dev);
+ cfg80211_clear_ibss(dev, nowext);
return 0;
}
@@ -179,7 +183,8 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
return 0;
if (wdev->ssid_len) {
- err = cfg80211_leave_ibss(wiphy_to_dev(wdev->wiphy), dev);
+ err = cfg80211_leave_ibss(wiphy_to_dev(wdev->wiphy),
+ dev, true);
if (err)
return err;
}
@@ -241,7 +246,8 @@ int cfg80211_ibss_wext_siwessid(struct net_device *dev,
return -EOPNOTSUPP;
if (wdev->ssid_len) {
- err = cfg80211_leave_ibss(wiphy_to_dev(wdev->wiphy), dev);
+ err = cfg80211_leave_ibss(wiphy_to_dev(wdev->wiphy),
+ dev, true);
if (err)
return err;
}
@@ -275,7 +281,7 @@ int cfg80211_ibss_wext_giwessid(struct net_device *dev,
data->flags = 1;
data->length = wdev->ssid_len;
memcpy(ssid, wdev->ssid, data->length);
- } else if (wdev->wext.ssid) {
+ } else if (wdev->wext.ssid && wdev->wext.ssid_len) {
data->flags = 1;
data->length = wdev->wext.ssid_len;
memcpy(ssid, wdev->wext.ssid, data->length);
@@ -318,7 +324,8 @@ int cfg80211_ibss_wext_siwap(struct net_device *dev,
return 0;
if (wdev->ssid_len) {
- err = cfg80211_leave_ibss(wiphy_to_dev(wdev->wiphy), dev);
+ err = cfg80211_leave_ibss(wiphy_to_dev(wdev->wiphy),
+ dev, true);
if (err)
return err;
}
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 5a9a5c6c71db..97bb5c80125d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -833,7 +833,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
if (dev && !err && (ntype != otype)) {
if (otype == NL80211_IFTYPE_ADHOC)
- cfg80211_clear_ibss(dev);
+ cfg80211_clear_ibss(dev, false);
}
unlock:
@@ -3249,7 +3249,7 @@ static int nl80211_leave_ibss(struct sk_buff *skb, struct genl_info *info)
goto out;
}
- err = cfg80211_leave_ibss(drv, dev);
+ err = cfg80211_leave_ibss(drv, dev, false);
out:
cfg80211_put_dev(drv);