linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mac80211 (ath9k, ath5k, etc.) set BSSID Patch
@ 2008-12-30  2:56 Alina Friedrichsen
  2008-12-30 10:39 ` Johannes Berg
  2008-12-30 11:37 ` mac80211 (ath9k, ath5k, etc.) set BSSID Patch Jouni Malinen
  0 siblings, 2 replies; 11+ messages in thread
From: Alina Friedrichsen @ 2008-12-30  2:56 UTC (permalink / raw)
  To: berlin, linux-wireless, openwrt-devel

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

Hi,

this patch corrects some bugs of the mac80211 wireless driver framework related to setting a static BSSID in the ad-hoc mode (e.g. for mesh networks like OLSR).

This patch should correct the bug which was reported by Elektra in that wiki, too. Elektra, can you please test it?
http://wiki.villagetelco.org/index.php/Information_about_cell-id_splitting%2C_stuck_beacons%2C_and_failed_IBSS_merges!#The_phenomenon_of_IBSS-ID_cell_splits

Regards
Alina

-- 
Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a

[-- Attachment #2: mac80211-setbssid.patch --]
[-- Type: text/x-patch, Size: 2387 bytes --]

diff -urN compat-wireless-2008-12-29.orig/net/mac80211/mlme.c compat-wireless-2008-12-29/net/mac80211/mlme.c
--- compat-wireless-2008-12-29.orig/net/mac80211/mlme.c	2008-12-29 06:14:35.000000000 +0100
+++ compat-wireless-2008-12-29/net/mac80211/mlme.c	2008-12-30 03:18:12.000000000 +0100
@@ -1660,6 +1660,7 @@
 
 	/* check if we need to merge IBSS */
 	if (sdata->vif.type == NL80211_IFTYPE_ADHOC && beacon &&
+	    (!(sdata->u.sta.flags & IEEE80211_STA_BSSID_SET)) &&
 	    bss->capability & WLAN_CAPABILITY_IBSS &&
 	    bss->freq == local->oper_channel->center_freq &&
 	    elems->ssid_len == sdata->u.sta.ssid_len &&
@@ -1706,13 +1707,15 @@
 		       jiffies);
 #endif /* CONFIG_MAC80211_IBSS_DEBUG */
 		if (beacon_timestamp > rx_timestamp) {
+			if (memcmp(sdata->u.sta.bssid, mgmt->bssid, ETH_ALEN) != 0) {
 #ifdef CONFIG_MAC80211_IBSS_DEBUG
-			printk(KERN_DEBUG "%s: beacon TSF higher than "
-			       "local TSF - IBSS merge with BSSID %s\n",
-			       sdata->dev->name, print_mac(mac, mgmt->bssid));
+				printk(KERN_DEBUG "%s: beacon TSF higher than "
+				       "local TSF - IBSS merge with BSSID %s\n",
+				       sdata->dev->name, print_mac(mac, mgmt->bssid));
 #endif
-			ieee80211_sta_join_ibss(sdata, &sdata->u.sta, bss);
-			ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, supp_rates);
+				ieee80211_sta_join_ibss(sdata, &sdata->u.sta, bss);
+				ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, supp_rates);
+			}
 		}
 	}
 
@@ -2031,6 +2034,9 @@
 	if (ieee80211_sta_active_ibss(sdata))
 		return;
 
+	if (sdata->u.sta.flags & IEEE80211_STA_BSSID_SET)
+		return;
+
 	printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other "
 	       "IBSS networks with same SSID (merge)\n", sdata->dev->name);
 	ieee80211_request_scan(sdata, ifsta->ssid, ifsta->ssid_len);
@@ -2576,11 +2582,14 @@
 {
 	struct ieee80211_if_sta *ifsta;
 	int res;
+	int valid;
 
 	ifsta = &sdata->u.sta;
+	valid = is_valid_ether_addr(bssid);
 
 	if (memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) {
-		memcpy(ifsta->bssid, bssid, ETH_ALEN);
+		if(valid) memcpy(ifsta->bssid, bssid, ETH_ALEN);
+		else memset(ifsta->bssid, 0, ETH_ALEN);
 		res = 0;
 		/*
 		 * Hack! See also ieee80211_sta_set_ssid.
@@ -2594,7 +2603,7 @@
 		}
 	}
 
-	if (is_valid_ether_addr(bssid))
+	if (valid)
 		ifsta->flags |= IEEE80211_STA_BSSID_SET;
 	else
 		ifsta->flags &= ~IEEE80211_STA_BSSID_SET;

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

* Re: mac80211 (ath9k, ath5k, etc.) set BSSID Patch
  2008-12-30  2:56 mac80211 (ath9k, ath5k, etc.) set BSSID Patch Alina Friedrichsen
@ 2008-12-30 10:39 ` Johannes Berg
  2008-12-30 22:36   ` Alina Friedrichsen
  2008-12-30 11:37 ` mac80211 (ath9k, ath5k, etc.) set BSSID Patch Jouni Malinen
  1 sibling, 1 reply; 11+ messages in thread
From: Johannes Berg @ 2008-12-30 10:39 UTC (permalink / raw)
  To: Alina Friedrichsen; +Cc: berlin, linux-wireless, openwrt-devel, Vladimir Koutny

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

Hi Alina,

>  #endif /* CONFIG_MAC80211_IBSS_DEBUG */
>                 if (beacon_timestamp > rx_timestamp) {
> +                       if (memcmp(sdata->u.sta.bssid, mgmt->bssid, ETH_ALEN) != 0) {
>  #ifdef CONFIG_MAC80211_IBSS_DEBUG
> -                       printk(KERN_DEBUG "%s: beacon TSF higher than "
> -                              "local TSF - IBSS merge with BSSID %s\n",
> -                              sdata->dev->name, print_mac(mac, mgmt->bssid));
> +                               printk(KERN_DEBUG "%s: beacon TSF higher than "
> +                                      "local TSF - IBSS merge with BSSID %s\n",
> +                                      sdata->dev->name, print_mac(mac, mgmt->bssid));
>  #endif
> -                       ieee80211_sta_join_ibss(sdata, &sdata->u.sta, bss);
> -                       ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, supp_rates);
> +                               ieee80211_sta_join_ibss(sdata, &sdata->u.sta, bss);
> +                               ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, supp_rates);
> +                       }
>                 }

Can you move the memcmp() into the other condition to avoid indenting
twice please? Also, it seems there needs to be a STA_BSSID_SET exclusion
somewhere above to avoid doing merges?

> @@ -2576,11 +2582,14 @@
>  {
>         struct ieee80211_if_sta *ifsta;
>         int res;
> +       int valid;

please use a bool for that
 
>         ifsta = &sdata->u.sta;
> +       valid = is_valid_ether_addr(bssid);
>  
>         if (memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) {
> -               memcpy(ifsta->bssid, bssid, ETH_ALEN);
> +               if(valid) memcpy(ifsta->bssid, bssid, ETH_ALEN);
> +               else memset(ifsta->bssid, 0, ETH_ALEN);
>                 res = 0;

and indent these properly

I won't comment on the actual code right now, the IBSS code is pretty
much unknown to me and I don't use it.

johannes

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

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

* Re: mac80211 (ath9k, ath5k, etc.) set BSSID Patch
  2008-12-30  2:56 mac80211 (ath9k, ath5k, etc.) set BSSID Patch Alina Friedrichsen
  2008-12-30 10:39 ` Johannes Berg
@ 2008-12-30 11:37 ` Jouni Malinen
  2008-12-30 16:15   ` Alina Friedrichsen
  1 sibling, 1 reply; 11+ messages in thread
From: Jouni Malinen @ 2008-12-30 11:37 UTC (permalink / raw)
  To: Alina Friedrichsen; +Cc: berlin, linux-wireless, openwrt-devel

On Tue, Dec 30, 2008 at 03:56:51AM +0100, Alina Friedrichsen wrote:

> this patch corrects some bugs of the mac80211 wireless driver framework related to setting a static BSSID in the ad-hoc mode (e.g. for mesh networks like OLSR).

This is not how IEEE 802.11 IBSS is supposed to work. If there are
issues in IBSS splits, merges, or timesync, I would consider fixes to
those to be preferred over hacks that hide the issues and cause
interoperability issues with standard compliant IBSS implementations.

Anyway, since I don't really care that much about IBSS to actually start
using lots of time to fix problems there, I would not object to this
type of change as long it does not change the default behavior (i.e., by
default, mac80211 should operate in standard compliant manner) and the
users are not mislead to enable such a hack while still believing that
their devices are operating in a standard IBSS.

-- 
Jouni Malinen                                            PGP id EFC895FA

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

* Re: mac80211 (ath9k, ath5k, etc.) set BSSID Patch
  2008-12-30 11:37 ` mac80211 (ath9k, ath5k, etc.) set BSSID Patch Jouni Malinen
@ 2008-12-30 16:15   ` Alina Friedrichsen
  2008-12-30 16:56     ` Jouni Malinen
  0 siblings, 1 reply; 11+ messages in thread
From: Alina Friedrichsen @ 2008-12-30 16:15 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: openwrt-devel, linux-wireless, berlin

Hello Jouni!

> This is not how IEEE 802.11 IBSS is supposed to work. If there are
> issues in IBSS splits, merges, or timesync, I would consider fixes to
> those to be preferred over hacks that hide the issues and cause
> interoperability issues with standard compliant IBSS implementations.

This breaks nothing. I think if you set your BSSID manually, you really=
 don't want that the driver changed it back. If you want this behavior,=
 you don't set it.
Handle BSSID splits in a mile width city mesh network with 500 or more =
nodes is impossible in a other way, I think. The standard was never wri=
tten for that dimensions.

Besides it fixes a bug that driver want to try to merge with the same B=
SSID, which is unnecessary and causes problems.

See:
http://wiki.villagetelco.org/index.php/Information_about_cell-id_splitt=
ing%2C_stuck_beacons%2C_and_failed_IBSS_merges!#The_phenomenon_of_IBSS-=
ID_cell_splits

> Anyway, since I don't really care that much about IBSS

We need it much here in the "Freifunk" mesh network of Berlin.

> to actually start
> using lots of time to fix problems there, I would not object to this
> type of change as long it does not change the default behavior (i.e.,=
 by
> default, mac80211 should operate in standard compliant manner) and th=
e
> users are not mislead to enable such a hack while still believing tha=
t
> their devices are operating in a standard IBSS.

ACK

Regards
Alina

--=20
Psssst! Schon vom neuen GMX MultiMessenger geh=F6rt? Der kann`s mit all=
en: http://www.gmx.net/de/go/multimessenger
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: mac80211 (ath9k, ath5k, etc.) set BSSID Patch
  2008-12-30 16:15   ` Alina Friedrichsen
@ 2008-12-30 16:56     ` Jouni Malinen
  2008-12-30 21:20       ` Alina Friedrichsen
  0 siblings, 1 reply; 11+ messages in thread
From: Jouni Malinen @ 2008-12-30 16:56 UTC (permalink / raw)
  To: Alina Friedrichsen; +Cc: openwrt-devel, linux-wireless, berlin

On Tue, Dec 30, 2008 at 05:15:39PM +0100, Alina Friedrichsen wrote:

> This breaks nothing. I think if you set your BSSID manually, you really don't want that the driver changed it back. If you want this behavior, you don't set it.

But it _does_ break interoperability with standard compliant IBSS
implementations if the forced BSSID means that the STA does not merge
with another part of the IBSS when this should happen by the STA
changing its BSSID to match with the other part. If you do not want the
code behave as described for IBSS, use something else than IBSS..

> Handle BSSID splits in a mile width city mesh network with 500 or more nodes is impossible in a other way, I think. The standard was never written for that dimensions.

Agreed, but we should not claim that the behavior with hardcoded BSSID
would be standard IBSS. It is something different and we should not
confuse users by calling it the same. I would have nothing against
this type of optional feature if it were called something else than IBSS
(or "adhoc" which iwconfig uses for IBSS).

> Besides it fixes a bug that driver want to try to merge with the same BSSID, which is unnecessary and causes problems.

If that fix is separate from the change that introduces hardcoding of
the BSSID, it would be better to bring that in as a separate patch.

-- 
Jouni Malinen                                            PGP id EFC895FA

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

* Re: mac80211 (ath9k, ath5k, etc.) set BSSID Patch
  2008-12-30 16:56     ` Jouni Malinen
@ 2008-12-30 21:20       ` Alina Friedrichsen
  0 siblings, 0 replies; 11+ messages in thread
From: Alina Friedrichsen @ 2008-12-30 21:20 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: berlin, linux-wireless, openwrt-devel

Hi Jouni!

> But it _does_ break interoperability with standard compliant IBSS
> implementations if the forced BSSID means that the STA does not merge
> with another part of the IBSS when this should happen by the STA
> changing its BSSID to match with the other part.

But in the practice this is not a bug, it's an optional feature and you=
 can mix nodes with fixed BSSID and nodes without, so that the backbone=
 nodes (routers) force the rather client nodes (e.g. notebooks) to use =
this BSSID, so that the mesh network don't break into many pieces. That=
 was happen many times before we use a fixed BSSID.

You don't need to use it, if you don't want it, but we must use it, or =
it will not work.

> Agreed, but we should not claim that the behavior with hardcoded BSSI=
D
> would be standard IBSS.

It's a little modified IBSS, that allow you to build bigger networks. N=
ot a huge change, that is completely incompatible with the standard.

> It is something different and we should not
> confuse users by calling it the same. I would have nothing against
> this type of optional feature if it were called something else than I=
BSS
> (or "adhoc" which iwconfig uses for IBSS).

I can call it Moonchild [0], if you want. ;)
I don't care on the name of it.

> If that fix is separate from the change that introduces hardcoding of
> the BSSID, it would be better to bring that in as a separate patch.

I don't introduce setting of a fixed BSSID with this patch, I only fix =
some bugs of the current implementation.

Regards
Alina

[0] The Neverending Story
--=20
Sensationsangebot verl=E4ngert: GMX FreeDSL - Telefonanschluss + DSL=20
f=FCr nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=3DOM.AD.PD003K1308T45=
69a
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: mac80211 (ath9k, ath5k, etc.) set BSSID Patch
  2008-12-30 10:39 ` Johannes Berg
@ 2008-12-30 22:36   ` Alina Friedrichsen
  2008-12-30 22:40     ` Johannes Berg
  0 siblings, 1 reply; 11+ messages in thread
From: Alina Friedrichsen @ 2008-12-30 22:36 UTC (permalink / raw)
  To: Johannes Berg; +Cc: openwrt-devel, linux-wireless, berlin

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

Hi Johannes,

thanks for your comments. I'm not so familiar with your coding style for now. Here is the revised patch.

> Can you move the memcmp() into the other condition to avoid indenting
> twice please?

Done.

> Also, it seems there needs to be a STA_BSSID_SET exclusion
> somewhere above to avoid doing merges?

Yes this function is even called if you set a fixed BSSID, where you don't want any merges. Done in line 1663.

> please use a bool for that

Yes, but the called function is written in the old C style before C99, so I think I should use the same type.

> static inline int is_valid_ether_addr(const u8 *addr)

> and indent these properly

Done.

> I won't comment on the actual code right now, the IBSS code is pretty
> much unknown to me and I don't use it.

You only need it for mesh networks.

Regards
Alina

-- 
Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a

[-- Attachment #2: mac80211-setbssid-1.patch --]
[-- Type: text/x-patch, Size: 1994 bytes --]

diff -urN compat-wireless-2008-12-29.orig/net/mac80211/mlme.c compat-wireless-2008-12-29/net/mac80211/mlme.c
--- compat-wireless-2008-12-29.orig/net/mac80211/mlme.c	2008-12-29 06:14:35.000000000 +0100
+++ compat-wireless-2008-12-29/net/mac80211/mlme.c	2008-12-30 23:08:08.000000000 +0100
@@ -1660,6 +1660,7 @@
 
 	/* check if we need to merge IBSS */
 	if (sdata->vif.type == NL80211_IFTYPE_ADHOC && beacon &&
+	    (!(sdata->u.sta.flags & IEEE80211_STA_BSSID_SET)) &&
 	    bss->capability & WLAN_CAPABILITY_IBSS &&
 	    bss->freq == local->oper_channel->center_freq &&
 	    elems->ssid_len == sdata->u.sta.ssid_len &&
@@ -1705,7 +1706,8 @@
 		       (unsigned long long)(rx_timestamp - beacon_timestamp),
 		       jiffies);
 #endif /* CONFIG_MAC80211_IBSS_DEBUG */
-		if (beacon_timestamp > rx_timestamp) {
+		if (beacon_timestamp > rx_timestamp &&
+		    memcmp(sdata->u.sta.bssid, mgmt->bssid, ETH_ALEN) != 0) {
 #ifdef CONFIG_MAC80211_IBSS_DEBUG
 			printk(KERN_DEBUG "%s: beacon TSF higher than "
 			       "local TSF - IBSS merge with BSSID %s\n",
@@ -2031,6 +2033,9 @@
 	if (ieee80211_sta_active_ibss(sdata))
 		return;
 
+	if (sdata->u.sta.flags & IEEE80211_STA_BSSID_SET)
+		return;
+
 	printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other "
 	       "IBSS networks with same SSID (merge)\n", sdata->dev->name);
 	ieee80211_request_scan(sdata, ifsta->ssid, ifsta->ssid_len);
@@ -2576,11 +2581,16 @@
 {
 	struct ieee80211_if_sta *ifsta;
 	int res;
+	int valid;
 
 	ifsta = &sdata->u.sta;
+	valid = is_valid_ether_addr(bssid);
 
 	if (memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) {
-		memcpy(ifsta->bssid, bssid, ETH_ALEN);
+		if(valid)
+			memcpy(ifsta->bssid, bssid, ETH_ALEN);
+		else
+			memset(ifsta->bssid, 0, ETH_ALEN);
 		res = 0;
 		/*
 		 * Hack! See also ieee80211_sta_set_ssid.
@@ -2594,7 +2604,7 @@
 		}
 	}
 
-	if (is_valid_ether_addr(bssid))
+	if (valid)
 		ifsta->flags |= IEEE80211_STA_BSSID_SET;
 	else
 		ifsta->flags &= ~IEEE80211_STA_BSSID_SET;

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

* Re: mac80211 (ath9k, ath5k, etc.) set BSSID Patch
  2008-12-30 22:36   ` Alina Friedrichsen
@ 2008-12-30 22:40     ` Johannes Berg
  2008-12-30 23:07       ` Alina Friedrichsen
  0 siblings, 1 reply; 11+ messages in thread
From: Johannes Berg @ 2008-12-30 22:40 UTC (permalink / raw)
  To: Alina Friedrichsen; +Cc: openwrt-devel, linux-wireless, berlin

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

Hi Alina,

> > please use a bool for that
> 
> Yes, but the called function is written in the old C style before C99, so I think I should use the same type.

I disagree, even if the function doesn't use the proper types
pervasively, we shouldn't be adding old-style stuff.

What Jouni pointed out still stands, you should separate the bugfix and
the 'disregard ibss join' feature into two patches.

johannes

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

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

* Re: mac80211 (ath9k, ath5k, etc.) set BSSID Patch
  2008-12-30 22:40     ` Johannes Berg
@ 2008-12-30 23:07       ` Alina Friedrichsen
  2009-01-01 22:41         ` mac80211 (ath9k, ath5k, etc.) set fixed BSSID + channel Patch Alina Friedrichsen
  0 siblings, 1 reply; 11+ messages in thread
From: Alina Friedrichsen @ 2008-12-30 23:07 UTC (permalink / raw)
  To: Johannes Berg; +Cc: openwrt-devel, linux-wireless, berlin

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

Hi Johannes!

> I disagree, even if the function doesn't use the proper types
> pervasively, we shouldn't be adding old-style stuff.

Okay, I can use bool to if you want, too.

> What Jouni pointed out still stands, you should separate the bugfix and
> the 'disregard ibss join' feature into two patches.

As I say, the "the 'disregard ibss join' feature" is already implemented only not complete. If you want a driver, that do in some situations merges and some others don't, you can easily remove the line 1663. But I think it would nice, if the main driver implement it properly, not half.

For now we can only use the madwifi and an awful hacked proprietary 2.4er kernel broadcom driver for it. It would nice to have a clean free software implementation for it.

Regards
Alina

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

[-- Attachment #2: mac80211-setbssid-2.patch --]
[-- Type: text/x-patch, Size: 1995 bytes --]

diff -urN compat-wireless-2008-12-29.orig/net/mac80211/mlme.c compat-wireless-2008-12-29/net/mac80211/mlme.c
--- compat-wireless-2008-12-29.orig/net/mac80211/mlme.c	2008-12-29 06:14:35.000000000 +0100
+++ compat-wireless-2008-12-29/net/mac80211/mlme.c	2008-12-30 23:08:08.000000000 +0100
@@ -1660,6 +1660,7 @@
 
 	/* check if we need to merge IBSS */
 	if (sdata->vif.type == NL80211_IFTYPE_ADHOC && beacon &&
+	    (!(sdata->u.sta.flags & IEEE80211_STA_BSSID_SET)) &&
 	    bss->capability & WLAN_CAPABILITY_IBSS &&
 	    bss->freq == local->oper_channel->center_freq &&
 	    elems->ssid_len == sdata->u.sta.ssid_len &&
@@ -1705,7 +1706,8 @@
 		       (unsigned long long)(rx_timestamp - beacon_timestamp),
 		       jiffies);
 #endif /* CONFIG_MAC80211_IBSS_DEBUG */
-		if (beacon_timestamp > rx_timestamp) {
+		if (beacon_timestamp > rx_timestamp &&
+		    memcmp(sdata->u.sta.bssid, mgmt->bssid, ETH_ALEN) != 0) {
 #ifdef CONFIG_MAC80211_IBSS_DEBUG
 			printk(KERN_DEBUG "%s: beacon TSF higher than "
 			       "local TSF - IBSS merge with BSSID %s\n",
@@ -2031,6 +2033,9 @@
 	if (ieee80211_sta_active_ibss(sdata))
 		return;
 
+	if (sdata->u.sta.flags & IEEE80211_STA_BSSID_SET)
+		return;
+
 	printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other "
 	       "IBSS networks with same SSID (merge)\n", sdata->dev->name);
 	ieee80211_request_scan(sdata, ifsta->ssid, ifsta->ssid_len);
@@ -2576,11 +2581,16 @@
 {
 	struct ieee80211_if_sta *ifsta;
 	int res;
+	bool valid;
 
 	ifsta = &sdata->u.sta;
+	valid = is_valid_ether_addr(bssid);
 
 	if (memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) {
-		memcpy(ifsta->bssid, bssid, ETH_ALEN);
+		if(valid)
+			memcpy(ifsta->bssid, bssid, ETH_ALEN);
+		else
+			memset(ifsta->bssid, 0, ETH_ALEN);
 		res = 0;
 		/*
 		 * Hack! See also ieee80211_sta_set_ssid.
@@ -2594,7 +2604,7 @@
 		}
 	}
 
-	if (is_valid_ether_addr(bssid))
+	if (valid)
 		ifsta->flags |= IEEE80211_STA_BSSID_SET;
 	else
 		ifsta->flags &= ~IEEE80211_STA_BSSID_SET;

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

* Re: mac80211 (ath9k, ath5k, etc.) set fixed BSSID + channel Patch
  2008-12-30 23:07       ` Alina Friedrichsen
@ 2009-01-01 22:41         ` Alina Friedrichsen
  2009-01-02 14:29           ` Johannes Berg
  0 siblings, 1 reply; 11+ messages in thread
From: Alina Friedrichsen @ 2009-01-01 22:41 UTC (permalink / raw)
  To: Alina Friedrichsen, johannes; +Cc: berlin, linux-wireless, openwrt-devel

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

Hello,

here is a new version of this patch, that fixes a bug that manual channel setting in the ad-hoc (IBSS) mode doesn't work properly, too.

It would nice, if it can be committed, before it's out of sync.

Regards
Alina

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

[-- Attachment #2: mac80211-setbssid-3.patch --]
[-- Type: text/x-patch, Size: 2999 bytes --]

diff -urN compat-wireless-2008-12-29.orig/net/mac80211/mlme.c compat-wireless-2008-12-29/net/mac80211/mlme.c
--- compat-wireless-2008-12-29.orig/net/mac80211/mlme.c	2008-12-29 06:14:35.000000000 +0100
+++ compat-wireless-2008-12-29/net/mac80211/mlme.c	2009-01-01 23:32:46.000000000 +0100
@@ -1660,6 +1660,7 @@
 
 	/* check if we need to merge IBSS */
 	if (sdata->vif.type == NL80211_IFTYPE_ADHOC && beacon &&
+	    (!(sdata->u.sta.flags & IEEE80211_STA_BSSID_SET)) &&
 	    bss->capability & WLAN_CAPABILITY_IBSS &&
 	    bss->freq == local->oper_channel->center_freq &&
 	    elems->ssid_len == sdata->u.sta.ssid_len &&
@@ -1705,7 +1706,8 @@
 		       (unsigned long long)(rx_timestamp - beacon_timestamp),
 		       jiffies);
 #endif /* CONFIG_MAC80211_IBSS_DEBUG */
-		if (beacon_timestamp > rx_timestamp) {
+		if (beacon_timestamp > rx_timestamp &&
+		    memcmp(sdata->u.sta.bssid, mgmt->bssid, ETH_ALEN) != 0) {
 #ifdef CONFIG_MAC80211_IBSS_DEBUG
 			printk(KERN_DEBUG "%s: beacon TSF higher than "
 			       "local TSF - IBSS merge with BSSID %s\n",
@@ -2031,6 +2033,10 @@
 	if (ieee80211_sta_active_ibss(sdata))
 		return;
 
+	if ((sdata->u.sta.flags & IEEE80211_STA_BSSID_SET) &&
+	    (!(sdata->u.sta.flags & IEEE80211_STA_AUTO_CHANNEL_SEL)))
+		return;
+
 	printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other "
 	       "IBSS networks with same SSID (merge)\n", sdata->dev->name);
 	ieee80211_request_scan(sdata, ifsta->ssid, ifsta->ssid_len);
@@ -2576,11 +2582,16 @@
 {
 	struct ieee80211_if_sta *ifsta;
 	int res;
+	bool valid;
 
 	ifsta = &sdata->u.sta;
+	valid = is_valid_ether_addr(bssid);
 
 	if (memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) {
-		memcpy(ifsta->bssid, bssid, ETH_ALEN);
+		if(valid)
+			memcpy(ifsta->bssid, bssid, ETH_ALEN);
+		else
+			memset(ifsta->bssid, 0, ETH_ALEN);
 		res = 0;
 		/*
 		 * Hack! See also ieee80211_sta_set_ssid.
@@ -2594,7 +2605,7 @@
 		}
 	}
 
-	if (is_valid_ether_addr(bssid))
+	if (valid)
 		ifsta->flags |= IEEE80211_STA_BSSID_SET;
 	else
 		ifsta->flags &= ~IEEE80211_STA_BSSID_SET;
diff -urN compat-wireless-2008-12-29.orig/net/mac80211/wext.c compat-wireless-2008-12-29/net/mac80211/wext.c
--- compat-wireless-2008-12-29.orig/net/mac80211/wext.c	2008-12-29 06:14:35.000000000 +0100
+++ compat-wireless-2008-12-29/net/mac80211/wext.c	2009-01-01 23:07:55.000000000 +0100
@@ -230,13 +230,15 @@
 {
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
-	if (sdata->vif.type == NL80211_IFTYPE_STATION)
+	if (sdata->vif.type == NL80211_IFTYPE_ADHOC ||
+	    sdata->vif.type == NL80211_IFTYPE_STATION)
 		sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL;
 
 	/* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
 	if (freq->e == 0) {
 		if (freq->m < 0) {
-			if (sdata->vif.type == NL80211_IFTYPE_STATION)
+			if (sdata->vif.type == NL80211_IFTYPE_ADHOC ||
+			    sdata->vif.type == NL80211_IFTYPE_STATION)
 				sdata->u.sta.flags |=
 					IEEE80211_STA_AUTO_CHANNEL_SEL;
 			return 0;

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

* Re: mac80211 (ath9k, ath5k, etc.) set fixed BSSID + channel Patch
  2009-01-01 22:41         ` mac80211 (ath9k, ath5k, etc.) set fixed BSSID + channel Patch Alina Friedrichsen
@ 2009-01-02 14:29           ` Johannes Berg
  0 siblings, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2009-01-02 14:29 UTC (permalink / raw)
  To: Alina Friedrichsen; +Cc: berlin, linux-wireless

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

[dropping openwrt list, it ignores non-subscribers anyway]

On Thu, 2009-01-01 at 23:41 +0100, Alina Friedrichsen wrote:
> Hello,
> 
> here is a new version of this patch, that fixes a bug that manual
> channel setting in the ad-hoc (IBSS) mode doesn't work properly, too.
> 
> It would nice, if it can be committed, before it's out of sync.

You need to provide a proper changelog that explains the changes, a
proper subject (don't mention any drivers) and a signed-off-by, see
http://wireless.kernel.org/en/developers/Documentation/SubmittingPatches
please.

johannes

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

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

end of thread, other threads:[~2009-01-02 14:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-30  2:56 mac80211 (ath9k, ath5k, etc.) set BSSID Patch Alina Friedrichsen
2008-12-30 10:39 ` Johannes Berg
2008-12-30 22:36   ` Alina Friedrichsen
2008-12-30 22:40     ` Johannes Berg
2008-12-30 23:07       ` Alina Friedrichsen
2009-01-01 22:41         ` mac80211 (ath9k, ath5k, etc.) set fixed BSSID + channel Patch Alina Friedrichsen
2009-01-02 14:29           ` Johannes Berg
2008-12-30 11:37 ` mac80211 (ath9k, ath5k, etc.) set BSSID Patch Jouni Malinen
2008-12-30 16:15   ` Alina Friedrichsen
2008-12-30 16:56     ` Jouni Malinen
2008-12-30 21:20       ` Alina Friedrichsen

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