Host AP update
cover Host AP update
Here are couple of patches to the Host AP driver. Please apply to wireless-2.6.
Signature · 1 line
Jouni Malinen PGP id EFC895FA
PATCH 1/4 hostap: Allocate enough tailroom for TKIP
From: Brandon Craig Rhodes <[email protected]>
When hostap_tx_encrypt() tries to allocate enough headroom and tailroom for ieee80211 encryption, it only makes enough room for the "mpdu" phase of the operation, but forgets about the "msdu" phase. (For TKIP, these two phases require, respectively, 4 and 8 bytes of tailroom, per the "ieee80211_crypt_tkip" structure at the bottom of net/ieee80211/ieee80211_crypt_tkip.c.)
drivers/net/wireless/hostap/hostap_80211_tx.c +8 -5
@@ -311,7 +311,7 @@ static struct sk_buff * hostap_tx_encryplocal_info_t *local;struct ieee80211_hdr_4addr *hdr;u16 fc; -int hdr_len, res; +int prefix_len, postfix_len, hdr_len, res; iface =netdev_priv (skb->dev); local = iface->local;
@@ -337,10 +337,13 @@ static struct sk_buff * hostap_tx_encrypif (skb ==NULL )return NULL ; -if ((skb_headroom (skb) < crypt->ops->extra_mpdu_prefix_len || -skb_tailroom (skb) < crypt->ops->extra_mpdu_postfix_len) && -pskb_expand_head (skb, crypt->ops->extra_mpdu_prefix_len, - crypt->ops->extra_mpdu_postfix_len,GFP_ATOMIC )) { + prefix_len = crypt->ops->extra_mpdu_prefix_len + + crypt->ops->extra_msdu_prefix_len; + postfix_len = crypt->ops->extra_mpdu_postfix_len + + crypt->ops->extra_msdu_postfix_len; +if ((skb_headroom (skb) < prefix_len || +skb_tailroom (skb) < postfix_len) && +pskb_expand_head (skb, prefix_len, postfix_len,GFP_ATOMIC )) {kfree_skb (skb);return NULL ; }
--
Signature · 1 line
Jouni Malinen PGP id EFC895FA
PATCH 2/4 hostap: Suppress broadcast if no stations are associated
In reply to Jouni MalinenFrom: Pavel Roskin <[email protected]>
This may be useful in mesh setups when most stations act as repeaters only.
drivers/net/wireless/hostap/hostap_ap.c +2 -0
@@ -2704,6 +2704,8 @@ ap_tx_ret hostap_handle_sta_tx(local_infif (hdr->addr1[0 ] &0x01 ) {/* broadcast/multicast frame - no AP related processing */ +if (local->ap->num_sta <=0 ) + ret =AP_TX_DROP ; goto out; }
--
Signature · 1 line
Jouni Malinen PGP id EFC895FA
PATCH 3/4 hostap: Use list_for_each_entry
In reply to Jouni MalinenFrom: Matthias Kaehlcke <[email protected]>
Use list_for_each_entry() instead of manual iteration and substitute some list_for_each() loops with list_for_each_entry().
drivers/net/wireless/hostap/hostap_ap.c +10 -22
@@ -326,7 +326,6 @@ static int ap_control_proc_read(char *pachar *p = page;struct ap_data *ap = (struct ap_data *) data;char *policy_txt; -struct list_head *ptr;struct mac_entry *entry;if (off !=0 ) {
@@ -352,14 +351,12 @@ static int ap_control_proc_read(char *pa p +=sprintf (p,"MAC entries: %u\n" , ap->mac_restrictions.entries); p +=sprintf (p,"MAC list:\n" );spin_lock_bh (&ap->mac_restrictions.lock); -for (ptr = ap->mac_restrictions.mac_list.next; - ptr != &ap->mac_restrictions.mac_list; ptr = ptr->next) { +list_for_each_entry (entry, &ap->mac_restrictions.mac_list, list) {if (p - page >PAGE_SIZE -80 ) { p +=sprintf (p,"All entries did not fit one page.\n" );break ; } - entry = list_entry(ptr, struct mac_entry, list); p +=sprintf (p,MACSTR "\n" ,MAC2STR (entry->addr)); }spin_unlock_bh (&ap->mac_restrictions.lock);
@@ -413,7 +410,6 @@ int ap_control_del_mac(struct mac_restristatic int ap_control_mac_deny (struct mac_restrictions *mac_restrictions,u8 *mac) { -struct list_head *ptr;struct mac_entry *entry;int found =0 ;
@@ -421,10 +417,7 @@ static int ap_control_mac_deny(struct mareturn 0 ;spin_lock_bh (&mac_restrictions->lock); -for (ptr = mac_restrictions->mac_list.next; - ptr != &mac_restrictions->mac_list; ptr = ptr->next) { - entry = list_entry(ptr, struct mac_entry, list); - +list_for_each_entry (entry, &mac_restrictions->mac_list, list) {if (memcmp (entry->addr, mac,ETH_ALEN ) ==0 ) { found =1 ;break ;
@@ -519,7 +512,7 @@ static int prism2_ap_proc_read(char *pag {char *p = page;struct ap_data *ap = (struct ap_data *) data; -struct list_head *ptr; +struct sta_info *sta;int i;if (off >PROC_LIMIT ) {
@@ -529,9 +522,7 @@ static int prism2_ap_proc_read(char *pag p +=sprintf (p,"# BSSID CHAN SIGNAL NOISE RATE SSID FLAGS\n" );spin_lock_bh (&ap->sta_table_lock); -for (ptr = ap->sta_list.next; ptr != &ap->sta_list; ptr = ptr->next) { -struct sta_info *sta = (struct sta_info *) ptr; - +list_for_each_entry (sta, &ap->sta_list, list) {if (!sta->ap)continue ;
@@ -861,7 +852,7 @@ void hostap_init_ap_proc(local_info_t *lvoid hostap_free_data (struct ap_data *ap) { -struct list_head *n, *ptr; +struct sta_info *n, *sta;if (ap ==NULL || !ap->initialized) { printk(KERN_DEBUG "hostap_free_data: ap has not yet been "
@@ -875,8 +866,7 @@ void hostap_free_data(struct ap_data *ap ap->crypt = ap->crypt_priv =NULL ;#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ -list_for_each_safe (ptr, n, &ap->sta_list) { - struct sta_info *sta = list_entry(ptr, struct sta_info, list); +list_for_each_entry_safe (sta, n, &ap->sta_list, list) {ap_sta_hash_del (ap, sta);list_del (&sta->list);if ((sta->flags &WLAN_STA_ASSOC ) && !sta->ap && sta->local)
@@ -3200,15 +3190,14 @@ int hostap_update_rx_stats(struct ap_datvoid hostap_update_rates (local_info_t *local) { -struct list_head *ptr; +struct sta_info *sta;struct ap_data *ap = local->ap;if (!ap)return ;spin_lock_bh (&ap->sta_table_lock); -for (ptr = ap->sta_list.next; ptr != &ap->sta_list; ptr = ptr->next) { -struct sta_info *sta = (struct sta_info *) ptr; +list_for_each_entry (sta, &ap->sta_list, list) {prism2_check_tx_rates (sta); }spin_unlock_bh (&ap->sta_table_lock);
@@ -3244,11 +3233,10 @@ void * ap_crypt_get_ptrs(struct ap_datavoid hostap_add_wds_links (local_info_t *local) {struct ap_data *ap = local->ap; -struct list_head *ptr; +struct sta_info *sta;spin_lock_bh (&ap->sta_table_lock); -list_for_each (ptr, &ap->sta_list) { - struct sta_info *sta = list_entry(ptr, struct sta_info, list); +list_for_each_entry (sta, &ap->sta_list, list) {if (sta->ap)hostap_wds_link_oper (local, sta->addr,WDS_ADD ); }
--
Signature · 1 line
Jouni Malinen PGP id EFC895FA
PATCH 4/4 hostap: Remove driver version number
In reply to Jouni MalinenThe driver version number has not been updated since the driver was included in the main kernel tree and there is no plan on updating this in the future either. At this point, the only correct way to refer to the version is to use the kernel version. The 0.4.4 version is confusing since there are external version with higher version number even though they are not actually any newer than the in-tree version.
Let's get rid of the version number in the kernel tree in order to avoid this kind of confusion.
drivers/net/wireless/hostap/hostap_config.h +0 -2
@@ -1,8 +1,6 @@#ifndef HOSTAP_CONFIG_H #define HOSTAP_CONFIG_H -#define PRISM2_VERSION "0.4.4-kernel" -/* In the previous versions of Host AP driver, support for user space version * of IEEE 802.11 management (hostapd) used to be disabled in the default * configuration. From now on, support for hostapd is always included and it is
drivers/net/wireless/hostap/hostap_cs.c +0 -4
@@ -22,7 +22,6 @@#include "hostap_wlan.h" -static char *version =PRISM2_VERSION " (Jouni Malinen <[email protected]>)" ;static dev_info_t dev_info ="hostap_cs" ;MODULE_AUTHOR ("Jouni Malinen" );
@@ -30,7 +29,6 @@ MODULE_DESCRIPTION("Support for Intersil "cards (PC Card).");MODULE_SUPPORTED_DEVICE ("Intersil Prism2-based WLAN cards (PC Card)" );MODULE_LICENSE ("GPL" ); -MODULE_VERSION (PRISM2_VERSION );static int ignore_cis_vcc;
@@ -910,14 +908,12 @@ static struct pcmcia_driver hostap_drivestatic int __init init_prism2_pccard (void ) { -printk (KERN_INFO "%s: %s\n" , dev_info, version);return pcmcia_register_driver (&hostap_driver); } static void __exit exit_prism2_pccard(void) {pcmcia_unregister_driver (&hostap_driver); -printk (KERN_INFO "%s: Driver unloaded\n" , dev_info); }
drivers/net/wireless/hostap/hostap_ioctl.c +0 -2
@@ -3893,8 +3893,6 @@ static void prism2_get_drvinfo(struct ne local = iface->local;strncpy (info->driver,"hostap" ,sizeof (info->driver) -1 ); -strncpy (info->version,PRISM2_VERSION , -sizeof (info->version) -1 ); snprintf(info->fw_version, sizeof(info->fw_version) - 1, "%d.%d.%d", (local->sta_fw_ver >> 16) & 0xff, (local->sta_fw_ver >> 8) & 0xff,
drivers/net/wireless/hostap/hostap_main.c +0 -1
@@ -37,7 +37,6 @@MODULE_AUTHOR ("Jouni Malinen" );MODULE_DESCRIPTION ("Host AP common routines" );MODULE_LICENSE ("GPL" ); -MODULE_VERSION (PRISM2_VERSION );#define TX_TIMEOUT (2 * HZ)
drivers/net/wireless/hostap/hostap_pci.c +0 -5
@@ -20,7 +20,6 @@#include "hostap_wlan.h" -static char *version =PRISM2_VERSION " (Jouni Malinen <[email protected]>)" ;static char *dev_info ="hostap_pci" ;
@@ -29,7 +28,6 @@ MODULE_DESCRIPTION("Support for Intersil "PCI cards.");MODULE_SUPPORTED_DEVICE ("Intersil Prism2.5-based WLAN PCI cards" );MODULE_LICENSE ("GPL" ); -MODULE_VERSION (PRISM2_VERSION );/* struct local_info::hw_priv */
@@ -462,8 +460,6 @@ static struct pci_driver prism2_pci_drv_static int __init init_prism2_pci (void ) { -printk (KERN_INFO "%s: %s\n" , dev_info, version); -return pci_register_driver (&prism2_pci_drv_id); }
@@ -471,7 +467,6 @@ static int __init init_prism2_pci(void) static void __exit exit_prism2_pci(void) {pci_unregister_driver (&prism2_pci_drv_id); -printk (KERN_INFO "%s: Driver unloaded\n" , dev_info); }
drivers/net/wireless/hostap/hostap_plx.c +0 -5
@@ -23,7 +23,6 @@#include "hostap_wlan.h" -static char *version =PRISM2_VERSION " (Jouni Malinen <[email protected]>)" ;static char *dev_info ="hostap_plx" ;
@@ -32,7 +31,6 @@ MODULE_DESCRIPTION("Support for Intersil "cards (PLX).");MODULE_SUPPORTED_DEVICE ("Intersil Prism2-based WLAN cards (PLX)" );MODULE_LICENSE ("GPL" ); -MODULE_VERSION (PRISM2_VERSION );static int ignore_cis;
@@ -623,8 +621,6 @@ static struct pci_driver prism2_plx_drv_static int __init init_prism2_plx (void ) { -printk (KERN_INFO "%s: %s\n" , dev_info, version); -return pci_register_driver (&prism2_plx_drv_id); }
@@ -632,7 +628,6 @@ static int __init init_prism2_plx(void) static void __exit exit_prism2_plx(void) {pci_unregister_driver (&prism2_plx_drv_id); -printk (KERN_INFO "%s: Driver unloaded\n" , dev_info); }
--
Signature · 1 line
Jouni Malinen PGP id EFC895FA