netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/7] d80211: allow for hardware crypto of default keys
       [not found] <20061207004238.540749000@devicescape.com>
@ 2006-12-07  0:44 ` David Kimdon
  2006-12-07  0:45 ` [patch 2/7] d80211: set default_wep_only dynamically David Kimdon
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: David Kimdon @ 2006-12-07  0:44 UTC (permalink / raw)
  To: netdev; +Cc: John W. Linville, Jiri Benc, David Kimdon

[-- Attachment #1: hwaccel-virt-sta.patch --]
[-- Type: text/plain, Size: 1505 bytes --]

Remove incorrect prohibition of hardware crypto support.  This was
originally present to prevent hardware crypto when more than one
station interface was created for a single hardware device, the code
in question is no longer correct and should be removed.

Signed-off-by: David Kimdon <david.kimdon@devicescape.com>

Index: wireless-dev/net/d80211/ieee80211_ioctl.c
===================================================================
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c
+++ wireless-dev/net/d80211/ieee80211_ioctl.c
@@ -537,9 +537,7 @@ static int ieee80211_set_encryption(stru
 		}
 		key = sdata->keys[idx];
 
-		/* Disable hwaccel for default keys when the interface is not
-		 * the default one.
-		 * TODO: consider adding hwaccel support for these; at least
+		/* TODO: consider adding hwaccel support for these; at least
 		 * Atheros key cache should be able to handle this since AP is
 		 * only transmitting frames with default keys. */
 		/* FIX: hw key cache can be used when only one virtual
@@ -548,11 +546,6 @@ static int ieee80211_set_encryption(stru
 		 * must be used. This should be done automatically
 		 * based on configured station devices. For the time
 		 * being, this can be only set at compile time. */
-		/* FIXME: There is no more anything like "default
-		 * interface". We should try hwaccel if there is just one
-		 * interface - for now, hwaccel is unconditionaly
-		 * disabled. */
-		try_hwaccel = 0;
 	} else {
 		set_tx_key = 0;
 		if (idx != 0) {

--

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

* [patch 2/7] d80211: set default_wep_only dynamically
       [not found] <20061207004238.540749000@devicescape.com>
  2006-12-07  0:44 ` [patch 1/7] d80211: allow for hardware crypto of default keys David Kimdon
@ 2006-12-07  0:45 ` David Kimdon
  2006-12-07  0:45 ` [patch 3/7] d80211: fix potential interface name overflow David Kimdon
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: David Kimdon @ 2006-12-07  0:45 UTC (permalink / raw)
  To: netdev; +Cc: John W. Linville, Jiri Benc, David Kimdon

[-- Attachment #1: hwaccel-default_wep_only.patch --]
[-- Type: text/plain, Size: 3133 bytes --]

Without this change d80211 relies on userspace to let it know when it can
configure default wep keys.  It is always safe to set default_wep_only if there
is a single station interface.  This allows for hardware accelleration for
the case of a single station interface.

Signed-off-by: David Kimdon <david.kimdon@devicescape.com>

Index: wireless-dev/net/d80211/ieee80211_i.h
===================================================================
--- wireless-dev.orig/net/d80211/ieee80211_i.h
+++ wireless-dev/net/d80211/ieee80211_i.h
@@ -607,6 +607,7 @@ extern const struct iw_handler_def ieee8
 int ieee80211_set_hw_encryption(struct net_device *dev,
 				struct sta_info *sta, u8 addr[ETH_ALEN],
 				struct ieee80211_key *key);
+void ieee80211_update_default_wep_only(struct ieee80211_local *local);
 
 /* ieee80211_scan.c */
 void ieee80211_init_scan(struct ieee80211_local *local);
Index: wireless-dev/net/d80211/ieee80211_iface.c
===================================================================
--- wireless-dev.orig/net/d80211/ieee80211_iface.c
+++ wireless-dev/net/d80211/ieee80211_iface.c
@@ -97,6 +97,7 @@ int ieee80211_if_add(struct net_device *
 	}
 
 	list_add(&sdata->list, &local->sub_if_list);
+	ieee80211_update_default_wep_only(local);
 
 	return 0;
 
@@ -164,6 +165,7 @@ void ieee80211_if_del_mgmt(struct ieee80
 void ieee80211_if_set_type(struct net_device *dev, int type)
 {
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct ieee80211_local *local = dev->ieee80211_ptr;
 
 	sdata->type = type;
 	switch (type) {
@@ -205,6 +207,7 @@ void ieee80211_if_set_type(struct net_de
 		       dev->name, __FUNCTION__, type);
 	}
 	ieee80211_sysfs_change_if_type(dev);
+	ieee80211_update_default_wep_only(local);
 }
 
 /* Must be called with rtnl lock held. */
@@ -329,6 +332,7 @@ int ieee80211_if_remove(struct net_devic
 		    strcmp(name, sdata->dev->name) == 0 &&
 		    sdata->dev != local->mdev) {
 			__ieee80211_if_del(local, sdata);
+			ieee80211_update_default_wep_only(local);
 			return 0;
 		}
 	}
Index: wireless-dev/net/d80211/ieee80211_ioctl.c
===================================================================
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c
+++ wireless-dev/net/d80211/ieee80211_ioctl.c
@@ -2357,6 +2357,36 @@ static int ieee80211_ioctl_default_wep_o
 }
 
 
+void ieee80211_update_default_wep_only(struct ieee80211_local *local)
+{
+	int i = 0;
+	struct ieee80211_sub_if_data *sdata;
+
+	spin_lock_bh(&local->sub_if_lock);
+	list_for_each_entry(sdata, &local->sub_if_list, list) {
+
+		if (sdata->dev == local->mdev)
+			continue;
+
+		/* If there is an AP interface then depend on userspace to
+		   set default_wep_only correctly. */
+		if (sdata->type == IEEE80211_IF_TYPE_AP) {
+			spin_unlock_bh(&local->sub_if_lock);
+			return;
+		}
+
+		i++;
+	}
+
+	if (i <= 1)
+		ieee80211_ioctl_default_wep_only(local, 1);
+	else
+		ieee80211_ioctl_default_wep_only(local, 0);
+
+	spin_unlock_bh(&local->sub_if_lock);
+}
+
+
 static int ieee80211_ioctl_prism2_param(struct net_device *dev,
 					struct iw_request_info *info,
 					void *wrqu, char *extra)

--

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

* [patch 3/7] d80211: fix potential interface name overflow
       [not found] <20061207004238.540749000@devicescape.com>
  2006-12-07  0:44 ` [patch 1/7] d80211: allow for hardware crypto of default keys David Kimdon
  2006-12-07  0:45 ` [patch 2/7] d80211: set default_wep_only dynamically David Kimdon
@ 2006-12-07  0:45 ` David Kimdon
  2006-12-07  0:45 ` [patch 4/7] d80211: fix potential invalid array index returning key information David Kimdon
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: David Kimdon @ 2006-12-07  0:45 UTC (permalink / raw)
  To: netdev; +Cc: John W. Linville, Jiri Benc, David Kimdon

[-- Attachment #1: ieee80211_if_add-snprintf.patch --]
[-- Type: text/plain, Size: 687 bytes --]

dev->name and ndev->name are both IFNAMSIZ in length, the ".%d" is
not guarenteed to fit in ndev->name.

Signed-off-by: David Kimdon <david.kimdon@devicescape.com>

Index: wireless-dev/net/d80211/ieee80211_iface.c
===================================================================
--- wireless-dev.orig/net/d80211/ieee80211_iface.c
+++ wireless-dev/net/d80211/ieee80211_iface.c
@@ -56,7 +56,8 @@ int ieee80211_if_add(struct net_device *
 	if (strlen(name) == 0) {
 		i = 0;
 		do {
-			sprintf(ndev->name, "%s.%d", dev->name, i++);
+			snprintf(ndev->name, sizeof(ndev->name), "%s.%d",
+				 dev->name, i++);
 			tmp_dev = dev_get_by_name(ndev->name);
 			if (!tmp_dev)
 				break;

--

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

* [patch 4/7] d80211: fix potential invalid array index returning key information
       [not found] <20061207004238.540749000@devicescape.com>
                   ` (2 preceding siblings ...)
  2006-12-07  0:45 ` [patch 3/7] d80211: fix potential interface name overflow David Kimdon
@ 2006-12-07  0:45 ` David Kimdon
  2006-12-07  0:45 ` [patch 5/7] d80211: remove unused references to sub interface data David Kimdon
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: David Kimdon @ 2006-12-07  0:45 UTC (permalink / raw)
  To: netdev; +Cc: John W. Linville, Jiri Benc, David Kimdon

[-- Attachment #1: get_encrypt-overflow.patch --]
[-- Type: text/plain, Size: 750 bytes --]

sdata->keys[] has NUM_DEFAULT_KEYS elements, don't access past that.

Signed-off-by: David Kimdon <david.kimdon@devicescape.com>

Index: wireless-dev/net/d80211/ieee80211_ioctl.c
===================================================================
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c
+++ wireless-dev/net/d80211/ieee80211_ioctl.c
@@ -803,7 +803,7 @@ static int ieee80211_ioctl_get_encryptio
 	    param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
 	    param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
 		sta = NULL;
-		if (param->u.crypt.idx > NUM_DEFAULT_KEYS) {
+		if (param->u.crypt.idx >= NUM_DEFAULT_KEYS) {
 			param->u.crypt.idx = sdata->default_key ?
 				sdata->default_key->keyidx : 0;
 			return 0;

--

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

* [patch 5/7] d80211: remove unused references to sub interface data
       [not found] <20061207004238.540749000@devicescape.com>
                   ` (3 preceding siblings ...)
  2006-12-07  0:45 ` [patch 4/7] d80211: fix potential invalid array index returning key information David Kimdon
@ 2006-12-07  0:45 ` David Kimdon
  2006-12-07 12:29   ` Johannes Berg
  2006-12-07  0:45 ` [patch 6/7] d80211: fix invalid check for sub interface type AP David Kimdon
  2006-12-07  0:45 ` [patch 7/7] d80211: do not pass an invalid key index to set_key() David Kimdon
  6 siblings, 1 reply; 11+ messages in thread
From: David Kimdon @ 2006-12-07  0:45 UTC (permalink / raw)
  To: netdev; +Cc: John W. Linville, Jiri Benc, David Kimdon

[-- Attachment #1: unused-sdata.patch --]
[-- Type: text/plain, Size: 2246 bytes --]

In these three cases the pointer returned by IEEE80211_DEV_TO_SUB_IF()
is never used.

Signed-off-by: David Kimdon <david.kimdon@devicescape.com>

Index: wireless-dev/net/d80211/ieee80211.c
===================================================================
--- wireless-dev.orig/net/d80211/ieee80211.c
+++ wireless-dev/net/d80211/ieee80211.c
@@ -1362,11 +1362,9 @@ static int ieee80211_master_start_xmit(s
 	struct ieee80211_tx_control control;
 	struct ieee80211_tx_packet_data *pkt_data;
 	struct net_device *odev = NULL;
-	struct ieee80211_sub_if_data *sdata, *osdata;
+	struct ieee80211_sub_if_data *osdata;
 	int ret;
 
-	sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-
 	/*
 	 * copy control out of the skb so other people can use skb->cb
 	 */
Index: wireless-dev/net/d80211/ieee80211_ioctl.c
===================================================================
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c
+++ wireless-dev/net/d80211/ieee80211_ioctl.c
@@ -407,10 +407,8 @@ static int ieee80211_ioctl_get_info_sta(
 	if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
 	    param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
 	    param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
-		struct ieee80211_sub_if_data *sdata;
 		struct net_device_stats *stats;
 
-		sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 		stats = ieee80211_dev_stats(local->mdev);
 		param->u.get_info_sta.rx_bytes = stats->rx_bytes;
 		param->u.get_info_sta.tx_bytes = stats->tx_bytes;
Index: wireless-dev/net/d80211/ieee80211_iface.c
===================================================================
--- wireless-dev.orig/net/d80211/ieee80211_iface.c
+++ wireless-dev/net/d80211/ieee80211_iface.c
@@ -42,7 +42,7 @@ int ieee80211_if_add(struct net_device *
 {
 	struct net_device *ndev, *tmp_dev;
 	struct ieee80211_local *local = dev->ieee80211_ptr;
-	struct ieee80211_sub_if_data *sdata = NULL, *sdata_parent;
+	struct ieee80211_sub_if_data *sdata = NULL;
 	int ret;
 	int i;
 
@@ -83,7 +83,6 @@ int ieee80211_if_add(struct net_device *
 	sdata->type = IEEE80211_IF_TYPE_AP;
 	sdata->dev = ndev;
 	sdata->local = local;
-	sdata_parent = IEEE80211_DEV_TO_SUB_IF(dev);
 	ieee80211_if_sdata_init(sdata);
 
 	ret = register_netdevice(ndev);

--

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

* [patch 6/7] d80211: fix invalid check for sub interface type AP
       [not found] <20061207004238.540749000@devicescape.com>
                   ` (4 preceding siblings ...)
  2006-12-07  0:45 ` [patch 5/7] d80211: remove unused references to sub interface data David Kimdon
@ 2006-12-07  0:45 ` David Kimdon
  2006-12-07 12:47   ` Jiri Benc
  2006-12-07  0:45 ` [patch 7/7] d80211: do not pass an invalid key index to set_key() David Kimdon
  6 siblings, 1 reply; 11+ messages in thread
From: David Kimdon @ 2006-12-07  0:45 UTC (permalink / raw)
  To: netdev; +Cc: John W. Linville, Jiri Benc, David Kimdon

[-- Attachment #1: sub_if_type.patch --]
[-- Type: text/plain, Size: 694 bytes --]

We should be checking the type member, not the raw pointer.

Signed-off-by: David Kimdon <david.kimdon@devicescape.com>

Index: wireless-dev/net/d80211/ieee80211_ioctl.c
===================================================================
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c
+++ wireless-dev/net/d80211/ieee80211_ioctl.c
@@ -1996,7 +1996,7 @@ static int ieee80211_ioctl_siwscan(struc
 		    sdata->type == IEEE80211_IF_TYPE_IBSS) {
 			ssid = sdata->u.sta.ssid;
 			ssid_len = sdata->u.sta.ssid_len;
-		} else if (sdata == IEEE80211_IF_TYPE_AP) {
+		} else if (sdata->type == IEEE80211_IF_TYPE_AP) {
 			ssid = sdata->u.ap.ssid;
 			ssid_len = sdata->u.ap.ssid_len;
 		} else

--

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

* [patch 7/7] d80211: do not pass an invalid key index to set_key()
       [not found] <20061207004238.540749000@devicescape.com>
                   ` (5 preceding siblings ...)
  2006-12-07  0:45 ` [patch 6/7] d80211: fix invalid check for sub interface type AP David Kimdon
@ 2006-12-07  0:45 ` David Kimdon
  2006-12-07 12:25   ` Jiri Benc
  6 siblings, 1 reply; 11+ messages in thread
From: David Kimdon @ 2006-12-07  0:45 UTC (permalink / raw)
  To: netdev; +Cc: John W. Linville, Jiri Benc, David Kimdon

[-- Attachment #1: alg-none-keyix.patch --]
[-- Type: text/plain, Size: 784 bytes --]

If a hardware key has not been configured then there is no point
to calling DISABLE_KEY.

Signed-off-by: David Kimdon <david.kimdon@devicescape.com>

Index: wireless-dev/net/d80211/ieee80211_ioctl.c
===================================================================
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c
+++ wireless-dev/net/d80211/ieee80211_ioctl.c
@@ -612,7 +612,7 @@ static int ieee80211_set_encryption(stru
 
 	if (alg == ALG_NONE) {
 		keyconf = NULL;
-		if (try_hwaccel && key && local->ops->set_key &&
+		if (try_hwaccel && key && key->hw_key_idx != -1 && local->ops->set_key &&
 		    (keyconf = ieee80211_key_data2conf(local, key)) != NULL &&
 		    local->ops->set_key(local_to_hw(local), DISABLE_KEY,
 				       sta_addr, keyconf, sta ? sta->aid : 0)) {

--

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

* Re: [patch 7/7] d80211: do not pass an invalid key index to set_key()
  2006-12-07  0:45 ` [patch 7/7] d80211: do not pass an invalid key index to set_key() David Kimdon
@ 2006-12-07 12:25   ` Jiri Benc
  2006-12-07 17:01     ` David Kimdon
  0 siblings, 1 reply; 11+ messages in thread
From: Jiri Benc @ 2006-12-07 12:25 UTC (permalink / raw)
  To: David Kimdon; +Cc: netdev, John W. Linville

On Wed, 6 Dec 2006 16:45:40 -0800, David Kimdon wrote:
> Index: wireless-dev/net/d80211/ieee80211_ioctl.c
> ===================================================================
> --- wireless-dev.orig/net/d80211/ieee80211_ioctl.c
> +++ wireless-dev/net/d80211/ieee80211_ioctl.c
> @@ -612,7 +612,7 @@ static int ieee80211_set_encryption(stru
>  
>  	if (alg == ALG_NONE) {
>  		keyconf = NULL;
> -		if (try_hwaccel && key && local->ops->set_key &&
> +		if (try_hwaccel && key && key->hw_key_idx != -1 && local->ops->set_key &&

Use HW_KEY_IDX_INVALID, please.

Thanks,

 Jiri

-- 
Jiri Benc
SUSE Labs

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

* Re: [patch 5/7] d80211: remove unused references to sub interface data
  2006-12-07  0:45 ` [patch 5/7] d80211: remove unused references to sub interface data David Kimdon
@ 2006-12-07 12:29   ` Johannes Berg
  0 siblings, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2006-12-07 12:29 UTC (permalink / raw)
  To: David Kimdon; +Cc: netdev, John W. Linville, Jiri Benc

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]

On Wed, 2006-12-06 at 16:45 -0800, David Kimdon wrote:
> plain text document attachment (unused-sdata.patch)
> In these three cases the pointer returned by IEEE80211_DEV_TO_SUB_IF()
> is never used.

Good catch, I must have introduced this when converting the prototypes.
Thanks.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

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

* Re: [patch 6/7] d80211: fix invalid check for sub interface type AP
  2006-12-07  0:45 ` [patch 6/7] d80211: fix invalid check for sub interface type AP David Kimdon
@ 2006-12-07 12:47   ` Jiri Benc
  0 siblings, 0 replies; 11+ messages in thread
From: Jiri Benc @ 2006-12-07 12:47 UTC (permalink / raw)
  To: David Kimdon; +Cc: netdev, John W. Linville

Patches 1 to 6 have been applied to my tree.

Thanks,

 Jiri

On Wed, 6 Dec 2006 16:45:32 -0800, David Kimdon wrote:
> We should be checking the type member, not the raw pointer.
> 
> Signed-off-by: David Kimdon <david.kimdon@devicescape.com>

-- 
Jiri Benc
SUSE Labs

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

* Re: [patch 7/7] d80211: do not pass an invalid key index to set_key()
  2006-12-07 12:25   ` Jiri Benc
@ 2006-12-07 17:01     ` David Kimdon
  0 siblings, 0 replies; 11+ messages in thread
From: David Kimdon @ 2006-12-07 17:01 UTC (permalink / raw)
  To: Jiri Benc; +Cc: David Kimdon, netdev, John W. Linville


> Use HW_KEY_IDX_INVALID, please.

oops, here you go (also fixed bad indentation):

------

d80211: do not pass an invalid key index to set_key()

If a hardware key has not been configured then there is no point
to calling DISABLE_KEY.

Signed-off-by: David Kimdon <david.kimdon@devicescape.com>

Index: wireless-dev/net/d80211/ieee80211_ioctl.c
===================================================================
--- wireless-dev.orig/net/d80211/ieee80211_ioctl.c
+++ wireless-dev/net/d80211/ieee80211_ioctl.c
@@ -612,7 +612,9 @@ static int ieee80211_set_encryption(stru
 
 	if (alg == ALG_NONE) {
 		keyconf = NULL;
-		if (try_hwaccel && key && local->ops->set_key &&
+		if (try_hwaccel && key &&
+		    key->hw_key_idx != HW_KEY_IDX_INVALID &&
+		    local->ops->set_key &&
 		    (keyconf = ieee80211_key_data2conf(local, key)) != NULL &&
 		    local->ops->set_key(local_to_hw(local), DISABLE_KEY,
 				       sta_addr, keyconf, sta ? sta->aid : 0)) {

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

end of thread, other threads:[~2006-12-07 17:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20061207004238.540749000@devicescape.com>
2006-12-07  0:44 ` [patch 1/7] d80211: allow for hardware crypto of default keys David Kimdon
2006-12-07  0:45 ` [patch 2/7] d80211: set default_wep_only dynamically David Kimdon
2006-12-07  0:45 ` [patch 3/7] d80211: fix potential interface name overflow David Kimdon
2006-12-07  0:45 ` [patch 4/7] d80211: fix potential invalid array index returning key information David Kimdon
2006-12-07  0:45 ` [patch 5/7] d80211: remove unused references to sub interface data David Kimdon
2006-12-07 12:29   ` Johannes Berg
2006-12-07  0:45 ` [patch 6/7] d80211: fix invalid check for sub interface type AP David Kimdon
2006-12-07 12:47   ` Jiri Benc
2006-12-07  0:45 ` [patch 7/7] d80211: do not pass an invalid key index to set_key() David Kimdon
2006-12-07 12:25   ` Jiri Benc
2006-12-07 17:01     ` David Kimdon

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