linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Host AP update
@ 2007-05-28 16:38 Jouni Malinen
  2007-05-28 16:38 ` [PATCH 1/4] hostap: Allocate enough tailroom for TKIP Jouni Malinen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jouni Malinen @ 2007-05-28 16:38 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

Here are couple of patches to the Host AP driver. Please apply to
wireless-2.6.

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] hostap: Allocate enough tailroom for TKIP
  2007-05-28 16:38 [PATCH 0/4] Host AP update Jouni Malinen
@ 2007-05-28 16:38 ` Jouni Malinen
  2007-05-28 16:38 ` [PATCH 2/4] hostap: Suppress broadcast if no stations are associated Jouni Malinen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jouni Malinen @ 2007-05-28 16:38 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

From: Brandon Craig Rhodes <brandon@rhodesmill.org>

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.)

Signed-off-by: Brandon Craig Rhodes <brandon@rhodesmill.org>
Signed-off-by: Jouni Malinen <j@w1.fi>


Index: linux-2.6/drivers/net/wireless/hostap/hostap_80211_tx.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/hostap/hostap_80211_tx.c
+++ linux-2.6/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -311,7 +311,7 @@ static struct sk_buff * hostap_tx_encryp
 	local_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_encryp
 	if (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;
 	}

--

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/4] hostap: Suppress broadcast if no stations are associated
  2007-05-28 16:38 [PATCH 0/4] Host AP update Jouni Malinen
  2007-05-28 16:38 ` [PATCH 1/4] hostap: Allocate enough tailroom for TKIP Jouni Malinen
@ 2007-05-28 16:38 ` Jouni Malinen
  2007-05-28 16:38 ` [PATCH 3/4] hostap: Use list_for_each_entry Jouni Malinen
  2007-05-28 16:38 ` [PATCH 4/4] hostap: Remove driver version number Jouni Malinen
  3 siblings, 0 replies; 5+ messages in thread
From: Jouni Malinen @ 2007-05-28 16:38 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

From: Pavel Roskin <proski@gnu.org>

This may be useful in mesh setups when most stations act as repeaters only.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Jouni Malinen <j@w1.fi>


Index: linux-2.6/drivers/net/wireless/hostap/hostap_ap.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/hostap/hostap_ap.c
+++ linux-2.6/drivers/net/wireless/hostap/hostap_ap.c
@@ -2704,6 +2704,8 @@ ap_tx_ret hostap_handle_sta_tx(local_inf
 
 	if (hdr->addr1[0] & 0x01) {
 		/* broadcast/multicast frame - no AP related processing */
+		if (local->ap->num_sta <= 0)
+			ret = AP_TX_DROP;
 		goto out;
 	}
 

--

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/4] hostap: Use list_for_each_entry
  2007-05-28 16:38 [PATCH 0/4] Host AP update Jouni Malinen
  2007-05-28 16:38 ` [PATCH 1/4] hostap: Allocate enough tailroom for TKIP Jouni Malinen
  2007-05-28 16:38 ` [PATCH 2/4] hostap: Suppress broadcast if no stations are associated Jouni Malinen
@ 2007-05-28 16:38 ` Jouni Malinen
  2007-05-28 16:38 ` [PATCH 4/4] hostap: Remove driver version number Jouni Malinen
  3 siblings, 0 replies; 5+ messages in thread
From: Jouni Malinen @ 2007-05-28 16:38 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

From: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>

Use list_for_each_entry() instead of manual iteration and
substitute some list_for_each() loops with list_for_each_entry().

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Jouni Malinen <j@w1.fi>


Index: linux-2.6/drivers/net/wireless/hostap/hostap_ap.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/hostap/hostap_ap.c
+++ linux-2.6/drivers/net/wireless/hostap/hostap_ap.c
@@ -326,7 +326,6 @@ static int ap_control_proc_read(char *pa
 	char *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_restri
 static 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 ma
 		return 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 *l
 
 void 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_dat
 
 void 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_data 
 void 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);
 	}

--

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 4/4] hostap: Remove driver version number
  2007-05-28 16:38 [PATCH 0/4] Host AP update Jouni Malinen
                   ` (2 preceding siblings ...)
  2007-05-28 16:38 ` [PATCH 3/4] hostap: Use list_for_each_entry Jouni Malinen
@ 2007-05-28 16:38 ` Jouni Malinen
  3 siblings, 0 replies; 5+ messages in thread
From: Jouni Malinen @ 2007-05-28 16:38 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

The 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.

Signed-off-by: Jouni Malinen <j@w1.fi>


Index: linux-2.6/drivers/net/wireless/hostap/hostap_config.h
===================================================================
--- linux-2.6.orig/drivers/net/wireless/hostap/hostap_config.h
+++ linux-2.6/drivers/net/wireless/hostap/hostap_config.h
@@ -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
Index: linux-2.6/drivers/net/wireless/hostap/hostap_cs.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/hostap/hostap_cs.c
+++ linux-2.6/drivers/net/wireless/hostap/hostap_cs.c
@@ -22,7 +22,6 @@
 #include "hostap_wlan.h"
 
 
-static char *version = PRISM2_VERSION " (Jouni Malinen <j@w1.fi>)";
 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_drive
 
 static 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);
 }
 
 
Index: linux-2.6/drivers/net/wireless/hostap/hostap_ioctl.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/hostap/hostap_ioctl.c
+++ linux-2.6/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -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,
Index: linux-2.6/drivers/net/wireless/hostap/hostap_main.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/hostap/hostap_main.c
+++ linux-2.6/drivers/net/wireless/hostap/hostap_main.c
@@ -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)
 
Index: linux-2.6/drivers/net/wireless/hostap/hostap_pci.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/hostap/hostap_pci.c
+++ linux-2.6/drivers/net/wireless/hostap/hostap_pci.c
@@ -20,7 +20,6 @@
 #include "hostap_wlan.h"
 
 
-static char *version = PRISM2_VERSION " (Jouni Malinen <j@w1.fi>)";
 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);
 }
 
 
Index: linux-2.6/drivers/net/wireless/hostap/hostap_plx.c
===================================================================
--- linux-2.6.orig/drivers/net/wireless/hostap/hostap_plx.c
+++ linux-2.6/drivers/net/wireless/hostap/hostap_plx.c
@@ -23,7 +23,6 @@
 #include "hostap_wlan.h"
 
 
-static char *version = PRISM2_VERSION " (Jouni Malinen <j@w1.fi>)";
 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);
 }
 
 

--

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-05-28 16:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-28 16:38 [PATCH 0/4] Host AP update Jouni Malinen
2007-05-28 16:38 ` [PATCH 1/4] hostap: Allocate enough tailroom for TKIP Jouni Malinen
2007-05-28 16:38 ` [PATCH 2/4] hostap: Suppress broadcast if no stations are associated Jouni Malinen
2007-05-28 16:38 ` [PATCH 3/4] hostap: Use list_for_each_entry Jouni Malinen
2007-05-28 16:38 ` [PATCH 4/4] hostap: Remove driver version number Jouni Malinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).