diff options
author | Antonio Quartulli <antonio@open-mesh.com> | 2014-01-29 11:53:43 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-02-04 15:58:16 -0500 |
commit | fe94f3a4ffaa20c7470038c69ffc8e545ef5f90a (patch) | |
tree | a8056f9f9e74e30679bb4fc852dfe19bd680f51e /net/wireless | |
parent | 67235cbca44f082e9c4c2ed370f9afe5fc478d49 (diff) |
cfg80211: fix channel configuration in IBSS join
When receiving an IBSS_JOINED event select the BSS object
based on the {bssid, channel} couple rather than the bssid
only.
With the current approach if another cell having the same
BSSID (but using a different channel) exists then cfg80211
picks up the wrong BSS object.
The result is a mismatching channel configuration between
cfg80211 and the driver, that can lead to any sort of
problem.
The issue can be triggered by having an IBSS sitting on
given channel and then asking the driver to create a new
cell using the same BSSID but with a different frequency.
By passing the channel to cfg80211_get_bss() we can solve
this ambiguity and retrieve/create the correct BSS object.
All the users of cfg80211_ibss_joined() have been changed
accordingly.
Moreover WARN when cfg80211_ibss_joined() gets a NULL
channel as argument and remove a bogus call of the same
function in ath6kl (it does not make sense to call
cfg80211_ibss_joined() with a zero BSSID on ibss-leave).
Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: Arend van Spriel <arend@broadcom.com>
Cc: Bing Zhao <bzhao@marvell.com>
Cc: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Cc: libertas-dev@lists.infradead.org
Acked-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
[minor code cleanup in ath6kl]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/core.h | 4 | ||||
-rw-r--r-- | net/wireless/ibss.c | 17 | ||||
-rw-r--r-- | net/wireless/trace.h | 23 | ||||
-rw-r--r-- | net/wireless/util.c | 3 |
4 files changed, 34 insertions, 13 deletions
diff --git a/net/wireless/core.h b/net/wireless/core.h index 37ec16d7bb1a..8a820f9c4a76 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -210,6 +210,7 @@ struct cfg80211_event { | |||
210 | } dc; | 210 | } dc; |
211 | struct { | 211 | struct { |
212 | u8 bssid[ETH_ALEN]; | 212 | u8 bssid[ETH_ALEN]; |
213 | struct ieee80211_channel *channel; | ||
213 | } ij; | 214 | } ij; |
214 | }; | 215 | }; |
215 | }; | 216 | }; |
@@ -257,7 +258,8 @@ int __cfg80211_leave_ibss(struct cfg80211_registered_device *rdev, | |||
257 | struct net_device *dev, bool nowext); | 258 | struct net_device *dev, bool nowext); |
258 | int cfg80211_leave_ibss(struct cfg80211_registered_device *rdev, | 259 | int cfg80211_leave_ibss(struct cfg80211_registered_device *rdev, |
259 | struct net_device *dev, bool nowext); | 260 | struct net_device *dev, bool nowext); |
260 | void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid); | 261 | void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, |
262 | struct ieee80211_channel *channel); | ||
261 | int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, | 263 | int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, |
262 | struct wireless_dev *wdev); | 264 | struct wireless_dev *wdev); |
263 | 265 | ||
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c index f911c5f9f903..e37e39c29dfb 100644 --- a/net/wireless/ibss.c +++ b/net/wireless/ibss.c | |||
@@ -14,7 +14,8 @@ | |||
14 | #include "rdev-ops.h" | 14 | #include "rdev-ops.h" |
15 | 15 | ||
16 | 16 | ||
17 | void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid) | 17 | void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, |
18 | struct ieee80211_channel *channel) | ||
18 | { | 19 | { |
19 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 20 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
20 | struct cfg80211_bss *bss; | 21 | struct cfg80211_bss *bss; |
@@ -28,8 +29,7 @@ void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid) | |||
28 | if (!wdev->ssid_len) | 29 | if (!wdev->ssid_len) |
29 | return; | 30 | return; |
30 | 31 | ||
31 | bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid, | 32 | bss = cfg80211_get_bss(wdev->wiphy, channel, bssid, NULL, 0, |
32 | wdev->ssid, wdev->ssid_len, | ||
33 | WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); | 33 | WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); |
34 | 34 | ||
35 | if (WARN_ON(!bss)) | 35 | if (WARN_ON(!bss)) |
@@ -54,21 +54,26 @@ void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid) | |||
54 | #endif | 54 | #endif |
55 | } | 55 | } |
56 | 56 | ||
57 | void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp) | 57 | void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, |
58 | struct ieee80211_channel *channel, gfp_t gfp) | ||
58 | { | 59 | { |
59 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 60 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
60 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 61 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); |
61 | struct cfg80211_event *ev; | 62 | struct cfg80211_event *ev; |
62 | unsigned long flags; | 63 | unsigned long flags; |
63 | 64 | ||
64 | trace_cfg80211_ibss_joined(dev, bssid); | 65 | trace_cfg80211_ibss_joined(dev, bssid, channel); |
66 | |||
67 | if (WARN_ON(!channel)) | ||
68 | return; | ||
65 | 69 | ||
66 | ev = kzalloc(sizeof(*ev), gfp); | 70 | ev = kzalloc(sizeof(*ev), gfp); |
67 | if (!ev) | 71 | if (!ev) |
68 | return; | 72 | return; |
69 | 73 | ||
70 | ev->type = EVENT_IBSS_JOINED; | 74 | ev->type = EVENT_IBSS_JOINED; |
71 | memcpy(ev->cr.bssid, bssid, ETH_ALEN); | 75 | memcpy(ev->ij.bssid, bssid, ETH_ALEN); |
76 | ev->ij.channel = channel; | ||
72 | 77 | ||
73 | spin_lock_irqsave(&wdev->event_lock, flags); | 78 | spin_lock_irqsave(&wdev->event_lock, flags); |
74 | list_add_tail(&ev->list, &wdev->event_list); | 79 | list_add_tail(&ev->list, &wdev->event_list); |
diff --git a/net/wireless/trace.h b/net/wireless/trace.h index fbcc23edee54..5eaeed59db07 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h | |||
@@ -2278,11 +2278,6 @@ DECLARE_EVENT_CLASS(cfg80211_rx_evt, | |||
2278 | TP_printk(NETDEV_PR_FMT ", " MAC_PR_FMT, NETDEV_PR_ARG, MAC_PR_ARG(addr)) | 2278 | TP_printk(NETDEV_PR_FMT ", " MAC_PR_FMT, NETDEV_PR_ARG, MAC_PR_ARG(addr)) |
2279 | ); | 2279 | ); |
2280 | 2280 | ||
2281 | DEFINE_EVENT(cfg80211_rx_evt, cfg80211_ibss_joined, | ||
2282 | TP_PROTO(struct net_device *netdev, const u8 *addr), | ||
2283 | TP_ARGS(netdev, addr) | ||
2284 | ); | ||
2285 | |||
2286 | DEFINE_EVENT(cfg80211_rx_evt, cfg80211_rx_spurious_frame, | 2281 | DEFINE_EVENT(cfg80211_rx_evt, cfg80211_rx_spurious_frame, |
2287 | TP_PROTO(struct net_device *netdev, const u8 *addr), | 2282 | TP_PROTO(struct net_device *netdev, const u8 *addr), |
2288 | TP_ARGS(netdev, addr) | 2283 | TP_ARGS(netdev, addr) |
@@ -2293,6 +2288,24 @@ DEFINE_EVENT(cfg80211_rx_evt, cfg80211_rx_unexpected_4addr_frame, | |||
2293 | TP_ARGS(netdev, addr) | 2288 | TP_ARGS(netdev, addr) |
2294 | ); | 2289 | ); |
2295 | 2290 | ||
2291 | TRACE_EVENT(cfg80211_ibss_joined, | ||
2292 | TP_PROTO(struct net_device *netdev, const u8 *bssid, | ||
2293 | struct ieee80211_channel *channel), | ||
2294 | TP_ARGS(netdev, bssid, channel), | ||
2295 | TP_STRUCT__entry( | ||
2296 | NETDEV_ENTRY | ||
2297 | MAC_ENTRY(bssid) | ||
2298 | CHAN_ENTRY | ||
2299 | ), | ||
2300 | TP_fast_assign( | ||
2301 | NETDEV_ASSIGN; | ||
2302 | MAC_ASSIGN(bssid, bssid); | ||
2303 | CHAN_ASSIGN(channel); | ||
2304 | ), | ||
2305 | TP_printk(NETDEV_PR_FMT ", bssid: " MAC_PR_FMT ", " CHAN_PR_FMT, | ||
2306 | NETDEV_PR_ARG, MAC_PR_ARG(bssid), CHAN_PR_ARG) | ||
2307 | ); | ||
2308 | |||
2296 | TRACE_EVENT(cfg80211_probe_status, | 2309 | TRACE_EVENT(cfg80211_probe_status, |
2297 | TP_PROTO(struct net_device *netdev, const u8 *addr, u64 cookie, | 2310 | TP_PROTO(struct net_device *netdev, const u8 *addr, u64 cookie, |
2298 | bool acked), | 2311 | bool acked), |
diff --git a/net/wireless/util.c b/net/wireless/util.c index d39c37104ae2..7526a4d8aa16 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -820,7 +820,8 @@ void cfg80211_process_wdev_events(struct wireless_dev *wdev) | |||
820 | ev->dc.reason, true); | 820 | ev->dc.reason, true); |
821 | break; | 821 | break; |
822 | case EVENT_IBSS_JOINED: | 822 | case EVENT_IBSS_JOINED: |
823 | __cfg80211_ibss_joined(wdev->netdev, ev->ij.bssid); | 823 | __cfg80211_ibss_joined(wdev->netdev, ev->ij.bssid, |
824 | ev->ij.channel); | ||
824 | break; | 825 | break; |
825 | } | 826 | } |
826 | wdev_unlock(wdev); | 827 | wdev_unlock(wdev); |