WPA3: Update transition disable bitmap based on port authorized event

In case of drivers that offload the 4-way handshake to the driver, there
was no way of updating wpa_supplicant about the transition disable
bitmap received as a part of EAPOL-Key msg 3/4.

With latest provisions in cfg80211_port_authorized(), the TD bitmap can
be sent to the upper layer. Parse that as a part of the port authorized
event and set the transition disable information accordingly.

Signed-off-by: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
This commit is contained in:
Vinayak Yadawad 2022-12-06 14:52:27 +05:30 committed by Jouni Malinen
parent 8fdf3c4473
commit 870edfd67e
5 changed files with 38 additions and 3 deletions

View file

@ -6472,6 +6472,13 @@ union wpa_event_data {
*/
struct pasn_auth pasn_auth;
/**
* struct port_authorized - Data for EVENT_PORT_AUTHORIZED
*/
struct port_authorized {
const u8 *td_bitmap;
size_t td_bitmap_len;
} port_authorized;
};
/**

View file

@ -3158,6 +3158,9 @@ static void nl80211_port_authorized(struct wpa_driver_nl80211_data *drv,
struct nlattr **tb)
{
const u8 *addr;
union wpa_event_data event;
os_memset(&event, 0, sizeof(event));
if (!tb[NL80211_ATTR_MAC] ||
nla_len(tb[NL80211_ATTR_MAC]) != ETH_ALEN) {
@ -3175,7 +3178,15 @@ static void nl80211_port_authorized(struct wpa_driver_nl80211_data *drv,
return;
}
wpa_supplicant_event(drv->ctx, EVENT_PORT_AUTHORIZED, NULL);
if (tb[NL80211_ATTR_TD_BITMAP]) {
event.port_authorized.td_bitmap_len =
nla_len(tb[NL80211_ATTR_TD_BITMAP]);
if (event.port_authorized.td_bitmap_len > 0)
event.port_authorized.td_bitmap =
nla_data(tb[NL80211_ATTR_TD_BITMAP]);
}
wpa_supplicant_event(drv->ctx, EVENT_PORT_AUTHORIZED, &event);
}

View file

@ -6061,6 +6061,15 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
break;
#endif /* CONFIG_PASN */
case EVENT_PORT_AUTHORIZED:
#ifndef CONFIG_NO_WPA
if (data->port_authorized.td_bitmap_len) {
wpa_printf(MSG_DEBUG,
"WPA3: Transition Disable bitmap from the driver event: 0x%x",
data->port_authorized.td_bitmap[0]);
wpas_transition_disable(
wpa_s, data->port_authorized.td_bitmap[0]);
}
#endif /* CONFIG_NO_WPA */
wpa_supplicant_event_port_authorized(wpa_s);
break;
case EVENT_STATION_OPMODE_CHANGED:

View file

@ -1282,9 +1282,8 @@ static void disable_wpa_wpa2(struct wpa_ssid *ssid)
}
static void wpa_supplicant_transition_disable(void *_wpa_s, u8 bitmap)
void wpas_transition_disable(struct wpa_supplicant *wpa_s, u8 bitmap)
{
struct wpa_supplicant *wpa_s = _wpa_s;
struct wpa_ssid *ssid;
int changed = 0;
@ -1354,6 +1353,13 @@ static void wpa_supplicant_transition_disable(void *_wpa_s, u8 bitmap)
}
static void wpa_supplicant_transition_disable(void *_wpa_s, u8 bitmap)
{
struct wpa_supplicant *wpa_s = _wpa_s;
wpas_transition_disable(wpa_s, bitmap);
}
static void wpa_supplicant_store_ptk(void *ctx, u8 *addr, int cipher,
u32 life_time, const struct wpa_ptk *ptk)
{

View file

@ -27,4 +27,6 @@ enum wpa_ctrl_req_type wpa_supplicant_ctrl_req_from_string(const char *field);
void wpas_send_ctrl_req(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
const char *field_name, const char *txt);
void wpas_transition_disable(struct wpa_supplicant *wpa_s, u8 bitmap);
#endif /* WPAS_GLUE_H */