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