2012-03-27 10:42:47 +00:00
|
|
|
--- a/src/drivers/driver_nl80211.c
|
|
|
|
+++ b/src/drivers/driver_nl80211.c
|
2013-06-30 20:27:38 +00:00
|
|
|
@@ -751,7 +751,6 @@ nla_put_failure:
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-#ifndef HOSTAPD
|
|
|
|
static int nl80211_get_macaddr(struct i802_bss *bss)
|
|
|
|
{
|
|
|
|
struct nl_msg *msg;
|
|
|
|
@@ -773,7 +772,6 @@ nla_put_failure:
|
|
|
|
nlmsg_free(msg);
|
|
|
|
return NL80211_IFTYPE_UNSPECIFIED;
|
|
|
|
}
|
|
|
|
-#endif /* HOSTAPD */
|
|
|
|
|
|
|
|
|
|
|
|
static int nl80211_register_beacons(struct wpa_driver_nl80211_data *drv,
|
|
|
|
@@ -3592,6 +3590,7 @@ static void * wpa_driver_nl80211_init(vo
|
2012-03-27 10:42:47 +00:00
|
|
|
drv->monitor_sock = -1;
|
|
|
|
drv->eapol_tx_sock = -1;
|
|
|
|
drv->ap_scan_as_station = NL80211_IFTYPE_UNSPECIFIED;
|
|
|
|
+ drv->nlmode = NL80211_IFTYPE_STATION;
|
|
|
|
|
|
|
|
if (wpa_driver_nl80211_init_nl(drv)) {
|
|
|
|
os_free(drv);
|
2013-06-30 20:27:38 +00:00
|
|
|
@@ -3982,31 +3981,16 @@ static int i802_set_iface_flags(struct i
|
|
|
|
|
2012-03-27 10:42:47 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
-wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
|
|
|
|
+wpa_driver_nl80211_finish_drv_init_sta(struct wpa_driver_nl80211_data *drv,
|
|
|
|
+ int *send_rfkill_event)
|
|
|
|
{
|
2013-06-30 20:27:38 +00:00
|
|
|
-#ifndef HOSTAPD
|
|
|
|
enum nl80211_iftype nlmode = NL80211_IFTYPE_STATION;
|
|
|
|
-#endif /* HOSTAPD */
|
2012-03-27 10:42:47 +00:00
|
|
|
struct i802_bss *bss = &drv->first_bss;
|
|
|
|
- int send_rfkill_event = 0;
|
2013-06-30 20:27:38 +00:00
|
|
|
int dynamic_if;
|
2012-03-27 10:42:47 +00:00
|
|
|
|
|
|
|
- drv->ifindex = if_nametoindex(bss->ifname);
|
2013-06-30 20:27:38 +00:00
|
|
|
- bss->ifindex = drv->ifindex;
|
|
|
|
- bss->wdev_id = drv->global->if_add_wdevid;
|
|
|
|
- bss->wdev_id_set = drv->global->if_add_wdevid_set;
|
|
|
|
-
|
|
|
|
dynamic_if = drv->ifindex == drv->global->if_add_ifindex;
|
|
|
|
dynamic_if = dynamic_if || drv->global->if_add_wdevid_set;
|
|
|
|
- drv->global->if_add_wdevid_set = 0;
|
|
|
|
|
|
|
|
- if (wpa_driver_nl80211_capa(drv))
|
|
|
|
- return -1;
|
|
|
|
-
|
|
|
|
- wpa_printf(MSG_DEBUG, "nl80211: interface %s in phy %s",
|
|
|
|
- bss->ifname, drv->phyname);
|
2012-03-27 10:42:47 +00:00
|
|
|
-
|
|
|
|
-#ifndef HOSTAPD
|
2013-06-30 20:27:38 +00:00
|
|
|
if (dynamic_if)
|
|
|
|
nlmode = nl80211_get_ifmode(bss);
|
|
|
|
|
|
|
|
@@ -4035,7 +4019,7 @@ wpa_driver_nl80211_finish_drv_init(struc
|
2012-03-27 10:42:47 +00:00
|
|
|
"interface '%s' due to rfkill",
|
|
|
|
bss->ifname);
|
|
|
|
drv->if_disabled = 1;
|
|
|
|
- send_rfkill_event = 1;
|
|
|
|
+ *send_rfkill_event = 1;
|
|
|
|
} else {
|
|
|
|
wpa_printf(MSG_ERROR, "nl80211: Could not set "
|
|
|
|
"interface '%s' UP", bss->ifname);
|
2013-06-30 20:27:38 +00:00
|
|
|
@@ -4045,7 +4029,30 @@ wpa_driver_nl80211_finish_drv_init(struc
|
2012-03-27 10:42:47 +00:00
|
|
|
|
|
|
|
netlink_send_oper_ifla(drv->global->netlink, drv->ifindex,
|
|
|
|
1, IF_OPER_DORMANT);
|
|
|
|
-#endif /* HOSTAPD */
|
2013-06-30 20:27:38 +00:00
|
|
|
+ return 0;
|
2012-03-27 10:42:47 +00:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
|
|
|
|
+{
|
|
|
|
+ struct i802_bss *bss = &drv->first_bss;
|
|
|
|
+ int send_rfkill_event = 0;
|
|
|
|
+
|
|
|
|
+ drv->ifindex = if_nametoindex(bss->ifname);
|
2013-06-30 20:27:38 +00:00
|
|
|
+ bss->ifindex = drv->ifindex;
|
|
|
|
+ bss->wdev_id = drv->global->if_add_wdevid;
|
|
|
|
+ bss->wdev_id_set = drv->global->if_add_wdevid_set;
|
|
|
|
+ drv->global->if_add_wdevid_set = 0;
|
|
|
|
+
|
|
|
|
+ if (wpa_driver_nl80211_capa(drv))
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+ wpa_printf(MSG_DEBUG, "nl80211: interface %s in phy %s",
|
|
|
|
+ bss->ifname, drv->phyname);
|
2012-03-27 10:42:47 +00:00
|
|
|
+
|
2013-06-30 20:27:38 +00:00
|
|
|
+ if (drv->nlmode == NL80211_IFTYPE_STATION &&
|
|
|
|
+ wpa_driver_nl80211_finish_drv_init_sta(drv, &send_rfkill_event))
|
|
|
|
+ return -1;
|
2012-03-27 10:42:47 +00:00
|
|
|
|
2013-06-30 20:27:38 +00:00
|
|
|
if (linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname,
|
|
|
|
bss->addr))
|