1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -1135,7 +1135,6 @@ nla_put_failure:
8 struct wiphy_info_data {
11 @@ -1247,7 +1246,6 @@ static int wpa_driver_nl80211_capa(struc
18 static int wpa_driver_nl80211_init_nl(struct wpa_driver_nl80211_data *drv,
19 @@ -1411,6 +1409,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, ctx)) {
27 @@ -1530,32 +1529,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");
36 + if (drv->nlmode == NL80211_IFTYPE_STATION) {
37 + if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
38 + wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
39 + "use managed mode");
42 - if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
43 - if (rfkill_is_blocked(drv->rfkill)) {
44 - wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
45 - "interface '%s' due to rfkill",
47 - drv->if_disabled = 1;
48 - send_rfkill_event = 1;
50 - wpa_printf(MSG_ERROR, "nl80211: Could not set "
51 - "interface '%s' UP", bss->ifname);
53 + if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
54 + if (rfkill_is_blocked(drv->rfkill)) {
55 + wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
56 + "interface '%s' due to rfkill",
58 + drv->if_disabled = 1;
59 + send_rfkill_event = 1;
61 + wpa_printf(MSG_ERROR, "nl80211: Could not set "
62 + "interface '%s' UP", bss->ifname);
68 - if (wpa_driver_nl80211_capa(drv))
70 + if (wpa_driver_nl80211_capa(drv))
73 - netlink_send_oper_ifla(drv->netlink, drv->ifindex,
74 - 1, IF_OPER_DORMANT);
76 + netlink_send_oper_ifla(drv->netlink, drv->ifindex,
77 + 1, IF_OPER_DORMANT);
80 if (nl80211_register_action_frames(drv) < 0) {
81 wpa_printf(MSG_DEBUG, "nl80211: Failed to register Action "
82 @@ -2219,13 +2218,9 @@ static int wpa_driver_nl80211_set_key(co
84 if (ret || !set_tx || alg == WPA_ALG_NONE)
91 if (drv->nlmode == NL80211_IFTYPE_AP && addr)
97 @@ -3066,7 +3061,8 @@ static void nl80211_remove_iface(struct
100 /* stop listening for EAPOL on this interface */
101 - del_ifidx(drv, ifidx);
102 + if (drv->nlmode == NL80211_IFTYPE_AP)
103 + del_ifidx(drv, ifidx);
107 @@ -3139,7 +3135,8 @@ static int nl80211_create_iface_once(str
110 /* start listening for EAPOL on this interface */
111 - add_ifidx(drv, ifidx);
112 + if (drv->nlmode == NL80211_IFTYPE_AP)
113 + add_ifidx(drv, ifidx);
116 if (addr && iftype != NL80211_IFTYPE_MONITOR &&
117 @@ -4842,6 +4839,7 @@ static void *i802_init(struct hostapd_da
121 + drv->nlmode = NL80211_IFTYPE_AP;
122 if (linux_br_get(brname, params->ifname) == 0) {
123 wpa_printf(MSG_DEBUG, "nl80211: Interface %s is in bridge %s",
124 params->ifname, brname);