Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac80211: remove direct probe step before authentication

The direct probe step before authentication was done mostly for
two reasons:
1) the BSS data could be stale
2) the beacon might not have included all IEs

The concern (1) doesn't really seem to be relevant any more as
we time out BSS information after about 30 seconds, and in fact
the original patch only did the direct probe if the data was
older than the BSS timeout to begin with. This condition got
(likely inadvertedly) removed later though.

Analysing this in more detail shows that since we mostly use
data from the association response, the only real reason for
needing the probe response was that the code validates the WMM
parameters, and those are optional in beacons. As the previous
patches removed that behaviour, we can now remove the direct
probe step entirely.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

+24 -60
+24 -60
net/mac80211/mlme.c
··· 3262 3262 if (ifmgd->associated && 3263 3263 ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid)) 3264 3264 ieee80211_reset_ap_probe(sdata); 3265 - 3266 - if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies && 3267 - ether_addr_equal(mgmt->bssid, ifmgd->auth_data->bss->bssid)) { 3268 - /* got probe response, continue with auth */ 3269 - sdata_info(sdata, "direct probe responded\n"); 3270 - ifmgd->auth_data->tries = 0; 3271 - ifmgd->auth_data->timeout = jiffies; 3272 - ifmgd->auth_data->timeout_started = true; 3273 - run_again(sdata, ifmgd->auth_data->timeout); 3274 - } 3275 3265 } 3276 3266 3277 3267 /* ··· 3707 3717 reason); 3708 3718 } 3709 3719 3710 - static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata) 3720 + static int ieee80211_auth(struct ieee80211_sub_if_data *sdata) 3711 3721 { 3712 3722 struct ieee80211_local *local = sdata->local; 3713 3723 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 3714 3724 struct ieee80211_mgd_auth_data *auth_data = ifmgd->auth_data; 3715 3725 u32 tx_flags = 0; 3726 + u16 trans = 1; 3727 + u16 status = 0; 3716 3728 3717 3729 sdata_assert_lock(sdata); 3718 3730 ··· 3738 3746 3739 3747 drv_mgd_prepare_tx(local, sdata); 3740 3748 3741 - if (auth_data->bss->proberesp_ies) { 3742 - u16 trans = 1; 3743 - u16 status = 0; 3749 + sdata_info(sdata, "send auth to %pM (try %d/%d)\n", 3750 + auth_data->bss->bssid, auth_data->tries, 3751 + IEEE80211_AUTH_MAX_TRIES); 3744 3752 3745 - sdata_info(sdata, "send auth to %pM (try %d/%d)\n", 3746 - auth_data->bss->bssid, auth_data->tries, 3747 - IEEE80211_AUTH_MAX_TRIES); 3753 + auth_data->expected_transaction = 2; 3748 3754 3749 - auth_data->expected_transaction = 2; 3750 - 3751 - if (auth_data->algorithm == WLAN_AUTH_SAE) { 3752 - trans = auth_data->sae_trans; 3753 - status = auth_data->sae_status; 3754 - auth_data->expected_transaction = trans; 3755 - } 3756 - 3757 - if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) 3758 - tx_flags = IEEE80211_TX_CTL_REQ_TX_STATUS | 3759 - IEEE80211_TX_INTFL_MLME_CONN_TX; 3760 - 3761 - ieee80211_send_auth(sdata, trans, auth_data->algorithm, status, 3762 - auth_data->data, auth_data->data_len, 3763 - auth_data->bss->bssid, 3764 - auth_data->bss->bssid, NULL, 0, 0, 3765 - tx_flags); 3766 - } else { 3767 - const u8 *ssidie; 3768 - 3769 - sdata_info(sdata, "direct probe to %pM (try %d/%i)\n", 3770 - auth_data->bss->bssid, auth_data->tries, 3771 - IEEE80211_AUTH_MAX_TRIES); 3772 - 3773 - rcu_read_lock(); 3774 - ssidie = ieee80211_bss_get_ie(auth_data->bss, WLAN_EID_SSID); 3775 - if (!ssidie) { 3776 - rcu_read_unlock(); 3777 - return -EINVAL; 3778 - } 3779 - /* 3780 - * Direct probe is sent to broadcast address as some APs 3781 - * will not answer to direct packet in unassociated state. 3782 - */ 3783 - ieee80211_send_probe_req(sdata, sdata->vif.addr, NULL, 3784 - ssidie + 2, ssidie[1], 3785 - NULL, 0, (u32) -1, true, 0, 3786 - auth_data->bss->channel, false); 3787 - rcu_read_unlock(); 3755 + if (auth_data->algorithm == WLAN_AUTH_SAE) { 3756 + trans = auth_data->sae_trans; 3757 + status = auth_data->sae_status; 3758 + auth_data->expected_transaction = trans; 3788 3759 } 3760 + 3761 + if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) 3762 + tx_flags = IEEE80211_TX_CTL_REQ_TX_STATUS | 3763 + IEEE80211_TX_INTFL_MLME_CONN_TX; 3764 + 3765 + ieee80211_send_auth(sdata, trans, auth_data->algorithm, status, 3766 + auth_data->data, auth_data->data_len, 3767 + auth_data->bss->bssid, 3768 + auth_data->bss->bssid, NULL, 0, 0, 3769 + tx_flags); 3789 3770 3790 3771 if (tx_flags == 0) { 3791 3772 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; ··· 3839 3874 bool status_acked = ifmgd->status_acked; 3840 3875 3841 3876 ifmgd->status_received = false; 3842 - if (ifmgd->auth_data && 3843 - (ieee80211_is_probe_req(fc) || ieee80211_is_auth(fc))) { 3877 + if (ifmgd->auth_data && ieee80211_is_auth(fc)) { 3844 3878 if (status_acked) { 3845 3879 ifmgd->auth_data->timeout = 3846 3880 jiffies + IEEE80211_AUTH_TIMEOUT_SHORT; ··· 3870 3906 * so let's just kill the auth data 3871 3907 */ 3872 3908 ieee80211_destroy_auth_data(sdata, false); 3873 - } else if (ieee80211_probe_auth(sdata)) { 3909 + } else if (ieee80211_auth(sdata)) { 3874 3910 u8 bssid[ETH_ALEN]; 3875 3911 struct ieee80211_event event = { 3876 3912 .type = MLME_EVENT, ··· 4561 4597 if (err) 4562 4598 goto err_clear; 4563 4599 4564 - err = ieee80211_probe_auth(sdata); 4600 + err = ieee80211_auth(sdata); 4565 4601 if (err) { 4566 4602 sta_info_destroy_addr(sdata, req->bss->bssid); 4567 4603 goto err_clear;