[OpenWrt-Devel] [PATCH] Fixed wpa_supplicant locking hostapd to 20MHz (#12720) backported to Backfire r33081
George Valkov
gvalkov at abv.bg
Sat Aug 2 11:16:47 EDT 2014
https://www.dropbox.com/s/gjyvq70z3wgdrzm/g.Fixed-wpa_supplicant-locking-hostapd-to-20MHz-12720.patch
From 78015d8b25b5bf9057346944077f3c4d12c2bc9e Mon Sep 17 00:00:00 2001 From: Georgi Valkov Date: Fri, 11 Jul 2014 14:41:38 +0300 Subject: [PATCH] Fixed wpa_supplicant locking hostapd to 20MHz (#12720)
Fixed wpa_supplicant when the radio is in 40MHz mode so that it no longer restarts hostapd with the second channel disableed.
Original patch by: Lance Chaney Backported to Backfire r33081 by: Georgi Valkov ---
package/hostapd/patches/553-ap_sta_support.patch | 32 +++++++++++++++++-------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/package/hostapd/patches/553-ap_sta_support.patch b/package/hostapd/patches/553-ap_sta_support.patch index 6053ee2..0084a56 100644 --- a/package/hostapd/patches/553-ap_sta_support.patch +++ b/package/hostapd/patches/553-ap_sta_support.patch @@ -44,7 +44,7 @@
CONFIG_OS=win32
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c -@@ -125,6 +125,55 @@ extern int wpa_debug_show_keys; +@@ -125,6 +125,63 @@ extern int wpa_debug_show_keys;
extern int wpa_debug_timestamp;
extern struct wpa_driver_ops *wpa_drivers[];
@@ -68,11 +68,20 @@
+ char buf[256];
+ int len = sizeof(buf);
+ int channel, hw_mode; ++ int sec_chan = 0;
+ int ret;
+
+ if (!bss)
+ return;
+ ++ if (bss->ht_param & HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH) { ++ int sec = bss->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK; ++ if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE) ++ sec_chan = 1; ++ else if (sec ==
HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW) ++ sec_chan = -1; ++ } ++
+ if (bss->freq
+ hw_mode = HOSTAPD_MODE_IEEE80211G;
+ channel = (bss->freq - 2407) / 5; @@ -80,9 +89,8 @@
+ hw_mode = HOSTAPD_MODE_IEEE80211A;
+ channel = (bss->freq - 5000) / 5;
+ } -+ -+ if (asprintf(&cmd, "RELOAD channel=%d sec_chan=0 hw_mode=%d ieee80211n=%d", -+
channel, hw_mode, !!bss->ht_capab) ++ if (asprintf(&cmd, "RELOAD channel=%d sec_chan=%d hw_mode=%d ieee80211n=%d", ++
channel, sec_chan, hw_mode, !!bss->ht_capab)
+ return -1;
+ }
+ @@ -100,7 +108,7 @@
/* Configure default/group WEP keys for static WEP */
int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
{ -@@ -632,8 +681,16 @@ void wpa_supplicant_set_state(struct wpa +@@ -632,8 +689,16 @@ void wpa_supplicant_set_state(struct wpa
#ifdef CONFIG_P2P
wpas_p2p_completed(wpa_s);
#endif /* CONFIG_P2P */ @@ -117,7 +125,7 @@
wpa_s->new_connection = 1;
wpa_drv_set_operstate(wpa_s, 0);
#ifndef IEEE8021X_EAPOL -@@ -2245,6 +2302,21 @@ static int wpa_supplicant_init_iface(str +@@ -2245,6 +2310,21 @@ static int wpa_supplicant_init_iface(str
os_strlcpy(wpa_s->bridge_ifname, iface->bridge_ifname,
sizeof(wpa_s->bridge_ifname));
} @@ -149,35 +157,41 @@
#include "drivers/driver.h"
#include "wpa_supplicant_i.h"
#include "config.h" -@@ -79,6 +80,8 @@ struct wpa_bss * wpa_bss_get(struct wpa_ +@@ -79,6 +80,9 @@ struct wpa_bss * wpa_bss_get(struct wpa_
static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src)
{
+ struct ieee80211_ht_capabilities *capab; ++ struct ieee80211_ht_operation *oper;
+ struct ieee802_11_elems elems;
os_time_t usec;
dst->flags = src->flags; -@@ -91,6 +94,12 @@ static void wpa_bss_copy_res(struct wpa_ +@@ -91,6 +95,15 @@ static void wpa_bss_copy_res(struct wpa_
dst->level = src->level;
dst->tsf = src->tsf;
+ memset(&elems, 0, sizeof(elems));
+ ieee802_11_parse_elems((u8 *) (src + 1), src->ie_len, &elems, 0);
+ capab = (struct ieee80211_ht_capabilities *) elems.ht_capabilities; ++ oper = (struct ieee80211_ht_operation *) elems.ht_operation;
+ if (capab)
+ dst->ht_capab = le_to_host16(capab->ht_capabilities_info); ++ if (oper) ++ dst->ht_param = oper->ht_param;
+
os_get_time(&dst->last_update);
dst->last_update.sec -= src->age / 1000;
usec = (src->age % 1000) * 1000;
--- a/wpa_supplicant/bss.h
+++ b/wpa_supplicant/bss.h -@@ -57,6 +57,7 @@ struct wpa_bss { +@@ -57,6 +57,9 @@ struct wpa_bss {
unsigned int flags;
u8 bssid[ETH_ALEN];
u8 ssid[32];
+ u16 ht_capab; ++ /** Five octets of HT Operation Information */ ++ u8 ht_param;
size_t ssid_len;
int freq;
u16 beacon_int; --
1.9.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20140802/c6165b00/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list