1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -1380,7 +1380,6 @@ nla_put_failure:
8 struct wiphy_info_data {
11 @@ -1493,7 +1492,6 @@ static int wpa_driver_nl80211_capa(struc
18 static int wpa_driver_nl80211_init_nl(struct wpa_driver_nl80211_data *drv)
19 @@ -1667,6 +1665,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 @@ -1823,32 +1822,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 @@ -2511,13 +2510,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 @@ -3368,7 +3363,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 @@ -3441,7 +3437,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 @@ -5155,6 +5152,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);