diff options
author | Daniel Drake <dsd@gentoo.org> | 2008-07-19 23:31:17 +0100 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-04 15:09:10 -0400 |
commit | 80693ceb78b08baa3b66a900d9225b2cf9c6f0ed (patch) | |
tree | fb1a3060d10cb05affc2990b1eeb866172ccf8a5 /net | |
parent | b5d7be5e665f29274cfe6645b661acb38cb1d19b (diff) | |
download | blackbird-op-linux-80693ceb78b08baa3b66a900d9225b2cf9c6f0ed.tar.gz blackbird-op-linux-80693ceb78b08baa3b66a900d9225b2cf9c6f0ed.zip |
mac80211: automatic IBSS channel selection
When joining an ad-hoc network, the user is currently required to specify
the channel. The network will not be joined otherwise, unless it happens
to be sitting on the currently active channel.
This patch implements automatic channel selection when the user has not
locked the interface onto a specific channel.
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/mlme.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 779affd8b8fe..5358420d8796 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -3663,11 +3663,21 @@ static int ieee80211_sta_find_ibss(struct net_device *dev, "%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, - local->hw.conf.channel->center_freq, - ifsta->ssid, ifsta->ssid_len))) { + + if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { int ret; + int search_freq; + + if (ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL) + search_freq = bss->freq; + else + search_freq = local->hw.conf.channel->center_freq; + + bss = ieee80211_rx_bss_get(dev, bssid, search_freq, + ifsta->ssid, ifsta->ssid_len); + if (!bss) + goto dont_join; + printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" " based on configured SSID\n", dev->name, print_mac(mac, bssid)); @@ -3675,6 +3685,8 @@ static int ieee80211_sta_find_ibss(struct net_device *dev, ieee80211_rx_bss_put(local, bss); return ret; } + +dont_join: #ifdef CONFIG_MAC80211_IBSS_DEBUG printk(KERN_DEBUG " did not try to join ibss\n"); #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |