-static int wpa_driver_nl80211_event_wireless_michaelmicfailure(
- void *ctx, const char *ev, size_t len)
-{
- const struct iw_michaelmicfailure *mic;
- union wpa_event_data data;
-
- if (len < sizeof(*mic))
- return -1;
-
- mic = (const struct iw_michaelmicfailure *) ev;
-
- wpa_printf(MSG_DEBUG, "Michael MIC failure wireless event: "
- "flags=0x%x src_addr=" MACSTR, mic->flags,
- MAC2STR(mic->src_addr.sa_data));
-
- os_memset(&data, 0, sizeof(data));
- data.michael_mic_failure.unicast = !(mic->flags & IW_MICFAILURE_GROUP);
- wpa_supplicant_event(ctx, EVENT_MICHAEL_MIC_FAILURE, &data);
-
- return 0;
-}
-
-
-static void wpa_driver_nl80211_event_wireless(struct wpa_driver_nl80211_data *drv,
- void *ctx, char *data, int len)
-{
- struct iw_event iwe_buf, *iwe = &iwe_buf;
- char *pos, *end, *custom;
-
- pos = data;
- end = data + len;
-
- while (pos + IW_EV_LCP_LEN <= end) {
- /* Event data may be unaligned, so make a local, aligned copy
- * before processing. */
- os_memcpy(&iwe_buf, pos, IW_EV_LCP_LEN);
- wpa_printf(MSG_DEBUG, "Wireless event: cmd=0x%x len=%d",
- iwe->cmd, iwe->len);
- if (iwe->len <= IW_EV_LCP_LEN)
- return;
-
- custom = pos + IW_EV_POINT_LEN;
- if (drv->we_version_compiled > 18 &&
- (iwe->cmd == IWEVMICHAELMICFAILURE ||
- iwe->cmd == IWEVCUSTOM ||
- iwe->cmd == IWEVASSOCREQIE ||
- iwe->cmd == IWEVASSOCRESPIE ||
- iwe->cmd == IWEVPMKIDCAND)) {
- /* WE-19 removed the pointer from struct iw_point */
- char *dpos = (char *) &iwe_buf.u.data.length;
- int dlen = dpos - (char *) &iwe_buf;
- os_memcpy(dpos, pos + IW_EV_LCP_LEN,
- sizeof(struct iw_event) - dlen);
- } else {
- os_memcpy(&iwe_buf, pos, sizeof(struct iw_event));
- custom += IW_EV_POINT_OFF;
- }
-
- switch (iwe->cmd) {
- case IWEVMICHAELMICFAILURE:
- wpa_driver_nl80211_event_wireless_michaelmicfailure(
- ctx, custom, iwe->u.data.length);
- break;
- }
-
- pos += iwe->len;
- }
-}
-
-