Share common code in wpa_supplicant_{disassociate,deauthenticate}()
This commit is contained in:
parent
eb0a3c7f96
commit
09f58c0984
1 changed files with 29 additions and 29 deletions
|
@ -1296,27 +1296,11 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
static void wpa_supplicant_clear_connection(struct wpa_supplicant *wpa_s,
|
||||||
* wpa_supplicant_disassociate - Disassociate the current connection
|
const u8 *addr)
|
||||||
* @wpa_s: Pointer to wpa_supplicant data
|
|
||||||
* @reason_code: IEEE 802.11 reason code for the disassociate frame
|
|
||||||
*
|
|
||||||
* This function is used to request %wpa_supplicant to disassociate with the
|
|
||||||
* current AP.
|
|
||||||
*/
|
|
||||||
void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
|
|
||||||
int reason_code)
|
|
||||||
{
|
{
|
||||||
struct wpa_ssid *old_ssid;
|
struct wpa_ssid *old_ssid;
|
||||||
u8 *addr = NULL;
|
|
||||||
|
|
||||||
if (!is_zero_ether_addr(wpa_s->bssid)) {
|
|
||||||
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME)
|
|
||||||
ieee80211_sta_disassociate(wpa_s, reason_code);
|
|
||||||
else
|
|
||||||
wpa_drv_disassociate(wpa_s, wpa_s->bssid, reason_code);
|
|
||||||
addr = wpa_s->bssid;
|
|
||||||
}
|
|
||||||
wpa_clear_keys(wpa_s, addr);
|
wpa_clear_keys(wpa_s, addr);
|
||||||
wpa_supplicant_mark_disassoc(wpa_s);
|
wpa_supplicant_mark_disassoc(wpa_s);
|
||||||
old_ssid = wpa_s->current_ssid;
|
old_ssid = wpa_s->current_ssid;
|
||||||
|
@ -1330,6 +1314,31 @@ void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wpa_supplicant_disassociate - Disassociate the current connection
|
||||||
|
* @wpa_s: Pointer to wpa_supplicant data
|
||||||
|
* @reason_code: IEEE 802.11 reason code for the disassociate frame
|
||||||
|
*
|
||||||
|
* This function is used to request %wpa_supplicant to disassociate with the
|
||||||
|
* current AP.
|
||||||
|
*/
|
||||||
|
void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
|
||||||
|
int reason_code)
|
||||||
|
{
|
||||||
|
u8 *addr = NULL;
|
||||||
|
|
||||||
|
if (!is_zero_ether_addr(wpa_s->bssid)) {
|
||||||
|
if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME)
|
||||||
|
ieee80211_sta_disassociate(wpa_s, reason_code);
|
||||||
|
else
|
||||||
|
wpa_drv_disassociate(wpa_s, wpa_s->bssid, reason_code);
|
||||||
|
addr = wpa_s->bssid;
|
||||||
|
}
|
||||||
|
|
||||||
|
wpa_supplicant_clear_connection(wpa_s, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wpa_supplicant_deauthenticate - Deauthenticate the current connection
|
* wpa_supplicant_deauthenticate - Deauthenticate the current connection
|
||||||
* @wpa_s: Pointer to wpa_supplicant data
|
* @wpa_s: Pointer to wpa_supplicant data
|
||||||
|
@ -1341,7 +1350,6 @@ void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s,
|
||||||
void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
|
void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
|
||||||
int reason_code)
|
int reason_code)
|
||||||
{
|
{
|
||||||
struct wpa_ssid *old_ssid;
|
|
||||||
u8 *addr = NULL;
|
u8 *addr = NULL;
|
||||||
|
|
||||||
if (!is_zero_ether_addr(wpa_s->bssid)) {
|
if (!is_zero_ether_addr(wpa_s->bssid)) {
|
||||||
|
@ -1352,16 +1360,8 @@ void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
|
||||||
reason_code);
|
reason_code);
|
||||||
addr = wpa_s->bssid;
|
addr = wpa_s->bssid;
|
||||||
}
|
}
|
||||||
wpa_clear_keys(wpa_s, addr);
|
|
||||||
wpa_supplicant_mark_disassoc(wpa_s);
|
wpa_supplicant_clear_connection(wpa_s, addr);
|
||||||
old_ssid = wpa_s->current_ssid;
|
|
||||||
wpa_s->current_ssid = NULL;
|
|
||||||
wpa_s->current_bss = NULL;
|
|
||||||
wpa_sm_set_config(wpa_s->wpa, NULL);
|
|
||||||
eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
|
|
||||||
if (old_ssid != wpa_s->current_ssid)
|
|
||||||
wpas_notify_network_changed(wpa_s);
|
|
||||||
eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue