From 4e0a533f6052fa82ae61434fdefda22679b170f7 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 15 Jun 2016 19:28:48 +0200 Subject: [PATCH] hostapd: fix breakage with non-nl80211 drivers Signed-off-by: Felix Fietkau --- ...dd-new-config-params-to-be-used-with.patch | 27 ++++++++++--------- .../462-wpa_s-support-htmode-param.patch | 6 ++--- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch index ec84b9a4b2..169b17100d 100644 --- a/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch +++ b/package/network/services/hostapd/patches/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch @@ -18,7 +18,7 @@ Signed-hostap: Antonio Quartulli #define WPA_SUPPLICANT_DRIVER_VERSION 4 -+#include "drivers/nl80211_copy.h" ++#include "ap/sta_info.h" #include "common/defs.h" #include "common/ieee802_11_defs.h" #include "utils/list.h" @@ -26,7 +26,7 @@ Signed-hostap: Antonio Quartulli * responsible for selecting with which BSS to associate. */ const u8 *bssid; -+ unsigned char rates[NL80211_MAX_SUPP_RATES]; ++ unsigned char rates[WLAN_SUPP_RATES_MAX]; + int mcast_rate; + /** @@ -38,7 +38,7 @@ Signed-hostap: Antonio Quartulli #include "eap_peer/eap.h" #include "p2p/p2p.h" #include "fst/fst.h" -+#include "drivers/nl80211_copy.h" ++#include "ap/sta_info.h" #include "config.h" @@ -88,7 +88,7 @@ Signed-hostap: Antonio Quartulli + pos = (char *)value; + r = strtok_r(pos, ",", &sptr); + i = 0; -+ while (pos && i < NL80211_MAX_SUPP_RATES) { ++ while (pos && i < WLAN_SUPP_RATES_MAX) { + rate = 0.0; + if (r) + rate = strtod(r, &end); @@ -113,11 +113,11 @@ Signed-hostap: Antonio Quartulli + if (ssid->rates[0] <= 0) + return NULL; + -+ value = os_malloc(6 * NL80211_MAX_SUPP_RATES + 1); ++ value = os_malloc(6 * WLAN_SUPP_RATES_MAX + 1); + if (value == NULL) + return NULL; + pos = value; -+ for (i = 0; i < NL80211_MAX_SUPP_RATES - 1; i++) { ++ for (i = 0; i < WLAN_SUPP_RATES_MAX - 1; i++) { + res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2); + if (res < 0) { + os_free(value); @@ -126,13 +126,13 @@ Signed-hostap: Antonio Quartulli + pos += res; + } + res = os_snprintf(pos, 6, "%.1f", -+ (double)ssid->rates[NL80211_MAX_SUPP_RATES - 1] / 2); ++ (double)ssid->rates[WLAN_SUPP_RATES_MAX - 1] / 2); + if (res < 0) { + os_free(value); + return NULL; + } + -+ value[6 * NL80211_MAX_SUPP_RATES] = '\0'; ++ value[6 * WLAN_SUPP_RATES_MAX] = '\0'; + return value; +} +#endif /* NO_CONFIG_WRITE */ @@ -152,19 +152,22 @@ Signed-hostap: Antonio Quartulli #endif /* CONFIG_MACSEC */ --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -12,6 +12,7 @@ +@@ -10,8 +10,10 @@ + #define CONFIG_SSID_H + #include "common/defs.h" ++#include "ap/sta_info.h" #include "utils/list.h" #include "eap_peer/eap_config.h" +#include "drivers/nl80211_copy.h" #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1) -@@ -711,6 +712,9 @@ struct wpa_ssid { +@@ -711,6 +713,9 @@ struct wpa_ssid { */ void *parent_cred; -+ unsigned char rates[NL80211_MAX_SUPP_RATES]; ++ unsigned char rates[WLAN_SUPP_RATES_MAX]; + double mcast_rate; + #ifdef CONFIG_MACSEC @@ -178,7 +181,7 @@ Signed-hostap: Antonio Quartulli params.beacon_int = wpa_s->conf->beacon_int; + params.fixed_freq = ssid->fixed_freq; + i = 0; -+ while (i < NL80211_MAX_SUPP_RATES) { ++ while (i < WLAN_SUPP_RATES_MAX) { + params.rates[i] = ssid->rates[i]; + i++; + } diff --git a/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch index e2bd37d7a5..a81465c56f 100644 --- a/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch +++ b/package/network/services/hostapd/patches/462-wpa_s-support-htmode-param.patch @@ -18,7 +18,7 @@ Signed-off-by: Antonio Quartulli +++ b/src/drivers/driver.h @@ -590,6 +590,8 @@ struct wpa_driver_associate_params { - unsigned char rates[NL80211_MAX_SUPP_RATES]; + unsigned char rates[WLAN_SUPP_RATES_MAX]; int mcast_rate; + int ht_set; + unsigned int htmode; @@ -134,9 +134,9 @@ Signed-off-by: Antonio Quartulli #endif /* CONFIG_MACSEC */ --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h -@@ -714,6 +714,8 @@ struct wpa_ssid { +@@ -715,6 +715,8 @@ struct wpa_ssid { - unsigned char rates[NL80211_MAX_SUPP_RATES]; + unsigned char rates[WLAN_SUPP_RATES_MAX]; double mcast_rate; + int ht_set; + unsigned int htmode; -- 2.30.2