1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -1119,7 +1119,6 @@ nla_put_failure:
8 struct wiphy_info_data {
11 @@ -1231,7 +1230,6 @@ static int wpa_driver_nl80211_capa(struc
18 static int wpa_driver_nl80211_init_nl(struct wpa_driver_nl80211_data *drv,
19 @@ -1371,6 +1369,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 @@ -1468,24 +1467,23 @@ 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 - wpa_printf(MSG_ERROR, "Could not set interface '%s' UP",
42 + if (drv->nlmode == NL80211_IFTYPE_STATION) {
43 + if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0)
44 + wpa_printf(MSG_DEBUG, "nl80211: Could not configure "
45 + "driver to use managed mode");
47 + if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
48 + wpa_printf(MSG_ERROR, "Could not set interface '%s' UP",
53 - if (wpa_driver_nl80211_capa(drv))
55 + if (wpa_driver_nl80211_capa(drv))
58 - netlink_send_oper_ifla(drv->netlink, drv->ifindex,
59 - 1, IF_OPER_DORMANT);
61 + netlink_send_oper_ifla(drv->netlink, drv->ifindex,
62 + 1, IF_OPER_DORMANT);
65 if (nl80211_register_action_frames(drv) < 0) {
66 wpa_printf(MSG_DEBUG, "nl80211: Failed to register Action "
67 @@ -2143,13 +2141,9 @@ static int wpa_driver_nl80211_set_key(co
69 if (ret || !set_tx || alg == WPA_ALG_NONE)
76 if (drv->nlmode == NL80211_IFTYPE_AP && addr)
82 @@ -2990,7 +2984,8 @@ static void nl80211_remove_iface(struct
85 /* stop listening for EAPOL on this interface */
86 - del_ifidx(drv, ifidx);
87 + if (drv->nlmode == NL80211_IFTYPE_AP)
88 + del_ifidx(drv, ifidx);
92 @@ -3063,7 +3058,8 @@ static int nl80211_create_iface_once(str
95 /* start listening for EAPOL on this interface */
96 - add_ifidx(drv, ifidx);
97 + if (drv->nlmode == NL80211_IFTYPE_AP)
98 + add_ifidx(drv, ifidx);
101 if (addr && iftype != NL80211_IFTYPE_MONITOR &&
102 @@ -4766,6 +4762,7 @@ static void *i802_init(struct hostapd_da
106 + drv->nlmode = NL80211_IFTYPE_AP;
107 if (linux_br_get(brname, params->ifname) == 0) {
108 wpa_printf(MSG_DEBUG, "nl80211: Interface %s is in bridge %s",
109 params->ifname, brname);