nl80211: Handle rfkill for P2P Device interface
The rfkill processing in nl80211 driver assumes that the INTERFACE_ENABLED/DISABLED will be also issued, so does not do much in the rfkill callbacks. However, as a P2P Device interface is not associated with a network interface, these events are not issued for it. Handle rfkill events for the P2P_DEVICE interface by faking the INTERFACE_ENABLED/DISABLED. Signed-off-by: Moshe Benji <Moshe.Benji@intel.com> Signed-off-by: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
parent
9f052d805d
commit
6da504a1f5
1 changed files with 23 additions and 11 deletions
|
@ -1520,11 +1520,16 @@ static void nl80211_check_global(struct nl80211_global *global)
|
|||
|
||||
static void wpa_driver_nl80211_rfkill_blocked(void *ctx)
|
||||
{
|
||||
struct wpa_driver_nl80211_data *drv = ctx;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked");
|
||||
|
||||
/*
|
||||
* This may be for any interface; use ifdown event to disable
|
||||
* interface.
|
||||
* rtnetlink ifdown handler will report interfaces other than the P2P
|
||||
* Device interface as disabled.
|
||||
*/
|
||||
if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE)
|
||||
wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_DISABLED, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1541,7 +1546,12 @@ static void wpa_driver_nl80211_rfkill_unblocked(void *ctx)
|
|||
if (is_p2p_net_interface(drv->nlmode))
|
||||
nl80211_disable_11b_rates(drv, drv->ifindex, 1);
|
||||
|
||||
/* rtnetlink ifup handler will report interface as enabled */
|
||||
/*
|
||||
* rtnetlink ifup handler will report interfaces other than the P2P
|
||||
* Device interface as enabled.
|
||||
*/
|
||||
if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE)
|
||||
wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2241,20 +2251,22 @@ wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv,
|
|||
} else {
|
||||
wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
|
||||
"interface '%s' due to rfkill", bss->ifname);
|
||||
if (nlmode == NL80211_IFTYPE_P2P_DEVICE)
|
||||
return 0;
|
||||
drv->if_disabled = 1;
|
||||
if (nlmode != NL80211_IFTYPE_P2P_DEVICE)
|
||||
drv->if_disabled = 1;
|
||||
|
||||
send_rfkill_event = 1;
|
||||
}
|
||||
|
||||
if (!drv->hostapd)
|
||||
if (!drv->hostapd && nlmode != NL80211_IFTYPE_P2P_DEVICE)
|
||||
netlink_send_oper_ifla(drv->global->netlink, drv->ifindex,
|
||||
1, IF_OPER_DORMANT);
|
||||
|
||||
if (linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname,
|
||||
bss->addr))
|
||||
return -1;
|
||||
os_memcpy(drv->perm_addr, bss->addr, ETH_ALEN);
|
||||
if (nlmode != NL80211_IFTYPE_P2P_DEVICE) {
|
||||
if (linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname,
|
||||
bss->addr))
|
||||
return -1;
|
||||
os_memcpy(drv->perm_addr, bss->addr, ETH_ALEN);
|
||||
}
|
||||
|
||||
if (send_rfkill_event) {
|
||||
eloop_register_timeout(0, 0, wpa_driver_nl80211_send_rfkill,
|
||||
|
|
Loading…
Reference in a new issue