d80211: pull request
Subsystems (2)
cover d80211: pull request
Please pull fromgit://git.kernel.org/pub/scm/linux/kernel/git/jbenc/dscape.git up to obtain following patches:
David Kimdon:
d80211: fix multiple device ap support
d80211: Fix type of prism2_hostapd_param crypt.alg
d80211: allow vlan interfaces to receive ToDS frames
Hong Liu:
d80211: fix wpa_supplicant reassoc problem
d80211: add hardware scan callback
d80211: fix "iwconfig key [x]" behavior
Jiri Benc:
d80211: fix invalid pointer dereference
Johannes Berg:
d80211: use BUILD_BUG_ON
d80211: clean up those huge else if statements
d80211: use list_for_each_entry{,_safe}
d80211: LED triggersMichael Wu:
d80211: fix WEP on big endian cpus
Mohamed Abbas:
d80211: diplay supported rates in readable format
d80211: getting wrong freq value if we did hardware scan
include/net/d80211.h | 46 ++++++++++++++---- net/d80211/Kconfig | 9 ++++ net/d80211/Makefile | 10 ++-- net/d80211/hostapd_ioctl.h | 2 - net/d80211/ieee80211.c | 73 ++++++++++------------------ net/d80211/ieee80211_dev.c | 7 +-- net/d80211/ieee80211_i.h | 6 ++ net/d80211/ieee80211_iface.c | 2 - net/d80211/ieee80211_ioctl.c | 108 +++++++++++++++++++++--------------------- net/d80211/ieee80211_led.c | 93 ++++++++++++++++++++++++++++++------ net/d80211/ieee80211_led.h | 32 ++++++++++++ net/d80211/ieee80211_sta.c | 107 +++++++++++++++++++++++------------------- net/d80211/sta_info.c | 26 +++++----- net/d80211/wep.c | 10 ++-- 14 files changed, 324 insertions(+), 207 deletions(-)
Signature · 2 lines
Jiri Benc SUSE Labs
PATCH 1/14 d80211: fix wpa_supplicant reassoc problem
From: Hong Liu <[email protected]>
After key negotiation completed using wpa_supplicant, wpa_supplicant can't reassoc with the AP if we reboot the AP. It always fails at the 4-way handshake.
The problem is the key info is not cleared correctly. Thus when wpa_supplicant send the EAPOL-KEY packet, the d80211 stack finds the old key and uses it to encrypt the packet.
The patch removes the sta_info when we disassociate with AP.
---
net/d80211/ieee80211_sta.c | 2 ++ net/d80211/sta_info.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
25a49e579344602c14e4cf79fa95098b01e7cf27
net/d80211/ieee80211_sta.c +2 -0
@@ -710,6 +710,8 @@ static void ieee80211_associated(struct"range\n" , dev->name, MAC_ARG(ifsta->bssid)); disassoc =1 ; +sta_info_free (sta,0 ); + ifsta->probereq_poll =0 ; }else { ieee80211_send_probe_req(dev, ifsta->bssid, local->scan_ssid,
net/d80211/sta_info.c +6 -2
@@ -197,6 +197,12 @@ #ifdef CONFIG_D80211_VERBOSE_DEBUG local->mdev->name, MAC_ARG(sta->addr));#endif /* CONFIG_D80211_VERBOSE_DEBUG */ +if (sta->key) { +ieee80211_key_sysfs_remove (sta->key); +ieee80211_key_free (sta->key); + sta->key =NULL ; + } +rate_control_remove_sta_attrs (local, sta->rate_ctrl_priv, &sta->kobj);ieee80211_sta_sysfs_remove (sta);
@@ -244,8 +250,6 @@ void sta_info_free(struct sta_info *sta,kfree (key); } } -ieee80211_key_free (sta->key); - sta->key =NULL ; }else if (sta->key_idx_compression !=HW_KEY_IDX_INVALID ) {struct ieee80211_key_conf conf;memset (&conf,0 ,sizeof (conf));
Signature · 1 line
1.3.0
PATCH 2/14 d80211: add hardware scan callback
In reply to Jiri BencFrom: Hong Liu <[email protected]>
Add hardware scan callback to support cards like ipw3945 which implements the scan command in firmware.
---
include/net/d80211.h | 6 ++++++ net/d80211/ieee80211_sta.c | 47 ++++++++++++++++++++++++++++++-------------- 2 files changed, 38 insertions(+), 15 deletions(-)
5b1756ecb9786baeb5127ca60cf0b3431e1d0e84
include/net/d80211.h +6 -0
@@ -600,6 +600,10 @@ struct ieee80211_hw {int (*passive_scan)(struct net_device *dev,int state,struct ieee80211_scan_conf *conf); +/* Ask the hardware to service the scan request, no need to start +* the scan state machine in stack. */ +int (*hw_scan)(struct net_device *dev,u8 *ssid,size_t len); +/* return low-level statistics */ int (*get_stats)(struct net_device *dev,struct ieee80211_low_level_stats *stats);
@@ -863,6 +867,8 @@ struct dev_mc_list *ieee80211_get_mc_lisstruct ieee80211_conf *ieee80211_get_hw_conf (struct net_device *dev); +/* called by driver to notify scan status completed */ +void ieee80211_scan_completed (struct net_device *dev);/* Return a pointer to the low-level private data area for the given device. */ void *ieee80211_dev_hw_data (struct net_device *dev);
net/d80211/ieee80211_sta.c +32 -15
71 lines not on this page · raw message
Signature · 1 line
1.3.0
PATCH 3/14 d80211: diplay supported rates in readable format
In reply to Jiri BencFrom: mabbas <[email protected]>
This patch modify d80211 to report supported rates in readable format in iwlist scan command.
---
net/d80211/ieee80211_sta.c | 24 +++++++++++++++--------- 1 files changed, 15 insertions(+), 9 deletions(-)
f99ee9c93d75118c2dc54085ff2218407bd8601c
net/d80211/ieee80211_sta.c +15 -9
@@ -2733,15 +2733,21 @@ ieee80211_sta_scan_result(struct net_dev current_ev =iwe_stream_add_point (current_ev, end_buf, &iwe, buf); - p = buf; - p +=sprintf (p,"supp_rates=" ); -for (i =0 ; i < bss->supp_rates_len; i++) - p+=sprintf (p,"%02x" , bss->supp_rates[i]); -memset (&iwe,0 ,sizeof (iwe)); - iwe.cmd =IWEVCUSTOM ; - iwe.u.data.length =strlen (buf); - current_ev =iwe_stream_add_point (current_ev, end_buf, &iwe, - buf); +/* dispaly all support rates in readable format */ + p = current_ev +IW_EV_LCP_LEN ; + iwe.cmd =SIOCGIWRATE ; +/* Those two flags are ignored... */ + iwe.u.bitrate.fixed = iwe.u.bitrate.disabled =0 ; + +for (i =0 ; i < bss->supp_rates_len; i++) { + iwe.u.bitrate.value = ((bss->supp_rates[i] & +0x7f ) *500000 ); + p =iwe_stream_add_value (current_ev, p, + end_buf, &iwe,IW_EV_PARAM_LEN ); + } +/* Check if we added any rate */ +if ((p - current_ev) >IW_EV_LCP_LEN ) + current_ev = p;kfree (buf);break ;
Signature · 1 line
1.3.0
PATCH 4/14 d80211: use BUILD_BUG_ON
In reply to Jiri BencFrom: Johannes Berg <[email protected]>
This patch makes d80211 use BUILD_BUG_ON instead of checking at module initialisation time. This check really is only interesting while you hack since if the module was built, then it's either an 'always true' or 'always false' comparison, hence useless to do it at runtime.
---
net/d80211/ieee80211.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)
156023b8efbec8a72f7077934d7b12cf1d00fb95
net/d80211/ieee80211.c +2 -7
@@ -4799,13 +4799,8 @@ static int __init ieee80211_init(void)struct sk_buff *skb;int ret; -if (sizeof (struct ieee80211_tx_packet_data ) > (sizeof (skb->cb))) { -printk ("80211: ieee80211_tx_packet_data is bigger " -"than the skb->cb (%d > %d)\n" , - (int )sizeof (struct ieee80211_tx_packet_data ), - (int )sizeof (skb->cb)); -return -EINVAL ; - } +BUILD_BUG_ON (sizeof (struct ieee80211_tx_packet_data ) >sizeof (skb->cb)); +if ((ret =ieee80211_sysfs_init ())) {printk (KERN_WARNING "ieee80211_init: sysfs initialization " "failed\n" );
Signature · 1 line
1.3.0
PATCH 5/14 d80211: clean up those huge else if statements
In reply to Jiri BencFrom: Johannes Berg <[email protected]>
This patch replaces the if (...) else if (...) else if (...) ... statements I complained about earlier with switches.
---
net/d80211/ieee80211_ioctl.c | 44 +++++++++++++++++++++--------------------- 1 files changed, 22 insertions(+), 22 deletions(-)
361d9a9f51633c7128158d90a05a3b6cc43ee444
net/d80211/ieee80211_ioctl.c +22 -22
@@ -1000,11 +1000,13 @@ static int ieee80211_ioctl_add_if(structint left = param_len - ((u8 *) pos - (u8 *) param);struct net_device *new_dev;int res; +struct hostapd_if_wds *wds; +struct hostapd_if_bss *bss;printk (KERN_WARNING "PRISM2_HOSTAPD_ADD_IF ioctl is deprecated!" ); -if (param->u.if_info.type ==HOSTAP_IF_WDS ) { -struct hostapd_if_wds *wds = - (struct hostapd_if_wds *) param->u.if_info.data; +switch (param->u.if_info.type) { +case HOSTAP_IF_WDS : + wds = (struct hostapd_if_wds *) param->u.if_info.data;if (left <sizeof (struct hostapd_if_wds ))return -EPROTO ;
@@ -1018,7 +1020,7 @@ static int ieee80211_ioctl_add_if(struct__ieee80211_if_del (dev->ieee80211_ptr,IEEE80211_DEV_TO_SUB_IF (new_dev));return res; - }else if (param->u.if_info.type ==HOSTAP_IF_VLAN ) { +case HOSTAP_IF_VLAN :if (left <sizeof (struct hostapd_if_vlan ))return -EPROTO ;
@@ -1033,9 +1035,8 @@ #if 0 IEEE80211_DEV_TO_SUB_IF(new_dev));#endif return res; - }else if (param->u.if_info.type ==HOSTAP_IF_BSS ) { -struct hostapd_if_bss *bss = - (struct hostapd_if_bss *) param->u.if_info.data; +case HOSTAP_IF_BSS : + bss = (struct hostapd_if_bss *) param->u.if_info.data;if (left <sizeof (struct hostapd_if_bss ))return -EPROTO ;
@@ -1046,12 +1047,7 @@ #endifieee80211_if_set_type (new_dev,IEEE80211_IF_TYPE_AP );memcpy (new_dev->dev_addr, bss->bssid,ETH_ALEN );return 0 ; - }else if (param->u.if_info.type ==HOSTAP_IF_STA ) { -#if 0 -struct hostapd_if_sta *sta = - (struct hostapd_if_sta *) param->u.if_info.data; -#endif - +case HOSTAP_IF_STA :if (left <sizeof (struct hostapd_if_sta ))return -EPROTO ;
@@ -1060,34 +1056,38 @@ #endifreturn res;ieee80211_if_set_type (new_dev,IEEE80211_IF_TYPE_STA );return 0 ; - }else -return -EINVAL ; +default : +return -EINVAL ; + }return 0 ; } -static int ieee80211_ioctl_remove_if (struct net_device *dev,struct prism2_hostapd_param *param) {unsigned int type; -if (param->u.if_info.type ==HOSTAP_IF_WDS ) { +switch (param->u.if_info.type) { +case HOSTAP_IF_WDS : type =IEEE80211_IF_TYPE_WDS ; - }else if (param->u.if_info.type ==HOSTAP_IF_VLAN ) { +break ; +case HOSTAP_IF_VLAN : type =IEEE80211_IF_TYPE_VLAN ; - }else if (param->u.if_info.type ==HOSTAP_IF_BSS ) { +break ; +case HOSTAP_IF_BSS : type =IEEE80211_IF_TYPE_AP ; - }else if (param->u.if_info.type ==HOSTAP_IF_STA ) { +break ; +case HOSTAP_IF_STA : type =IEEE80211_IF_TYPE_STA ; - }else { +break ; +default :return -EINVAL ; }return ieee80211_if_remove (dev, param->u.if_info.name, type); } -static int ieee80211_ioctl_update_if (struct net_device *dev,struct prism2_hostapd_param *param,int param_len)
Signature · 1 line
1.3.0
PATCH 6/14 d80211: fix multiple device ap support
In reply to Jiri BencFrom: David Kimdon <[email protected]>
Another fix to the interpretation of dev_alloc_name() return value. dev_alloc_name() returns the number of the unit assigned or a negative errno code.
---
net/d80211/ieee80211_iface.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
51539cf2d4fd958fa9a5ea282a9b7272353d0a49
net/d80211/ieee80211_iface.c +1 -1
@@ -122,7 +122,7 @@ int ieee80211_if_add_mgmt(struct net_devif (!ndev)return -ENOMEM ; ret =dev_alloc_name (ndev,"wmgmt%d" ); -if (ret) +if (ret <0 ) goto fail; ndev->ieee80211_ptr = local;
Signature · 1 line
1.3.0
PATCH 7/14 d80211: Fix type of prism2_hostapd_param crypt.alg
In reply to Jiri BencFrom: David Kimdon <[email protected]>
crypt.alg is a string, use the correct type.
---
net/d80211/hostapd_ioctl.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
2c9c2aa6731a429574a987c26769466a19373359
net/d80211/hostapd_ioctl.h +1 -1
@@ -207,7 +207,7 @@ #define IEEE80211_STA_DYNAMIC_ENC BIT(0)u32 last_ack_rssi; } get_info_sta;struct { -u8 alg[HOSTAP_CRYPT_ALG_NAME_LEN ]; +char alg[HOSTAP_CRYPT_ALG_NAME_LEN ];u32 flags;u32 err;u8 idx;
Signature · 1 line
1.3.0
PATCH 8/14 d80211: fix WEP on big endian cpus
In reply to Jiri BencFrom: Michael Wu <[email protected]>
This patch fixes the endian issues with the ICV in WEP, as pointed out by David Kimdon <[email protected]>, and uses __le32 where appropriate to make things clear.
---
net/d80211/wep.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
adcdddba34181486f2a1b402f39d66fe05f42595
net/d80211/wep.c +5 -5
@@ -120,10 +120,10 @@ void ieee80211_wep_encrypt_data(struct c size_t klen, u8 *data, size_t data_len) { struct scatterlist sg; -u32 *icv; +__le32 *icv; - icv = (u32 *)(data + data_len); - *icv = ~crc32_le (~0 , data, data_len); + icv = (__le32 *)(data + data_len); + *icv =cpu_to_le32 (~crc32_le (~0 , data, data_len));crypto_cipher_setkey (tfm, rc4key, klen); sg.page =virt_to_page (data);
@@ -187,7 +187,7 @@ int ieee80211_wep_decrypt_data(struct cr size_t klen, u8 *data, size_t data_len) { struct scatterlist sg; -u32 crc; +__le32 crc;crypto_cipher_setkey (tfm, rc4key, klen); sg.page =virt_to_page (data);
@@ -195,7 +195,7 @@ int ieee80211_wep_decrypt_data(struct cr sg.length = data_len +WEP_ICV_LEN ;crypto_cipher_decrypt (tfm, &sg, &sg, sg.length); - crc = ~crc32_le (~0 , data, data_len); + crc =cpu_to_le32 (~crc32_le (~0 , data, data_len));if (memcmp (&crc, data + data_len,WEP_ICV_LEN ) !=0 )/* ICV mismatch */ return -1 ;
Signature · 1 line
1.3.0
PATCH 9/14 d80211: allow vlan interfaces to receive ToDS frames
In reply to Jiri BencFrom: David Kimdon <[email protected]>
Interfaces of type IEEE80211_IF_TYPE_VLAN are similar to AP interfaces. One difference is stations are bound to a particular vlan interface after authentication/association based on management policy (for example a radius server).
Interfaces of type IEEE80211_IF_TYPE_VLAN need to be able to receive ToDS frames.
---
net/d80211/ieee80211.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
c220ae6162f23935ebc141b6734ecad1ab435294
net/d80211/ieee80211.c +2 -1
@@ -2374,7 +2374,8 @@ ieee80211_rx_h_data(struct ieee80211_txrmemcpy (dst, hdr->addr3,ETH_ALEN );memcpy (src, hdr->addr2,ETH_ALEN ); -if (unlikely (sdata->type !=IEEE80211_IF_TYPE_AP )) { +if (unlikely (sdata->type !=IEEE80211_IF_TYPE_AP && + sdata->type !=IEEE80211_IF_TYPE_VLAN )) { printk(KERN_DEBUG "%s: dropped ToDS frame (BSSID=" MAC_FMT " SA=" MAC_FMT " DA=" MAC_FMT ")\n", dev->name, MAC_ARG(hdr->addr1),
Signature · 1 line
1.3.0
PATCH 10/14 d80211: fix "iwconfig key [x]" behavior
In reply to Jiri BencFrom: Hong Liu <[email protected]>
"iwconfig key [x]" behavior is not correctly handled in the stack, also modify the giwencode method to show the key info.
---
net/d80211/ieee80211_ioctl.c | 32 +++++++++++++++++++++----------- 1 files changed, 21 insertions(+), 11 deletions(-)
ad8c3766f67df906ff45143d393c924ad7297471
net/d80211/ieee80211_ioctl.c +21 -11
@@ -2867,9 +2867,10 @@ static int ieee80211_ioctl_siwencode(strif (!sdata->default_key) idx =0 ;else for (i =0 ; i <NUM_DEFAULT_KEYS ; i++) { -if (sdata->default_key == sdata->keys[i]) +if (sdata->default_key == sdata->keys[i]) { idx = i; -break ; +break ; + } }if (idx <0 )return -EINVAL ;
@@ -2880,16 +2881,21 @@ static int ieee80211_ioctl_siwencode(str alg =ALG_NONE ; else if (erq->length == 0) {/* No key data - just set the default TX key index */ - sdata->default_key = sdata->keys[idx]; +if (sdata->default_key != sdata->keys[idx]) { +if (sdata->default_key) +ieee80211_key_sysfs_remove_default (sdata); + sdata->default_key = sdata->keys[idx]; +if (sdata->default_key) +ieee80211_key_sysfs_add_default (sdata); + } +return 0 ; }return ieee80211_set_encryption ( dev, bcaddr, - idx, erq->length ==0 ?ALG_NONE :ALG_WEP , + idx, alg, !sdata->default_key,NULL , keybuf, erq->length); - -return 0 ; }
@@ -2908,9 +2914,10 @@ static int ieee80211_ioctl_giwencode(strif (!sdata->default_key) idx =0 ;else for (i =0 ; i <NUM_DEFAULT_KEYS ; i++) { -if (sdata->default_key == sdata->keys[i]) +if (sdata->default_key == sdata->keys[i]) { idx = i; -break ; +break ; + } }if (idx <0 )return -EINVAL ;
@@ -2925,7 +2932,9 @@ static int ieee80211_ioctl_giwencode(strreturn 0 ; } - erq->length =0 ; +memcpy (key, sdata->keys[idx]->key, +min ((int )erq->length, sdata->keys[idx]->keylen)); + erq->length = sdata->keys[idx]->keylen; erq->flags |=IW_ENCODE_ENABLED ;return 0 ;
@@ -3054,9 +3063,10 @@ static int ieee80211_ioctl_siwencodeext(if (!sdata->default_key) idx =0 ;else for (i =0 ; i <NUM_DEFAULT_KEYS ; i++) { -if (sdata->default_key == sdata->keys[i]) +if (sdata->default_key == sdata->keys[i]) { idx = i; -break ; +break ; + } }if (idx <0 )return -EINVAL ;
Signature · 1 line
1.3.0
PATCH 11/14 d80211: use list_for_each_entry{,_safe}
In reply to Jiri BencFrom: Johannes Berg <[email protected]>
This patch changes (hopefully!) all occurrences in d80211 of list_for_each to list_for_each_entry (and _safe variants where they were used before).
---
net/d80211/ieee80211.c | 33 ++++++++++++--------------------- net/d80211/ieee80211_dev.c | 6 ++---- net/d80211/ieee80211_ioctl.c | 32 +++++++++++--------------------- net/d80211/ieee80211_sta.c | 24 ++++++------------------ net/d80211/sta_info.c | 13 ++++--------- 5 files changed, 35 insertions(+), 73 deletions(-)
871e88d24ff80e9521da300fd5c80e521b869ac9
net/d80211/ieee80211.c +12 -21
@@ -945,13 +945,12 @@ static void purge_old_ps_buffers(struct {int total =0 , purged =0 ;struct sk_buff *skb; -struct list_head *ptr; +struct ieee80211_sub_if_data *sdata; +struct sta_info *sta;spin_lock_bh (&local->sub_if_lock); -list_for_each (ptr, &local->sub_if_list) { +list_for_each_entry (sdata, &local->sub_if_list, list) {struct ieee80211_if_ap *ap; -struct ieee80211_sub_if_data *sdata = - list_entry(ptr, struct ieee80211_sub_if_data, list);if (sdata->dev == local->mdev || sdata->type !=IEEE80211_IF_TYPE_AP )continue ;
@@ -966,9 +965,7 @@ static void purge_old_ps_buffers(structspin_unlock_bh (&local->sub_if_lock);spin_lock_bh (&local->sta_lock); -list_for_each (ptr, &local->sta_list) { -struct sta_info *sta = - list_entry(ptr, struct sta_info, list); +list_for_each_entry (sta, &local->sta_list, list) { skb =skb_dequeue (&sta->ps_tx_buf);if (skb) { purged++;
@@ -3829,16 +3826,15 @@ ieee80211_rx_h_if_stats(struct ieee80211static void ieee80211_stat_refresh (unsigned long data) {struct ieee80211_local *local = (struct ieee80211_local *) data; -struct list_head *ptr, *n; +struct sta_info *sta; +struct ieee80211_sub_if_data *sdata;if (!local->stat_time)return ;/* go through all stations */ spin_lock_bh (&local->sta_lock); -list_for_each (ptr, &local->sta_list) { -struct sta_info *sta = - list_entry(ptr, struct sta_info, list); +list_for_each_entry (sta, &local->sta_list, list) { sta->channel_use = (sta->channel_use_raw / local->stat_time) /CHAN_UTIL_PER_10MS ; sta->channel_use_raw =0 ;
@@ -3846,14 +3842,11 @@ static void ieee80211_stat_refresh(unsigspin_unlock_bh (&local->sta_lock);/* go through all subinterfaces */ -list_for_each_safe (ptr, n, &local->sub_if_list) { -struct ieee80211_sub_if_data *sdata = - list_entry(ptr, struct ieee80211_sub_if_data, list); +list_for_each_entry (sdata, &local->sub_if_list, list) { sdata->channel_use = (sdata->channel_use_raw / local->stat_time) /CHAN_UTIL_PER_10MS ; sdata->channel_use_raw =0 ; - - } + }/* hardware interface */ local->channel_use = (local->channel_use_raw /
@@ -4563,7 +4556,7 @@ EXPORT_SYMBOL(ieee80211_update_hw);void ieee80211_unregister_hw (struct net_device *dev) {struct ieee80211_local *local = dev->ieee80211_ptr; -struct list_head *ptr, *n; +struct ieee80211_sub_if_data *sdata, *tmp;int i;tasklet_disable (&local->tasklet);
@@ -4576,11 +4569,9 @@ void ieee80211_unregister_hw(struct net_sysfs_remove_link (&local->class_dev.kobj,"master" ); -list_for_each_safe (ptr, n, &local->sub_if_list) { -struct ieee80211_sub_if_data *sdata = - list_entry(ptr, struct ieee80211_sub_if_data, list); +list_for_each_entry_safe (sdata, tmp, &local->sub_if_list, list)__ieee80211_if_del (local, sdata); - } +rtnl_unlock ();if (local->rate_limit)
net/d80211/ieee80211_dev.c +2 -4
@@ -38,7 +38,6 @@ static struct ieee80211_dev_list *__ieeeint ieee80211_dev_alloc_index (struct ieee80211_local *local) { -struct list_head *i;struct ieee80211_dev_list *dev_item, *new;int index =0 ;
@@ -47,14 +46,13 @@ int ieee80211_dev_alloc_index(struct ieereturn -ENOMEM ; new->local = local;spin_lock (&dev_list_lock); -list_for_each (i, &dev_list) { - dev_item = list_entry(i, struct ieee80211_dev_list, list); +list_for_each_entry (dev_item, &dev_list, list) {if (index < dev_item->dev_index)break ; index++; } new->dev_index = index; -list_add_tail (&new->list, i); +list_add_tail (&new->list, &dev_item->list);spin_unlock (&dev_list_lock); local->dev_index = index;return index;
net/d80211/ieee80211_ioctl.c +11 -21
@@ -2174,23 +2174,21 @@ static int ieee80211_ioctl_clear_keys(st {struct ieee80211_local *local = dev->ieee80211_ptr;struct ieee80211_key_conf key; -struct list_head *ptr;int i;u8 addr[ETH_ALEN ];struct ieee80211_key_conf *keyconf; +struct ieee80211_sub_if_data *sdata; +struct sta_info *sta;memset (addr,0xff ,ETH_ALEN ); -list_for_each (ptr, &local->sub_if_list) { -struct ieee80211_sub_if_data *sdata = - list_entry(ptr, struct ieee80211_sub_if_data, list); +list_for_each_entry (sdata, &local->sub_if_list, list) {for (i =0 ; i <NUM_DEFAULT_KEYS ; i++) { keyconf =NULL ;if (sdata->keys[i] && !sdata->keys[i]->force_sw_encrypt && local->hw->set_key && (keyconf =ieee80211_key_data2conf (local, - sdata->keys[i])) - !=NULL ) + sdata->keys[i]))) local->hw->set_key (dev,DISABLE_KEY , addr, keyconf,0 );kfree (keyconf);
@@ -2201,14 +2199,11 @@ static int ieee80211_ioctl_clear_keys(st }spin_lock_bh (&local->sta_lock); -list_for_each (ptr, &local->sta_list) { -struct sta_info *sta = - list_entry(ptr, struct sta_info, list); +list_for_each_entry (sta, &local->sta_list, list) { keyconf =NULL ;if (sta->key && !sta->key->force_sw_encrypt && local->hw->set_key && - (keyconf =ieee80211_key_data2conf (local, sta->key)) - !=NULL ) + (keyconf =ieee80211_key_data2conf (local, sta->key))) local->hw->set_key (dev,DISABLE_KEY , sta->addr, keyconf, sta->aid);kfree (keyconf);
@@ -2324,22 +2319,17 @@ static int ieee80211_ioctl_default_wep_o int value) {int i; -struct list_head *ptr; +struct ieee80211_sub_if_data *sdata; local->default_wep_only = value; -list_for_each (ptr, &local->sub_if_list) { -struct ieee80211_sub_if_data *sdata = - list_entry(ptr, struct ieee80211_sub_if_data, list); -for (i =0 ; i <NUM_DEFAULT_KEYS ; i++) { -if (value) { +list_for_each_entry (sdata, &local->sub_if_list, list) +for (i =0 ; i <NUM_DEFAULT_KEYS ; i++) +if (value)ieee80211_key_enable_hwaccel (local, sdata->keys[i]); - }else { +else ieee80211_key_disable_hwaccel (local, sdata->keys[i]); - } - } - }return 0 ; }
net/d80211/ieee80211_sta.c +6 -18
@@ -1791,13 +1791,11 @@ void ieee80211_sta_rx_scan(struct net_destatic int ieee80211_sta_active_ibss (struct net_device *dev) {struct ieee80211_local *local = dev->ieee80211_ptr; -struct list_head *ptr;int active =0 ;struct sta_info *sta;spin_lock_bh (&local->sta_lock); -list_for_each (ptr, &local->sta_list) { - sta = list_entry(ptr, struct sta_info, list); +list_for_each_entry (sta, &local->sta_list, list) {if (sta->dev == dev &&time_after (sta->last_rx +IEEE80211_IBSS_MERGE_INTERVAL , jiffies)) {
@@ -1814,19 +1812,16 @@ static int ieee80211_sta_active_ibss(strstatic void ieee80211_sta_expire (struct net_device *dev) {struct ieee80211_local *local = dev->ieee80211_ptr; -struct list_head *ptr, *n; -struct sta_info *sta; +struct sta_info *sta, *tmp;spin_lock_bh (&local->sta_lock); -list_for_each_safe (ptr, n, &local->sta_list) { - sta = list_entry(ptr, struct sta_info, list); +list_for_each_entry_safe (sta, tmp, &local->sta_list, list)if (time_after (jiffies, sta->last_rx +IEEE80211_IBSS_INACTIVITY_LIMIT )) {printk (KERN_DEBUG "%s: expiring inactive STA " MAC_FMT "\n" , dev->name,MAC_ARG (sta->addr));sta_info_free (sta,1 ); } - }spin_unlock_bh (&local->sta_lock); }
@@ -2181,7 +2176,6 @@ static int ieee80211_sta_find_ibss(strucstruct ieee80211_sta_bss *bss;int found =0 ;u8 bssid[ETH_ALEN ]; -struct list_head *ptr;int active_ibss;if (ifsta->ssid_len ==0 )
@@ -2193,8 +2187,7 @@ #ifdef CONFIG_D80211_IBSS_DEBUG dev->name, active_ibss);#endif /* CONFIG_D80211_IBSS_DEBUG */ spin_lock_bh (&local->sta_bss_lock); -list_for_each (ptr, &local->sta_bss_list) { - bss = list_entry(ptr, struct ieee80211_sta_bss, list); +list_for_each_entry (bss, &local->sta_bss_list, list) {if (ifsta->ssid_len != bss->ssid_len ||memcmp (ifsta->ssid, bss->ssid, bss->ssid_len) !=0 || !(bss->capability &WLAN_CAPABILITY_IBSS ))
@@ -2760,14 +2753,12 @@ ieee80211_sta_scan_result(struct net_devint ieee80211_sta_scan_results (struct net_device *dev,char *buf,size_t len) {struct ieee80211_local *local = dev->ieee80211_ptr; -struct list_head *ptr;char *current_ev = buf;char *end_buf = buf + len;struct ieee80211_sta_bss *bss;spin_lock_bh (&local->sta_bss_lock); -list_for_each (ptr, &local->sta_bss_list) { - bss = list_entry(ptr, struct ieee80211_sta_bss, list); +list_for_each_entry (bss, &local->sta_bss_list, list) {if (buf + len - current_ev <=IW_EV_ADDR_LEN ) {spin_unlock_bh (&local->sta_bss_lock);return -E2BIG ;
@@ -2809,7 +2800,6 @@ struct sta_info * ieee80211_ibss_add_sta u8 *addr) {struct ieee80211_local *local = dev->ieee80211_ptr; -struct list_head *ptr;struct sta_info *sta;struct ieee80211_sub_if_data *sdata =NULL ;struct net_device *sta_dev =NULL ;
@@ -2825,14 +2815,12 @@ struct sta_info * ieee80211_ibss_add_sta }spin_lock_bh (&local->sub_if_lock); -list_for_each (ptr, &local->sub_if_list) { - sdata = list_entry(ptr, struct ieee80211_sub_if_data, list); +list_for_each_entry (sdata, &local->sub_if_list, list)if (sdata->type ==IEEE80211_IF_TYPE_IBSS &&memcmp (bssid, sdata->u.sta.bssid,ETH_ALEN ) ==0 ) { sta_dev = sdata->dev;break ; } - }spin_unlock_bh (&local->sub_if_lock);if (!sta_dev)
net/d80211/sta_info.c +4 -9
@@ -337,8 +337,7 @@ static void sta_info_cleanup(unsigned lostatic void sta_info_proc_add_task (void *data) {struct ieee80211_local *local = data; -struct list_head *ptr; -struct sta_info *sta; +struct sta_info *sta, *tmp;while (1 ) {spin_lock_bh (&local->sta_lock);
@@ -356,8 +355,7 @@ static void sta_info_proc_add_task(voidwhile (1 ) {spin_lock_bh (&local->sta_lock); -list_for_each (ptr, &local->sta_list) { - sta = list_entry(ptr, struct sta_info, list); +list_for_each_entry_safe (sta, tmp, &local->sta_list, list) {if (!sta->sysfs_registered) {__sta_info_get (sta);break ;
@@ -445,14 +443,11 @@ void sta_info_remove_aid_ptr(struct sta_*/ void sta_info_flush (struct ieee80211_local *local,struct net_device *dev) { -struct list_head *ptr, *n; +struct sta_info *sta, *tmp;spin_lock_bh (&local->sta_lock); - -list_for_each_safe (ptr, n, &local->sta_list) { - struct sta_info *sta = list_entry(ptr, struct sta_info, list); +list_for_each_entry_safe (sta, tmp, &local->sta_list, list)if (!dev || dev == sta->dev)sta_info_free (sta,1 ); - }spin_unlock_bh (&local->sta_lock); }
Signature · 1 line
1.3.0
PATCH 12/14 d80211: LED triggers
In reply to Jiri BencFrom: Johannes Berg <[email protected]>
This patch makes d80211 export LED triggers for rx/tx and introduces functions to allow device drivers to query the trigger names for setting default triggers. It also cleans up the Makefile LED related stuff.
---
include/net/d80211.h | 40 ++++++++++++++----- net/d80211/Kconfig | 9 ++++ net/d80211/Makefile | 10 ++--- net/d80211/ieee80211.c | 28 ++++--------- net/d80211/ieee80211_dev.c | 1 net/d80211/ieee80211_i.h | 6 ++- net/d80211/ieee80211_led.c | 93 ++++++++++++++++++++++++++++++++++++-------- net/d80211/ieee80211_led.h | 32 +++++++++++++++ 8 files changed, 166 insertions(+), 53 deletions(-) create mode 100644 net/d80211/ieee80211_led.h
fc0f9a5915098ff5e405b80db3134fa9dd55ee9b
include/net/d80211.h +30 -10
@@ -703,6 +703,36 @@ struct net_device *ieee80211_alloc_hw(si* function. */ int ieee80211_register_hw (struct net_device *dev,struct ieee80211_hw *hw); +/* driver can use this and ieee80211_get_rx_led_name to get the +* name of the registered LEDs after ieee80211_register_hw +* was called. +* This is useful to set the default trigger on the LED class +* device that your driver should export for each LED the device +* has, that way the default behaviour will be as expected but +* the user can still change it/turn off the LED etc. +*/ +#ifdef CONFIG_D80211_LEDS +extern char *__ieee80211_get_tx_led_name (struct net_device *dev); +extern char *__ieee80211_get_rx_led_name (struct net_device *dev); +#endif +static inline char *ieee80211_get_tx_led_name (struct net_device *dev) +{ +#ifdef CONFIG_D80211_LEDS +return __ieee80211_get_tx_led_name (dev); +#else +return NULL ; +#endif +} + +static inline char *ieee80211_get_rx_led_name (struct net_device *dev) +{ +#ifdef CONFIG_D80211_LEDS +return __ieee80211_get_rx_led_name (dev); +#else +return NULL ; +#endif +} +/* This function is allowed to update hardware configuration (e.g., list of * supported operation modes and rates). */ int ieee80211_update_hw (struct net_device *dev,struct ieee80211_hw *hw);
@@ -903,16 +933,6 @@ enum { IEEE80211_TEST_PARAM_TX_ANT_SEL_RAW = 5, }; -/* ieee80211_tx_led called with state == 1 when the first frame is queued -* with state == 0 when the last frame is transmitted and tx queue is empty -*/ -void ieee80211_tx_led (int state,struct net_device *dev); -/* ieee80211_rx_led is called each time frame is received, state is not used -* (== 2) -*/ -void ieee80211_rx_led (int state,struct net_device *dev); - -/* IEEE 802.11 defines */ #define FCS_LEN 4
net/d80211/Kconfig +9 -0
@@ -7,6 +7,15 @@ config D80211 This option enables the hardware independent IEEE 802.11 networking stack. +config D80211_LEDS + bool "Enable LED triggers" + depends on D80211 + select NEW_LEDS + select LEDS_TRIGGERS + ---help--- + This option enables a few LED triggers for different + packet receive/transmit events. + config D80211_DEBUG bool "Enable debugging output" depends on D80211
net/d80211/Makefile +4 -6
@@ -1,5 +1,7 @@ obj-$(CONFIG_D80211) += 80211.o rate_control.o +80211-objs-$(CONFIG_D80211_LEDS) += ieee80211_led.o + 80211-objs := \ ieee80211.o \ ieee80211_ioctl.o \
@@ -15,13 +17,9 @@ obj-$(CONFIG_D80211) += 80211.o rate_con michael.o \ tkip.o \ aes_ccm.o \ - wme.o + wme.o \ + $(80211-objs-y) ifeq ($(CONFIG_NET_SCHED),) 80211-objs += fifo_qdisc.o endif - -ifeq ($(CONFIG_D80211_LEDS),y) - 80211-objs += ieee80211_led.o -endif -
net/d80211/ieee80211.c +9 -19
@@ -31,7 +31,7 @@ #include "wpa.h"#include "tkip.h" #include "wme.h" #include "aes_ccm.h" - +#include "ieee80211_led.h" /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ /* Ethernet-II snap header (RFC1042 for most EtherTypes) */
@@ -1180,11 +1180,7 @@ static int __ieee80211_tx(struct ieee802 ret = local->hw->tx (local->mdev, skb, control);if (ret)return IEEE80211_TX_AGAIN ; -#ifdef IEEE80211_LEDS -if (local->tx_led_counter++ ==0 ) { -ieee80211_tx_led (1 , local->mdev); - } -#endif /* IEEE80211_LEDS */ +ieee80211_led_tx (local,1 ); }if (tx->u.tx.extra_frag) { control->use_rts_cts =0 ;
@@ -1209,11 +1205,7 @@ #endif /* IEEE80211_LEDS */ control);if (ret)return IEEE80211_TX_FRAG_AGAIN ; -#ifdef IEEE80211_LEDS -if (local->tx_led_counter++ ==0 ) { -ieee80211_tx_led (1 , local->mdev); - } -#endif /* IEEE80211_LEDS */ +ieee80211_led_tx (local,1 ); tx->u.tx.extra_frag[i] =NULL ; }kfree (tx->u.tx.extra_frag);
@@ -2998,10 +2990,8 @@ ieee80211_rx_h_defragment(struct ieee802 rx->sta->rx_packets++;if (is_multicast_ether_addr (hdr->addr1)) rx->local->dot11MulticastReceivedFrameCount++; -#ifdef IEEE80211_LEDS else - ieee80211_rx_led(2, rx->dev); -#endif /* IEEE80211_LEDS */ +ieee80211_led_rx (rx->local);return TXRX_CONTINUE ; }
@@ -4100,11 +4090,8 @@ void ieee80211_tx_status(struct net_devirate_control_tx_status (dev, skb, status); } -#ifdef IEEE80211_LEDS -if (local->tx_led_counter && (local->tx_led_counter-- ==1 )) { -ieee80211_tx_led (0 , dev); - } -#endif /* IEEE80211_LEDS */ +ieee80211_led_tx (local,0 ); +/* SNMP counters * Fragments are passed to low-level drivers as separate skbs, so these * are actually fragments, not frames. Update frame counters only for
@@ -4501,6 +4488,8 @@ int ieee80211_register_hw(struct net_dev local->reg_state =IEEE80211_DEV_REGISTERED ;rtnl_unlock (); +ieee80211_led_init (local); +return 0 ; fail_rate_attrs:
@@ -4607,6 +4596,7 @@ void ieee80211_unregister_hw(struct net_skb_queue_purge (&local->skb_queue_unreliable);ieee80211_dev_free_index (local); +ieee80211_led_exit (local); }EXPORT_SYMBOL (ieee80211_unregister_hw);
net/d80211/ieee80211_dev.c +1 -0
@@ -13,6 +13,7 @@ #include <linux/if_ether.h>#include <linux/netdevice.h> #include <net/d80211.h> #include "ieee80211_i.h" +#include "ieee80211_led.h" struct ieee80211_dev_list {struct list_head list;
net/d80211/ieee80211_i.h +5 -1
@@ -459,7 +459,11 @@ #endif /* CONFIG_HOSTAPD_WPA_TESTING */u32 dot11TransmittedFrameCount;u32 dot11WEPUndecryptableCount; -int tx_led_counter; +#ifdef CONFIG_D80211_LEDS +int tx_led_counter, rx_led_counter; +struct led_trigger *tx_led, *rx_led; +char tx_led_name[32 ], rx_led_name[32 ]; +#endif u32 channel_use;u32 channel_use_raw;
net/d80211/ieee80211_led.c +76 -17
108 lines not on this page · raw message
net/d80211/ieee80211_led.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright 2006, Johannes Berg <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/list.h> +#include <linux/spinlock.h> +#include <linux/leds.h> +#include "ieee80211_i.h" + +#ifdef CONFIG_D80211_LEDS +extern void ieee80211_led_rx (struct ieee80211_local *local); +extern void ieee80211_led_tx (struct ieee80211_local *local,int q); +extern void ieee80211_led_init (struct ieee80211_local *local); +extern void ieee80211_led_exit (struct ieee80211_local *local); +#else +static inline void ieee80211_led_rx (struct ieee80211_local *local) +{ +} +static inline void ieee80211_led_tx (struct ieee80211_local *local,int q) +{ +} +static inline void ieee80211_led_init (struct ieee80211_local *local) +{ +} +static inline void ieee80211_led_exit (struct ieee80211_local *local) +{ +} +#endif
Signature · 1 line
1.3.0
PATCH 13/14 d80211: getting wrong freq value if we did hardware scan
In reply to Jiri BencFrom: Mohamed Abbas <[email protected]>
This patch modify d80211 to fix getting wrong frequency value for scan implemented in hardware. With harware scan we might get beacon of a network that is on different channel that in local->conf.channel causing set freq to wrong value.
---
net/d80211/ieee80211_sta.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
a5b4c8adb19c9d5d8b6c9b187ae6b2351e74e4a1
net/d80211/ieee80211_sta.c +5 -5
@@ -1541,12 +1541,12 @@ #endif } - bss->hw_mode = local->conf.phymode; + bss->hw_mode = rx_status->phymode; bss->channel = channel; - bss->freq = local->conf.freq; -if (channel != local->conf.channel && - (local->conf.phymode ==MODE_IEEE80211G || - local->conf.phymode ==MODE_IEEE80211B ) && + bss->freq = rx_status->freq; +if (channel != rx_status->channel && + (bss->hw_mode ==MODE_IEEE80211G || + bss->hw_mode ==MODE_IEEE80211B ) && channel >=1 && channel <=14 ) {static const int freq_list[] = {2412 ,2417 ,2422 ,2427 ,2432 ,2437 ,2442 ,
Signature · 1 line
1.3.0
PATCH 14/14 d80211: fix invalid pointer dereference
In reply to Jiri BencWhen deleted_sta_list is nonempty and sta_list is empty in sta_info_proc_add_task, an invalid sta pointer is dereferenced.
---
net/d80211/sta_info.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
388092c43ba32071c0102c28e2cf43c0dc782566
net/d80211/sta_info.c +4 -3
@@ -354,13 +354,14 @@ static void sta_info_proc_add_task(void }while (1 ) { + sta =NULL ;spin_lock_bh (&local->sta_lock); -list_for_each_entry_safe (sta, tmp, &local->sta_list, list) { -if (!sta->sysfs_registered) { +list_for_each_entry (tmp, &local->sta_list, list) { +if (!tmp->sysfs_registered) { + sta = tmp;__sta_info_get (sta);break ; } - sta =NULL ; }spin_unlock_bh (&local->sta_lock);
Signature · 1 line
1.3.0