TDLS: Clean up wpa_tdls_teardown_link() uses
Making this function be used only for external setup case simplifies the implementation and makes core wpa_supplicant calls in ctrl_iface.c and events.c consistent. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
f9174c3b4e
commit
f130b105ec
2 changed files with 15 additions and 19 deletions
|
@ -276,21 +276,13 @@ static int wpa_tdls_tpk_send(struct wpa_sm *sm, const u8 *dest, u8 action_code,
|
|||
|
||||
|
||||
static int wpa_tdls_do_teardown(struct wpa_sm *sm, struct wpa_tdls_peer *peer,
|
||||
u16 reason_code, int free_peer)
|
||||
u16 reason_code)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (sm->tdls_external_setup) {
|
||||
ret = wpa_tdls_send_teardown(sm, peer->addr, reason_code);
|
||||
|
||||
/* disable the link after teardown was sent */
|
||||
wpa_sm_tdls_oper(sm, TDLS_DISABLE_LINK, peer->addr);
|
||||
} else {
|
||||
ret = wpa_sm_tdls_oper(sm, TDLS_TEARDOWN, peer->addr);
|
||||
}
|
||||
|
||||
if (sm->tdls_external_setup || free_peer)
|
||||
wpa_tdls_peer_free(sm, peer);
|
||||
wpa_tdls_disable_link(sm, peer->addr);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -338,7 +330,7 @@ static void wpa_tdls_tpk_retry_timeout(void *eloop_ctx, void *timeout_ctx)
|
|||
|
||||
wpa_printf(MSG_DEBUG, "TDLS: Sending Teardown Request");
|
||||
wpa_tdls_do_teardown(sm, peer,
|
||||
WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED, 1);
|
||||
WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -616,7 +608,7 @@ static void wpa_tdls_tpk_timeout(void *eloop_ctx, void *timeout_ctx)
|
|||
wpa_printf(MSG_DEBUG, "TDLS: TPK lifetime expired for " MACSTR
|
||||
" - tear down", MAC2STR(peer->addr));
|
||||
wpa_tdls_do_teardown(sm, peer,
|
||||
WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED, 1);
|
||||
WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -775,7 +767,7 @@ int wpa_tdls_teardown_link(struct wpa_sm *sm, const u8 *addr, u16 reason_code)
|
|||
return -1;
|
||||
}
|
||||
|
||||
return wpa_tdls_do_teardown(sm, peer, reason_code, 0);
|
||||
return wpa_tdls_do_teardown(sm, peer, reason_code);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2057,7 +2049,7 @@ skip_rsn:
|
|||
if (ret < 0) {
|
||||
wpa_printf(MSG_DEBUG, "TDLS: Could not enable link");
|
||||
wpa_tdls_do_teardown(sm, peer,
|
||||
WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED, 1);
|
||||
WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
|
||||
}
|
||||
return ret;
|
||||
|
||||
|
@ -2202,7 +2194,7 @@ skip_rsn:
|
|||
if (ret < 0) {
|
||||
wpa_printf(MSG_DEBUG, "TDLS: Could not enable link");
|
||||
wpa_tdls_do_teardown(sm, peer,
|
||||
WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED, 1);
|
||||
WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
|
||||
}
|
||||
return ret;
|
||||
error:
|
||||
|
|
|
@ -2281,8 +2281,12 @@ static void wpa_supplicant_event_tdls(struct wpa_supplicant *wpa_s,
|
|||
wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, data->tdls.peer);
|
||||
break;
|
||||
case TDLS_REQUEST_TEARDOWN:
|
||||
if (wpa_tdls_is_external_setup(wpa_s->wpa))
|
||||
wpa_tdls_teardown_link(wpa_s->wpa, data->tdls.peer,
|
||||
data->tdls.reason_code);
|
||||
else
|
||||
wpa_drv_tdls_oper(wpa_s, TDLS_TEARDOWN,
|
||||
data->tdls.peer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue