From: Felix Fietkau Date: Sun, 2 May 2010 22:03:49 +0000 (+0000) Subject: wpa_supplicant: fix issues with the nl80211 driver X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=fd61253b6603d1ac2516992e2b69ddb77d881b8b;p=openwrt%2Fstaging%2Fjow.git wpa_supplicant: fix issues with the nl80211 driver SVN-Revision: 21320 --- diff --git a/package/hostapd/patches/390-nl80211_fixes.patch b/package/hostapd/patches/390-nl80211_fixes.patch new file mode 100644 index 0000000000..2413a1266a --- /dev/null +++ b/package/hostapd/patches/390-nl80211_fixes.patch @@ -0,0 +1,109 @@ +--- a/src/drivers/driver_nl80211.c ++++ b/src/drivers/driver_nl80211.c +@@ -1119,7 +1119,6 @@ nla_put_failure: + } + + +-#ifndef HOSTAPD + struct wiphy_info_data { + int max_scan_ssids; + int ap_supported; +@@ -1231,7 +1230,6 @@ static int wpa_driver_nl80211_capa(struc + + return 0; + } +-#endif /* HOSTAPD */ + + + static int wpa_driver_nl80211_init_nl(struct wpa_driver_nl80211_data *drv, +@@ -1371,6 +1369,7 @@ static void * wpa_driver_nl80211_init(vo + drv->monitor_ifidx = -1; + drv->monitor_sock = -1; + drv->ioctl_sock = -1; ++ drv->nlmode = NL80211_IFTYPE_STATION; + + if (wpa_driver_nl80211_init_nl(drv, ctx)) { + os_free(drv); +@@ -1468,24 +1467,23 @@ wpa_driver_nl80211_finish_drv_init(struc + 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 (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) { +- wpa_printf(MSG_ERROR, "Could not set interface '%s' UP", +- bss->ifname); +- return -1; +- } ++ if (drv->nlmode == NL80211_IFTYPE_STATION) { ++ 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 (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) { ++ wpa_printf(MSG_ERROR, "Could not set interface '%s' UP", ++ bss->ifname); ++ return -1; ++ } + +- 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 " +@@ -2143,13 +2141,9 @@ static int wpa_driver_nl80211_set_key(co + */ + 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) +@@ -2990,7 +2984,8 @@ static void nl80211_remove_iface(struct + + #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(); +@@ -3063,7 +3058,8 @@ static int nl80211_create_iface_once(str + + #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 && +@@ -4765,6 +4761,7 @@ static void *i802_init(struct hostapd_da + if (bss == NULL) + return NULL; + ++ drv->nlmode = NL80211_IFTYPE_AP; + drv = bss->drv; + if (linux_br_get(brname, params->ifname) == 0) { + wpa_printf(MSG_DEBUG, "nl80211: Interface %s is in bridge %s", diff --git a/package/hostapd/patches/400-nl80211_sta_auth.patch b/package/hostapd/patches/400-nl80211_sta_auth.patch new file mode 100644 index 0000000000..8c959062dc --- /dev/null +++ b/package/hostapd/patches/400-nl80211_sta_auth.patch @@ -0,0 +1,19 @@ +--- a/wpa_supplicant/wpa_supplicant.c ++++ b/wpa_supplicant/wpa_supplicant.c +@@ -543,10 +543,16 @@ void wpa_supplicant_set_state(struct wpa + wpa_s->reassociated_connection = 1; + wpa_drv_set_operstate(wpa_s, 1); + wpa_s->after_wps = 0; ++#ifndef IEEE8021X_EAPOL ++ wpa_drv_set_supp_port(wpa_s, 1); ++#endif + } else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING || + state == WPA_ASSOCIATED) { + wpa_s->new_connection = 1; + wpa_drv_set_operstate(wpa_s, 0); ++#ifndef IEEE8021X_EAPOL ++ wpa_drv_set_supp_port(wpa_s, 0); ++#endif + } + wpa_s->wpa_state = state; +