Restore permanent MAC address on the FLUSH command
Clear previously used random MAC address on the FLUSH command if mac_addr setting has been disabled. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
39fac5abd1
commit
f03580e319
3 changed files with 22 additions and 11 deletions
|
@ -8572,6 +8572,8 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
|
||||||
wpas_pasn_auth_stop(wpa_s);
|
wpas_pasn_auth_stop(wpa_s);
|
||||||
#endif /* CONFIG_PASN */
|
#endif /* CONFIG_PASN */
|
||||||
|
|
||||||
|
if (wpa_s->mac_addr_changed && wpa_s->conf->mac_addr == 0)
|
||||||
|
wpas_restore_permanent_mac_addr(wpa_s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2145,6 +2145,24 @@ static void wpa_s_clear_sae_rejected(struct wpa_supplicant *wpa_s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int wpas_restore_permanent_mac_addr(struct wpa_supplicant *wpa_s)
|
||||||
|
{
|
||||||
|
if (wpa_drv_set_mac_addr(wpa_s, NULL) < 0) {
|
||||||
|
wpa_msg(wpa_s, MSG_INFO,
|
||||||
|
"Could not restore permanent MAC address");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
wpa_s->mac_addr_changed = 0;
|
||||||
|
if (wpa_supplicant_update_mac_addr(wpa_s) < 0) {
|
||||||
|
wpa_msg(wpa_s, MSG_INFO,
|
||||||
|
"Could not update MAC address information");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
wpa_msg(wpa_s, MSG_DEBUG, "Using permanent MAC address");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit);
|
static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2205,19 +2223,9 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
|
||||||
return;
|
return;
|
||||||
wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
|
wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
|
||||||
} else if (rand_style == 0 && wpa_s->mac_addr_changed) {
|
} else if (rand_style == 0 && wpa_s->mac_addr_changed) {
|
||||||
if (wpa_drv_set_mac_addr(wpa_s, NULL) < 0) {
|
if (wpas_restore_permanent_mac_addr(wpa_s) < 0)
|
||||||
wpa_msg(wpa_s, MSG_INFO,
|
|
||||||
"Could not restore permanent MAC address");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wpa_s->mac_addr_changed = 0;
|
|
||||||
if (wpa_supplicant_update_mac_addr(wpa_s) < 0) {
|
|
||||||
wpa_msg(wpa_s, MSG_INFO,
|
|
||||||
"Could not update MAC address information");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
wpa_msg(wpa_s, MSG_DEBUG, "Using permanent MAC address");
|
|
||||||
}
|
|
||||||
wpa_s->last_ssid = ssid;
|
wpa_s->last_ssid = ssid;
|
||||||
|
|
||||||
#ifdef CONFIG_IBSS_RSN
|
#ifdef CONFIG_IBSS_RSN
|
||||||
|
|
|
@ -1425,6 +1425,7 @@ int wpa_supplicant_update_bridge_ifname(struct wpa_supplicant *wpa_s,
|
||||||
int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
|
int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_bss *bss, struct wpa_ssid *ssid,
|
struct wpa_bss *bss, struct wpa_ssid *ssid,
|
||||||
u8 *wpa_ie, size_t *wpa_ie_len);
|
u8 *wpa_ie, size_t *wpa_ie_len);
|
||||||
|
int wpas_restore_permanent_mac_addr(struct wpa_supplicant *wpa_s);
|
||||||
void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
|
void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
|
||||||
struct wpa_bss *bss,
|
struct wpa_bss *bss,
|
||||||
struct wpa_ssid *ssid);
|
struct wpa_ssid *ssid);
|
||||||
|
|
Loading…
Reference in a new issue