* [PATCH] mac80211: fix alternating-BSSID issue in IBSS
@ 2008-07-01 14:48 Vladimir Koutny
2008-07-02 19:00 ` John W. Linville
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Koutny @ 2008-07-01 14:48 UTC (permalink / raw)
To: linux-wireless, bruno randolf, Johannes Berg, John W. Linville,
Jiri Benc
Due to the fact that we (still) keep old BSS information, we can end
up switching between 2 or more BSSIDs when in IBSS (these are the
BSSIDs of networks with the same name we've seen before, even if they
are not around anymore). This switching happens in 30sec intervals
(IBSS merge attempt when no active STAs are around).
This patch expires old BSS entries after IEEE80211_SCAN_RESULT_EXPIRE
seconds (the same time after it will not be reported in scan results)
when trying to merge.
Signed-off-by: Vladimir Koutny <vlado@ksp.sk>
---
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2b49852..b9ec4f6 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3276,12 +3276,32 @@ static void ieee80211_sta_expire(struct net_device *dev, unsigned long exp_time)
}
+static void ieee80211_bss_expire(struct net_device *dev, unsigned long exp_time)
+{
+ struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+ struct ieee80211_sta_bss *bss, *tmp;
+ DECLARE_MAC_BUF(mac);
+
+ spin_lock_bh(&local->sta_bss_lock);
+ list_for_each_entry_safe(bss, tmp, &local->sta_bss_list, list) {
+ if (time_after(jiffies, bss->last_update + exp_time)) {
+#ifdef CONFIG_MAC80211_IBSS_DEBUG
+ printk(KERN_DEBUG "%s: expiring inactive BSS %s\n",
+ dev->name, print_mac(mac, bss->bssid));
+#endif /* CONFIG_MAC80211_IBSS_DEBUG */
+ ieee80211_rx_bss_put(dev, bss);
+ }
+ }
+ spin_unlock_bh(&local->sta_bss_lock);
+}
+
static void ieee80211_sta_merge_ibss(struct net_device *dev,
struct ieee80211_if_sta *ifsta)
{
mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL);
ieee80211_sta_expire(dev, IEEE80211_IBSS_INACTIVITY_LIMIT);
+ ieee80211_bss_expire(dev, IEEE80211_SCAN_RESULT_EXPIRE);
if (ieee80211_sta_active_ibss(dev))
return;
@@ -3662,8 +3662,10 @@ static int ieee80211_sta_find_ibss(struct net_device *dev,
spin_unlock_bh(&local->sta_bss_lock);
#ifdef CONFIG_MAC80211_IBSS_DEBUG
- printk(KERN_DEBUG " sta_find_ibss: selected %s current "
- "%s\n", print_mac(mac, bssid), print_mac(mac2, ifsta->bssid));
+ if (found)
+ printk(KERN_DEBUG " sta_find_ibss: selected %s current "
+ "%s\n", print_mac(mac, bssid),
+ print_mac(mac2, ifsta->bssid));
#endif /* CONFIG_MAC80211_IBSS_DEBUG */
if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 &&
(bss = ieee80211_rx_bss_get(dev, bssid,
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] mac80211: fix alternating-BSSID issue in IBSS
2008-07-01 14:48 [PATCH] mac80211: fix alternating-BSSID issue in IBSS Vladimir Koutny
@ 2008-07-02 19:00 ` John W. Linville
2008-07-03 13:50 ` Vladimir Koutny
0 siblings, 1 reply; 3+ messages in thread
From: John W. Linville @ 2008-07-02 19:00 UTC (permalink / raw)
To: Vladimir Koutny; +Cc: linux-wireless, bruno randolf, Johannes Berg, Jiri Benc
On Tue, Jul 01, 2008 at 04:48:48PM +0200, Vladimir Koutny wrote:
> Due to the fact that we (still) keep old BSS information, we can end
> up switching between 2 or more BSSIDs when in IBSS (these are the
> BSSIDs of networks with the same name we've seen before, even if they
> are not around anymore). This switching happens in 30sec intervals
> (IBSS merge attempt when no active STAs are around).
>
> This patch expires old BSS entries after IEEE80211_SCAN_RESULT_EXPIRE
> seconds (the same time after it will not be reported in scan results)
> when trying to merge.
>
> Signed-off-by: Vladimir Koutny <vlado@ksp.sk>
This seems like a good thing to do, but the sta_bss_list is used in STA
mode too. Perhaps we should find a time to run ieee80211_bss_expire
in STA mode as well?
>
> ---
>
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 2b49852..b9ec4f6 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -3276,12 +3276,32 @@ static void ieee80211_sta_expire(struct net_device *dev, unsigned long exp_time)
> }
>
>
> +static void ieee80211_bss_expire(struct net_device *dev, unsigned long exp_time)
You probably want this positioned before (or
after?) ieee80211_rx_bss_free, and change the name to match.
> +{
> + struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
> + struct ieee80211_sta_bss *bss, *tmp;
> + DECLARE_MAC_BUF(mac);
> +
> + spin_lock_bh(&local->sta_bss_lock);
> + list_for_each_entry_safe(bss, tmp, &local->sta_bss_list, list) {
> + if (time_after(jiffies, bss->last_update + exp_time)) {
> +#ifdef CONFIG_MAC80211_IBSS_DEBUG
Since this hopefully won't be IBSS-specific, maybe use
MAC80211_VERBOSE_DEBUG instead?
> + printk(KERN_DEBUG "%s: expiring inactive BSS %s\n",
> + dev->name, print_mac(mac, bss->bssid));
> +#endif /* CONFIG_MAC80211_IBSS_DEBUG */
> + ieee80211_rx_bss_put(dev, bss);
> + }
> + }
> + spin_unlock_bh(&local->sta_bss_lock);
> +}
> +
> static void ieee80211_sta_merge_ibss(struct net_device *dev,
> struct ieee80211_if_sta *ifsta)
> {
> mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL);
>
> ieee80211_sta_expire(dev, IEEE80211_IBSS_INACTIVITY_LIMIT);
> + ieee80211_bss_expire(dev, IEEE80211_SCAN_RESULT_EXPIRE);
> if (ieee80211_sta_active_ibss(dev))
> return;
>
> @@ -3662,8 +3662,10 @@ static int ieee80211_sta_find_ibss(struct net_device *dev,
> spin_unlock_bh(&local->sta_bss_lock);
>
> #ifdef CONFIG_MAC80211_IBSS_DEBUG
> - printk(KERN_DEBUG " sta_find_ibss: selected %s current "
> - "%s\n", print_mac(mac, bssid), print_mac(mac2, ifsta->bssid));
> + if (found)
> + printk(KERN_DEBUG " sta_find_ibss: selected %s current "
> + "%s\n", print_mac(mac, bssid),
> + print_mac(mac2, ifsta->bssid));
> #endif /* CONFIG_MAC80211_IBSS_DEBUG */
> if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 &&
> (bss = ieee80211_rx_bss_get(dev, bssid,
Should the last hunk be a different patch?
John
--
John W. Linville
linville@tuxdriver.com
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] mac80211: fix alternating-BSSID issue in IBSS
2008-07-02 19:00 ` John W. Linville
@ 2008-07-03 13:50 ` Vladimir Koutny
0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Koutny @ 2008-07-03 13:50 UTC (permalink / raw)
To: John W. Linville; +Cc: linux-wireless, bruno randolf, Johannes Berg, Jiri Benc
[-- Attachment #1: Type: text/plain, Size: 2151 bytes --]
John W. Linville wrote:
> On Tue, Jul 01, 2008 at 04:48:48PM +0200, Vladimir Koutny wrote:
>> Due to the fact that we (still) keep old BSS information, we can end
>> up switching between 2 or more BSSIDs when in IBSS (these are the
>> BSSIDs of networks with the same name we've seen before, even if they
>> are not around anymore). This switching happens in 30sec intervals
>> (IBSS merge attempt when no active STAs are around).
>>
>> This patch expires old BSS entries after IEEE80211_SCAN_RESULT_EXPIRE
>> seconds (the same time after it will not be reported in scan results)
>> when trying to merge.
>>
>> Signed-off-by: Vladimir Koutny <vlado@ksp.sk>
>
> This seems like a good thing to do, but the sta_bss_list is used in STA
> mode too. Perhaps we should find a time to run ieee80211_bss_expire
> in STA mode as well?
Yes, probably. Any suggestions for a suitable place? (I'm not that
familiar with the code..) It should probably be done on some timer (and
probably also right before we try to associate?)..
>> +static void ieee80211_bss_expire(struct net_device *dev, unsigned long exp_time)
>
> You probably want this positioned before (or
> after?) ieee80211_rx_bss_free, and change the name to match.
OK, moved and renamed to ieee80211_rx_bss_expire.
>> @@ -3662,8 +3662,10 @@ static int ieee80211_sta_find_ibss(struct net_device *dev,
>> spin_unlock_bh(&local->sta_bss_lock);
>>
>> #ifdef CONFIG_MAC80211_IBSS_DEBUG
>> - printk(KERN_DEBUG " sta_find_ibss: selected %s current "
>> - "%s\n", print_mac(mac, bssid), print_mac(mac2, ifsta->bssid));
>> + if (found)
>> + printk(KERN_DEBUG " sta_find_ibss: selected %s current "
>> + "%s\n", print_mac(mac, bssid),
>> + print_mac(mac2, ifsta->bssid));
>> #endif /* CONFIG_MAC80211_IBSS_DEBUG */
>> if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 &&
>> (bss = ieee80211_rx_bss_get(dev, bssid,
>
> Should the last hunk be a different patch?
Oops - I've found this out at the same time I was doing the rest and
I kept it in the same patch.. I'll split this.
Vladimir
>
> John
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 378 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-03 13:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-01 14:48 [PATCH] mac80211: fix alternating-BSSID issue in IBSS Vladimir Koutny
2008-07-02 19:00 ` John W. Linville
2008-07-03 13:50 ` Vladimir Koutny
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).