|
@@ -773,12 +773,12 @@ bsd_wireless_event_receive(int sock, void *ctx, void *sock_ctx)
|
|
|
rtm->rtm_version);
|
|
|
return;
|
|
|
}
|
|
|
- drv = bsd_get_drvindex(global, rtm->rtm_index);
|
|
|
- if (drv == NULL)
|
|
|
- return;
|
|
|
switch (rtm->rtm_type) {
|
|
|
case RTM_IEEE80211:
|
|
|
ifan = (struct if_announcemsghdr *) rtm;
|
|
|
+ drv = bsd_get_drvindex(global, ifan->ifan_index);
|
|
|
+ if (drv == NULL)
|
|
|
+ return;
|
|
|
switch (ifan->ifan_what) {
|
|
|
case RTM_IEEE80211_ASSOC:
|
|
|
case RTM_IEEE80211_REASSOC:
|
|
@@ -1189,6 +1189,7 @@ wpa_driver_bsd_event_receive(int sock, void *ctx, void *sock_ctx)
|
|
|
struct bsd_driver_global *global = sock_ctx;
|
|
|
struct bsd_driver_data *drv;
|
|
|
struct if_announcemsghdr *ifan;
|
|
|
+ struct if_msghdr *ifm;
|
|
|
struct rt_msghdr *rtm;
|
|
|
union wpa_event_data event;
|
|
|
struct ieee80211_michael_event *mic;
|
|
@@ -1210,14 +1211,13 @@ wpa_driver_bsd_event_receive(int sock, void *ctx, void *sock_ctx)
|
|
|
rtm->rtm_version);
|
|
|
return;
|
|
|
}
|
|
|
- drv = bsd_get_drvindex(global, rtm->rtm_index);
|
|
|
- if (drv == NULL)
|
|
|
- return;
|
|
|
- ctx = drv->ctx;
|
|
|
os_memset(&event, 0, sizeof(event));
|
|
|
switch (rtm->rtm_type) {
|
|
|
case RTM_IFANNOUNCE:
|
|
|
ifan = (struct if_announcemsghdr *) rtm;
|
|
|
+ drv = bsd_get_drvindex(global, ifan->ifan_index);
|
|
|
+ if (drv == NULL)
|
|
|
+ return;
|
|
|
os_strlcpy(event.interface_status.ifname, drv->ifname,
|
|
|
sizeof(event.interface_status.ifname));
|
|
|
switch (ifan->ifan_what) {
|
|
@@ -1230,37 +1230,41 @@ wpa_driver_bsd_event_receive(int sock, void *ctx, void *sock_ctx)
|
|
|
event.interface_status.ifname,
|
|
|
ifan->ifan_what == IFAN_DEPARTURE ?
|
|
|
"removed" : "added");
|
|
|
- wpa_supplicant_event(ctx, EVENT_INTERFACE_STATUS, &event);
|
|
|
+ wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS, &event);
|
|
|
break;
|
|
|
case RTM_IEEE80211:
|
|
|
ifan = (struct if_announcemsghdr *) rtm;
|
|
|
+ drv = bsd_get_drvindex(global, ifan->ifan_index);
|
|
|
+ if (drv == NULL)
|
|
|
+ return;
|
|
|
switch (ifan->ifan_what) {
|
|
|
case RTM_IEEE80211_ASSOC:
|
|
|
case RTM_IEEE80211_REASSOC:
|
|
|
if (drv->is_ap)
|
|
|
break;
|
|
|
- wpa_supplicant_event(ctx, EVENT_ASSOC, NULL);
|
|
|
+ wpa_supplicant_event(drv->ctx, EVENT_ASSOC, NULL);
|
|
|
break;
|
|
|
case RTM_IEEE80211_DISASSOC:
|
|
|
if (drv->is_ap)
|
|
|
break;
|
|
|
- wpa_supplicant_event(ctx, EVENT_DISASSOC, NULL);
|
|
|
+ wpa_supplicant_event(drv->ctx, EVENT_DISASSOC, NULL);
|
|
|
break;
|
|
|
case RTM_IEEE80211_SCAN:
|
|
|
if (drv->is_ap)
|
|
|
break;
|
|
|
- wpa_supplicant_event(ctx, EVENT_SCAN_RESULTS, NULL);
|
|
|
+ wpa_supplicant_event(drv->ctx, EVENT_SCAN_RESULTS,
|
|
|
+ NULL);
|
|
|
break;
|
|
|
case RTM_IEEE80211_LEAVE:
|
|
|
leave = (struct ieee80211_leave_event *) &ifan[1];
|
|
|
- drv_event_disassoc(ctx, leave->iev_addr);
|
|
|
+ drv_event_disassoc(drv->ctx, leave->iev_addr);
|
|
|
break;
|
|
|
case RTM_IEEE80211_JOIN:
|
|
|
#ifdef RTM_IEEE80211_REJOIN
|
|
|
case RTM_IEEE80211_REJOIN:
|
|
|
#endif
|
|
|
join = (struct ieee80211_join_event *) &ifan[1];
|
|
|
- bsd_new_sta(drv, ctx, join->iev_addr);
|
|
|
+ bsd_new_sta(drv, drv->ctx, join->iev_addr);
|
|
|
break;
|
|
|
case RTM_IEEE80211_REPLAY:
|
|
|
/* ignore */
|
|
@@ -1275,19 +1279,24 @@ wpa_driver_bsd_event_receive(int sock, void *ctx, void *sock_ctx)
|
|
|
os_memset(&event, 0, sizeof(event));
|
|
|
event.michael_mic_failure.unicast =
|
|
|
!IEEE80211_IS_MULTICAST(mic->iev_dst);
|
|
|
- wpa_supplicant_event(ctx, EVENT_MICHAEL_MIC_FAILURE,
|
|
|
- &event);
|
|
|
+ wpa_supplicant_event(drv->ctx,
|
|
|
+ EVENT_MICHAEL_MIC_FAILURE, &event);
|
|
|
break;
|
|
|
}
|
|
|
break;
|
|
|
case RTM_IFINFO:
|
|
|
+ ifm = (struct if_msghdr *) rtm;
|
|
|
+ drv = bsd_get_drvindex(global, ifm->ifm_index);
|
|
|
+ if (drv == NULL)
|
|
|
+ return;
|
|
|
if ((rtm->rtm_flags & RTF_UP) == 0) {
|
|
|
os_strlcpy(event.interface_status.ifname, drv->ifname,
|
|
|
sizeof(event.interface_status.ifname));
|
|
|
event.interface_status.ievent = EVENT_INTERFACE_REMOVED;
|
|
|
wpa_printf(MSG_DEBUG, "RTM_IFINFO: Interface '%s' DOWN",
|
|
|
event.interface_status.ifname);
|
|
|
- wpa_supplicant_event(ctx, EVENT_INTERFACE_STATUS, &event);
|
|
|
+ wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_STATUS,
|
|
|
+ &event);
|
|
|
}
|
|
|
break;
|
|
|
}
|