2010-11-06 16:31:02 +01:00
|
|
|
/*
|
|
|
|
* STA list
|
2015-01-25 22:32:01 +01:00
|
|
|
* Copyright (c) 2010-2015, Jouni Malinen <j@w1.fi>
|
2010-11-06 16:31:02 +01:00
|
|
|
*
|
2012-02-11 15:46:35 +01:00
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
2010-11-06 16:31:02 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "utils/includes.h"
|
|
|
|
|
|
|
|
#include "utils/common.h"
|
2010-11-12 21:40:59 +01:00
|
|
|
#include "common/defs.h"
|
2011-01-14 16:43:17 +01:00
|
|
|
#include "common/ieee802_11_defs.h"
|
2010-11-06 17:10:34 +01:00
|
|
|
#include "common/ieee802_11_common.h"
|
2010-11-06 16:31:02 +01:00
|
|
|
#include "wlantest.h"
|
|
|
|
|
|
|
|
|
2010-11-19 21:00:10 +01:00
|
|
|
struct wlantest_sta * sta_find(struct wlantest_bss *bss, const u8 *addr)
|
2010-11-06 16:31:02 +01:00
|
|
|
{
|
|
|
|
struct wlantest_sta *sta;
|
|
|
|
|
|
|
|
dl_list_for_each(sta, &bss->sta, struct wlantest_sta, list) {
|
Use ether_addr_equal() to compare whether two MAC addresses are equal
This was done with spatch using the following semantic patch and minor
manual edits to clean up coding style and avoid compiler warnings in
driver_wext.c:
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !os_memcmp(a, b, ETH_ALEN)
+ ether_addr_equal(a, b)
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-01-13 22:15:36 +01:00
|
|
|
if (ether_addr_equal(sta->addr, addr))
|
2010-11-06 16:31:02 +01:00
|
|
|
return sta;
|
|
|
|
}
|
|
|
|
|
2010-11-19 21:00:10 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-29 12:08:37 +02:00
|
|
|
struct wlantest_sta * sta_find_mlo(struct wlantest *wt,
|
|
|
|
struct wlantest_bss *bss, const u8 *addr)
|
|
|
|
{
|
|
|
|
struct wlantest_sta *sta;
|
|
|
|
struct wlantest_bss *obss;
|
|
|
|
int link_id;
|
|
|
|
|
|
|
|
dl_list_for_each(sta, &bss->sta, struct wlantest_sta, list) {
|
Use ether_addr_equal() to compare whether two MAC addresses are equal
This was done with spatch using the following semantic patch and minor
manual edits to clean up coding style and avoid compiler warnings in
driver_wext.c:
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !os_memcmp(a, b, ETH_ALEN)
+ ether_addr_equal(a, b)
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-01-13 22:15:36 +01:00
|
|
|
if (ether_addr_equal(sta->addr, addr))
|
2022-09-29 12:08:37 +02:00
|
|
|
return sta;
|
Use ether_addr_equal() to compare whether two MAC addresses are equal
This was done with spatch using the following semantic patch and minor
manual edits to clean up coding style and avoid compiler warnings in
driver_wext.c:
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !os_memcmp(a, b, ETH_ALEN)
+ ether_addr_equal(a, b)
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-01-13 22:15:36 +01:00
|
|
|
if (ether_addr_equal(sta->mld_mac_addr, addr))
|
2023-08-10 10:34:41 +02:00
|
|
|
return sta;
|
2022-09-29 12:08:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (is_zero_ether_addr(addr))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
dl_list_for_each(sta, &bss->sta, struct wlantest_sta, list) {
|
2024-03-02 10:21:48 +01:00
|
|
|
for (link_id = 0; link_id < MAX_NUM_MLD_LINKS; link_id++) {
|
Use ether_addr_equal() to compare whether two MAC addresses are equal
This was done with spatch using the following semantic patch and minor
manual edits to clean up coding style and avoid compiler warnings in
driver_wext.c:
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !os_memcmp(a, b, ETH_ALEN)
+ ether_addr_equal(a, b)
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-01-13 22:15:36 +01:00
|
|
|
if (ether_addr_equal(sta->link_addr[link_id], addr))
|
2022-09-29 12:08:37 +02:00
|
|
|
return sta;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dl_list_for_each(obss, &wt->bss, struct wlantest_bss, list) {
|
|
|
|
if (obss == bss)
|
|
|
|
continue;
|
2023-08-10 10:18:57 +02:00
|
|
|
if (!is_zero_ether_addr(bss->mld_mac_addr) &&
|
Use ether_addr_equal() to compare whether two MAC addresses are equal
This was done with spatch using the following semantic patch and minor
manual edits to clean up coding style and avoid compiler warnings in
driver_wext.c:
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !os_memcmp(a, b, ETH_ALEN)
+ ether_addr_equal(a, b)
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-01-13 22:15:36 +01:00
|
|
|
!ether_addr_equal(obss->mld_mac_addr, bss->mld_mac_addr))
|
2023-08-10 10:18:57 +02:00
|
|
|
continue;
|
2022-09-29 12:08:37 +02:00
|
|
|
dl_list_for_each(sta, &obss->sta, struct wlantest_sta, list) {
|
Use ether_addr_equal() to compare whether two MAC addresses are equal
This was done with spatch using the following semantic patch and minor
manual edits to clean up coding style and avoid compiler warnings in
driver_wext.c:
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !os_memcmp(a, b, ETH_ALEN)
+ ether_addr_equal(a, b)
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-01-13 22:15:36 +01:00
|
|
|
if (ether_addr_equal(sta->addr, addr))
|
2022-09-29 12:08:37 +02:00
|
|
|
return sta;
|
Use ether_addr_equal() to compare whether two MAC addresses are equal
This was done with spatch using the following semantic patch and minor
manual edits to clean up coding style and avoid compiler warnings in
driver_wext.c:
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !os_memcmp(a, b, ETH_ALEN)
+ ether_addr_equal(a, b)
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-01-13 22:15:36 +01:00
|
|
|
if (ether_addr_equal(sta->mld_mac_addr, addr))
|
2023-08-10 10:34:41 +02:00
|
|
|
return sta;
|
2024-03-02 10:21:48 +01:00
|
|
|
for (link_id = 0; link_id < MAX_NUM_MLD_LINKS;
|
2022-09-29 12:08:37 +02:00
|
|
|
link_id++) {
|
Use ether_addr_equal() to compare whether two MAC addresses are equal
This was done with spatch using the following semantic patch and minor
manual edits to clean up coding style and avoid compiler warnings in
driver_wext.c:
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !os_memcmp(a, b, ETH_ALEN)
+ ether_addr_equal(a, b)
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-01-13 22:15:36 +01:00
|
|
|
if (ether_addr_equal(sta->link_addr[link_id],
|
|
|
|
addr))
|
2022-09-29 12:08:37 +02:00
|
|
|
return sta;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-19 21:00:10 +01:00
|
|
|
struct wlantest_sta * sta_get(struct wlantest_bss *bss, const u8 *addr)
|
|
|
|
{
|
|
|
|
struct wlantest_sta *sta;
|
|
|
|
|
|
|
|
if (addr[0] & 0x01)
|
|
|
|
return NULL; /* Skip group addressed frames */
|
|
|
|
|
|
|
|
sta = sta_find(bss, addr);
|
|
|
|
if (sta)
|
|
|
|
return sta;
|
|
|
|
|
2010-11-06 16:31:02 +01:00
|
|
|
sta = os_zalloc(sizeof(*sta));
|
|
|
|
if (sta == NULL)
|
|
|
|
return NULL;
|
2010-11-23 13:27:28 +01:00
|
|
|
os_memset(sta->seq_ctrl_to_sta, 0xff, sizeof(sta->seq_ctrl_to_sta));
|
|
|
|
os_memset(sta->seq_ctrl_to_ap, 0xff, sizeof(sta->seq_ctrl_to_ap));
|
2010-11-12 21:40:59 +01:00
|
|
|
sta->bss = bss;
|
2010-11-06 16:31:02 +01:00
|
|
|
os_memcpy(sta->addr, addr, ETH_ALEN);
|
|
|
|
dl_list_add(&bss->sta, &sta->list);
|
2023-08-10 10:46:07 +02:00
|
|
|
wpa_printf(MSG_DEBUG, "Discovered new STA " MACSTR " in BSS " MACSTR
|
|
|
|
" (MLD " MACSTR ")",
|
|
|
|
MAC2STR(sta->addr),
|
|
|
|
MAC2STR(bss->bssid), MAC2STR(bss->mld_mac_addr));
|
2010-11-06 16:31:02 +01:00
|
|
|
return sta;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void sta_deinit(struct wlantest_sta *sta)
|
|
|
|
{
|
|
|
|
dl_list_del(&sta->list);
|
2010-11-19 16:09:02 +01:00
|
|
|
os_free(sta->assocreq_ies);
|
2010-11-06 16:31:02 +01:00
|
|
|
os_free(sta);
|
|
|
|
}
|
2010-11-06 17:10:34 +01:00
|
|
|
|
|
|
|
|
2023-02-13 20:34:58 +01:00
|
|
|
static void sta_update_assoc_ml(struct wlantest_sta *sta,
|
|
|
|
struct ieee802_11_elems *elems)
|
|
|
|
{
|
|
|
|
const u8 *mld_addr;
|
|
|
|
|
|
|
|
if (!elems->basic_mle)
|
|
|
|
return;
|
|
|
|
|
|
|
|
mld_addr = get_basic_mle_mld_addr(elems->basic_mle,
|
|
|
|
elems->basic_mle_len);
|
|
|
|
if (!mld_addr) {
|
|
|
|
wpa_printf(MSG_INFO, "MLO: Invalid Basic Multi-Link element");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wpa_printf(MSG_DEBUG, "STA MLD Address: " MACSTR, MAC2STR(mld_addr));
|
|
|
|
os_memcpy(sta->mld_mac_addr, mld_addr, ETH_ALEN);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-06 17:10:34 +01:00
|
|
|
void sta_update_assoc(struct wlantest_sta *sta, struct ieee802_11_elems *elems)
|
|
|
|
{
|
2010-11-12 21:40:59 +01:00
|
|
|
struct wpa_ie_data data;
|
|
|
|
struct wlantest_bss *bss = sta->bss;
|
|
|
|
|
2017-11-14 11:55:48 +01:00
|
|
|
if (elems->wpa_ie && !bss->wpaie[0] &&
|
|
|
|
(bss->beacon_seen || bss->proberesp_seen)) {
|
2011-01-17 18:52:35 +01:00
|
|
|
wpa_printf(MSG_INFO, "WPA IE included in Association Request "
|
|
|
|
"frame from " MACSTR " even though BSS does not "
|
|
|
|
"use WPA - ignore IE",
|
|
|
|
MAC2STR(sta->addr));
|
|
|
|
elems->wpa_ie = NULL;
|
|
|
|
}
|
|
|
|
|
2017-11-14 11:55:48 +01:00
|
|
|
if (elems->rsn_ie && !bss->rsnie[0] &&
|
|
|
|
(bss->beacon_seen || bss->proberesp_seen)) {
|
2011-01-17 18:52:35 +01:00
|
|
|
wpa_printf(MSG_INFO, "RSN IE included in Association Request "
|
|
|
|
"frame from " MACSTR " even though BSS does not "
|
|
|
|
"use RSN - ignore IE",
|
|
|
|
MAC2STR(sta->addr));
|
|
|
|
elems->rsn_ie = NULL;
|
|
|
|
}
|
|
|
|
|
2017-11-14 11:55:48 +01:00
|
|
|
if (elems->osen && !bss->osenie[0] &&
|
|
|
|
(bss->beacon_seen || bss->proberesp_seen)) {
|
2014-05-15 11:40:02 +02:00
|
|
|
wpa_printf(MSG_INFO, "OSEN IE included in Association Request "
|
|
|
|
"frame from " MACSTR " even though BSS does not "
|
|
|
|
"use OSEN - ignore IE",
|
|
|
|
MAC2STR(sta->addr));
|
|
|
|
elems->osen = NULL;
|
|
|
|
}
|
|
|
|
|
2010-11-06 17:10:34 +01:00
|
|
|
if (elems->wpa_ie && elems->rsn_ie) {
|
|
|
|
wpa_printf(MSG_INFO, "Both WPA IE and RSN IE included in "
|
|
|
|
"Association Request frame from " MACSTR,
|
|
|
|
MAC2STR(sta->addr));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (elems->rsn_ie) {
|
|
|
|
wpa_hexdump(MSG_DEBUG, "RSN IE", elems->rsn_ie - 2,
|
|
|
|
elems->rsn_ie_len + 2);
|
|
|
|
os_memcpy(sta->rsnie, elems->rsn_ie - 2,
|
|
|
|
elems->rsn_ie_len + 2);
|
2010-11-12 21:40:59 +01:00
|
|
|
if (wpa_parse_wpa_ie_rsn(sta->rsnie, 2 + sta->rsnie[1], &data)
|
|
|
|
< 0) {
|
|
|
|
wpa_printf(MSG_INFO, "Failed to parse RSN IE from "
|
|
|
|
MACSTR, MAC2STR(sta->addr));
|
|
|
|
}
|
2010-11-06 17:10:34 +01:00
|
|
|
} else if (elems->wpa_ie) {
|
|
|
|
wpa_hexdump(MSG_DEBUG, "WPA IE", elems->wpa_ie - 2,
|
|
|
|
elems->wpa_ie_len + 2);
|
|
|
|
os_memcpy(sta->rsnie, elems->wpa_ie - 2,
|
|
|
|
elems->wpa_ie_len + 2);
|
2010-11-12 21:40:59 +01:00
|
|
|
if (wpa_parse_wpa_ie_wpa(sta->rsnie, 2 + sta->rsnie[1], &data)
|
|
|
|
< 0) {
|
|
|
|
wpa_printf(MSG_INFO, "Failed to parse WPA IE from "
|
|
|
|
MACSTR, MAC2STR(sta->addr));
|
|
|
|
}
|
2014-05-15 11:40:02 +02:00
|
|
|
} else if (elems->osen) {
|
|
|
|
wpa_hexdump(MSG_DEBUG, "OSEN IE", elems->osen - 2,
|
|
|
|
elems->osen_len + 2);
|
|
|
|
os_memcpy(sta->osenie, elems->osen - 2, elems->osen_len + 2);
|
|
|
|
sta->proto = WPA_PROTO_OSEN;
|
|
|
|
sta->pairwise_cipher = WPA_CIPHER_CCMP;
|
|
|
|
sta->key_mgmt = WPA_KEY_MGMT_OSEN;
|
|
|
|
sta->rsn_capab = 0;
|
|
|
|
goto skip_rsn_wpa;
|
2011-01-14 16:43:17 +01:00
|
|
|
} else {
|
2010-11-06 17:10:34 +01:00
|
|
|
sta->rsnie[0] = 0;
|
2011-01-14 16:43:17 +01:00
|
|
|
sta->proto = 0;
|
|
|
|
sta->pairwise_cipher = 0;
|
|
|
|
sta->key_mgmt = 0;
|
|
|
|
sta->rsn_capab = 0;
|
|
|
|
if (sta->assocreq_capab_info & WLAN_CAPABILITY_PRIVACY)
|
|
|
|
sta->pairwise_cipher = WPA_CIPHER_WEP40;
|
|
|
|
goto skip_rsn_wpa;
|
|
|
|
}
|
2010-11-12 21:40:59 +01:00
|
|
|
|
|
|
|
sta->proto = data.proto;
|
|
|
|
sta->pairwise_cipher = data.pairwise_cipher;
|
|
|
|
sta->key_mgmt = data.key_mgmt;
|
|
|
|
sta->rsn_capab = data.capabilities;
|
|
|
|
if (bss->proto && (sta->proto & bss->proto) == 0) {
|
|
|
|
wpa_printf(MSG_INFO, "Mismatch in WPA/WPA2 proto: STA "
|
|
|
|
MACSTR " 0x%x BSS " MACSTR " 0x%x",
|
|
|
|
MAC2STR(sta->addr), sta->proto,
|
|
|
|
MAC2STR(bss->bssid), bss->proto);
|
|
|
|
}
|
|
|
|
if (bss->pairwise_cipher &&
|
|
|
|
(sta->pairwise_cipher & bss->pairwise_cipher) == 0) {
|
|
|
|
wpa_printf(MSG_INFO, "Mismatch in pairwise cipher: STA "
|
|
|
|
MACSTR " 0x%x BSS " MACSTR " 0x%x",
|
|
|
|
MAC2STR(sta->addr), sta->pairwise_cipher,
|
|
|
|
MAC2STR(bss->bssid), bss->pairwise_cipher);
|
|
|
|
}
|
2020-02-27 23:51:07 +01:00
|
|
|
if (sta->proto && data.group_cipher != bss->group_cipher &&
|
|
|
|
bss->ies_set) {
|
2010-11-12 21:40:59 +01:00
|
|
|
wpa_printf(MSG_INFO, "Mismatch in group cipher: STA "
|
|
|
|
MACSTR " 0x%x != BSS " MACSTR " 0x%x",
|
|
|
|
MAC2STR(sta->addr), data.group_cipher,
|
|
|
|
MAC2STR(bss->bssid), bss->group_cipher);
|
|
|
|
}
|
2010-11-12 22:16:38 +01:00
|
|
|
if ((bss->rsn_capab & WPA_CAPABILITY_MFPR) &&
|
|
|
|
!(sta->rsn_capab & WPA_CAPABILITY_MFPC)) {
|
|
|
|
wpa_printf(MSG_INFO, "STA " MACSTR " tries to associate "
|
|
|
|
"without MFP to BSS " MACSTR " that advertises "
|
|
|
|
"MFPR", MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
|
}
|
2018-08-06 21:46:25 +02:00
|
|
|
if ((sta->rsn_capab & WPA_CAPABILITY_OCVC) &&
|
|
|
|
!(sta->rsn_capab & WPA_CAPABILITY_MFPC)) {
|
|
|
|
wpa_printf(MSG_INFO, "STA " MACSTR " tries to associate "
|
|
|
|
"without MFP to BSS " MACSTR " while supporting "
|
|
|
|
"OCV", MAC2STR(sta->addr), MAC2STR(bss->bssid));
|
|
|
|
}
|
2010-11-12 21:40:59 +01:00
|
|
|
|
2011-01-14 16:43:17 +01:00
|
|
|
skip_rsn_wpa:
|
2010-11-12 21:40:59 +01:00
|
|
|
wpa_printf(MSG_INFO, "STA " MACSTR
|
2014-05-15 11:40:02 +02:00
|
|
|
" proto=%s%s%s%s"
|
2014-08-29 15:03:01 +02:00
|
|
|
"pairwise=%s%s%s%s%s%s%s"
|
2023-05-23 12:14:54 +02:00
|
|
|
"key_mgmt=%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
|
2021-02-07 12:52:59 +01:00
|
|
|
"rsn_capab=%s%s%s%s%s%s%s%s%s%s",
|
2010-11-12 21:40:59 +01:00
|
|
|
MAC2STR(sta->addr),
|
|
|
|
sta->proto == 0 ? "OPEN " : "",
|
|
|
|
sta->proto & WPA_PROTO_WPA ? "WPA " : "",
|
|
|
|
sta->proto & WPA_PROTO_RSN ? "WPA2 " : "",
|
2014-05-15 11:40:02 +02:00
|
|
|
sta->proto & WPA_PROTO_OSEN ? "OSEN " : "",
|
2010-11-12 21:40:59 +01:00
|
|
|
sta->pairwise_cipher == 0 ? "N/A " : "",
|
|
|
|
sta->pairwise_cipher & WPA_CIPHER_NONE ? "NONE " : "",
|
|
|
|
sta->pairwise_cipher & WPA_CIPHER_TKIP ? "TKIP " : "",
|
|
|
|
sta->pairwise_cipher & WPA_CIPHER_CCMP ? "CCMP " : "",
|
2014-08-29 15:03:01 +02:00
|
|
|
bss->pairwise_cipher & WPA_CIPHER_CCMP_256 ? "CCMP-256 " :
|
|
|
|
"",
|
|
|
|
bss->pairwise_cipher & WPA_CIPHER_GCMP ? "GCMP " : "",
|
|
|
|
bss->pairwise_cipher & WPA_CIPHER_GCMP_256 ? "GCMP-256 " :
|
|
|
|
"",
|
2010-11-12 21:40:59 +01:00
|
|
|
sta->key_mgmt == 0 ? "N/A " : "",
|
|
|
|
sta->key_mgmt & WPA_KEY_MGMT_IEEE8021X ? "EAP " : "",
|
|
|
|
sta->key_mgmt & WPA_KEY_MGMT_PSK ? "PSK " : "",
|
|
|
|
sta->key_mgmt & WPA_KEY_MGMT_WPA_NONE ? "WPA-NONE " : "",
|
|
|
|
sta->key_mgmt & WPA_KEY_MGMT_FT_IEEE8021X ? "FT-EAP " : "",
|
|
|
|
sta->key_mgmt & WPA_KEY_MGMT_FT_PSK ? "FT-PSK " : "",
|
|
|
|
sta->key_mgmt & WPA_KEY_MGMT_IEEE8021X_SHA256 ?
|
|
|
|
"EAP-SHA256 " : "",
|
|
|
|
sta->key_mgmt & WPA_KEY_MGMT_PSK_SHA256 ?
|
|
|
|
"PSK-SHA256 " : "",
|
2021-02-07 12:52:59 +01:00
|
|
|
sta->key_mgmt & WPA_KEY_MGMT_OWE ? "OWE " : "",
|
|
|
|
sta->key_mgmt & WPA_KEY_MGMT_PASN ? "PASN " : "",
|
2014-05-15 11:40:02 +02:00
|
|
|
sta->key_mgmt & WPA_KEY_MGMT_OSEN ? "OSEN " : "",
|
2021-02-07 12:52:59 +01:00
|
|
|
sta->key_mgmt & WPA_KEY_MGMT_DPP ? "DPP " : "",
|
2014-11-16 12:20:51 +01:00
|
|
|
sta->key_mgmt & WPA_KEY_MGMT_IEEE8021X_SUITE_B ?
|
|
|
|
"EAP-SUITE-B " : "",
|
2015-01-25 22:32:01 +01:00
|
|
|
sta->key_mgmt & WPA_KEY_MGMT_IEEE8021X_SUITE_B_192 ?
|
|
|
|
"EAP-SUITE-B-192 " : "",
|
2023-05-23 12:14:54 +02:00
|
|
|
sta->key_mgmt & WPA_KEY_MGMT_IEEE8021X_SHA384 ?
|
|
|
|
"EAP-SHA384 " : "",
|
2010-11-12 21:40:59 +01:00
|
|
|
sta->rsn_capab & WPA_CAPABILITY_PREAUTH ? "PREAUTH " : "",
|
|
|
|
sta->rsn_capab & WPA_CAPABILITY_NO_PAIRWISE ?
|
|
|
|
"NO_PAIRWISE " : "",
|
|
|
|
sta->rsn_capab & WPA_CAPABILITY_MFPR ? "MFPR " : "",
|
|
|
|
sta->rsn_capab & WPA_CAPABILITY_MFPC ? "MFPC " : "",
|
|
|
|
sta->rsn_capab & WPA_CAPABILITY_PEERKEY_ENABLED ?
|
2018-08-06 21:46:25 +02:00
|
|
|
"PEERKEY " : "",
|
2021-02-07 12:52:59 +01:00
|
|
|
sta->rsn_capab & WPA_CAPABILITY_SPP_A_MSDU_CAPABLE ?
|
|
|
|
"SPP-A-MSDU-CAPAB " : "",
|
|
|
|
sta->rsn_capab & WPA_CAPABILITY_SPP_A_MSDU_REQUIRED ?
|
|
|
|
"SPP-A-MSDU-REQUIRED " : "",
|
|
|
|
sta->rsn_capab & WPA_CAPABILITY_PBAC ? "PBAC " : "",
|
|
|
|
sta->rsn_capab & WPA_CAPABILITY_OCVC ? "OCVC " : "",
|
|
|
|
sta->rsn_capab & WPA_CAPABILITY_EXT_KEY_ID_FOR_UNICAST ?
|
|
|
|
"ExtKeyID " : "");
|
2023-02-13 20:34:58 +01:00
|
|
|
|
|
|
|
sta_update_assoc_ml(sta, elems);
|
2010-11-06 17:10:34 +01:00
|
|
|
}
|
2022-11-09 21:39:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
static void sta_copy_ptk(struct wlantest_sta *sta, struct wpa_ptk *ptk)
|
|
|
|
{
|
|
|
|
os_memcpy(&sta->ptk, ptk, sizeof(*ptk));
|
|
|
|
sta->ptk_set = 1;
|
|
|
|
os_memset(sta->rsc_tods, 0, sizeof(sta->rsc_tods));
|
|
|
|
os_memset(sta->rsc_fromds, 0, sizeof(sta->rsc_fromds));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void sta_new_ptk(struct wlantest *wt, struct wlantest_sta *sta,
|
|
|
|
struct wpa_ptk *ptk)
|
|
|
|
{
|
|
|
|
struct wlantest_bss *bss;
|
|
|
|
struct wlantest_sta *osta;
|
|
|
|
|
|
|
|
add_note(wt, MSG_DEBUG, "Derived new PTK");
|
|
|
|
sta_copy_ptk(sta, ptk);
|
|
|
|
wpa_hexdump(MSG_DEBUG, "PTK:KCK", sta->ptk.kck, sta->ptk.kck_len);
|
|
|
|
wpa_hexdump(MSG_DEBUG, "PTK:KEK", sta->ptk.kek, sta->ptk.kek_len);
|
|
|
|
wpa_hexdump(MSG_DEBUG, "PTK:TK", sta->ptk.tk, sta->ptk.tk_len);
|
|
|
|
|
|
|
|
dl_list_for_each(bss, &wt->bss, struct wlantest_bss, list) {
|
|
|
|
dl_list_for_each(osta, &bss->sta, struct wlantest_sta, list) {
|
|
|
|
bool match = false;
|
|
|
|
int link_id;
|
|
|
|
|
|
|
|
if (osta == sta)
|
|
|
|
continue;
|
Use ether_addr_equal() to compare whether two MAC addresses are equal
This was done with spatch using the following semantic patch and minor
manual edits to clean up coding style and avoid compiler warnings in
driver_wext.c:
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !os_memcmp(a, b, ETH_ALEN)
+ ether_addr_equal(a, b)
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-01-13 22:15:36 +01:00
|
|
|
if (ether_addr_equal(sta->addr, osta->addr))
|
2022-11-09 21:39:01 +01:00
|
|
|
match = true;
|
2024-03-02 10:21:48 +01:00
|
|
|
for (link_id = 0; !match && link_id < MAX_NUM_MLD_LINKS;
|
2022-11-09 21:39:01 +01:00
|
|
|
link_id++) {
|
Use ether_addr_equal() to compare whether two MAC addresses are equal
This was done with spatch using the following semantic patch and minor
manual edits to clean up coding style and avoid compiler warnings in
driver_wext.c:
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !os_memcmp(a, b, ETH_ALEN)
+ ether_addr_equal(a, b)
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-01-13 22:15:36 +01:00
|
|
|
if (ether_addr_equal(osta->link_addr[link_id],
|
|
|
|
sta->addr))
|
2022-11-09 21:39:01 +01:00
|
|
|
match = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!match)
|
|
|
|
continue;
|
Use ether_addr_equal() to compare whether two MAC addresses are equal
This was done with spatch using the following semantic patch and minor
manual edits to clean up coding style and avoid compiler warnings in
driver_wext.c:
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- os_memcmp(a, b, ETH_ALEN) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !os_memcmp(a, b, ETH_ALEN)
+ ether_addr_equal(a, b)
Signed-off-by: Jouni Malinen <j@w1.fi>
2024-01-13 22:15:36 +01:00
|
|
|
if (!ether_addr_equal(sta->bss->mld_mac_addr,
|
|
|
|
osta->bss->mld_mac_addr))
|
2023-08-10 11:12:01 +02:00
|
|
|
continue;
|
2022-11-09 21:39:01 +01:00
|
|
|
wpa_printf(MSG_DEBUG,
|
|
|
|
"Add PTK to another MLO STA entry " MACSTR
|
|
|
|
" (MLD " MACSTR " --> " MACSTR ") in BSS "
|
|
|
|
MACSTR " (MLD " MACSTR " --> " MACSTR ")",
|
|
|
|
MAC2STR(osta->addr),
|
|
|
|
MAC2STR(osta->mld_mac_addr),
|
|
|
|
MAC2STR(sta->mld_mac_addr),
|
|
|
|
MAC2STR(bss->bssid),
|
|
|
|
MAC2STR(bss->mld_mac_addr),
|
|
|
|
MAC2STR(sta->bss->mld_mac_addr));
|
|
|
|
sta_copy_ptk(osta, ptk);
|
|
|
|
os_memcpy(osta->mld_mac_addr, sta->mld_mac_addr,
|
|
|
|
ETH_ALEN);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|