2010-05-02 22:03:49 +00:00
|
|
|
--- a/src/drivers/driver_nl80211.c
|
|
|
|
+++ b/src/drivers/driver_nl80211.c
|
2010-11-09 01:36:36 +00:00
|
|
|
@@ -1380,7 +1380,6 @@ nla_put_failure:
|
2010-05-02 22:03:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-#ifndef HOSTAPD
|
|
|
|
struct wiphy_info_data {
|
|
|
|
int max_scan_ssids;
|
|
|
|
int ap_supported;
|
2010-11-09 01:36:36 +00:00
|
|
|
@@ -1493,7 +1492,6 @@ static int wpa_driver_nl80211_capa(struc
|
2010-05-02 22:03:49 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
-#endif /* HOSTAPD */
|
|
|
|
|
|
|
|
|
2010-11-09 01:36:36 +00:00
|
|
|
static int wpa_driver_nl80211_init_nl(struct wpa_driver_nl80211_data *drv)
|
|
|
|
@@ -1667,6 +1665,7 @@ static void * wpa_driver_nl80211_init(vo
|
2010-05-02 22:03:49 +00:00
|
|
|
drv->monitor_ifidx = -1;
|
|
|
|
drv->monitor_sock = -1;
|
|
|
|
drv->ioctl_sock = -1;
|
|
|
|
+ drv->nlmode = NL80211_IFTYPE_STATION;
|
|
|
|
|
2010-11-09 01:36:36 +00:00
|
|
|
if (wpa_driver_nl80211_init_nl(drv)) {
|
2010-05-02 22:03:49 +00:00
|
|
|
os_free(drv);
|
2010-11-09 01:36:36 +00:00
|
|
|
@@ -1823,32 +1822,32 @@ wpa_driver_nl80211_finish_drv_init(struc
|
2010-05-02 22:03:49 +00:00
|
|
|
drv->ifindex = if_nametoindex(bss->ifname);
|
|
|
|
drv->first_bss.ifindex = drv->ifindex;
|
|
|
|
|
|
|
|
-#ifndef HOSTAPD
|
|
|
|
- if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
|
|
|
|
- wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
|
|
|
|
- "use managed mode");
|
|
|
|
- }
|
|
|
|
+ if (drv->nlmode == NL80211_IFTYPE_STATION) {
|
2010-07-08 18:35:15 +00:00
|
|
|
+ if (wpa_driver_nl80211_set_mode(bss, IEEE80211_MODE_INFRA) < 0) {
|
|
|
|
+ wpa_printf(MSG_DEBUG, "nl80211: Could not configure driver to "
|
|
|
|
+ "use managed mode");
|
2010-05-02 22:03:49 +00:00
|
|
|
+ }
|
|
|
|
|
2010-07-08 18:35:15 +00:00
|
|
|
- if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
|
|
|
|
- if (rfkill_is_blocked(drv->rfkill)) {
|
|
|
|
- wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
|
|
|
|
- "interface '%s' due to rfkill",
|
|
|
|
- bss->ifname);
|
|
|
|
- drv->if_disabled = 1;
|
|
|
|
- send_rfkill_event = 1;
|
|
|
|
- } else {
|
|
|
|
- wpa_printf(MSG_ERROR, "nl80211: Could not set "
|
|
|
|
- "interface '%s' UP", bss->ifname);
|
|
|
|
- return -1;
|
|
|
|
+ if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
|
|
|
|
+ if (rfkill_is_blocked(drv->rfkill)) {
|
|
|
|
+ wpa_printf(MSG_DEBUG, "nl80211: Could not yet enable "
|
|
|
|
+ "interface '%s' due to rfkill",
|
|
|
|
+ bss->ifname);
|
|
|
|
+ drv->if_disabled = 1;
|
|
|
|
+ send_rfkill_event = 1;
|
|
|
|
+ } else {
|
|
|
|
+ wpa_printf(MSG_ERROR, "nl80211: Could not set "
|
|
|
|
+ "interface '%s' UP", bss->ifname);
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
- }
|
|
|
|
|
2010-05-02 22:03:49 +00:00
|
|
|
- if (wpa_driver_nl80211_capa(drv))
|
|
|
|
- return -1;
|
|
|
|
+ if (wpa_driver_nl80211_capa(drv))
|
|
|
|
+ return -1;
|
|
|
|
|
|
|
|
- netlink_send_oper_ifla(drv->netlink, drv->ifindex,
|
|
|
|
- 1, IF_OPER_DORMANT);
|
|
|
|
-#endif /* HOSTAPD */
|
|
|
|
+ netlink_send_oper_ifla(drv->netlink, drv->ifindex,
|
|
|
|
+ 1, IF_OPER_DORMANT);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (nl80211_register_action_frames(drv) < 0) {
|
|
|
|
wpa_printf(MSG_DEBUG, "nl80211: Failed to register Action "
|
2010-11-09 01:36:36 +00:00
|
|
|
@@ -2511,13 +2510,9 @@ static int wpa_driver_nl80211_set_key(co
|
2010-05-02 22:03:49 +00:00
|
|
|
*/
|
|
|
|
if (ret || !set_tx || alg == WPA_ALG_NONE)
|
|
|
|
return ret;
|
|
|
|
-#ifdef HOSTAPD
|
|
|
|
- if (addr)
|
|
|
|
- return ret;
|
|
|
|
-#else /* HOSTAPD */
|
|
|
|
+
|
|
|
|
if (drv->nlmode == NL80211_IFTYPE_AP && addr)
|
|
|
|
return ret;
|
|
|
|
-#endif /* HOSTAPD */
|
|
|
|
|
|
|
|
msg = nlmsg_alloc();
|
|
|
|
if (!msg)
|
2010-11-09 01:36:36 +00:00
|
|
|
@@ -3368,7 +3363,8 @@ static void nl80211_remove_iface(struct
|
2010-05-02 22:03:49 +00:00
|
|
|
|
|
|
|
#ifdef HOSTAPD
|
|
|
|
/* stop listening for EAPOL on this interface */
|
|
|
|
- del_ifidx(drv, ifidx);
|
|
|
|
+ if (drv->nlmode == NL80211_IFTYPE_AP)
|
|
|
|
+ del_ifidx(drv, ifidx);
|
|
|
|
#endif /* HOSTAPD */
|
|
|
|
|
|
|
|
msg = nlmsg_alloc();
|
2010-11-09 01:36:36 +00:00
|
|
|
@@ -3441,7 +3437,8 @@ static int nl80211_create_iface_once(str
|
2010-05-02 22:03:49 +00:00
|
|
|
|
|
|
|
#ifdef HOSTAPD
|
|
|
|
/* start listening for EAPOL on this interface */
|
|
|
|
- add_ifidx(drv, ifidx);
|
|
|
|
+ if (drv->nlmode == NL80211_IFTYPE_AP)
|
|
|
|
+ add_ifidx(drv, ifidx);
|
|
|
|
#endif /* HOSTAPD */
|
|
|
|
|
|
|
|
if (addr && iftype != NL80211_IFTYPE_MONITOR &&
|
2010-11-11 22:39:19 +00:00
|
|
|
@@ -5155,6 +5152,7 @@ static void *i802_init(struct hostapd_da
|
2010-05-02 22:03:49 +00:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
drv = bss->drv;
|
2010-05-02 23:38:15 +00:00
|
|
|
+ drv->nlmode = NL80211_IFTYPE_AP;
|
2010-05-02 22:03:49 +00:00
|
|
|
if (linux_br_get(brname, params->ifname) == 0) {
|
|
|
|
wpa_printf(MSG_DEBUG, "nl80211: Interface %s is in bridge %s",
|
2010-05-02 23:38:15 +00:00
|
|
|
params->ifname, brname);
|