aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_sta.c
diff options
context:
space:
mode:
authorDaniel Drake <dsd@gentoo.org>2007-07-10 13:32:11 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-07-12 16:07:26 -0400
commit63fc33ceb0ccc08b3f62d7bfe56a33eb33ca9427 (patch)
tree6fb60af08616b2f4065cdd74b83f43c819f1853c /net/mac80211/ieee80211_sta.c
parent5628221caf88e2a052782b042e12da7cd34111b0 (diff)
[PATCH] mac80211: improved 802.11g CTS protection
Currently, CTS protection is partially implemented twice: 1. via prism2 ioctls, only used by hostapd 2. via STA beacon parsing, recorded in sta.use_protection but never used (other than printed in debugfs) Protection control should be implemented on a per-subif basis. For example, a single physical device may be running a soft AP on one channel, and a STA on another. The AP interface should use protection based on what hostapd told it, and the STA interface should use protection based on beacon parsing. These should operate independantly: one subif using protection should not influence the other. To implement this, I moved the use_protection flag into ieee80211_sub_if_data and removed the device-global cts_protect_erp_frames flag. I also made the PRISM2_PARAM_CTS_PROTECT_ERP_FRAMES write operation only available for AP interfaces, to avoid any possibility of the user messing with the behaviour of a STA. Signed-off-by: Daniel Drake <dsd@gentoo.org> Signed-off-by: Jiri Benc <jbenc@suse.cz> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/ieee80211_sta.c')
-rw-r--r--net/mac80211/ieee80211_sta.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index df6c410de161..ba2bf8f0a347 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -316,12 +316,11 @@ static void ieee80211_sta_wmm_params(struct net_device *dev,
316 316
317static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value) 317static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value)
318{ 318{
319 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
320 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 319 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
321 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 320 struct ieee80211_if_sta *ifsta = &sdata->u.sta;
322 int use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0; 321 int use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0;
323 322
324 if (use_protection != !!ifsta->use_protection) { 323 if (use_protection != sdata->use_protection) {
325 if (net_ratelimit()) { 324 if (net_ratelimit()) {
326 printk(KERN_DEBUG "%s: CTS protection %s (BSSID=" 325 printk(KERN_DEBUG "%s: CTS protection %s (BSSID="
327 MAC_FMT ")\n", 326 MAC_FMT ")\n",
@@ -329,8 +328,7 @@ static void ieee80211_handle_erp_ie(struct net_device *dev, u8 erp_value)
329 use_protection ? "enabled" : "disabled", 328 use_protection ? "enabled" : "disabled",
330 MAC_ARG(ifsta->bssid)); 329 MAC_ARG(ifsta->bssid));
331 } 330 }
332 ifsta->use_protection = use_protection ? 1 : 0; 331 sdata->use_protection = use_protection;
333 local->cts_protect_erp_frames = use_protection;
334 } 332 }
335} 333}
336 334
@@ -390,6 +388,7 @@ static void ieee80211_set_associated(struct net_device *dev,
390 struct ieee80211_if_sta *ifsta, int assoc) 388 struct ieee80211_if_sta *ifsta, int assoc)
391{ 389{
392 union iwreq_data wrqu; 390 union iwreq_data wrqu;
391 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
393 392
394 if (ifsta->associated == assoc) 393 if (ifsta->associated == assoc)
395 return; 394 return;
@@ -417,6 +416,7 @@ static void ieee80211_set_associated(struct net_device *dev,
417 ieee80211_sta_send_associnfo(dev, ifsta); 416 ieee80211_sta_send_associnfo(dev, ifsta);
418 } else { 417 } else {
419 netif_carrier_off(dev); 418 netif_carrier_off(dev);
419 sdata->use_protection = 0;
420 memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); 420 memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
421 } 421 }
422 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 422 wrqu.ap_addr.sa_family = ARPHRD_ETHER;