diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-04-20 12:43:46 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-04-22 16:57:17 -0400 |
commit | 9d308429a9fd0fa644f0b748f6241631f74a6cda (patch) | |
tree | 944b813829d21665f05e579bd97fd5c070f7ddf8 /net/wireless/ibss.c | |
parent | b9a5f8cab751d362f7c2d94899ca788c22fcd1ef (diff) |
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/ibss.c')
-rw-r--r-- | net/wireless/ibss.c | 21 |
1 files changed, 14 insertions, 7 deletions
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, | |||
76 | return 0; | 76 | return 0; |
77 | } | 77 | } |
78 | 78 | ||
79 | void cfg80211_clear_ibss(struct net_device *dev) | 79 | void cfg80211_clear_ibss(struct net_device *dev, bool nowext) |
80 | { | 80 | { |
81 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 81 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
82 | 82 | ||
@@ -88,10 +88,14 @@ void cfg80211_clear_ibss(struct net_device *dev) | |||
88 | wdev->current_bss = NULL; | 88 | wdev->current_bss = NULL; |
89 | wdev->ssid_len = 0; | 89 | wdev->ssid_len = 0; |
90 | memset(wdev->bssid, 0, ETH_ALEN); | 90 | memset(wdev->bssid, 0, ETH_ALEN); |
91 | #ifdef CONFIG_WIRELESS_EXT | ||
92 | if (!nowext) | ||
93 | wdev->wext.ssid_len = 0; | ||
94 | #endif | ||
91 | } | 95 | } |
92 | 96 | ||
93 | int cfg80211_leave_ibss(struct cfg80211_registered_device *rdev, | 97 | int cfg80211_leave_ibss(struct cfg80211_registered_device *rdev, |
94 | struct net_device *dev) | 98 | struct net_device *dev, bool nowext) |
95 | { | 99 | { |
96 | int err; | 100 | int err; |
97 | 101 | ||
@@ -100,7 +104,7 @@ int cfg80211_leave_ibss(struct cfg80211_registered_device *rdev, | |||
100 | if (err) | 104 | if (err) |
101 | return err; | 105 | return err; |
102 | 106 | ||
103 | cfg80211_clear_ibss(dev); | 107 | cfg80211_clear_ibss(dev, nowext); |
104 | 108 | ||
105 | return 0; | 109 | return 0; |
106 | } | 110 | } |
@@ -179,7 +183,8 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev, | |||
179 | return 0; | 183 | return 0; |
180 | 184 | ||
181 | if (wdev->ssid_len) { | 185 | if (wdev->ssid_len) { |
182 | err = cfg80211_leave_ibss(wiphy_to_dev(wdev->wiphy), dev); | 186 | err = cfg80211_leave_ibss(wiphy_to_dev(wdev->wiphy), |
187 | dev, true); | ||
183 | if (err) | 188 | if (err) |
184 | return err; | 189 | return err; |
185 | } | 190 | } |
@@ -241,7 +246,8 @@ int cfg80211_ibss_wext_siwessid(struct net_device *dev, | |||
241 | return -EOPNOTSUPP; | 246 | return -EOPNOTSUPP; |
242 | 247 | ||
243 | if (wdev->ssid_len) { | 248 | if (wdev->ssid_len) { |
244 | err = cfg80211_leave_ibss(wiphy_to_dev(wdev->wiphy), dev); | 249 | err = cfg80211_leave_ibss(wiphy_to_dev(wdev->wiphy), |
250 | dev, true); | ||
245 | if (err) | 251 | if (err) |
246 | return err; | 252 | return err; |
247 | } | 253 | } |
@@ -275,7 +281,7 @@ int cfg80211_ibss_wext_giwessid(struct net_device *dev, | |||
275 | data->flags = 1; | 281 | data->flags = 1; |
276 | data->length = wdev->ssid_len; | 282 | data->length = wdev->ssid_len; |
277 | memcpy(ssid, wdev->ssid, data->length); | 283 | memcpy(ssid, wdev->ssid, data->length); |
278 | } else if (wdev->wext.ssid) { | 284 | } else if (wdev->wext.ssid && wdev->wext.ssid_len) { |
279 | data->flags = 1; | 285 | data->flags = 1; |
280 | data->length = wdev->wext.ssid_len; | 286 | data->length = wdev->wext.ssid_len; |
281 | memcpy(ssid, wdev->wext.ssid, data->length); | 287 | memcpy(ssid, wdev->wext.ssid, data->length); |
@@ -318,7 +324,8 @@ int cfg80211_ibss_wext_siwap(struct net_device *dev, | |||
318 | return 0; | 324 | return 0; |
319 | 325 | ||
320 | if (wdev->ssid_len) { | 326 | if (wdev->ssid_len) { |
321 | err = cfg80211_leave_ibss(wiphy_to_dev(wdev->wiphy), dev); | 327 | err = cfg80211_leave_ibss(wiphy_to_dev(wdev->wiphy), |
328 | dev, true); | ||
322 | if (err) | 329 | if (err) |
323 | return err; | 330 | return err; |
324 | } | 331 | } |