hostapd: fix breakage with non-nl80211 drivers

Signed-off-by: Felix Fietkau <nbd@nbd.name>
v19.07.3_mercusys_ac12_duma
Felix Fietkau 8 years ago
parent 96db107524
commit 4e0a533f60

@ -18,7 +18,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
#define WPA_SUPPLICANT_DRIVER_VERSION 4 #define WPA_SUPPLICANT_DRIVER_VERSION 4
+#include "drivers/nl80211_copy.h" +#include "ap/sta_info.h"
#include "common/defs.h" #include "common/defs.h"
#include "common/ieee802_11_defs.h" #include "common/ieee802_11_defs.h"
#include "utils/list.h" #include "utils/list.h"
@ -26,7 +26,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
* responsible for selecting with which BSS to associate. */ * responsible for selecting with which BSS to associate. */
const u8 *bssid; const u8 *bssid;
+ unsigned char rates[NL80211_MAX_SUPP_RATES]; + unsigned char rates[WLAN_SUPP_RATES_MAX];
+ int mcast_rate; + int mcast_rate;
+ +
/** /**
@ -38,7 +38,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
#include "eap_peer/eap.h" #include "eap_peer/eap.h"
#include "p2p/p2p.h" #include "p2p/p2p.h"
#include "fst/fst.h" #include "fst/fst.h"
+#include "drivers/nl80211_copy.h" +#include "ap/sta_info.h"
#include "config.h" #include "config.h"
@ -88,7 +88,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
+ pos = (char *)value; + pos = (char *)value;
+ r = strtok_r(pos, ",", &sptr); + r = strtok_r(pos, ",", &sptr);
+ i = 0; + i = 0;
+ while (pos && i < NL80211_MAX_SUPP_RATES) { + while (pos && i < WLAN_SUPP_RATES_MAX) {
+ rate = 0.0; + rate = 0.0;
+ if (r) + if (r)
+ rate = strtod(r, &end); + rate = strtod(r, &end);
@ -113,11 +113,11 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
+ if (ssid->rates[0] <= 0) + if (ssid->rates[0] <= 0)
+ return NULL; + return NULL;
+ +
+ value = os_malloc(6 * NL80211_MAX_SUPP_RATES + 1); + value = os_malloc(6 * WLAN_SUPP_RATES_MAX + 1);
+ if (value == NULL) + if (value == NULL)
+ return NULL; + return NULL;
+ pos = value; + 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); + res = os_snprintf(pos, 6, "%.1f,", (double)ssid->rates[i] / 2);
+ if (res < 0) { + if (res < 0) {
+ os_free(value); + os_free(value);
@ -126,13 +126,13 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
+ pos += res; + pos += res;
+ } + }
+ res = os_snprintf(pos, 6, "%.1f", + 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) { + if (res < 0) {
+ os_free(value); + os_free(value);
+ return NULL; + return NULL;
+ } + }
+ +
+ value[6 * NL80211_MAX_SUPP_RATES] = '\0'; + value[6 * WLAN_SUPP_RATES_MAX] = '\0';
+ return value; + return value;
+} +}
+#endif /* NO_CONFIG_WRITE */ +#endif /* NO_CONFIG_WRITE */
@ -152,19 +152,22 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
#endif /* CONFIG_MACSEC */ #endif /* CONFIG_MACSEC */
--- a/wpa_supplicant/config_ssid.h --- a/wpa_supplicant/config_ssid.h
+++ b/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 "common/defs.h"
+#include "ap/sta_info.h"
#include "utils/list.h" #include "utils/list.h"
#include "eap_peer/eap_config.h" #include "eap_peer/eap_config.h"
+#include "drivers/nl80211_copy.h" +#include "drivers/nl80211_copy.h"
#define DEFAULT_EAP_WORKAROUND ((unsigned int) -1) #define DEFAULT_EAP_WORKAROUND ((unsigned int) -1)
@@ -711,6 +712,9 @@ struct wpa_ssid { @@ -711,6 +713,9 @@ struct wpa_ssid {
*/ */
void *parent_cred; void *parent_cred;
+ unsigned char rates[NL80211_MAX_SUPP_RATES]; + unsigned char rates[WLAN_SUPP_RATES_MAX];
+ double mcast_rate; + double mcast_rate;
+ +
#ifdef CONFIG_MACSEC #ifdef CONFIG_MACSEC
@ -178,7 +181,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
params.beacon_int = wpa_s->conf->beacon_int; params.beacon_int = wpa_s->conf->beacon_int;
+ params.fixed_freq = ssid->fixed_freq; + params.fixed_freq = ssid->fixed_freq;
+ i = 0; + i = 0;
+ while (i < NL80211_MAX_SUPP_RATES) { + while (i < WLAN_SUPP_RATES_MAX) {
+ params.rates[i] = ssid->rates[i]; + params.rates[i] = ssid->rates[i];
+ i++; + i++;
+ } + }

@ -18,7 +18,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
+++ b/src/drivers/driver.h +++ b/src/drivers/driver.h
@@ -590,6 +590,8 @@ struct wpa_driver_associate_params { @@ -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 mcast_rate;
+ int ht_set; + int ht_set;
+ unsigned int htmode; + unsigned int htmode;
@ -134,9 +134,9 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
#endif /* CONFIG_MACSEC */ #endif /* CONFIG_MACSEC */
--- a/wpa_supplicant/config_ssid.h --- a/wpa_supplicant/config_ssid.h
+++ b/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; double mcast_rate;
+ int ht_set; + int ht_set;
+ unsigned int htmode; + unsigned int htmode;

Loading…
Cancel
Save