Skip to content

Commit

Permalink
mac80211: redesign auth/assoc
Browse files Browse the repository at this point in the history
This is the second part of the auth/assoc redesign,
the mac80211 part. This moves the auth/assoc code
out of the work abstraction and into the MLME, so
that we don't flip channels all the time etc.

The only downside is that when we are associated,
we need to drop the association in order to create
a connection to another AP, but for most drivers
this is actually desirable and the ability to do
was never used by any applications. If we want to
implement resource reservation with FT-OTA, we'd
probably best do it with explicit R-O-C in wpa_s.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Feb 6, 2012
1 parent 4c0c0b7 commit 66e67e4
Show file tree
Hide file tree
Showing 8 changed files with 1,038 additions and 1,227 deletions.
4 changes: 2 additions & 2 deletions net/mac80211/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mac80211-y := \
scan.o offchannel.o \
ht.o agg-tx.o agg-rx.o \
ibss.o \
mlme.o work.o \
work.o \
iface.o \
rate.o \
michael.o \
Expand All @@ -25,7 +25,7 @@ mac80211-y := \
wme.o \
event.o \
chan.o \
driver-trace.o
driver-trace.o mlme.o

mac80211-$(CONFIG_MAC80211_LEDS) += led.o
mac80211-$(CONFIG_MAC80211_DEBUGFS) += \
Expand Down
6 changes: 3 additions & 3 deletions net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2028,7 +2028,7 @@ ieee80211_offchan_tx_done(struct ieee80211_work *wk, struct sk_buff *skb)
if (wk->offchan_tx.wait && !wk->offchan_tx.status)
cfg80211_mgmt_tx_status(wk->sdata->dev,
(unsigned long) wk->offchan_tx.frame,
wk->ie, wk->ie_len, false, GFP_KERNEL);
wk->data, wk->data_len, false, GFP_KERNEL);

return WORK_DONE_DESTROY;
}
Expand Down Expand Up @@ -2179,8 +2179,8 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
wk->done = ieee80211_offchan_tx_done;
wk->offchan_tx.frame = skb;
wk->offchan_tx.wait = wait;
wk->ie_len = len;
memcpy(wk->ie, buf, len);
wk->data_len = len;
memcpy(wk->data, buf, len);

ieee80211_add_work(wk);
return 0;
Expand Down
77 changes: 41 additions & 36 deletions net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,6 @@ struct mesh_preq_queue {

enum ieee80211_work_type {
IEEE80211_WORK_ABORT,
IEEE80211_WORK_DIRECT_PROBE,
IEEE80211_WORK_AUTH,
IEEE80211_WORK_ASSOC_BEACON_WAIT,
IEEE80211_WORK_ASSOC,
IEEE80211_WORK_REMAIN_ON_CHANNEL,
IEEE80211_WORK_OFFCHANNEL_TX,
};
Expand Down Expand Up @@ -316,35 +312,9 @@ struct ieee80211_work {
unsigned long timeout;
enum ieee80211_work_type type;

u8 filter_ta[ETH_ALEN];

bool started;

union {
struct {
int tries;
u16 algorithm, transaction;
u8 ssid[IEEE80211_MAX_SSID_LEN];
u8 ssid_len;
u8 key[WLAN_KEY_LEN_WEP104];
u8 key_len, key_idx;
bool privacy;
bool synced;
} probe_auth;
struct {
struct cfg80211_bss *bss;
const u8 *supp_rates;
const u8 *ht_information_ie;
enum ieee80211_smps_mode smps;
int tries;
u16 capability;
u8 prev_bssid[ETH_ALEN];
u8 ssid[IEEE80211_MAX_SSID_LEN];
u8 ssid_len;
u8 supp_rates_len;
bool wmm_used, use_11n, uapsd_used;
bool synced;
} assoc;
struct {
u32 duration;
} remain;
Expand All @@ -355,9 +325,8 @@ struct ieee80211_work {
} offchan_tx;
};

int ie_len;
/* must be last */
u8 ie[0];
size_t data_len;
u8 data[];
};

/* flags used in struct ieee80211_if_managed.flags */
Expand All @@ -373,6 +342,43 @@ enum ieee80211_sta_flags {
IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9),
};

struct ieee80211_mgd_auth_data {
struct cfg80211_bss *bss;
unsigned long timeout;
int tries;
u16 algorithm, expected_transaction;

u8 key[WLAN_KEY_LEN_WEP104];
u8 key_len, key_idx;
bool synced;
bool done;

size_t ie_len;
u8 ie[];
};

struct ieee80211_mgd_assoc_data {
struct cfg80211_bss *bss;
const u8 *supp_rates;
const u8 *ht_information_ie;

unsigned long timeout;
int tries;

u16 capability;
u8 prev_bssid[ETH_ALEN];
u8 ssid[IEEE80211_MAX_SSID_LEN];
u8 ssid_len;
u8 supp_rates_len;
bool wmm_used, uapsd_used;
bool have_beacon;
bool sent_assoc;
bool synced;

size_t ie_len;
u8 ie[];
};

struct ieee80211_if_managed {
struct timer_list timer;
struct timer_list conn_mon_timer;
Expand All @@ -389,6 +395,8 @@ struct ieee80211_if_managed {

struct mutex mtx;
struct cfg80211_bss *associated;
struct ieee80211_mgd_auth_data *auth_data;
struct ieee80211_mgd_assoc_data *assoc_data;

u8 bssid[ETH_ALEN];

Expand Down Expand Up @@ -770,7 +778,6 @@ struct ieee80211_local {
struct list_head work_list;
struct timer_list work_timer;
struct work_struct work_work;
struct sk_buff_head work_skb_queue;

/*
* private workqueue to mac80211. mac80211 makes this accessible
Expand Down Expand Up @@ -1437,8 +1444,6 @@ void ieee80211_work_init(struct ieee80211_local *local);
void ieee80211_add_work(struct ieee80211_work *wk);
void free_work(struct ieee80211_work *wk);
void ieee80211_work_purge(struct ieee80211_sub_if_data *sdata);
ieee80211_rx_result ieee80211_work_rx_mgmt(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb);
int ieee80211_wk_remain_on_channel(struct ieee80211_sub_if_data *sdata,
struct ieee80211_channel *chan,
enum nl80211_channel_type channel_type,
Expand Down
4 changes: 3 additions & 1 deletion net/mac80211/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,9 @@ u32 __ieee80211_recalc_idle(struct ieee80211_local *local)

/* do not count disabled managed interfaces */
if (sdata->vif.type == NL80211_IFTYPE_STATION &&
!sdata->u.mgd.associated) {
!sdata->u.mgd.associated &&
!sdata->u.mgd.auth_data &&
!sdata->u.mgd.assoc_data) {
sdata->vif.bss_conf.idle = true;
continue;
}
Expand Down
10 changes: 1 addition & 9 deletions net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,7 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
return;

if (sdata->vif.type == NL80211_IFTYPE_STATION) {
/*
* While not associated, claim a BSSID of all-zeroes
* so that drivers don't do any weird things with the
* BSSID at that time.
*/
if (sdata->vif.bss_conf.assoc)
sdata->vif.bss_conf.bssid = sdata->u.mgd.bssid;
else
sdata->vif.bss_conf.bssid = zero;
sdata->vif.bss_conf.bssid = sdata->u.mgd.bssid;
} else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
sdata->vif.bss_conf.bssid = sdata->u.ibss.bssid;
else if (sdata->vif.type == NL80211_IFTYPE_AP)
Expand Down
Loading

0 comments on commit 66e67e4

Please sign in to comment.