diff mbox

cfg80211: Use capability info to detect mesh beacons.

Message ID 1304529896-20934-1-git-send-email-javier@cozybit.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Javier Cardona May 4, 2011, 5:24 p.m. UTC
Mesh beacons no longer use all-zeroes BSSID.  Beacon frames for MBSS,
infrastructure BSS, or IBSS are differentiated by the Capability
Information field in the Beacon frame.  A mesh STA sets the ESS and IBSS
subfields to 0 in transmitted Beacon or Probe Response management
frames.

Signed-off-by: Javier Cardona <javier@cozybit.com>
---
 include/linux/ieee80211.h |    5 +++++
 net/wireless/scan.c       |   14 +++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

Comments

Johannes Berg May 9, 2011, 8:25 a.m. UTC | #1
On Wed, 2011-05-04 at 10:24 -0700, Javier Cardona wrote:
> Mesh beacons no longer use all-zeroes BSSID.  Beacon frames for MBSS,
> infrastructure BSS, or IBSS are differentiated by the Capability
> Information field in the Beacon frame.  A mesh STA sets the ESS and IBSS
> subfields to 0 in transmitted Beacon or Probe Response management
> frames.

Sorry for the late reply, yeah, I think that looks good.

johannes

> Signed-off-by: Javier Cardona <javier@cozybit.com>
> ---
>  include/linux/ieee80211.h |    5 +++++
>  net/wireless/scan.c       |   14 +++++++-------
>  2 files changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
> index a26dcb8..b2eee58 100644
> --- a/include/linux/ieee80211.h
> +++ b/include/linux/ieee80211.h
> @@ -1002,6 +1002,11 @@ struct ieee80211_ht_info {
>  
>  #define WLAN_CAPABILITY_ESS		(1<<0)
>  #define WLAN_CAPABILITY_IBSS		(1<<1)
> +
> +/* A mesh STA sets the ESS and IBSS capability bits to zero */
> +#define WLAN_CAPABILITY_IS_MBSS(cap)	\
> +	(!((cap) & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)))
> +
>  #define WLAN_CAPABILITY_CF_POLLABLE	(1<<2)
>  #define WLAN_CAPABILITY_CF_POLL_REQUEST	(1<<3)
>  #define WLAN_CAPABILITY_PRIVACY		(1<<4)
> diff --git a/net/wireless/scan.c b/net/wireless/scan.c
> index fbf6f33..62e542a 100644
> --- a/net/wireless/scan.c
> +++ b/net/wireless/scan.c
> @@ -210,7 +210,7 @@ static bool is_mesh(struct cfg80211_bss *a,
>  {
>  	const u8 *ie;
>  
> -	if (!is_zero_ether_addr(a->bssid))
> +	if (!WLAN_CAPABILITY_IS_MBSS(a->capability))
>  		return false;
>  
>  	ie = cfg80211_find_ie(WLAN_EID_MESH_ID,
> @@ -248,11 +248,7 @@ static int cmp_bss(struct cfg80211_bss *a,
>  	if (a->channel != b->channel)
>  		return b->channel->center_freq - a->channel->center_freq;
>  
> -	r = memcmp(a->bssid, b->bssid, ETH_ALEN);
> -	if (r)
> -		return r;
> -
> -	if (is_zero_ether_addr(a->bssid)) {
> +	if (WLAN_CAPABILITY_IS_MBSS(a->capability | b->capability)) {
>  		r = cmp_ies(WLAN_EID_MESH_ID,
>  			    a->information_elements,
>  			    a->len_information_elements,
> @@ -267,6 +263,10 @@ static int cmp_bss(struct cfg80211_bss *a,
>  			       b->len_information_elements);
>  	}
>  
> +	r = memcmp(a->bssid, b->bssid, ETH_ALEN);
> +	if (r)
> +		return r;
> +
>  	return cmp_ies(WLAN_EID_SSID,
>  		       a->information_elements,
>  		       a->len_information_elements,
> @@ -407,7 +407,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
>  
>  	res->ts = jiffies;
>  
> -	if (is_zero_ether_addr(res->pub.bssid)) {
> +	if (WLAN_CAPABILITY_IS_MBSS(res->pub.capability)) {
>  		/* must be mesh, verify */
>  		meshid = cfg80211_find_ie(WLAN_EID_MESH_ID,
>  					  res->pub.information_elements,


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vivek Natarajan May 30, 2011, 10:51 a.m. UTC | #2
On Wed, May 4, 2011 at 10:54 PM, Javier Cardona <javier@cozybit.com> wrote:
> Mesh beacons no longer use all-zeroes BSSID.  Beacon frames for MBSS,
> infrastructure BSS, or IBSS are differentiated by the Capability
> Information field in the Beacon frame.  A mesh STA sets the ESS and IBSS
> subfields to 0 in transmitted Beacon or Probe Response management
> frames.

This breaks P2P mode as a P2P STA also sets the ESS and IBSS subfields
to zero. Is there any other way to find if it is a mesh other than
this check?

> index fbf6f33..62e542a 100644
> --- a/net/wireless/scan.c
> +++ b/net/wireless/scan.c

> @@ -407,7 +407,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
>
>        res->ts = jiffies;
>
> -       if (is_zero_ether_addr(res->pub.bssid)) {
> +       if (WLAN_CAPABILITY_IS_MBSS(res->pub.capability)) {
>                /* must be mesh, verify */

Reverting the above change, makes P2P work. Any other better fix?

>                meshid = cfg80211_find_ie(WLAN_EID_MESH_ID,
>                                          res->pub.information_elements,
> --

Vivek.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Javier Cardona May 31, 2011, 5:26 p.m. UTC | #3
On Mon, May 30, 2011 at 3:51 AM, Vivek Natarajan <vivek.natraj@gmail.com> wrote:
> On Wed, May 4, 2011 at 10:54 PM, Javier Cardona <javier@cozybit.com> wrote:
>> Mesh beacons no longer use all-zeroes BSSID.  Beacon frames for MBSS,
>> infrastructure BSS, or IBSS are differentiated by the Capability
>> Information field in the Beacon frame.  A mesh STA sets the ESS and IBSS
>> subfields to 0 in transmitted Beacon or Probe Response management
>> frames.
>
> This breaks P2P mode as a P2P STA also sets the ESS and IBSS subfields
> to zero. Is there any other way to find if it is a mesh other than
> this check?

Bummer.  I guess that's a collision between WiFi Alliance and IEEE,
respectively the organizations standardizing P2P and 802.11s.
The 11s draft is pretty clear about that.  I can consult the task
group and see if they have thought about this conflict.

>> index fbf6f33..62e542a 100644
>> --- a/net/wireless/scan.c
>> +++ b/net/wireless/scan.c
>
>> @@ -407,7 +407,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
>>
>>        res->ts = jiffies;
>>
>> -       if (is_zero_ether_addr(res->pub.bssid)) {
>> +       if (WLAN_CAPABILITY_IS_MBSS(res->pub.capability)) {
>>                /* must be mesh, verify */
>
> Reverting the above change, makes P2P work. Any other better fix?

We could check that the WLAN_CAPABILITY_IS_MBSS *and* that the bssid
matches the TA.  Do you think that would work?

Thanks,

Javier
Eliad Peller May 31, 2011, 6:10 p.m. UTC | #4
On Tue, May 31, 2011 at 8:26 PM, Javier Cardona <javier@cozybit.com> wrote:
> On Mon, May 30, 2011 at 3:51 AM, Vivek Natarajan <vivek.natraj@gmail.com> wrote:
>> On Wed, May 4, 2011 at 10:54 PM, Javier Cardona <javier@cozybit.com> wrote:
>>> Mesh beacons no longer use all-zeroes BSSID.  Beacon frames for MBSS,
>>> infrastructure BSS, or IBSS are differentiated by the Capability
>>> Information field in the Beacon frame.  A mesh STA sets the ESS and IBSS
>>> subfields to 0 in transmitted Beacon or Probe Response management
>>> frames.
>>
>> This breaks P2P mode as a P2P STA also sets the ESS and IBSS subfields
>> to zero. Is there any other way to find if it is a mesh other than
>> this check?
>
> Bummer.  I guess that's a collision between WiFi Alliance and IEEE,
> respectively the organizations standardizing P2P and 802.11s.
> The 11s draft is pretty clear about that.  I can consult the task
> group and see if they have thought about this conflict.
>
>>> index fbf6f33..62e542a 100644
>>> --- a/net/wireless/scan.c
>>> +++ b/net/wireless/scan.c
>>
>>> @@ -407,7 +407,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
>>>
>>>        res->ts = jiffies;
>>>
>>> -       if (is_zero_ether_addr(res->pub.bssid)) {
>>> +       if (WLAN_CAPABILITY_IS_MBSS(res->pub.capability)) {
>>>                /* must be mesh, verify */
>>
>> Reverting the above change, makes P2P work. Any other better fix?
>
> We could check that the WLAN_CAPABILITY_IS_MBSS *and* that the bssid
> matches the TA.  Do you think that would work?
>
i guess you are referring to SA (rather than TA).
in that case, this solution is not enough, as SA==bssid also holds
true for the p2p probe responses (at least when a single vif is being
used).

btw, i've already submitted some workaround for this issue:
http://permalink.gmane.org/gmane.linux.kernel.wireless.general/70763

in case we won't find a better solution...

Eliad.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Javier Cardona May 31, 2011, 6:38 p.m. UTC | #5
On Tue, May 31, 2011 at 11:10 AM, Eliad Peller <eliad@wizery.com> wrote:
> On Tue, May 31, 2011 at 8:26 PM, Javier Cardona <javier@cozybit.com> wrote:
>> On Mon, May 30, 2011 at 3:51 AM, Vivek Natarajan <vivek.natraj@gmail.com> wrote:
>>> On Wed, May 4, 2011 at 10:54 PM, Javier Cardona <javier@cozybit.com> wrote:
>>>> Mesh beacons no longer use all-zeroes BSSID.  Beacon frames for MBSS,
>>>> infrastructure BSS, or IBSS are differentiated by the Capability
>>>> Information field in the Beacon frame.  A mesh STA sets the ESS and IBSS
>>>> subfields to 0 in transmitted Beacon or Probe Response management
>>>> frames.
>>>
>>> This breaks P2P mode as a P2P STA also sets the ESS and IBSS subfields
>>> to zero. Is there any other way to find if it is a mesh other than
>>> this check?
>>
>> Bummer.  I guess that's a collision between WiFi Alliance and IEEE,
>> respectively the organizations standardizing P2P and 802.11s.
>> The 11s draft is pretty clear about that.  I can consult the task
>> group and see if they have thought about this conflict.
>>
>>>> index fbf6f33..62e542a 100644
>>>> --- a/net/wireless/scan.c
>>>> +++ b/net/wireless/scan.c
>>>
>>>> @@ -407,7 +407,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
>>>>
>>>>        res->ts = jiffies;
>>>>
>>>> -       if (is_zero_ether_addr(res->pub.bssid)) {
>>>> +       if (WLAN_CAPABILITY_IS_MBSS(res->pub.capability)) {
>>>>                /* must be mesh, verify */
>>>
>>> Reverting the above change, makes P2P work. Any other better fix?
>>
>> We could check that the WLAN_CAPABILITY_IS_MBSS *and* that the bssid
>> matches the TA.  Do you think that would work?
>>
> i guess you are referring to SA (rather than TA).
> in that case, this solution is not enough, as SA==bssid also holds
> true for the p2p probe responses (at least when a single vif is being
> used).

Yes, you are right, SA or Address 2  (11s changes the address field
definitions from DA, SA, BSSID to Address 1, 2 and 3).  In mesh
management frames, Address 2 always equals Address 3.  Is this also
the case for some P2P management frames?

> btw, i've already submitted some workaround for this issue:
> http://permalink.gmane.org/gmane.linux.kernel.wireless.general/70763
>
> in case we won't find a better solution...

OK.  If the answer to my question above is yes, then I guess we'll
have to do it as you suggest.  Thanks!

Javier
Eliad Peller June 1, 2011, 7:01 a.m. UTC | #6
On Tue, May 31, 2011 at 9:38 PM, Javier Cardona <javier@cozybit.com> wrote:
> On Tue, May 31, 2011 at 11:10 AM, Eliad Peller <eliad@wizery.com> wrote:
>> On Tue, May 31, 2011 at 8:26 PM, Javier Cardona <javier@cozybit.com> wrote:
>>> On Mon, May 30, 2011 at 3:51 AM, Vivek Natarajan <vivek.natraj@gmail.com> wrote:
>>>> On Wed, May 4, 2011 at 10:54 PM, Javier Cardona <javier@cozybit.com> wrote:
>>>>> Mesh beacons no longer use all-zeroes BSSID.  Beacon frames for MBSS,
>>>>> infrastructure BSS, or IBSS are differentiated by the Capability
>>>>> Information field in the Beacon frame.  A mesh STA sets the ESS and IBSS
>>>>> subfields to 0 in transmitted Beacon or Probe Response management
>>>>> frames.
>>>>
>>>> This breaks P2P mode as a P2P STA also sets the ESS and IBSS subfields
>>>> to zero. Is there any other way to find if it is a mesh other than
>>>> this check?
>>>
>>> Bummer.  I guess that's a collision between WiFi Alliance and IEEE,
>>> respectively the organizations standardizing P2P and 802.11s.
>>> The 11s draft is pretty clear about that.  I can consult the task
>>> group and see if they have thought about this conflict.
>>>
>>>>> index fbf6f33..62e542a 100644
>>>>> --- a/net/wireless/scan.c
>>>>> +++ b/net/wireless/scan.c
>>>>
>>>>> @@ -407,7 +407,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
>>>>>
>>>>>        res->ts = jiffies;
>>>>>
>>>>> -       if (is_zero_ether_addr(res->pub.bssid)) {
>>>>> +       if (WLAN_CAPABILITY_IS_MBSS(res->pub.capability)) {
>>>>>                /* must be mesh, verify */
>>>>
>>>> Reverting the above change, makes P2P work. Any other better fix?
>>>
>>> We could check that the WLAN_CAPABILITY_IS_MBSS *and* that the bssid
>>> matches the TA.  Do you think that would work?
>>>
>> i guess you are referring to SA (rather than TA).
>> in that case, this solution is not enough, as SA==bssid also holds
>> true for the p2p probe responses (at least when a single vif is being
>> used).
>
> Yes, you are right, SA or Address 2  (11s changes the address field
> definitions from DA, SA, BSSID to Address 1, 2 and 3).  In mesh
> management frames, Address 2 always equals Address 3.  Is this also
> the case for some P2P management frames?
>
yes.

>> btw, i've already submitted some workaround for this issue:
>> http://permalink.gmane.org/gmane.linux.kernel.wireless.general/70763
>>
>> in case we won't find a better solution...
>
> OK.  If the answer to my question above is yes, then I guess we'll
> have to do it as you suggest.  Thanks!
ok. thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index a26dcb8..b2eee58 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1002,6 +1002,11 @@  struct ieee80211_ht_info {
 
 #define WLAN_CAPABILITY_ESS		(1<<0)
 #define WLAN_CAPABILITY_IBSS		(1<<1)
+
+/* A mesh STA sets the ESS and IBSS capability bits to zero */
+#define WLAN_CAPABILITY_IS_MBSS(cap)	\
+	(!((cap) & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)))
+
 #define WLAN_CAPABILITY_CF_POLLABLE	(1<<2)
 #define WLAN_CAPABILITY_CF_POLL_REQUEST	(1<<3)
 #define WLAN_CAPABILITY_PRIVACY		(1<<4)
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index fbf6f33..62e542a 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -210,7 +210,7 @@  static bool is_mesh(struct cfg80211_bss *a,
 {
 	const u8 *ie;
 
-	if (!is_zero_ether_addr(a->bssid))
+	if (!WLAN_CAPABILITY_IS_MBSS(a->capability))
 		return false;
 
 	ie = cfg80211_find_ie(WLAN_EID_MESH_ID,
@@ -248,11 +248,7 @@  static int cmp_bss(struct cfg80211_bss *a,
 	if (a->channel != b->channel)
 		return b->channel->center_freq - a->channel->center_freq;
 
-	r = memcmp(a->bssid, b->bssid, ETH_ALEN);
-	if (r)
-		return r;
-
-	if (is_zero_ether_addr(a->bssid)) {
+	if (WLAN_CAPABILITY_IS_MBSS(a->capability | b->capability)) {
 		r = cmp_ies(WLAN_EID_MESH_ID,
 			    a->information_elements,
 			    a->len_information_elements,
@@ -267,6 +263,10 @@  static int cmp_bss(struct cfg80211_bss *a,
 			       b->len_information_elements);
 	}
 
+	r = memcmp(a->bssid, b->bssid, ETH_ALEN);
+	if (r)
+		return r;
+
 	return cmp_ies(WLAN_EID_SSID,
 		       a->information_elements,
 		       a->len_information_elements,
@@ -407,7 +407,7 @@  cfg80211_bss_update(struct cfg80211_registered_device *dev,
 
 	res->ts = jiffies;
 
-	if (is_zero_ether_addr(res->pub.bssid)) {
+	if (WLAN_CAPABILITY_IS_MBSS(res->pub.capability)) {
 		/* must be mesh, verify */
 		meshid = cfg80211_find_ie(WLAN_EID_MESH_ID,
 					  res->pub.information_elements,