hostapd: Fixes after merge.
NoSwapWifiPrimaryChannel has to be implemented in a new
file, as hostapd code moved around.
src/ap/beacon.c had some rearrangement, taxonomy code
must now look up the STA itself.
This gets us to a working hostapd current as of:
http://w1.fi/cgit/hostap/commit/?id=ca68a8b561c48393c8ba25055ce294caaa3ac008
This includes fixing CVE-2015-1863.
Change-Id: I3655bc5fc908ec00c55a8e4281161bd22ae42c41
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 1a46d4d..9e6b66a 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -652,9 +652,12 @@
#endif /* CONFIG_P2P */
#ifdef CONFIG_CLIENT_TAXONOMY
- if (sta) {
- hostapd_taxonomy_probe_req(sta, ie, ie_len);
- hostapd_write_sta_taxonomy(sta);
+ {
+ struct sta_info *sta = ap_get_sta(hapd, mgmt->sa);
+ if (sta) {
+ hostapd_taxonomy_probe_req(sta, ie, ie_len);
+ hostapd_write_sta_taxonomy(sta);
+ }
}
#endif /* CONFIG_CLIENT_TAXONOMY */
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 6d84ee4..13d32ee 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -221,15 +221,6 @@
}
-static int experiment(const char *name)
-{
- char filename[128];
- snprintf(filename, sizeof(filename), "/config/experiments/%s.active",
- name);
- return access(filename, F_OK) == 0;
-}
-
-
#ifdef CONFIG_IEEE80211N
static int ieee80211n_allowed_ht40_channel_pair(struct hostapd_iface *iface)
{
diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c
index e61f824..ee5c873 100644
--- a/src/common/hw_features_common.c
+++ b/src/common/hw_features_common.c
@@ -16,6 +16,15 @@
#include "hw_features_common.h"
+int experiment(const char *name)
+{
+ char filename[128];
+ snprintf(filename, sizeof(filename), "/config/experiments/%s.active",
+ name);
+ return access(filename, F_OK) == 0;
+}
+
+
struct hostapd_channel_data * hw_get_channel_chan(struct hostapd_hw_modes *mode,
int chan, int *freq)
{
@@ -198,9 +207,15 @@
sec_bss++;
}
if (sec_bss && !pri_bss) {
- wpa_printf(MSG_INFO,
- "Switch own primary and secondary channel to get secondary channel with no Beacons from other BSSes");
- return 2;
+ if (experiment("NoSwapWifiPrimaryChannel")) {
+ wpa_printf(MSG_INFO, "NoSwapPrimaryWifiChannel: "
+ "would have swapped channels (1).");
+ } else {
+ wpa_printf(MSG_INFO, "Switch own primary and secondary "
+ "channel to get secondary channel with no Beacons "
+ "from other BSSes");
+ return 2;
+ }
}
/*
@@ -224,11 +239,16 @@
get_pri_sec_chan(bss, &bss_pri_chan, &bss_sec_chan);
if (pri_chan == bss_sec_chan &&
sec_chan == bss_pri_chan) {
- wpa_printf(MSG_INFO, "Switch own primary and "
- "secondary channel due to BSS "
- "overlap with " MACSTR,
- MAC2STR(bss->bssid));
- return 2;
+ if (experiment("NoSwapWifiPrimaryChannel")) {
+ wpa_printf(MSG_INFO, "NoSwapPrimaryWifiChannel: "
+ "would have swapped channels (2).");
+ } else {
+ wpa_printf(MSG_INFO, "Switch own primary and "
+ "secondary channel due to BSS "
+ "overlap with " MACSTR,
+ MAC2STR(bss->bssid));
+ return 2;
+ }
}
}
}
diff --git a/src/common/hw_features_common.h b/src/common/hw_features_common.h
index 7f43d00..7af8331 100644
--- a/src/common/hw_features_common.h
+++ b/src/common/hw_features_common.h
@@ -36,5 +36,6 @@
int vht_enabled, int sec_channel_offset,
int vht_oper_chwidth, int center_segment0,
int center_segment1, u32 vht_caps);
+int experiment(const char *name);
#endif /* HW_FEATURES_COMMON_H */