1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -1847,6 +1847,7 @@ static void * wpa_driver_nl80211_init(vo
4 drv->monitor_ifidx = -1;
5 drv->monitor_sock = -1;
7 + drv->nlmode = NL80211_IFTYPE_STATION;
9 if (wpa_driver_nl80211_init_nl(drv)) {
11 @@ -2013,29 +2014,29 @@ wpa_driver_nl80211_finish_drv_init(struc
12 drv->ifindex = if_nametoindex(bss->ifname);
13 drv->first_bss.ifindex = drv->ifindex;
16 - if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
17 - wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
18 - "use managed mode");
20 + if (drv->nlmode == NL80211_IFTYPE_STATION) {
21 + if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
22 + wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
23 + "use managed mode");
26 - if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
27 - if (rfkill_is_blocked(drv->rfkill)) {
28 - wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
29 - "interface '%s' due to rfkill",
31 - drv->if_disabled = 1;
32 - send_rfkill_event = 1;
34 - wpa_printf(MSG_ERROR, "nl80211: Could not set "
35 - "interface '%s' UP", bss->ifname);
37 + if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
38 + if (rfkill_is_blocked(drv->rfkill)) {
39 + wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
40 + "interface '%s' due to rfkill",
42 + drv->if_disabled = 1;
43 + send_rfkill_event = 1;
45 + wpa_printf(MSG_ERROR, "nl80211: Could not set "
46 + "interface '%s' UP", bss->ifname);
52 - netlink_send_oper_ifla(drv->netlink, drv->ifindex,
53 - 1, IF_OPER_DORMANT);
55 + netlink_send_oper_ifla(drv->netlink, drv->ifindex,
56 + 1, IF_OPER_DORMANT);
59 if (wpa_driver_nl80211_capa(drv))
61 @@ -3765,7 +3766,8 @@ static void nl80211_remove_iface(struct
64 /* stop listening for EAPOL on this interface */
65 - del_ifidx(drv, ifidx);
66 + if (drv->nlmode == NL80211_IFTYPE_AP)
67 + del_ifidx(drv, ifidx);
71 @@ -3838,7 +3840,8 @@ static int nl80211_create_iface_once(str
74 /* start listening for EAPOL on this interface */
75 - add_ifidx(drv, ifidx);
76 + if (drv->nlmode == NL80211_IFTYPE_AP)
77 + add_ifidx(drv, ifidx);
80 if (addr && iftype != NL80211_IFTYPE_MONITOR &&