Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 1/2] wl12xx: remove TIM ie from probe response
@ 2011-09-15  9:07 Eliad Peller
  2011-09-15  9:07 ` [PATCH 2/2] wl12xx: remove P2P " Eliad Peller
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Eliad Peller @ 2011-09-15  9:07 UTC (permalink / raw)
  To: Luciano Coelho; +Cc: linux-wireless

wl12xx uses the beacon as the probe response template.
However, the beacon includes a TIM ie, which shouldn't
exist in the probe response.

Delete it from the skb before configuring the probe
response template.

Signed-off-by: Eliad Peller <eliad@wizery.com>
---
 drivers/net/wireless/wl12xx/main.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 680f558..a1d9639 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -3069,6 +3069,20 @@ static int wl1271_ssid_set(struct wl1271 *wl, struct sk_buff *skb,
 	return 0;
 }
 
+static void wl12xx_remove_ie(struct sk_buff *skb, u8 eid, int ieoffset)
+{
+	int len;
+	const u8 *next, *end = skb->data + skb->len;
+	u8 *ie = (u8 *)cfg80211_find_ie(eid, skb->data + ieoffset,
+					skb->len - ieoffset);
+	if (!ie)
+		return;
+	len = ie[1] + 2;
+	next = ie + len;
+	memmove(ie, next, end - next);
+	skb_trim(skb, skb->len - len);
+}
+
 static int wl1271_bss_erp_info_changed(struct wl1271 *wl,
 				       struct ieee80211_bss_conf *bss_conf,
 				       u32 changed)
@@ -3151,6 +3165,9 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl,
 			goto out;
 		}
 
+		/* remove TIM ie from probe response */
+		wl12xx_remove_ie(beacon, WLAN_EID_TIM, ieoffset);
+
 		hdr = (struct ieee80211_hdr *) beacon->data;
 		hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
 						 IEEE80211_STYPE_PROBE_RESP);
-- 
1.7.6.401.g6a319


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

* [PATCH 2/2] wl12xx: remove P2P ie from probe response
  2011-09-15  9:07 [PATCH 1/2] wl12xx: remove TIM ie from probe response Eliad Peller
@ 2011-09-15  9:07 ` Eliad Peller
  2011-09-15  9:20 ` [PATCH 1/2] wl12xx: remove TIM " Johannes Berg
  2011-09-23 11:43 ` Luciano Coelho
  2 siblings, 0 replies; 5+ messages in thread
From: Eliad Peller @ 2011-09-15  9:07 UTC (permalink / raw)
  To: Luciano Coelho; +Cc: linux-wireless

wl12xx uses a single probe response template, regardless of
the probe request.
However, the P2P spec forbids including the p2p ie in some
cases (e.g. the probe request didn't include the p2p ie).

The fw responds only to probe requests that don't
include the p2p ie, and passes up probe requests that
include them (the supplicant will answer them).

Thus, strip the p2p ie from the probe response template.

Signed-off-by: Eliad Peller <eliad@wizery.com>
---
depends on "cfg80211: add cfg80211_find_vendor_ie() function"

 drivers/net/wireless/wl12xx/main.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index a1d9639..168ca4e 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -3083,6 +3083,23 @@ static void wl12xx_remove_ie(struct sk_buff *skb, u8 eid, int ieoffset)
 	skb_trim(skb, skb->len - len);
 }
 
+static void wl12xx_remove_vendor_ie(struct sk_buff *skb,
+					    unsigned int oui, u8 oui_type,
+					    int ieoffset)
+{
+	int len;
+	const u8 *next, *end = skb->data + skb->len;
+	u8 *ie = (u8 *)cfg80211_find_vendor_ie(oui, oui_type,
+					       skb->data + ieoffset,
+					       skb->len - ieoffset);
+	if (!ie)
+		return;
+	len = ie[1] + 2;
+	next = ie + len;
+	memmove(ie, next, end - next);
+	skb_trim(skb, skb->len - len);
+}
+
 static int wl1271_bss_erp_info_changed(struct wl1271 *wl,
 				       struct ieee80211_bss_conf *bss_conf,
 				       u32 changed)
@@ -3168,6 +3185,17 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl,
 		/* remove TIM ie from probe response */
 		wl12xx_remove_ie(beacon, WLAN_EID_TIM, ieoffset);
 
+		/*
+		 * remove p2p ie from probe response.
+		 * the fw reponds to probe requests that don't include
+		 * the p2p ie. probe requests with p2p ie will be passed,
+		 * and will be responded by the supplicant (the spec
+		 * forbids including the p2p ie when responding to probe
+		 * requests that didn't include it).
+		 */
+		wl12xx_remove_vendor_ie(beacon, WLAN_OUI_WFA,
+					WLAN_OUI_TYPE_WFA_P2P, ieoffset);
+
 		hdr = (struct ieee80211_hdr *) beacon->data;
 		hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
 						 IEEE80211_STYPE_PROBE_RESP);
-- 
1.7.6.401.g6a319


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

* Re: [PATCH 1/2] wl12xx: remove TIM ie from probe response
  2011-09-15  9:07 [PATCH 1/2] wl12xx: remove TIM ie from probe response Eliad Peller
  2011-09-15  9:07 ` [PATCH 2/2] wl12xx: remove P2P " Eliad Peller
@ 2011-09-15  9:20 ` Johannes Berg
  2011-09-15  9:33   ` Eliad Peller
  2011-09-23 11:43 ` Luciano Coelho
  2 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2011-09-15  9:20 UTC (permalink / raw)
  To: Eliad Peller; +Cc: Luciano Coelho, linux-wireless

On Thu, 2011-09-15 at 12:07 +0300, Eliad Peller wrote:
> wl12xx uses the beacon as the probe response template.
> However, the beacon includes a TIM ie, which shouldn't
> exist in the probe response.
> 
> Delete it from the skb before configuring the probe
> response template.

Are you sure all this is a good thing instead of getting the right info
from hostapd/wpa_s like for ath6kl? (Yeah, I know that's still
different, but ...)

johannes


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

* Re: [PATCH 1/2] wl12xx: remove TIM ie from probe response
  2011-09-15  9:20 ` [PATCH 1/2] wl12xx: remove TIM " Johannes Berg
@ 2011-09-15  9:33   ` Eliad Peller
  0 siblings, 0 replies; 5+ messages in thread
From: Eliad Peller @ 2011-09-15  9:33 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Luciano Coelho, linux-wireless

On Thu, Sep 15, 2011 at 12:20 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Thu, 2011-09-15 at 12:07 +0300, Eliad Peller wrote:
>> wl12xx uses the beacon as the probe response template.
>> However, the beacon includes a TIM ie, which shouldn't
>> exist in the probe response.
>>
>> Delete it from the skb before configuring the probe
>> response template.
>
> Are you sure all this is a good thing instead of getting the right info
> from hostapd/wpa_s like for ath6kl? (Yeah, I know that's still
> different, but ...)
>
you're right.
but i guess we can start with easily fixing the current flow, and
later on also doing it right :)

thanks,
Eliad.

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

* Re: [PATCH 1/2] wl12xx: remove TIM ie from probe response
  2011-09-15  9:07 [PATCH 1/2] wl12xx: remove TIM ie from probe response Eliad Peller
  2011-09-15  9:07 ` [PATCH 2/2] wl12xx: remove P2P " Eliad Peller
  2011-09-15  9:20 ` [PATCH 1/2] wl12xx: remove TIM " Johannes Berg
@ 2011-09-23 11:43 ` Luciano Coelho
  2 siblings, 0 replies; 5+ messages in thread
From: Luciano Coelho @ 2011-09-23 11:43 UTC (permalink / raw)
  To: Eliad Peller; +Cc: linux-wireless

On Thu, 2011-09-15 at 12:07 +0300, Eliad Peller wrote: 
> wl12xx uses the beacon as the probe response template.
> However, the beacon includes a TIM ie, which shouldn't
> exist in the probe response.
> 
> Delete it from the skb before configuring the probe
> response template.
> 
> Signed-off-by: Eliad Peller <eliad@wizery.com>
> ---

Applied both patches.  Thanks!

-- 
Cheers,
Luca.


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

end of thread, other threads:[~2011-09-23 11:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-15  9:07 [PATCH 1/2] wl12xx: remove TIM ie from probe response Eliad Peller
2011-09-15  9:07 ` [PATCH 2/2] wl12xx: remove P2P " Eliad Peller
2011-09-15  9:20 ` [PATCH 1/2] wl12xx: remove TIM " Johannes Berg
2011-09-15  9:33   ` Eliad Peller
2011-09-23 11:43 ` Luciano Coelho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox