nl80211: Process unprotected Beacon frame RX events

Convert driver indications to internal events to allow invalid Beacon
frames to be reported to the AP.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2020-04-01 16:06:32 +03:00 committed by Jouni Malinen
parent a39e9af908
commit ff0b87304c

View file

@ -137,6 +137,7 @@ static const char * nl80211_command_to_string(enum nl80211_commands cmd)
C2S(NL80211_CMD_STA_OPMODE_CHANGED) C2S(NL80211_CMD_STA_OPMODE_CHANGED)
C2S(NL80211_CMD_CONTROL_PORT_FRAME) C2S(NL80211_CMD_CONTROL_PORT_FRAME)
C2S(NL80211_CMD_UPDATE_OWE_INFO) C2S(NL80211_CMD_UPDATE_OWE_INFO)
C2S(NL80211_CMD_UNPROT_BEACON)
default: default:
return "NL80211_CMD_UNKNOWN"; return "NL80211_CMD_UNKNOWN";
} }
@ -893,6 +894,23 @@ static void mlme_event_unprot_disconnect(struct wpa_driver_nl80211_data *drv,
} }
static void mlme_event_unprot_beacon(struct wpa_driver_nl80211_data *drv,
const u8 *frame, size_t len)
{
const struct ieee80211_mgmt *mgmt;
union wpa_event_data event;
if (len < 24)
return;
mgmt = (const struct ieee80211_mgmt *) frame;
os_memset(&event, 0, sizeof(event));
event.unprot_beacon.sa = mgmt->sa;
wpa_supplicant_event(drv->ctx, EVENT_UNPROT_BEACON, &event);
}
static void mlme_event(struct i802_bss *bss, static void mlme_event(struct i802_bss *bss,
enum nl80211_commands cmd, struct nlattr *frame, enum nl80211_commands cmd, struct nlattr *frame,
struct nlattr *addr, struct nlattr *timed_out, struct nlattr *addr, struct nlattr *timed_out,
@ -974,6 +992,9 @@ static void mlme_event(struct i802_bss *bss,
mlme_event_unprot_disconnect(drv, EVENT_UNPROT_DISASSOC, mlme_event_unprot_disconnect(drv, EVENT_UNPROT_DISASSOC,
nla_data(frame), nla_len(frame)); nla_data(frame), nla_len(frame));
break; break;
case NL80211_CMD_UNPROT_BEACON:
mlme_event_unprot_beacon(drv, nla_data(frame), nla_len(frame));
break;
default: default:
break; break;
} }
@ -2541,6 +2562,7 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd,
{ {
struct wpa_driver_nl80211_data *drv = bss->drv; struct wpa_driver_nl80211_data *drv = bss->drv;
int external_scan_event = 0; int external_scan_event = 0;
struct nlattr *frame = tb[NL80211_ATTR_FRAME];
wpa_printf(MSG_DEBUG, "nl80211: Drv Event %d (%s) received for %s", wpa_printf(MSG_DEBUG, "nl80211: Drv Event %d (%s) received for %s",
cmd, nl80211_command_to_string(cmd), bss->ifname); cmd, nl80211_command_to_string(cmd), bss->ifname);
@ -2751,6 +2773,11 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd,
case NL80211_CMD_UPDATE_OWE_INFO: case NL80211_CMD_UPDATE_OWE_INFO:
mlme_event_dh_event(drv, bss, tb); mlme_event_dh_event(drv, bss, tb);
break; break;
case NL80211_CMD_UNPROT_BEACON:
if (frame)
mlme_event_unprot_beacon(drv, nla_data(frame),
nla_len(frame));
break;
default: default:
wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Ignored unknown event " wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Ignored unknown event "
"(cmd=%d)", cmd); "(cmd=%d)", cmd);