1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -1468,7 +1468,6 @@ nla_put_failure:
8 struct wiphy_info_data {
11 @@ -1613,7 +1612,6 @@ static int wpa_driver_nl80211_capa(struc
18 static int wpa_driver_nl80211_init_nl(struct wpa_driver_nl80211_data *drv)
19 @@ -1825,6 +1823,7 @@ static void * wpa_driver_nl80211_init(vo
20 drv->monitor_ifidx = -1;
21 drv->monitor_sock = -1;
23 + drv->nlmode = NL80211_IFTYPE_STATION;
25 if (wpa_driver_nl80211_init_nl(drv)) {
27 @@ -1988,32 +1987,32 @@ wpa_driver_nl80211_finish_drv_init(struc
28 drv->ifindex = if_nametoindex(bss->ifname);
29 drv->first_bss.ifindex = drv->ifindex;
32 - if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
33 - wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
34 - "use managed mode");
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);
48 + if (drv->nlmode == NL80211_IFTYPE_STATION) {
49 + if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
50 + wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
51 + "use managed mode");
54 + if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
55 + if (rfkill_is_blocked(drv->rfkill)) {
56 + wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
57 + "interface '%s' due to rfkill",
59 + drv->if_disabled = 1;
60 + send_rfkill_event = 1;
62 + wpa_printf(MSG_ERROR, "nl80211: Could not set "
63 + "interface '%s' UP", bss->ifname);
69 - if (wpa_driver_nl80211_capa(drv))
71 + if (wpa_driver_nl80211_capa(drv))
74 - netlink_send_oper_ifla(drv->netlink, drv->ifindex,
75 - 1, IF_OPER_DORMANT);
77 + netlink_send_oper_ifla(drv->netlink, drv->ifindex,
78 + 1, IF_OPER_DORMANT);
81 if (linux_get_ifhwaddr(drv->ioctl_sock, bss->ifname, drv->addr))
83 @@ -3738,7 +3737,8 @@ static void nl80211_remove_iface(struct
86 /* stop listening for EAPOL on this interface */
87 - del_ifidx(drv, ifidx);
88 + if (drv->nlmode == NL80211_IFTYPE_AP)
89 + del_ifidx(drv, ifidx);
93 @@ -3811,7 +3811,8 @@ static int nl80211_create_iface_once(str
96 /* start listening for EAPOL on this interface */
97 - add_ifidx(drv, ifidx);
98 + if (drv->nlmode == NL80211_IFTYPE_AP)
99 + add_ifidx(drv, ifidx);
102 if (addr && iftype != NL80211_IFTYPE_MONITOR &&