Skip to content

Commit 776b358

Browse files
committed
cfg80211: track hidden SSID networks properly
Currently, cfg80211 will copy beacon IEs from a previously received hidden SSID beacon to a probe response entry, if that entry is created after the beacon entry. However, if it is the other way around, or if the beacon is updated, such changes aren't propagated. Fix this by tracking the relation between the probe response and beacon BSS structs in this case. In case drivers have private data stored in a BSS struct and need access to such data from a beacon entry, cfg80211 now provides the hidden_beacon_bss pointer from the probe response entry to the beacon entry. Signed-off-by: Johannes Berg <[email protected]>
1 parent 1f4ac5a commit 776b358

File tree

3 files changed

+232
-54
lines changed

3 files changed

+232
-54
lines changed

include/net/cfg80211.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,14 @@ struct cfg80211_bss_ies {
12921292
* either the beacon_ies or proberesp_ies depending on whether Probe
12931293
* Response frame has been received
12941294
* @beacon_ies: the information elements from the last Beacon frame
1295+
* (implementation note: if @hidden_beacon_bss is set this struct doesn't
1296+
* own the beacon_ies, but they're just pointers to the ones from the
1297+
* @hidden_beacon_bss struct)
12951298
* @proberesp_ies: the information elements from the last Probe Response frame
1299+
* @hidden_beacon_bss: in case this BSS struct represents a probe response from
1300+
* a BSS that hides the SSID in its beacon, this points to the BSS struct
1301+
* that holds the beacon data. @beacon_ies is still valid, of course, and
1302+
* points to the same data as hidden_beacon_bss->beacon_ies in that case.
12961303
* @signal: signal strength value (type depends on the wiphy's signal_type)
12971304
* @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
12981305
*/
@@ -1305,6 +1312,8 @@ struct cfg80211_bss {
13051312
const struct cfg80211_bss_ies __rcu *beacon_ies;
13061313
const struct cfg80211_bss_ies __rcu *proberesp_ies;
13071314

1315+
struct cfg80211_bss *hidden_beacon_bss;
1316+
13081317
s32 signal;
13091318

13101319
u16 beacon_interval;

net/wireless/core.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <linux/mutex.h>
99
#include <linux/list.h>
1010
#include <linux/netdevice.h>
11-
#include <linux/kref.h>
1211
#include <linux/rbtree.h>
1312
#include <linux/debugfs.h>
1413
#include <linux/rfkill.h>
@@ -124,9 +123,10 @@ static inline void assert_cfg80211_lock(void)
124123

125124
struct cfg80211_internal_bss {
126125
struct list_head list;
126+
struct list_head hidden_list;
127127
struct rb_node rbn;
128128
unsigned long ts;
129-
struct kref ref;
129+
unsigned long refcount;
130130
atomic_t hold;
131131

132132
/* must be last because of priv member */

0 commit comments

Comments
 (0)