struct nl80211_global {
struct dl_list interfaces;
+ int if_add_ifindex;
};
struct i802_bss {
drv->first_bss.ifindex = drv->ifindex;
#ifndef HOSTAPD
- if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
+ /*
+ * Make sure the interface starts up in station mode unless this is a
+ * dynamically added interface (e.g., P2P) that was already configured
+ * with proper iftype.
+ */
+ if ((drv->global == NULL ||
+ drv->ifindex != drv->global->if_add_ifindex) &&
+ wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
"use managed mode");
}
}
#endif /* HOSTAPD */
+ if (drv->global)
+ drv->global->if_add_ifindex = ifidx;
+
return 0;
}
if (global == NULL)
return NULL;
dl_list_init(&global->interfaces);
+ global->if_add_ifindex = -1;
return global;
}