Revert "[wpa_supplicant] cumilative patch from commit 3a5d1a7e6"
Revert submission 26533062-Supplicant_merge_June24
Reason for revert: https://b.corp.google.com/issues/349780869
Reverted changes: /q/submissionid:26533062-Supplicant_merge_June24
Change-Id: I4a7a5b8ccb6b4822353bacc29649587cd5a3cb80
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index a851024..d4401ff 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1,6 +1,6 @@
/*
* WPA Supplicant
- * Copyright (c) 2003-2024, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2003-2022, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@@ -65,7 +65,6 @@
#include "wpas_kay.h"
#include "mesh.h"
#include "dpp_supplicant.h"
-#include "nan_usd.h"
#ifdef CONFIG_MESH
#include "ap/ap_config.h"
#include "ap/hostapd.h"
@@ -585,9 +584,7 @@
wpa_tdls_deinit(wpa_s->wpa);
#endif /* CONFIG_TDLS */
-#ifndef CONFIG_NO_WMM_AC
wmm_ac_clear_saved_tspecs(wpa_s);
-#endif /* CONFIG_NO_WMM_AC */
pmksa_candidate_free(wpa_s->wpa);
ptksa_cache_deinit(wpa_s->ptksa);
wpa_s->ptksa = NULL;
@@ -704,9 +701,7 @@
wpa_s->vendor_elem[i] = NULL;
}
-#ifndef CONFIG_NO_WMM_AC
wmm_ac_notify_disassoc(wpa_s);
-#endif /* CONFIG_NO_WMM_AC */
wpa_s->sched_scan_plans_num = 0;
os_free(wpa_s->sched_scan_plans);
@@ -722,9 +717,7 @@
wpabuf_free(wpa_s->lci);
wpa_s->lci = NULL;
-#ifndef CONFIG_NO_RRM
wpas_clear_beacon_rep_data(wpa_s);
-#endif /* CONFIG_NO_RRM */
#ifdef CONFIG_PMKSA_CACHE_EXTERNAL
#ifdef CONFIG_MESH
@@ -753,17 +746,11 @@
wpa_s->dpp = NULL;
#endif /* CONFIG_DPP */
-#ifdef CONFIG_NAN_USD
- wpas_nan_usd_deinit(wpa_s);
-#endif /* CONFIG_NAN_USD */
-
#ifdef CONFIG_PASN
wpas_pasn_auth_stop(wpa_s);
#endif /* CONFIG_PASN */
-#ifndef CONFIG_NO_ROBUST_AV
wpas_scs_deinit(wpa_s);
wpas_dscp_deinit(wpa_s);
-#endif /* CONFIG_NO_ROBUST_AV */
#ifdef CONFIG_OWE
os_free(wpa_s->owe_trans_scan_freq);
@@ -1081,10 +1068,8 @@
if (state == WPA_DISCONNECTED || state == WPA_INACTIVE)
wpa_supplicant_start_autoscan(wpa_s);
-#ifndef CONFIG_NO_WMM_AC
if (old_state >= WPA_ASSOCIATED && wpa_s->wpa_state < WPA_ASSOCIATED)
wmm_ac_notify_disassoc(wpa_s);
-#endif /* CONFIG_NO_WMM_AC */
if (wpa_s->wpa_state != old_state) {
wpas_notify_state_changed(wpa_s, wpa_s->wpa_state, old_state);
@@ -2024,7 +2009,7 @@
(wpa_s->connection_ht || wpa_s->connection_vht ||
wpa_s->connection_he || wpa_s->connection_eht);
if (!wmm && bss)
- wmm = !!wpa_bss_get_vendor_ie(bss, WMM_IE_VENDOR_TYPE);
+ wmm = wpa_bss_get_vendor_ie(bss, WMM_IE_VENDOR_TYPE);
wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_WMM_ENABLED, wmm);
if (!skip_default_rsne) {
@@ -2126,9 +2111,7 @@
static void wpas_ext_capab_byte(struct wpa_supplicant *wpa_s, u8 *pos, int idx,
struct wpa_bss *bss)
{
-#ifndef CONFIG_NO_ROBUST_AV
bool scs = true, mscs = true;
-#endif /* CONFIG_NO_ROBUST_AV */
*pos = 0x00;
@@ -2144,9 +2127,7 @@
case 2: /* Bits 16-23 */
#ifdef CONFIG_WNM
*pos |= 0x02; /* Bit 17 - WNM-Sleep Mode */
- if ((wpas_driver_bss_selection(wpa_s) ||
- !wpa_s->disable_mbo_oce) &&
- !wpa_s->conf->disable_btm)
+ if (!wpa_s->disable_mbo_oce && !wpa_s->conf->disable_btm)
*pos |= 0x08; /* Bit 19 - BSS Transition */
#endif /* CONFIG_WNM */
break;
@@ -2175,7 +2156,6 @@
#endif /* CONFIG_MBO */
break;
case 6: /* Bits 48-55 */
-#ifndef CONFIG_NO_ROBUST_AV
#ifdef CONFIG_TESTING_OPTIONS
if (wpa_s->disable_scs_support)
scs = false;
@@ -2189,7 +2169,6 @@
}
if (scs)
*pos |= 0x40; /* Bit 54 - SCS */
-#endif /* CONFIG_NO_ROBUST_AV */
break;
case 7: /* Bits 56-63 */
break;
@@ -2206,7 +2185,6 @@
#endif /* CONFIG_FILS */
break;
case 10: /* Bits 80-87 */
-#ifndef CONFIG_NO_ROBUST_AV
#ifdef CONFIG_TESTING_OPTIONS
if (wpa_s->disable_mscs_support)
mscs = false;
@@ -2220,7 +2198,6 @@
}
if (mscs)
*pos |= 0x20; /* Bit 85 - Mirrored SCS */
-#endif /* CONFIG_NO_ROBUST_AV */
break;
}
}
@@ -2338,7 +2315,8 @@
if (style == WPAS_MAC_ADDR_STYLE_DEDICATED_PER_ESS) {
/* Pregenerated addresses do not expire but their value
* might have changed, so let's check that. */
- if (ether_addr_equal(wpa_s->own_addr, ssid->mac_value))
+ if (os_memcmp(wpa_s->own_addr, ssid->mac_value,
+ ETH_ALEN) == 0)
return 0;
} else if ((wpa_s->last_mac_addr_change.sec != 0 ||
wpa_s->last_mac_addr_change.usec != 0) &&
@@ -2517,12 +2495,7 @@
wpa_s->eapol_failed = 0;
wpa_s->multi_ap_ie = 0;
-#ifndef CONFIG_NO_WMM_AC
wmm_ac_clear_saved_tspecs(wpa_s);
-#endif /* CONFIG_NO_WMM_AC */
-#ifdef CONFIG_WNM
- wpa_s->wnm_mode = 0;
-#endif /* CONFIG_WNM */
wpa_s->reassoc_same_bss = 0;
wpa_s->reassoc_same_ess = 0;
#ifdef CONFIG_TESTING_OPTIONS
@@ -2533,9 +2506,7 @@
wpa_dbg(wpa_s, MSG_DEBUG, "Re-association to the same ESS");
wpa_s->reassoc_same_ess = 1;
if (wpa_s->current_bss && wpa_s->current_bss == bss) {
-#ifndef CONFIG_NO_WMM_AC
wmm_ac_save_tspecs(wpa_s);
-#endif /* CONFIG_NO_WMM_AC */
wpa_s->reassoc_same_bss = 1;
} else if (wpa_s->current_bss && wpa_s->current_bss != bss) {
os_get_reltime(&wpa_s->roam_start);
@@ -3103,7 +3074,7 @@
struct hostapd_hw_modes *mode = NULL;
int i, obss_scan = 1;
u8 channel;
- bool is_6ghz, is_24ghz;
+ bool is_6ghz;
freq->freq = ssid->frequency;
@@ -3132,9 +3103,6 @@
if (!mode)
return;
- is_24ghz = hw_mode == HOSTAPD_MODE_IEEE80211G ||
- hw_mode == HOSTAPD_MODE_IEEE80211B;
-
is_6ghz = is_6ghz_freq(freq->freq);
freq->ht_enabled = 0;
@@ -3146,7 +3114,7 @@
freq->ht_enabled = ibss_mesh_can_use_ht(wpa_s, ssid, mode);
if (freq->ht_enabled)
freq->vht_enabled = ibss_mesh_can_use_vht(wpa_s, ssid, mode);
- if (freq->vht_enabled || (freq->ht_enabled && is_24ghz) || is_6ghz)
+ if (freq->vht_enabled || is_6ghz)
freq->he_enabled = ibss_mesh_can_use_he(wpa_s, ssid, mode,
ieee80211_mode);
freq->channel = channel;
@@ -3288,10 +3256,8 @@
size_t wfa_ie_len, buf_len;
os_memset(wfa_capa, 0, sizeof(wfa_capa));
-#ifndef CONFIG_NO_ROBUST_AV
if (wpa_s->enable_dscp_policy_capa)
wfa_capa[0] |= WFA_CAPA_QM_DSCP_POLICY;
-#endif /* CONFIG_NO_ROBUST_AV */
if (wpa_is_non_eht_scs_traffic_desc_supported(bss))
wfa_capa[0] |= WFA_CAPA_QM_NON_EHT_SCS_TRAFFIC_DESC;
@@ -3555,14 +3521,12 @@
os_memset(wpa_s->p2p_ip_addr_info, 0, sizeof(wpa_s->p2p_ip_addr_info));
#endif /* CONFIG_P2P */
-#ifndef CONFIG_NO_RRM
if (bss) {
wpa_ie_len += wpas_supp_op_class_ie(wpa_s, ssid, bss,
wpa_ie + wpa_ie_len,
max_wpa_ie_len -
wpa_ie_len);
}
-#endif /* CONFIG_NO_RRM */
/*
* Workaround: Add Extended Capabilities element only if the AP
@@ -3789,7 +3753,6 @@
wpa_ie_len += wpa_s->rsnxe_len;
}
-#ifndef CONFIG_NO_ROBUST_AV
#ifdef CONFIG_TESTING_OPTIONS
if (wpa_s->disable_mscs_support)
goto mscs_end;
@@ -3824,7 +3787,6 @@
wpabuf_free(mscs_ie);
}
mscs_end:
-#endif /* CONFIG_NO_ROBUST_AV */
wpa_ie_len = wpas_populate_wfa_capa(wpa_s, bss, wpa_ie, wpa_ie_len,
max_wpa_ie_len);
@@ -4109,9 +4071,7 @@
wpa_sm_set_assoc_wpa_ie(wpa_s->wpa, NULL, 0);
wpa_sm_set_assoc_rsnxe(wpa_s->wpa, NULL, 0);
wpa_s->rsnxe_len = 0;
-#ifndef CONFIG_NO_ROBUST_AV
wpa_s->mscs_setup_done = false;
-#endif /* CONFIG_NO_ROBUST_AV */
wpa_ie = wpas_populate_assoc_ies(wpa_s, bss, ssid, ¶ms, NULL);
if (!wpa_ie) {
@@ -4506,8 +4466,7 @@
* can stop right here; the association will not
* succeed.
*/
- wpas_connection_failed(wpa_s, wpa_s->pending_bssid,
- NULL);
+ wpas_connection_failed(wpa_s, wpa_s->pending_bssid);
wpa_s->assoc_status_code = WLAN_STATUS_UNSPECIFIED_FAILURE;
wpas_notify_assoc_status_code(wpa_s, wpa_s->pending_bssid, 0, NULL, 0);
wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
@@ -4603,10 +4562,8 @@
if (old_ssid != wpa_s->current_ssid)
wpas_notify_network_changed(wpa_s);
-#ifndef CONFIG_NO_ROBUST_AV
wpas_scs_deinit(wpa_s);
wpas_dscp_deinit(wpa_s);
-#endif /* CONFIG_NO_ROBUST_AV */
eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL);
}
@@ -5386,14 +5343,14 @@
os_memcmp(ssid, entry->ssid, ssid_len) == 0)) ||
wired) &&
(!entry->bssid_set ||
- ether_addr_equal(bssid, entry->bssid)))
+ os_memcmp(bssid, entry->bssid, ETH_ALEN) == 0))
return entry;
#ifdef CONFIG_WPS
if (!wpas_network_disabled(wpa_s, entry) &&
(entry->key_mgmt & WPA_KEY_MGMT_WPS) &&
(entry->ssid == NULL || entry->ssid_len == 0) &&
(!entry->bssid_set ||
- ether_addr_equal(bssid, entry->bssid)))
+ os_memcmp(bssid, entry->bssid, ETH_ALEN) == 0))
return entry;
#endif /* CONFIG_WPS */
@@ -5403,13 +5360,13 @@
owe_trans_ssid_match(wpa_s, bssid, entry->ssid,
entry->ssid_len)) &&
(!entry->bssid_set ||
- ether_addr_equal(bssid, entry->bssid)))
+ os_memcmp(bssid, entry->bssid, ETH_ALEN) == 0))
return entry;
#endif /* CONFIG_OWE */
if (!wpas_network_disabled(wpa_s, entry) && entry->bssid_set &&
entry->ssid_len == 0 &&
- ether_addr_equal(bssid, entry->bssid))
+ os_memcmp(bssid, entry->bssid, ETH_ALEN) == 0)
return entry;
entry = entry->next;
@@ -5537,7 +5494,7 @@
#ifdef CONFIG_AP
!wpa_s->ap_iface &&
#endif /* CONFIG_AP */
- !ether_addr_equal(src_addr, connected_addr))) {
+ os_memcmp(src_addr, connected_addr, ETH_ALEN) != 0)) {
/*
* There is possible race condition between receiving the
* association event and the EAPOL frame since they are coming
@@ -5567,7 +5524,7 @@
}
wpa_s->last_eapol_matches_bssid =
- ether_addr_equal(src_addr, connected_addr);
+ os_memcmp(src_addr, connected_addr, ETH_ALEN) == 0;
#ifdef CONFIG_AP
if (wpa_s->ap_iface) {
@@ -5724,7 +5681,7 @@
fst_update_mac_addr(wpa_s->fst, wpa_s->own_addr);
#endif /* CONFIG_FST */
- if (!ether_addr_equal(prev_mac_addr, wpa_s->own_addr))
+ if (os_memcmp(prev_mac_addr, wpa_s->own_addr, ETH_ALEN) != 0)
wpas_notify_mac_address_changed(wpa_s);
return 0;
@@ -5741,7 +5698,7 @@
return;
eth = (const struct l2_ethhdr *) buf;
- if (!ether_addr_equal(eth->h_dest, wpa_s->own_addr) &&
+ if (os_memcmp(eth->h_dest, wpa_s->own_addr, ETH_ALEN) != 0 &&
!(eth->h_dest[0] & 0x01)) {
wpa_dbg(wpa_s, MSG_DEBUG, "RX EAPOL from " MACSTR " to " MACSTR
" (bridge - not for this interface - ignore)",
@@ -5916,11 +5873,8 @@
dl_list_init(&wpa_s->fils_hlp_req);
#ifdef CONFIG_TESTING_OPTIONS
dl_list_init(&wpa_s->drv_signal_override);
- wpa_s->test_assoc_comeback_type = -1;
#endif /* CONFIG_TESTING_OPTIONS */
-#ifndef CONFIG_NO_ROBUST_AV
dl_list_init(&wpa_s->active_scs_ids);
-#endif /* CONFIG_NO_ROBUST_AV */
wpa_s->ml_probe_mld_id = -1;
return wpa_s;
@@ -6433,7 +6387,7 @@
{
struct wpa_supplicant *wpa_s = ctx;
- if (!ether_addr_equal(wpa_s->bssid, da)) {
+ if (os_memcmp(wpa_s->bssid, da, ETH_ALEN) != 0) {
wpa_printf(MSG_INFO, "FST:%s:bssid=" MACSTR " != da=" MACSTR,
__func__, MAC2STR(wpa_s->bssid), MAC2STR(da));
return -1;
@@ -6449,7 +6403,7 @@
{
struct wpa_supplicant *wpa_s = ctx;
- WPA_ASSERT(ether_addr_equal(wpa_s->bssid, addr));
+ WPA_ASSERT(os_memcmp(wpa_s->bssid, addr, ETH_ALEN) == 0);
return wpa_s->received_mb_ies;
}
@@ -6460,7 +6414,7 @@
struct wpa_supplicant *wpa_s = ctx;
struct mb_ies_info info;
- WPA_ASSERT(ether_addr_equal(wpa_s->bssid, addr));
+ WPA_ASSERT(os_memcmp(wpa_s->bssid, addr, ETH_ALEN) == 0);
if (!mb_ies_info_by_ies(&info, buf, size)) {
wpabuf_free(wpa_s->received_mb_ies);
@@ -7249,9 +7203,6 @@
return -1;
}
- wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_FT_PREPEND_PMKID,
- wpa_s->conf->ft_prepend_pmkid);
-
wpa_s->hw.modes = wpa_drv_get_hw_feature_data(wpa_s,
&wpa_s->hw.num_modes,
&wpa_s->hw.flags,
@@ -7300,9 +7251,7 @@
wpa_s->extended_capa_len = capa.extended_capa_len;
wpa_s->num_multichan_concurrent =
capa.num_multichan_concurrent;
-#ifndef CONFIG_NO_WMM_AC
wpa_s->wmm_ac_supported = capa.wmm_ac_supported;
-#endif /* CONFIG_NO_WMM_AC */
wpa_s->max_num_akms = capa.max_num_akms;
if (capa.mac_addr_rand_scan_supported)
@@ -7390,11 +7339,6 @@
return -1;
#endif /* CONFIG_DPP */
-#ifdef CONFIG_NAN_USD
- if (wpas_nan_usd_init(wpa_s) < 0)
- return -1;
-#endif /* CONFIG_NAN_USD */
-
if (wpa_supplicant_init_eapol(wpa_s) < 0)
return -1;
wpa_sm_set_eapol(wpa_s->wpa, wpa_s->eapol);
@@ -7464,9 +7408,7 @@
if (wpas_init_ext_pw(wpa_s) < 0)
return -1;
-#ifndef CONFIG_NO_RRM
wpas_rrm_reset(wpa_s);
-#endif /* CONFIG_NO_RRM */
wpas_sched_scan_plans_set(wpa_s, wpa_s->conf->sched_scan_plans);
@@ -8231,10 +8173,6 @@
if (wpa_s->conf->changed_parameters & CFG_CHANGED_DISABLE_BTM)
wpa_supplicant_set_default_scan_ies(wpa_s);
- if (wpa_s->conf->changed_parameters & CFG_CHANGED_FT_PREPEND_PMKID)
- wpa_sm_set_param(wpa_s->wpa, WPA_PARAM_FT_PREPEND_PMKID,
- wpa_s->conf->ft_prepend_pmkid);
-
#ifdef CONFIG_BGSCAN
/*
* We default to global bgscan parameters only when per-network bgscan
@@ -8303,8 +8241,7 @@
}
-void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid,
- const u8 **link_bssids)
+void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid)
{
int timeout;
int count;
@@ -8339,12 +8276,6 @@
return;
}
- /* Also mark links as failed */
- while (link_bssids && *link_bssids) {
- wpa_bssid_ignore_add(wpa_s, *link_bssids);
- link_bssids++;
- }
-
/*
* Add the failed BSSID into the ignore list and speed up next scan
* attempt if there could be other APs that could accept association.
@@ -8761,16 +8692,9 @@
int pmf_in_use(struct wpa_supplicant *wpa_s, const u8 *addr)
{
if (wpa_s->current_ssid == NULL ||
- wpa_s->wpa_state < WPA_4WAY_HANDSHAKE)
+ wpa_s->wpa_state < WPA_4WAY_HANDSHAKE ||
+ os_memcmp(addr, wpa_s->bssid, ETH_ALEN) != 0)
return 0;
- if (wpa_s->valid_links) {
- if (!ether_addr_equal(addr, wpa_s->ap_mld_addr) &&
- !wpas_ap_link_address(wpa_s, addr))
- return 0;
- } else {
- if (!ether_addr_equal(addr, wpa_s->bssid))
- return 0;
- }
return wpa_sm_pmf_enabled(wpa_s->wpa);
}
@@ -8895,8 +8819,8 @@
return 0;
for (i = 0; i < wpa_s->disallow_aps_bssid_count; i++) {
- if (ether_addr_equal(wpa_s->disallow_aps_bssid + i * ETH_ALEN,
- bssid))
+ if (os_memcmp(wpa_s->disallow_aps_bssid + i * ETH_ALEN,
+ bssid, ETH_ALEN) == 0)
return 1;
}
@@ -9206,7 +9130,7 @@
dl_list_for_each(bss, &wpa_s->bss_tmp_disallowed,
struct wpa_bss_tmp_disallowed, list) {
- if (ether_addr_equal(bssid, bss->bssid))
+ if (os_memcmp(bssid, bss->bssid, ETH_ALEN) == 0)
return bss;
}
@@ -9289,7 +9213,7 @@
dl_list_for_each_safe(tmp, prev, &wpa_s->bss_tmp_disallowed,
struct wpa_bss_tmp_disallowed, list) {
- if (ether_addr_equal(bss->bssid, tmp->bssid)) {
+ if (os_memcmp(bss->bssid, tmp->bssid, ETH_ALEN) == 0) {
disallowed = tmp;
break;
}
@@ -9387,7 +9311,8 @@
dl_list_for_each(dso, &wpa_s->drv_signal_override,
struct driver_signal_override, list) {
- if (!ether_addr_equal(wpa_s->bssid, dso->bssid))
+ if (os_memcmp(wpa_s->bssid, dso->bssid,
+ ETH_ALEN) != 0)
continue;
wpa_printf(MSG_DEBUG,
"Override driver signal_poll information: current_signal: %d->%d avg_signal: %d->%d avg_beacon_signal: %d->%d current_noise: %d->%d",
@@ -9432,7 +9357,7 @@
dl_list_for_each(dso, &wpa_s->drv_signal_override,
struct driver_signal_override, list) {
- if (!ether_addr_equal(res->bssid, dso->bssid))
+ if (os_memcmp(res->bssid, dso->bssid, ETH_ALEN) != 0)
continue;
wpa_printf(MSG_DEBUG,
"Override driver scan signal level %d->%d for "
@@ -9454,7 +9379,7 @@
}
-bool wpas_ap_link_address(struct wpa_supplicant *wpa_s, const u8 *addr)
+static bool wpas_ap_link_address(struct wpa_supplicant *wpa_s, const u8 *addr)
{
int i;
@@ -9465,7 +9390,7 @@
if (!(wpa_s->valid_links & BIT(i)))
continue;
- if (ether_addr_equal(wpa_s->links[i].bssid, addr))
+ if (os_memcmp(wpa_s->links[i].bssid, addr, ETH_ALEN) == 0)
return true;
}