From 1e8a6e7553ad23fbd41b8b10671aef306c12d8f9 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 5 Nov 2012 17:05:37 +0200 Subject: [PATCH] Remove unused wpa_supplicant_disassociate() This function is now unused after the last couple of commits that removed the last uses, so remove this to keep code simpler since all places that disassociate, can use deauthentication instead. Signed-hostap: Jouni Malinen --- src/rsn_supp/wpa.h | 1 - src/rsn_supp/wpa_i.h | 6 ---- wpa_supplicant/preauth_test.c | 7 ----- wpa_supplicant/wpa_supplicant.c | 51 ------------------------------- wpa_supplicant/wpa_supplicant_i.h | 2 -- wpa_supplicant/wpas_glue.c | 9 ------ 6 files changed, 76 deletions(-) diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h index 1077b5a04..8afdf39bf 100644 --- a/src/rsn_supp/wpa.h +++ b/src/rsn_supp/wpa.h @@ -24,7 +24,6 @@ struct wpa_sm_ctx { void (*set_state)(void *ctx, enum wpa_states state); enum wpa_states (*get_state)(void *ctx); void (*deauthenticate)(void * ctx, int reason_code); - void (*disassociate)(void *ctx, int reason_code); int (*set_key)(void *ctx, enum wpa_alg alg, const u8 *addr, int key_idx, int set_tx, const u8 *seq, size_t seq_len, diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h index c30d09e8d..9f9e641c3 100644 --- a/src/rsn_supp/wpa_i.h +++ b/src/rsn_supp/wpa_i.h @@ -143,12 +143,6 @@ static inline void wpa_sm_deauthenticate(struct wpa_sm *sm, int reason_code) sm->ctx->deauthenticate(sm->ctx->ctx, reason_code); } -static inline void wpa_sm_disassociate(struct wpa_sm *sm, int reason_code) -{ - WPA_ASSERT(sm->ctx->disassociate); - sm->ctx->disassociate(sm->ctx->ctx, reason_code); -} - static inline int wpa_sm_set_key(struct wpa_sm *sm, enum wpa_alg alg, const u8 *addr, int key_idx, int set_tx, const u8 *seq, size_t seq_len, diff --git a/wpa_supplicant/preauth_test.c b/wpa_supplicant/preauth_test.c index 62b7538af..3503e65e5 100644 --- a/wpa_supplicant/preauth_test.c +++ b/wpa_supplicant/preauth_test.c @@ -38,12 +38,6 @@ struct preauth_test_data { }; -static void _wpa_supplicant_disassociate(void *wpa_s, int reason_code) -{ - wpa_supplicant_disassociate(wpa_s, reason_code); -} - - static void _wpa_supplicant_deauthenticate(void *wpa_s, int reason_code) { wpa_supplicant_deauthenticate(wpa_s, reason_code); @@ -238,7 +232,6 @@ static void wpa_init_conf(struct wpa_supplicant *wpa_s, const char *ifname) ctx->set_state = _wpa_supplicant_set_state; ctx->get_state = _wpa_supplicant_get_state; ctx->deauthenticate = _wpa_supplicant_deauthenticate; - ctx->disassociate = _wpa_supplicant_disassociate; ctx->set_key = wpa_supplicant_set_key; ctx->get_network_ctx = wpa_supplicant_get_network_ctx; ctx->get_bssid = wpa_supplicant_get_bssid; diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 82edae205..ee283b777 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1681,57 +1681,6 @@ static void wpa_supplicant_clear_connection(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; - union wpa_event_data event; - int zero_addr = 0; - - wpa_dbg(wpa_s, MSG_DEBUG, "Request to disassociate - bssid=" MACSTR - " pending_bssid=" MACSTR " reason=%d state=%s", - MAC2STR(wpa_s->bssid), MAC2STR(wpa_s->pending_bssid), - reason_code, wpa_supplicant_state_txt(wpa_s->wpa_state)); - - if (!is_zero_ether_addr(wpa_s->bssid)) - addr = wpa_s->bssid; - else if (!is_zero_ether_addr(wpa_s->pending_bssid) && - (wpa_s->wpa_state == WPA_AUTHENTICATING || - wpa_s->wpa_state == WPA_ASSOCIATING)) - addr = wpa_s->pending_bssid; - else if (wpa_s->wpa_state == WPA_ASSOCIATING) { - /* - * When using driver-based BSS selection, we may not know the - * BSSID with which we are currently trying to associate. We - * need to notify the driver of this disconnection even in such - * a case, so use the all zeros address here. - */ - addr = wpa_s->bssid; - zero_addr = 1; - } - - if (addr) { - wpa_drv_disassociate(wpa_s, addr, reason_code); - os_memset(&event, 0, sizeof(event)); - event.disassoc_info.reason_code = (u16) reason_code; - event.disassoc_info.locally_generated = 1; - wpa_supplicant_event(wpa_s, EVENT_DISASSOC, &event); - if (zero_addr) - addr = NULL; - } - - wpa_supplicant_clear_connection(wpa_s, addr); -} - - /** * wpa_supplicant_deauthenticate - Deauthenticate the current connection * @wpa_s: Pointer to wpa_supplicant data diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 3761fbf66..5e7702836 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -660,8 +660,6 @@ const char * wpa_supplicant_get_eap_mode(struct wpa_supplicant *wpa_s); void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s); void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s, int reason_code); -void wpa_supplicant_disassociate(struct wpa_supplicant *wpa_s, - int reason_code); void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c index 6aa52053e..aec639a31 100644 --- a/wpa_supplicant/wpas_glue.c +++ b/wpa_supplicant/wpas_glue.c @@ -406,14 +406,6 @@ static enum wpa_states _wpa_supplicant_get_state(void *wpa_s) } -static void _wpa_supplicant_disassociate(void *wpa_s, int reason_code) -{ - wpa_supplicant_disassociate(wpa_s, reason_code); - /* Schedule a scan to make sure we continue looking for networks */ - wpa_supplicant_req_scan(wpa_s, 5, 0); -} - - static void _wpa_supplicant_deauthenticate(void *wpa_s, int reason_code) { wpa_supplicant_deauthenticate(wpa_s, reason_code); @@ -839,7 +831,6 @@ int wpa_supplicant_init_wpa(struct wpa_supplicant *wpa_s) ctx->set_state = _wpa_supplicant_set_state; ctx->get_state = _wpa_supplicant_get_state; ctx->deauthenticate = _wpa_supplicant_deauthenticate; - ctx->disassociate = _wpa_supplicant_disassociate; ctx->set_key = wpa_supplicant_set_key; ctx->get_network_ctx = wpa_supplicant_get_network_ctx; ctx->get_bssid = wpa_supplicant_get_bssid;