* [PATCH 2.6.30] mac80211: fix managed mode BSSID handling
@ 2009-05-14 11:10 Johannes Berg
2009-05-18 19:20 ` [PATCH] " John W. Linville
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2009-05-14 11:10 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, Marcel Holtmann, Guy, Wey-Yi W
Currently, we will ask the driver to configure right away
when somebody changes the desired BSSID. That's totally
strange because then we will configure the driver without
even knowing whether the BSS exists. Change this to only
configure the BSSID when associated, and configure a zero
BSSID when not associated.
As a side effect, this fixes an issue with the iwlwifi
driver which doesn't implement sta_notify properly and
uses the BSSID instead and gets very confused if the
BSSID is cleared before we disassociate, which results
in the warning Marcel posted [1] and iwlwifi bug 1995 [2].
[1] http://thread.gmane.org/gmane.linux.kernel.wireless.general/32598
[2] http://www.intellinuxwireless.org/bugzilla/show_bug.cgi?id=1995
Cc: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
net/mac80211/main.c | 16 ++++++++++++----
net/mac80211/mlme.c | 10 +++++++---
2 files changed, 19 insertions(+), 7 deletions(-)
--- wireless-testing.orig/net/mac80211/mlme.c 2009-05-14 11:38:42.000000000 +0200
+++ wireless-testing/net/mac80211/mlme.c 2009-05-14 12:39:57.000000000 +0200
@@ -865,6 +865,10 @@ static void ieee80211_set_associated(str
* changed or not.
*/
bss_info_changed |= BSS_CHANGED_BASIC_RATES;
+
+ /* And the BSSID changed - we're associated now */
+ bss_info_changed |= BSS_CHANGED_BSSID;
+
ieee80211_bss_info_change_notify(sdata, bss_info_changed);
/* will be same as sdata */
@@ -1064,6 +1068,9 @@ static void ieee80211_set_disassoc(struc
}
ieee80211_hw_config(local, config_changed);
+
+ /* And the BSSID changed -- not very interesting here */
+ changed |= BSS_CHANGED_BSSID;
ieee80211_bss_info_change_notify(sdata, changed);
rcu_read_lock();
@@ -2310,9 +2317,6 @@ int ieee80211_sta_set_bssid(struct ieee8
ifmgd->flags &= ~IEEE80211_STA_BSSID_SET;
}
- if (netif_running(sdata->dev))
- ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BSSID);
-
return ieee80211_sta_commit(sdata);
}
--- wireless-testing.orig/net/mac80211/main.c 2009-05-14 12:40:44.000000000 +0200
+++ wireless-testing/net/mac80211/main.c 2009-05-14 12:54:23.000000000 +0200
@@ -219,18 +219,26 @@ void ieee80211_bss_info_change_notify(st
u32 changed)
{
struct ieee80211_local *local = sdata->local;
+ static const u8 zero[ETH_ALEN] = { 0 };
if (!changed)
return;
- if (sdata->vif.type == NL80211_IFTYPE_STATION)
- sdata->vif.bss_conf.bssid = sdata->u.mgd.bssid;
- else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
+ if (sdata->vif.type == NL80211_IFTYPE_STATION) {
+ /*
+ * While not associated, claim a BSSID of all-zeroes
+ * so that drivers don't do any weird things with the
+ * BSSID at that time.
+ */
+ if (sdata->vif.bss_conf.assoc)
+ sdata->vif.bss_conf.bssid = sdata->u.mgd.bssid;
+ else
+ sdata->vif.bss_conf.bssid = zero;
+ } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
sdata->vif.bss_conf.bssid = sdata->u.ibss.bssid;
else if (sdata->vif.type == NL80211_IFTYPE_AP)
sdata->vif.bss_conf.bssid = sdata->dev->dev_addr;
else if (ieee80211_vif_is_mesh(&sdata->vif)) {
- static const u8 zero[ETH_ALEN] = { 0 };
sdata->vif.bss_conf.bssid = zero;
} else {
WARN_ON(1);
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH] mac80211: fix managed mode BSSID handling
2009-05-14 11:10 [PATCH 2.6.30] mac80211: fix managed mode BSSID handling Johannes Berg
@ 2009-05-18 19:20 ` John W. Linville
2009-05-19 8:33 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: John W. Linville @ 2009-05-18 19:20 UTC (permalink / raw)
To: linux-wireless
Cc: Wey-Yi W Guy, Johannes Berg, Marcel Holtmann, John W. Linville
From: Johannes Berg <johannes@sipsolutions.net>
Currently, we will ask the driver to configure right away
when somebody changes the desired BSSID. That's totally
strange because then we will configure the driver without
even knowing whether the BSS exists. Change this to only
configure the BSSID when associated, and configure a zero
BSSID when not associated.
As a side effect, this fixes an issue with the iwlwifi
driver which doesn't implement sta_notify properly and
uses the BSSID instead and gets very confused if the
BSSID is cleared before we disassociate, which results
in the warning Marcel posted [1] and iwlwifi bug 1995 [2].
[1] http://thread.gmane.org/gmane.linux.kernel.wireless.general/32598
[2] http://www.intellinuxwireless.org/bugzilla/show_bug.cgi?id=1995
Cc: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
Did not apply to 2.6.30-rc6 as posted -- please verify my fix-up!
net/mac80211/main.c | 16 ++++++++++++----
net/mac80211/mlme.c | 14 +++++++-------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 1413419..346c25e 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -157,20 +157,28 @@ int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed)
{
struct ieee80211_local *local = sdata->local;
struct ieee80211_if_conf conf;
+ static const u8 zero[ETH_ALEN] = { 0 };
if (WARN_ON(!netif_running(sdata->dev)))
return 0;
memset(&conf, 0, sizeof(conf));
- if (sdata->vif.type == NL80211_IFTYPE_STATION)
- conf.bssid = sdata->u.mgd.bssid;
- else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
+ if (sdata->vif.type == NL80211_IFTYPE_STATION) {
+ /*
+ * While not associated, claim a BSSID of all-zeroes
+ * so that drivers don't do any weird things with the
+ * BSSID at that time.
+ */
+ if (sdata->vif.bss_conf.assoc)
+ sdata->vif.bss_conf.bssid = sdata->u.mgd.bssid;
+ else
+ sdata->vif.bss_conf.bssid = zero;
+ } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
conf.bssid = sdata->u.ibss.bssid;
else if (sdata->vif.type == NL80211_IFTYPE_AP)
conf.bssid = sdata->dev->dev_addr;
else if (ieee80211_vif_is_mesh(&sdata->vif)) {
- static const u8 zero[ETH_ALEN] = { 0 };
conf.bssid = zero;
} else {
WARN_ON(1);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 132938b..61ade8d 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -632,6 +632,10 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
* changed or not.
*/
bss_info_changed |= BSS_CHANGED_BASIC_RATES;
+
+ /* And the BSSID changed - we're associated now */
+ bss_info_changed |= BSS_CHANGED_BSSID;
+
ieee80211_bss_info_change_notify(sdata, bss_info_changed);
if (local->powersave) {
@@ -831,6 +835,9 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
}
ieee80211_hw_config(local, config_changed);
+
+ /* And the BSSID changed -- not very interesting here */
+ changed |= BSS_CHANGED_BSSID;
ieee80211_bss_info_change_notify(sdata, changed);
rcu_read_lock();
@@ -2032,13 +2039,6 @@ int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid)
ifmgd->flags &= ~IEEE80211_STA_BSSID_SET;
}
- if (netif_running(sdata->dev)) {
- if (ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID)) {
- printk(KERN_DEBUG "%s: Failed to config new BSSID to "
- "the low-level driver\n", sdata->dev->name);
- }
- }
-
return ieee80211_sta_commit(sdata);
}
--
1.6.0.6
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] mac80211: fix managed mode BSSID handling
2009-05-18 19:20 ` [PATCH] " John W. Linville
@ 2009-05-19 8:33 ` Johannes Berg
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2009-05-19 8:33 UTC (permalink / raw)
To: John W. Linville; +Cc: linux-wireless, Wey-Yi W Guy, Marcel Holtmann
[-- Attachment #1: Type: text/plain, Size: 1456 bytes --]
On Mon, 2009-05-18 at 15:20 -0400, John W. Linville wrote:
> --- a/net/mac80211/main.c
> +++ b/net/mac80211/main.c
> @@ -157,20 +157,28 @@ int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed)
> {
> struct ieee80211_local *local = sdata->local;
> struct ieee80211_if_conf conf;
> + static const u8 zero[ETH_ALEN] = { 0 };
>
> if (WARN_ON(!netif_running(sdata->dev)))
> return 0;
>
> memset(&conf, 0, sizeof(conf));
>
> - if (sdata->vif.type == NL80211_IFTYPE_STATION)
> - conf.bssid = sdata->u.mgd.bssid;
> - else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
> + if (sdata->vif.type == NL80211_IFTYPE_STATION) {
> + /*
> + * While not associated, claim a BSSID of all-zeroes
> + * so that drivers don't do any weird things with the
> + * BSSID at that time.
> + */
> + if (sdata->vif.bss_conf.assoc)
> + sdata->vif.bss_conf.bssid = sdata->u.mgd.bssid;
> + else
> + sdata->vif.bss_conf.bssid = zero;
> + } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
> conf.bssid = sdata->u.ibss.bssid;
> else if (sdata->vif.type == NL80211_IFTYPE_AP)
> conf.bssid = sdata->dev->dev_addr;
> else if (ieee80211_vif_is_mesh(&sdata->vif)) {
> - static const u8 zero[ETH_ALEN] = { 0 };
> conf.bssid = zero;
> } else {
> WARN_ON(1);
Yes, this looks correct, thanks. The difference is just due to the
config_interface vs. bss_info_changed change.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-05-19 8:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-14 11:10 [PATCH 2.6.30] mac80211: fix managed mode BSSID handling Johannes Berg
2009-05-18 19:20 ` [PATCH] " John W. Linville
2009-05-19 8:33 ` Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox