TDLS: Clean up add/set peer operations
Use a helper function to avoid multiple copies of the same long list of argument parameters to wpa_sm_tdls_peer_addset() from the peer entry. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
bcd2baa0fa
commit
37d8a27401
1 changed files with 21 additions and 34 deletions
|
@ -1631,6 +1631,23 @@ static int copy_peer_supp_oper_classes(const struct wpa_eapol_ie_parse *kde,
|
|||
}
|
||||
|
||||
|
||||
static int wpa_tdls_addset_peer(struct wpa_sm *sm, struct wpa_tdls_peer *peer,
|
||||
int add)
|
||||
{
|
||||
return wpa_sm_tdls_peer_addset(sm, peer->addr, add, peer->aid,
|
||||
peer->capability,
|
||||
peer->supp_rates, peer->supp_rates_len,
|
||||
peer->ht_capabilities,
|
||||
peer->vht_capabilities,
|
||||
peer->qos_info, peer->ext_capab,
|
||||
peer->ext_capab_len,
|
||||
peer->supp_channels,
|
||||
peer->supp_channels_len,
|
||||
peer->supp_oper_classes,
|
||||
peer->supp_oper_classes_len);
|
||||
}
|
||||
|
||||
|
||||
static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
|
||||
const u8 *buf, size_t len)
|
||||
{
|
||||
|
@ -1945,18 +1962,8 @@ skip_rsn:
|
|||
wpa_tdls_generate_tpk(peer, sm->own_addr, sm->bssid);
|
||||
|
||||
skip_rsn_check:
|
||||
/* add the peer to the driver as a "setup in progress" peer */
|
||||
if (wpa_sm_tdls_peer_addset(sm, peer->addr, 1, peer->aid,
|
||||
peer->capability,
|
||||
peer->supp_rates, peer->supp_rates_len,
|
||||
peer->ht_capabilities,
|
||||
peer->vht_capabilities,
|
||||
peer->qos_info, peer->ext_capab,
|
||||
peer->ext_capab_len,
|
||||
peer->supp_channels,
|
||||
peer->supp_channels_len,
|
||||
peer->supp_oper_classes,
|
||||
peer->supp_oper_classes_len))
|
||||
/* add supported rates, capabilities, and qos_info to the TDLS peer */
|
||||
if (wpa_tdls_addset_peer(sm, peer, 1) < 0)
|
||||
goto error;
|
||||
|
||||
peer->tpk_in_progress = 1;
|
||||
|
@ -2256,17 +2263,7 @@ skip_rsn:
|
|||
peer->dtoken = dtoken;
|
||||
|
||||
/* add supported rates, capabilities, and qos_info to the TDLS peer */
|
||||
if (wpa_sm_tdls_peer_addset(sm, peer->addr, 0, peer->aid,
|
||||
peer->capability,
|
||||
peer->supp_rates, peer->supp_rates_len,
|
||||
peer->ht_capabilities,
|
||||
peer->vht_capabilities,
|
||||
peer->qos_info, peer->ext_capab,
|
||||
peer->ext_capab_len,
|
||||
peer->supp_channels,
|
||||
peer->supp_channels_len,
|
||||
peer->supp_oper_classes,
|
||||
peer->supp_oper_classes_len) < 0)
|
||||
if (wpa_tdls_addset_peer(sm, peer, 0) < 0)
|
||||
goto error;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "TDLS: Sending TDLS Setup Confirm / "
|
||||
|
@ -2435,17 +2432,7 @@ static int wpa_tdls_process_tpk_m3(struct wpa_sm *sm, const u8 *src_addr,
|
|||
|
||||
skip_rsn:
|
||||
/* add supported rates, capabilities, and qos_info to the TDLS peer */
|
||||
if (wpa_sm_tdls_peer_addset(sm, peer->addr, 0, peer->aid,
|
||||
peer->capability,
|
||||
peer->supp_rates, peer->supp_rates_len,
|
||||
peer->ht_capabilities,
|
||||
peer->vht_capabilities,
|
||||
peer->qos_info, peer->ext_capab,
|
||||
peer->ext_capab_len,
|
||||
peer->supp_channels,
|
||||
peer->supp_channels_len,
|
||||
peer->supp_oper_classes,
|
||||
peer->supp_oper_classes_len) < 0)
|
||||
if (wpa_tdls_addset_peer(sm, peer, 0) < 0)
|
||||
goto error;
|
||||
|
||||
if (!peer->tpk_success) {
|
||||
|
|
Loading…
Reference in a new issue