diff options
author | Daniel Drake <dsd@gentoo.org> | 2008-07-19 18:31:17 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-04 15:09:10 -0400 |
commit | 80693ceb78b08baa3b66a900d9225b2cf9c6f0ed (patch) | |
tree | fb1a3060d10cb05affc2990b1eeb866172ccf8a5 /net/mac80211 | |
parent | b5d7be5e665f29274cfe6645b661acb38cb1d19b (diff) |
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/mac80211')
-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 779affd8b8f..5358420d879 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, | |||
3663 | "%s\n", print_mac(mac, bssid), | 3663 | "%s\n", print_mac(mac, bssid), |
3664 | print_mac(mac2, ifsta->bssid)); | 3664 | print_mac(mac2, ifsta->bssid)); |
3665 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 3665 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |
3666 | if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 && | 3666 | |
3667 | (bss = ieee80211_rx_bss_get(dev, bssid, | 3667 | if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) { |
3668 | local->hw.conf.channel->center_freq, | ||
3669 | ifsta->ssid, ifsta->ssid_len))) { | ||
3670 | int ret; | 3668 | int ret; |
3669 | int search_freq; | ||
3670 | |||
3671 | if (ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL) | ||
3672 | search_freq = bss->freq; | ||
3673 | else | ||
3674 | search_freq = local->hw.conf.channel->center_freq; | ||
3675 | |||
3676 | bss = ieee80211_rx_bss_get(dev, bssid, search_freq, | ||
3677 | ifsta->ssid, ifsta->ssid_len); | ||
3678 | if (!bss) | ||
3679 | goto dont_join; | ||
3680 | |||
3671 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" | 3681 | printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" |
3672 | " based on configured SSID\n", | 3682 | " based on configured SSID\n", |
3673 | dev->name, print_mac(mac, bssid)); | 3683 | dev->name, print_mac(mac, bssid)); |
@@ -3675,6 +3685,8 @@ static int ieee80211_sta_find_ibss(struct net_device *dev, | |||
3675 | ieee80211_rx_bss_put(local, bss); | 3685 | ieee80211_rx_bss_put(local, bss); |
3676 | return ret; | 3686 | return ret; |
3677 | } | 3687 | } |
3688 | |||
3689 | dont_join: | ||
3678 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 3690 | #ifdef CONFIG_MAC80211_IBSS_DEBUG |
3679 | printk(KERN_DEBUG " did not try to join ibss\n"); | 3691 | printk(KERN_DEBUG " did not try to join ibss\n"); |
3680 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | 3692 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ |