wlantest: Use local variables for AA/SPA in FT Request/Response processing

This makes the code more readable by getting rid of the multiple
instances of references to the specifiec fields within the FT Action
frame.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
This commit is contained in:
Veerendranath Jakkam 2023-08-14 20:55:08 +05:30 committed by Jouni Malinen
parent 338a78846b
commit 9318db7c38

View file

@ -2042,6 +2042,7 @@ static void rx_mgmt_action_ft_request(struct wlantest *wt,
const u8 *ies; const u8 *ies;
size_t ies_len; size_t ies_len;
struct wpa_ft_ies parse; struct wpa_ft_ies parse;
const u8 *spa, *aa;
struct wlantest_bss *bss; struct wlantest_bss *bss;
struct wlantest_sta *sta; struct wlantest_sta *sta;
@ -2050,10 +2051,11 @@ static void rx_mgmt_action_ft_request(struct wlantest *wt,
return; return;
} }
spa = mgmt->u.action.u.ft_action_resp.sta_addr;
aa = mgmt->u.action.u.ft_action_resp.target_ap_addr;
wpa_printf(MSG_DEBUG, "FT Request: STA Address: " MACSTR wpa_printf(MSG_DEBUG, "FT Request: STA Address: " MACSTR
" Target AP Address: " MACSTR, " Target AP Address: " MACSTR,
MAC2STR(mgmt->u.action.u.ft_action_req.sta_addr), MAC2STR(spa), MAC2STR(aa));
MAC2STR(mgmt->u.action.u.ft_action_req.target_ap_addr));
ies = mgmt->u.action.u.ft_action_req.variable; ies = mgmt->u.action.u.ft_action_req.variable;
ies_len = len - (24 + 2 + 2 * ETH_ALEN); ies_len = len - (24 + 2 + 2 * ETH_ALEN);
wpa_hexdump(MSG_DEBUG, "FT Request frame body", ies, ies_len); wpa_hexdump(MSG_DEBUG, "FT Request frame body", ies, ies_len);
@ -2063,7 +2065,7 @@ static void rx_mgmt_action_ft_request(struct wlantest *wt,
return; return;
} }
bss = bss_get(wt, mgmt->u.action.u.ft_action_resp.target_ap_addr); bss = bss_get(wt, aa);
if (!bss) { if (!bss) {
add_note(wt, MSG_INFO, "No BSS entry for Target AP"); add_note(wt, MSG_INFO, "No BSS entry for Target AP");
return; return;
@ -2086,6 +2088,7 @@ static void rx_mgmt_action_ft_response(struct wlantest *wt,
{ {
struct wlantest_bss *bss, *bss2; struct wlantest_bss *bss, *bss2;
struct wlantest_sta *new_sta; struct wlantest_sta *new_sta;
const u8 *spa, *aa;
const u8 *ies; const u8 *ies;
size_t ies_len; size_t ies_len;
struct wpa_ft_ies parse; struct wpa_ft_ies parse;
@ -2098,10 +2101,11 @@ static void rx_mgmt_action_ft_response(struct wlantest *wt,
return; return;
} }
spa = mgmt->u.action.u.ft_action_resp.sta_addr;
aa = mgmt->u.action.u.ft_action_resp.target_ap_addr;
wpa_printf(MSG_DEBUG, "FT Response: STA Address: " MACSTR wpa_printf(MSG_DEBUG, "FT Response: STA Address: " MACSTR
" Target AP Address: " MACSTR " Status Code: %u", " Target AP Address: " MACSTR " Status Code: %u",
MAC2STR(mgmt->u.action.u.ft_action_resp.sta_addr), MAC2STR(spa), MAC2STR(aa),
MAC2STR(mgmt->u.action.u.ft_action_resp.target_ap_addr),
le_to_host16(mgmt->u.action.u.ft_action_resp.status_code)); le_to_host16(mgmt->u.action.u.ft_action_resp.status_code));
ies = mgmt->u.action.u.ft_action_req.variable; ies = mgmt->u.action.u.ft_action_req.variable;
ies_len = len - (24 + 2 + 2 * ETH_ALEN); ies_len = len - (24 + 2 + 2 * ETH_ALEN);
@ -2113,15 +2117,14 @@ static void rx_mgmt_action_ft_response(struct wlantest *wt,
return; return;
} }
bss = bss_find(wt, mgmt->u.action.u.ft_action_resp.target_ap_addr); bss = bss_find(wt, aa);
bss2 = bss_find_mld(wt, mgmt->u.action.u.ft_action_resp.target_ap_addr); bss2 = bss_find_mld(wt, aa);
if (!bss) if (!bss)
bss = bss2; bss = bss2;
if (bss && bss2 && bss != bss2 && !sta_find(bss, sta->addr)) if (bss && bss2 && bss != bss2 && !sta_find(bss, sta->addr))
bss = bss2; bss = bss2;
if (!bss) if (!bss)
bss = bss_get(wt, bss = bss_get(wt, aa);
mgmt->u.action.u.ft_action_resp.target_ap_addr);
if (!bss) { if (!bss) {
add_note(wt, MSG_INFO, "No BSS entry for Target AP"); add_note(wt, MSG_INFO, "No BSS entry for Target AP");