1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -2918,6 +2918,7 @@ static void * wpa_driver_nl80211_init(vo
4 drv->monitor_sock = -1;
5 drv->eapol_tx_sock = -1;
6 drv->ap_scan_as_station = NL80211_IFTYPE_UNSPECIFIED;
7 + drv->nlmode = NL80211_IFTYPE_STATION;
9 if (wpa_driver_nl80211_init_nl(drv)) {
11 @@ -3232,17 +3233,12 @@ static void wpa_driver_nl80211_send_rfki
12 wpa_supplicant_event(timeout_ctx, EVENT_INTERFACE_DISABLED, NULL);
17 -wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
18 +wpa_driver_nl80211_finish_drv_init_sta(struct wpa_driver_nl80211_data *drv,
19 + int *send_rfkill_event)
21 struct i802_bss *bss = &drv->first_bss;
22 - int send_rfkill_event = 0;
24 - drv->ifindex = if_nametoindex(bss->ifname);
25 - drv->first_bss.ifindex = drv->ifindex;
29 * Make sure the interface starts up in station mode unless this is a
30 * dynamically added interface (e.g., P2P) that was already configured
31 @@ -3261,7 +3257,7 @@ wpa_driver_nl80211_finish_drv_init(struc
32 "interface '%s' due to rfkill",
35 - send_rfkill_event = 1;
36 + *send_rfkill_event = 1;
38 wpa_printf(MSG_ERROR, "nl80211: Could not set "
39 "interface '%s' UP", bss->ifname);
40 @@ -3271,7 +3267,19 @@ wpa_driver_nl80211_finish_drv_init(struc
42 netlink_send_oper_ifla(drv->global->netlink, drv->ifindex,
48 +wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
50 + struct i802_bss *bss = &drv->first_bss;
51 + int send_rfkill_event = 0;
53 + drv->ifindex = if_nametoindex(bss->ifname);
54 + drv->first_bss.ifindex = drv->ifindex;
56 + if (drv->nlmode == NL80211_IFTYPE_STATION)
57 + wpa_driver_nl80211_finish_drv_init_sta(drv, &send_rfkill_event);
59 if (wpa_driver_nl80211_capa(drv))