hostapd: fix breakage with non-nl80211 drivers

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2016-06-15 19:28:48 +02:00
parent 96db107524
commit 4e0a533f60
2 changed files with 18 additions and 15 deletions

View File

@ -18,7 +18,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
#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 <ordex@autistici.org>
* 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 <ordex@autistici.org>
#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 <ordex@autistici.org>
+ 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 <ordex@autistici.org>
+ 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 <ordex@autistici.org>
+ 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 <ordex@autistici.org>
#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 <ordex@autistici.org>
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++;
+ }

View File

@ -18,7 +18,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
+++ 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 <ordex@autistici.org>
#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;