hostapd: backport current version from trunk as of r27021
authorFelix Fietkau <nbd@openwrt.org>
Mon, 30 May 2011 14:01:37 +0000 (14:01 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 30 May 2011 14:01:37 +0000 (14:01 +0000)
SVN-Revision: 27031

19 files changed:
package/hostapd/Makefile
package/hostapd/files/hostapd.sh
package/hostapd/files/wpa_supplicant-full.config
package/hostapd/files/wpa_supplicant-mini.config
package/hostapd/patches/320-nl80211_multicall_fixes.patch
package/hostapd/patches/330-multicall_bridge_fix.patch
package/hostapd/patches/500-scan_wait.patch
package/hostapd/patches/510-multicall.patch
package/hostapd/patches/530-rescan_immediately.patch
package/hostapd/patches/540-optional_rfkill.patch
package/hostapd/patches/551-nl80211_del_beacon_bss.patch
package/hostapd/patches/553-ap_sta_support.patch
package/hostapd/patches/560-disable_ctrl_iface_mib.patch
package/hostapd/patches/600-terminate_on_setup_failure.patch
package/hostapd/patches/700-random_pool_add_kernel.patch
package/hostapd/patches/710-bring_down_interface.patch
package/hostapd/patches/730-fix_wds_bridge_handling.patch
package/hostapd/patches/740-process_assoc_resp_tx_status.patch [new file with mode: 0644]
package/hostapd/patches/800-dynamic_20_40_mhz.patch [new file with mode: 0644]

index 492edd71092b7f5a6a1f893abc96bff2d6c69609..6111e9a6eee5e9065bb66d7aeb43c5155a124821 100644 (file)
@@ -8,16 +8,16 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hostapd
-PKG_VERSION:=20110402
+PKG_VERSION:=20110527
 PKG_RELEASE:=1
-PKG_REV:=4378fc14ebfb355705e7674bf347ea659bcd77bc
+PKG_REV:=ceb34f250af7a7082f18c1e0451dc7fbc0f000f3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git
-PKG_SOURCE_SUBDIR:=hostapd-$(PKG_VERSION)
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 PKG_SOURCE_VERSION:=$(PKG_REV)
 PKG_SOURCE_PROTO:=git
-PKG_MIRROR_MD5SUM:=fd5e29bbfcb89a4e60fef633bd4efa94
+PKG_MIRROR_MD5SUM:=4b98902d782813b41aca1faff613f677
 
 PKG_BUILD_DEPENDS:= \
        PACKAGE_kmod-madwifi:madwifi \
index 5b69ecd622c3274c63f167fa151c6e761508bf55..29d8c729789128db56cc078e837b4d8088628bd0 100644 (file)
@@ -68,13 +68,23 @@ hostapd_set_bss_options() {
                *wpa*)
                        # required fields? formats?
                        # hostapd is particular, maybe a default configuration for failures
-                       config_get server "$vif" server
-                       append "$var" "auth_server_addr=$server" "$N"
-                       config_get port "$vif" port
-                       port=${port:-1812}
-                       append "$var" "auth_server_port=$port" "$N"
-                       config_get secret "$vif" key
-                       append "$var" "auth_server_shared_secret=$secret" "$N"
+                       config_get auth_server "$vif" auth_server
+                       [ -z "$auth_server" ] && config_get auth_server "$vif" server
+                       append "$var" "auth_server_addr=$auth_server" "$N"
+                       config_get auth_port "$vif" auth_port
+                       [ -z "$auth_port" ] && config_get auth_port "$vif" port
+                       auth_port=${auth_port:-1812}
+                       append "$var" "auth_server_port=$auth_port" "$N"
+                       config_get auth_secret "$vif" auth_secret
+                       [ -z "$auth_secret" ] && config_get auth_secret "$vif" key
+                       append "$var" "auth_server_shared_secret=$auth_secret" "$N"
+                       config_get acct_server "$vif" acct_server
+                       [ -n "$acct_server" ] && append "$var" "acct_server_addr=$acct_server" "$N"
+                       config_get acct_port "$vif" acct_port
+                       [ -n "$acct_port" ] && acct_port=${acct_port:-1813}
+                       [ -n "$acct_port" ] && append "$var" "acct_server_port=$acct_port" "$N"
+                       config_get acct_secret "$vif" acct_secret
+                       [ -n "$acct_secret" ] && append "$var" "acct_server_shared_secret=$acct_secret" "$N"
                        config_get nasid "$vif" nasid
                        append "$var" "nas_identifier=$nasid" "$N"
                        append "$var" "eapol_key_index_workaround=1" "$N"
index 6e157f749e41f5dcefb06dc79e9d88126e2aad82..8ad54dbabf5c9b7fb682346f8cfd080f6a3ec1c2 100644 (file)
@@ -402,3 +402,5 @@ CONFIG_INTERNAL_LIBTOMMATH_FAST=y
 #LIBS += -lbfd -liberty -lz
 #LIBS_p += -lbfd -liberty -lz
 #LIBS_c += -lbfd -liberty -lz
+
+NEED_80211_COMMON=y
index 843b64a7d10e7f66b3a959cca44ae85df6eedb58..772e1d98093346e184bdded771d029773845b6a2 100644 (file)
@@ -402,3 +402,5 @@ CONFIG_TLS=internal
 #LIBS += -lbfd -liberty -lz
 #LIBS_p += -lbfd -liberty -lz
 #LIBS_c += -lbfd -liberty -lz
+
+NEED_80211_COMMON=y
index 62ad1be8f892f0f43cc3a5f3f3f9801314673fe8..2403e72075b76241840dfc14694747ca6b964103 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -1847,6 +1847,7 @@ static void * wpa_driver_nl80211_init(vo
+@@ -1890,6 +1890,7 @@ static void * wpa_driver_nl80211_init(vo
        drv->monitor_ifidx = -1;
        drv->monitor_sock = -1;
        drv->ioctl_sock = -1;
@@ -8,7 +8,7 @@
  
        if (wpa_driver_nl80211_init_nl(drv)) {
                os_free(drv);
-@@ -2013,29 +2014,29 @@ wpa_driver_nl80211_finish_drv_init(struc
+@@ -2056,29 +2057,29 @@ wpa_driver_nl80211_finish_drv_init(struc
        drv->ifindex = if_nametoindex(bss->ifname);
        drv->first_bss.ifindex = drv->ifindex;
  
@@ -58,7 +58,7 @@
  
        if (wpa_driver_nl80211_capa(drv))
                return -1;
-@@ -3765,7 +3766,8 @@ static void nl80211_remove_iface(struct 
+@@ -3849,7 +3850,8 @@ static void nl80211_remove_iface(struct 
  
  #ifdef HOSTAPD
        /* stop listening for EAPOL on this interface */
@@ -68,7 +68,7 @@
  #endif /* HOSTAPD */
  
        msg = nlmsg_alloc();
-@@ -3838,7 +3840,8 @@ static int nl80211_create_iface_once(str
+@@ -3922,7 +3924,8 @@ static int nl80211_create_iface_once(str
  
  #ifdef HOSTAPD
        /* start listening for EAPOL on this interface */
index b67012242ae271e67d2225961da4a5002aed741f..350e722e8990044870acb60e5f195ba579dfae0b 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -466,6 +466,10 @@ static void wpa_driver_nl80211_event_rtm
+@@ -475,6 +475,10 @@ static void wpa_driver_nl80211_event_rtm
                return;
        }
  
@@ -11,7 +11,7 @@
        wpa_printf(MSG_DEBUG, "RTM_NEWLINK: operstate=%d ifi_flags=0x%x "
                   "(%s%s%s%s)",
                   drv->operstate, ifi->ifi_flags,
-@@ -537,6 +541,10 @@ static void wpa_driver_nl80211_event_rtm
+@@ -546,6 +550,10 @@ static void wpa_driver_nl80211_event_rtm
        attrlen = len;
        attr = (struct rtattr *) buf;
  
@@ -22,7 +22,7 @@
        rta_len = RTA_ALIGN(sizeof(struct rtattr));
        while (RTA_OK(attr, attrlen)) {
                if (attr->rta_type == IFLA_IFNAME) {
-@@ -1636,6 +1644,11 @@ static int wpa_driver_nl80211_capa(struc
+@@ -1679,6 +1687,11 @@ static int wpa_driver_nl80211_capa(struc
        drv->capa.flags |= WPA_DRIVER_FLAGS_EAPOL_TX_STATUS;
        drv->capa.max_remain_on_chan = info.max_remain_on_chan;
  
@@ -34,7 +34,7 @@
        return 0;
  }
  
-@@ -5623,8 +5636,6 @@ static void *i802_init(struct hostapd_da
+@@ -5715,8 +5728,6 @@ static void *i802_init(struct hostapd_da
                br_ifindex = 0;
        }
  
index 7f1c749b35fb5141b59021b9c3c0cf1fec517ae0..d4c5938de20a6f8b7b560c8f5308b3575d752900 100644 (file)
@@ -10,7 +10,7 @@
  /* hostapd.c */
 --- a/src/ap/hostapd.c
 +++ b/src/ap/hostapd.c
-@@ -790,6 +790,9 @@ int hostapd_setup_interface_complete(str
+@@ -807,6 +807,9 @@ int hostapd_setup_interface_complete(str
        wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
                   iface->bss[0]->conf->iface);
  
@@ -31,7 +31,7 @@
  
  
  struct hapd_interfaces {
-@@ -163,6 +165,15 @@ static void hostapd_logger_cb(void *ctx,
+@@ -163,6 +165,16 @@ static void hostapd_logger_cb(void *ctx,
  }
  #endif /* CONFIG_NO_HOSTAPD_LOGGER */
  
 +              return -1;
 +      }
 +      daemonize = 0;
++      return 0;
 +}
 +
  
  /**
   * hostapd_init - Allocate and initialize per-interface data
-@@ -184,6 +195,7 @@ static struct hostapd_iface * hostapd_in
+@@ -184,6 +196,7 @@ static struct hostapd_iface * hostapd_in
        if (hapd_iface == NULL)
                goto fail;
  
@@ -55,7 +56,7 @@
        hapd_iface->reload_config = hostapd_reload_config;
        hapd_iface->config_read_cb = hostapd_config_read;
        hapd_iface->config_fname = os_strdup(config_file);
-@@ -399,7 +411,7 @@ static int hostapd_global_init(struct ha
+@@ -399,7 +412,7 @@ static int hostapd_global_init(struct ha
  }
  
  
@@ -64,7 +65,7 @@
  {
  #ifdef EAP_SERVER_TNC
        tncs_global_deinit();
-@@ -419,8 +431,7 @@ static void hostapd_global_deinit(const 
+@@ -419,8 +432,7 @@ static void hostapd_global_deinit(const 
  }
  
  
@@ -74,7 +75,7 @@
  {
  #ifdef EAP_SERVER_TNC
        int tnc = 0;
-@@ -441,11 +452,6 @@ static int hostapd_global_run(struct hap
+@@ -441,11 +453,6 @@ static int hostapd_global_run(struct hap
        }
  #endif /* EAP_SERVER_TNC */
  
@@ -86,7 +87,7 @@
        eloop_run();
  
        return 0;
-@@ -501,8 +507,7 @@ int main(int argc, char *argv[])
+@@ -501,8 +508,7 @@ int main(int argc, char *argv[])
        struct hapd_interfaces interfaces;
        int ret = 1;
        size_t i;
@@ -96,7 +97,7 @@
        const char *log_file = NULL;
  
        if (os_program_init())
-@@ -576,7 +581,7 @@ int main(int argc, char *argv[])
+@@ -576,7 +582,7 @@ int main(int argc, char *argv[])
                        goto out;
        }
  
                goto out;
  
        ret = 0;
-@@ -587,7 +592,7 @@ int main(int argc, char *argv[])
+@@ -587,7 +593,7 @@ int main(int argc, char *argv[])
                hostapd_interface_deinit_free(interfaces.iface[i]);
        os_free(interfaces.iface);
  
                } else if (os_strcmp(buf, "ht_capab") == 0) {
 --- a/src/ap/ap_config.h
 +++ b/src/ap/ap_config.h
-@@ -389,6 +389,7 @@ struct hostapd_config {
+@@ -390,6 +390,7 @@ struct hostapd_config {
  
        int ht_op_mode_fixed;
        u16 ht_capab;
index ec4fb9b9b04110c010c89808d81f3ff2c94ee9b3..98d89f109544ab3af17e06a038074e404e0e44bd 100644 (file)
  wpa_cli.exe: wpa_cli
 --- a/src/drivers/driver.h
 +++ b/src/drivers/driver.h
-@@ -3186,8 +3186,8 @@ union wpa_event_data {
+@@ -3199,8 +3199,8 @@ union wpa_event_data {
   * Driver wrapper code should call this function whenever an event is received
   * from the driver.
   */
  /*
 --- a/src/ap/drv_callbacks.c
 +++ b/src/ap/drv_callbacks.c
-@@ -443,8 +443,8 @@ static void hostapd_event_eapol_rx(struc
+@@ -448,8 +448,8 @@ static void hostapd_event_eapol_rx(struc
  }
  
  
        for (;;) {
 --- a/wpa_supplicant/events.c
 +++ b/wpa_supplicant/events.c
-@@ -1734,8 +1734,8 @@ static void wpa_supplicant_event_unprot_
+@@ -1746,8 +1746,8 @@ static void wpa_supplicant_event_unprot_
  }
  
  
        u16 reason_code = 0;
 --- a/wpa_supplicant/wpa_supplicant.c
 +++ b/wpa_supplicant/wpa_supplicant.c
-@@ -2311,6 +2311,9 @@ static void wpa_supplicant_deinit_iface(
+@@ -2314,6 +2314,9 @@ static void wpa_supplicant_deinit_iface(
                wpa_drv_deinit(wpa_s);
  }
  
  
  /**
   * wpa_supplicant_add_iface - Add a new network interface
-@@ -2494,6 +2497,7 @@ struct wpa_global * wpa_supplicant_init(
+@@ -2497,6 +2500,7 @@ struct wpa_global * wpa_supplicant_init(
        wpa_msg_register_ifname_cb(wpa_supplicant_msg_ifname_cb);
  #endif /* CONFIG_NO_WPA_MSG */
  
                wpa_debug_open_syslog();
 --- a/hostapd/main.c
 +++ b/hostapd/main.c
-@@ -501,6 +501,9 @@ static const char * hostapd_msg_ifname_c
+@@ -502,6 +502,9 @@ static const char * hostapd_msg_ifname_c
        return NULL;
  }
  
  
  int main(int argc, char *argv[])
  {
-@@ -513,6 +516,7 @@ int main(int argc, char *argv[])
+@@ -514,6 +517,7 @@ int main(int argc, char *argv[])
        if (os_program_init())
                return -1;
  
index 0c8d846109415148829c9e5142bfe67a15490b74..01a2ecdef14e1a05644c6c7a43a349b8b7a06f89 100644 (file)
@@ -1,11 +1,11 @@
---- a/wpa_supplicant/events.c
-+++ b/wpa_supplicant/events.c
-@@ -958,7 +958,7 @@ static int _wpa_supplicant_event_scan_re
-                       wpa_dbg(wpa_s, MSG_DEBUG, "Setup a new network");
-                       wpa_supplicant_associate(wpa_s, NULL, ssid);
-               } else {
--                      int timeout_sec = 5;
-+                      int timeout_sec = 0;
-                       int timeout_usec = 0;
- #ifdef CONFIG_P2P
-                       if (wpa_s->p2p_in_provisioning) {
+--- a/wpa_supplicant/wpa_supplicant.c
++++ b/wpa_supplicant/wpa_supplicant.c
+@@ -2070,7 +2070,7 @@ static struct wpa_supplicant * wpa_suppl
+       if (wpa_s == NULL)
+               return NULL;
+       wpa_s->scan_req = 1;
+-      wpa_s->scan_interval = 5;
++      wpa_s->scan_interval = 0;
+       wpa_s->new_connection = 1;
+       wpa_s->parent = wpa_s;
index 4c9bf907475d60abbf9da55b14917724d18b69aa..1c15f6448ddae3372cfc54d33cb8463921780121 100644 (file)
@@ -10,7 +10,7 @@
        struct wpa_driver_capa capa;
        int has_capability;
  
-@@ -1776,7 +1778,7 @@ err1:
+@@ -1819,7 +1821,7 @@ err1:
        return -1;
  }
  
@@ -19,7 +19,7 @@
  static void wpa_driver_nl80211_rfkill_blocked(void *ctx)
  {
        wpa_printf(MSG_DEBUG, "nl80211: RFKILL blocked");
-@@ -1798,6 +1800,7 @@ static void wpa_driver_nl80211_rfkill_un
+@@ -1841,6 +1843,7 @@ static void wpa_driver_nl80211_rfkill_un
        }
        /* rtnetlink ifup handler will report interface as enabled */
  }
@@ -27,7 +27,7 @@
  
  
  static void nl80211_get_phy_name(struct wpa_driver_nl80211_data *drv)
-@@ -1846,7 +1849,9 @@ static void * wpa_driver_nl80211_init(vo
+@@ -1889,7 +1892,9 @@ static void * wpa_driver_nl80211_init(vo
  {
        struct wpa_driver_nl80211_data *drv;
        struct netlink_config *cfg;
@@ -37,7 +37,7 @@
        struct i802_bss *bss;
  
        drv = os_zalloc(sizeof(*drv));
-@@ -1887,6 +1892,7 @@ static void * wpa_driver_nl80211_init(vo
+@@ -1930,6 +1935,7 @@ static void * wpa_driver_nl80211_init(vo
                goto failed;
        }
  
@@ -45,7 +45,7 @@
        rcfg = os_zalloc(sizeof(*rcfg));
        if (rcfg == NULL)
                goto failed;
-@@ -1899,6 +1905,7 @@ static void * wpa_driver_nl80211_init(vo
+@@ -1942,6 +1948,7 @@ static void * wpa_driver_nl80211_init(vo
                wpa_printf(MSG_DEBUG, "nl80211: RFKILL status not available");
                os_free(rcfg);
        }
@@ -53,7 +53,7 @@
  
        if (wpa_driver_nl80211_finish_drv_init(drv))
                goto failed;
-@@ -1909,7 +1916,9 @@ static void * wpa_driver_nl80211_init(vo
+@@ -1952,7 +1959,9 @@ static void * wpa_driver_nl80211_init(vo
        return bss;
  
  failed:
@@ -63,7 +63,7 @@
        netlink_deinit(drv->netlink);
        if (drv->ioctl_sock >= 0)
                close(drv->ioctl_sock);
-@@ -2012,10 +2021,12 @@ static int nl80211_register_action_frame
+@@ -2055,10 +2064,12 @@ static int nl80211_register_action_frame
  }
  
  
@@ -76,7 +76,7 @@
  
  
  static int
-@@ -2034,13 +2045,16 @@ wpa_driver_nl80211_finish_drv_init(struc
+@@ -2077,13 +2088,16 @@ wpa_driver_nl80211_finish_drv_init(struc
                }
  
                if (linux_set_iface_flags(drv->ioctl_sock, bss->ifname, 1)) {
@@ -94,7 +94,7 @@
                                wpa_printf(MSG_ERROR, "nl80211: Could not set "
                                           "interface '%s' UP", bss->ifname);
                                return -1;
-@@ -2068,8 +2082,10 @@ wpa_driver_nl80211_finish_drv_init(struc
+@@ -2111,8 +2125,10 @@ wpa_driver_nl80211_finish_drv_init(struc
        }
  
        if (send_rfkill_event) {
        }
  
        return 0;
-@@ -2150,7 +2166,9 @@ static void wpa_driver_nl80211_deinit(vo
+@@ -2193,7 +2209,9 @@ static void wpa_driver_nl80211_deinit(vo
  
        netlink_send_oper_ifla(drv->netlink, drv->ifindex, 0, IF_OPER_UP);
        netlink_deinit(drv->netlink);
  
        eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout, drv, drv->ctx);
  
-@@ -5693,7 +5711,9 @@ static void *i802_init(struct hostapd_da
+@@ -5785,7 +5803,9 @@ static void *i802_init(struct hostapd_da
  
  failed:
        nl80211_remove_monitor_interface(drv);
index 43c550a210b4a533f8c64085adea45c7555aac27..e40c8678d08f08c553c134e47c8acd30c1dffe6d 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -2092,23 +2092,41 @@ wpa_driver_nl80211_finish_drv_init(struc
+@@ -2135,23 +2135,43 @@ wpa_driver_nl80211_finish_drv_init(struc
  }
  
  
 +
 +      for (bss = &drv->first_bss; bss; bss = bss->next)
 +              wpa_driver_nl80211_del_bss_beacon(bss);
++
++      return 0;
 +}
 +
 +static int wpa_driver_nl80211_stop_ap(void *priv)
 +{
 +      struct i802_bss *bss = priv;
 +
-+      wpa_driver_nl80211_del_beacon(bss->drv);
++      return wpa_driver_nl80211_del_beacon(bss->drv);
 +}
  
  /**
   * wpa_driver_nl80211_deinit - Deinitialize nl80211 driver interface
-@@ -6566,4 +6584,5 @@ const struct wpa_driver_ops wpa_driver_n
+@@ -6658,4 +6678,5 @@ const struct wpa_driver_ops wpa_driver_n
        .set_intra_bss = nl80211_set_intra_bss,
        .set_param = nl80211_set_param,
        .get_radio_name = nl80211_get_radio_name,
  };
 --- a/src/drivers/driver.h
 +++ b/src/drivers/driver.h
-@@ -2240,6 +2240,8 @@ struct wpa_driver_ops {
-        * @signal_info: Connection info structure
-          */
-       int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
+@@ -2253,6 +2253,8 @@ struct wpa_driver_ops {
+        * implementation, there is no need to implement this function.
+        */
+       int (*set_authmode)(void *priv, int authmode);
 +
 +      int (*stop_ap)(void *priv);
  };
index 734aa04344294e8b1af9701629526d2cb5ff07c7..dfc24c42c422a5487bae8f455bf0b6b1475ffe7c 100644 (file)
                wpa_s->new_connection = 1;
                wpa_drv_set_operstate(wpa_s, 0);
  #ifndef IEEE8021X_EAPOL
-@@ -2154,6 +2211,21 @@ static int wpa_supplicant_init_iface(str
+@@ -2157,6 +2214,21 @@ static int wpa_supplicant_init_iface(str
                os_strlcpy(wpa_s->bridge_ifname, iface->bridge_ifname,
                           sizeof(wpa_s->bridge_ifname));
        }
index e4a2c8ed637f2c6bbb220fbb881b68b93cb80c27..77352f1324fe8aabf09b30471764a49113fafe71 100644 (file)
@@ -55,7 +55,7 @@
  
 --- a/wpa_supplicant/ctrl_iface.c
 +++ b/wpa_supplicant/ctrl_iface.c
-@@ -2896,6 +2896,7 @@ char * wpa_supplicant_ctrl_iface_process
+@@ -2929,6 +2929,7 @@ char * wpa_supplicant_ctrl_iface_process
                        reply_len = -1;
        } else if (os_strncmp(buf, "NOTE ", 5) == 0) {
                wpa_printf(MSG_INFO, "NOTE: %s", buf + 5);
@@ -63,7 +63,7 @@
        } else if (os_strcmp(buf, "MIB") == 0) {
                reply_len = wpa_sm_get_mib(wpa_s->wpa, reply, reply_size);
                if (reply_len >= 0) {
-@@ -2907,6 +2908,7 @@ char * wpa_supplicant_ctrl_iface_process
+@@ -2940,6 +2941,7 @@ char * wpa_supplicant_ctrl_iface_process
                        else
                                reply_len += res;
                }
@@ -71,7 +71,7 @@
        } else if (os_strncmp(buf, "STATUS", 6) == 0) {
                reply_len = wpa_supplicant_ctrl_iface_status(
                        wpa_s, buf + 6, reply, reply_size);
-@@ -3200,6 +3202,7 @@ char * wpa_supplicant_ctrl_iface_process
+@@ -3245,6 +3247,7 @@ char * wpa_supplicant_ctrl_iface_process
                reply_len = wpa_supplicant_ctrl_iface_bss(
                        wpa_s, buf + 4, reply, reply_size);
  #ifdef CONFIG_AP
@@ -79,7 +79,7 @@
        } else if (os_strcmp(buf, "STA-FIRST") == 0) {
                reply_len = ap_ctrl_iface_sta_first(wpa_s, reply, reply_size);
        } else if (os_strncmp(buf, "STA ", 4) == 0) {
-@@ -3208,6 +3211,7 @@ char * wpa_supplicant_ctrl_iface_process
+@@ -3253,6 +3256,7 @@ char * wpa_supplicant_ctrl_iface_process
        } else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
                reply_len = ap_ctrl_iface_sta_next(wpa_s, buf + 9, reply,
                                                   reply_size);
 +#endif
 --- a/src/ap/ieee802_1x.c
 +++ b/src/ap/ieee802_1x.c
-@@ -1876,6 +1876,7 @@ static const char * bool_txt(Boolean boo
+@@ -1896,6 +1896,7 @@ static const char * bool_txt(Boolean boo
        return bool ? "TRUE" : "FALSE";
  }
  
  
  int ieee802_1x_get_mib(struct hostapd_data *hapd, char *buf, size_t buflen)
  {
-@@ -2027,6 +2028,7 @@ int ieee802_1x_get_mib_sta(struct hostap
+@@ -2047,6 +2048,7 @@ int ieee802_1x_get_mib_sta(struct hostap
        return len;
  }
  
index 63d3ec50155dad0471708b540439dcb5e1521170..f94684cd6b1169790079fdf3b39ffd7b55d6e105 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/ap/hostapd.c
 +++ b/src/ap/hostapd.c
-@@ -717,11 +717,8 @@ int hostapd_setup_interface_complete(str
+@@ -723,11 +723,8 @@ int hostapd_setup_interface_complete(str
        size_t j;
        u8 *prev_addr;
  
@@ -14,7 +14,7 @@
  
        wpa_printf(MSG_DEBUG, "Completing interface initialization");
        if (hapd->iconf->channel) {
-@@ -737,7 +734,7 @@ int hostapd_setup_interface_complete(str
+@@ -743,7 +740,7 @@ int hostapd_setup_interface_complete(str
                                     hapd->iconf->secondary_channel)) {
                        wpa_printf(MSG_ERROR, "Could not set channel for "
                                   "kernel driver");
@@ -23,7 +23,7 @@
                }
        }
  
-@@ -748,7 +745,7 @@ int hostapd_setup_interface_complete(str
+@@ -754,7 +751,7 @@ int hostapd_setup_interface_complete(str
                        hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
                                       HOSTAPD_LEVEL_WARNING,
                                       "Failed to prepare rates table.");
@@ -32,7 +32,7 @@
                }
        }
  
-@@ -756,14 +753,14 @@ int hostapd_setup_interface_complete(str
+@@ -762,14 +759,14 @@ int hostapd_setup_interface_complete(str
            hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) {
                wpa_printf(MSG_ERROR, "Could not set RTS threshold for "
                           "kernel driver");
@@ -49,7 +49,7 @@
        }
  
        prev_addr = hapd->own_addr;
-@@ -773,7 +770,7 @@ int hostapd_setup_interface_complete(str
+@@ -779,7 +776,7 @@ int hostapd_setup_interface_complete(str
                if (j)
                        os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN);
                if (hostapd_setup_bss(hapd, j == 0))
@@ -58,7 +58,7 @@
                if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0)
                        prev_addr = hapd->own_addr;
        }
-@@ -785,7 +782,7 @@ int hostapd_setup_interface_complete(str
+@@ -791,7 +788,7 @@ int hostapd_setup_interface_complete(str
        if (hostapd_driver_commit(hapd) < 0) {
                wpa_printf(MSG_ERROR, "%s: Failed to commit driver "
                           "configuration", __func__);
@@ -66,8 +66,8 @@
 +              goto error;
        }
  
-       if (hapd->setup_complete_cb)
-@@ -798,6 +795,11 @@ int hostapd_setup_interface_complete(str
+       /*
+@@ -815,6 +812,11 @@ int hostapd_setup_interface_complete(str
                iface->init_complete(iface);
  
        return 0;
index 84e556b45828b3614d14f0c8a1352a45cb8775ec..bf95848eebc3a923906db88b6754987979c5f90e 100644 (file)
  ifeq ($(CONFIG_CTRL_IFACE), y)
 --- a/wpa_supplicant/Android.mk
 +++ b/wpa_supplicant/Android.mk
-@@ -1102,9 +1102,8 @@ endif
+@@ -1109,9 +1109,8 @@ endif
  
  ifdef CONFIG_NO_RANDOM_POOL
  L_CFLAGS += -DCONFIG_NO_RANDOM_POOL
index 9ee9925d6f36ed821fc3df29088bfe98065fd51d..270a6438d828478dc8372e20d059e4521b270ede 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -4904,9 +4904,6 @@ static int wpa_driver_nl80211_set_mode(v
+@@ -5005,9 +5005,6 @@ static int wpa_driver_nl80211_set_mode(v
                        /* Try to set the mode again while the interface is
                         * down */
                        ret = nl80211_set_mode(drv, drv->ifindex, nlmode);
@@ -10,7 +10,7 @@
                        if (!ret)
                                break;
                } else
-@@ -4919,6 +4916,8 @@ static int wpa_driver_nl80211_set_mode(v
+@@ -5020,6 +5017,8 @@ static int wpa_driver_nl80211_set_mode(v
                wpa_printf(MSG_DEBUG, "nl80211: Mode change succeeded while "
                           "interface is down");
                drv->nlmode = nlmode;
index c5c8606d8559fcf8a232d951a8494727f319fbfe..850988d1abef184fa88abaf453555ea3611a0e5e 100644 (file)
@@ -1,6 +1,6 @@
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -5487,6 +5487,9 @@ static int i802_set_wds_sta(void *priv, 
+@@ -5660,6 +5660,9 @@ static int i802_set_wds_sta(void *priv, 
                linux_set_iface_flags(drv->ioctl_sock, name, 1);
                return i802_set_sta_vlan(priv, addr, name, 0);
        } else {
@@ -10,7 +10,7 @@
                i802_set_sta_vlan(priv, addr, bss->ifname, 0);
                return wpa_driver_nl80211_if_remove(priv, WPA_IF_AP_VLAN,
                                                    name);
-@@ -5927,14 +5930,14 @@ static int wpa_driver_nl80211_if_remove(
+@@ -6021,14 +6024,14 @@ static int wpa_driver_nl80211_if_remove(
                return -1;
  
  #ifdef HOSTAPD
diff --git a/package/hostapd/patches/740-process_assoc_resp_tx_status.patch b/package/hostapd/patches/740-process_assoc_resp_tx_status.patch
new file mode 100644 (file)
index 0000000..a0d9a0f
--- /dev/null
@@ -0,0 +1,48 @@
+--- a/src/ap/ieee802_11.c
++++ b/src/ap/ieee802_11.c
+@@ -1629,13 +1629,6 @@ static void handle_assoc_cb(struct hosta
+       int new_assoc = 1;
+       struct ieee80211_ht_capabilities ht_cap;
+-      if (!ok) {
+-              hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211,
+-                             HOSTAPD_LEVEL_DEBUG,
+-                             "did not acknowledge association response");
+-              return;
+-      }
+-
+       if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_resp) :
+                                     sizeof(mgmt->u.assoc_resp))) {
+               printf("handle_assoc_cb(reassoc=%d) - too short payload "
+@@ -1643,11 +1636,6 @@ static void handle_assoc_cb(struct hosta
+               return;
+       }
+-      if (reassoc)
+-              status = le_to_host16(mgmt->u.reassoc_resp.status_code);
+-      else
+-              status = le_to_host16(mgmt->u.assoc_resp.status_code);
+-
+       sta = ap_get_sta(hapd, mgmt->da);
+       if (!sta) {
+               printf("handle_assoc_cb: STA " MACSTR " not found\n",
+@@ -1655,6 +1643,19 @@ static void handle_assoc_cb(struct hosta
+               return;
+       }
++      if (!ok) {
++              hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211,
++                             HOSTAPD_LEVEL_DEBUG,
++                             "did not acknowledge association response");
++              sta->flags &= ~WLAN_STA_ASSOC_REQ_OK;
++              return;
++      }
++
++      if (reassoc)
++              status = le_to_host16(mgmt->u.reassoc_resp.status_code);
++      else
++              status = le_to_host16(mgmt->u.assoc_resp.status_code);
++
+       if (status != WLAN_STATUS_SUCCESS)
+               goto fail;
diff --git a/package/hostapd/patches/800-dynamic_20_40_mhz.patch b/package/hostapd/patches/800-dynamic_20_40_mhz.patch
new file mode 100644 (file)
index 0000000..b9448d7
--- /dev/null
@@ -0,0 +1,202 @@
+--- a/hostapd/config_file.c
++++ b/hostapd/config_file.c
+@@ -1920,6 +1920,10 @@ struct hostapd_config * hostapd_config_r
+                                          "ht_capab", line);
+                               errors++;
+                       }
++              } else if (os_strcmp(buf, "dynamic_ht40") == 0) {
++                      conf->dynamic_ht40 = atoi(pos);
++                      if (conf->dynamic_ht40 == 1)
++                              conf->dynamic_ht40 = 1500;
+               } else if (os_strcmp(buf, "require_ht") == 0) {
+                       conf->require_ht = atoi(pos);
+ #endif /* CONFIG_IEEE80211N */
+--- a/src/ap/ap_config.h
++++ b/src/ap/ap_config.h
+@@ -395,6 +395,7 @@ struct hostapd_config {
+       int ieee80211n;
+       int secondary_channel;
+       int require_ht;
++      int dynamic_ht40;
+ };
+--- a/src/ap/hostapd.c
++++ b/src/ap/hostapd.c
+@@ -27,6 +27,7 @@
+ #include "beacon.h"
+ #include "iapp.h"
+ #include "ieee802_1x.h"
++#include "ieee802_11.h"
+ #include "ieee802_11_auth.h"
+ #include "vlan_init.h"
+ #include "wpa_auth.h"
+@@ -285,6 +286,7 @@ static void hostapd_cleanup_iface_pre(st
+  */
+ static void hostapd_cleanup_iface(struct hostapd_iface *iface)
+ {
++      hostapd_deinit_ht(iface);
+       hostapd_free_hw_features(iface->hw_features, iface->num_hw_features);
+       iface->hw_features = NULL;
+       os_free(iface->current_rates);
+--- a/src/ap/hostapd.h
++++ b/src/ap/hostapd.h
+@@ -220,6 +220,9 @@ struct hostapd_iface {
+       /* Overlapping BSS information */
+       int olbc_ht;
++      int force_20mhz;
++      struct os_time last_20mhz_trigger;
++
+       u16 ht_op_mode;
+       void (*scan_cb)(struct hostapd_iface *iface);
+--- a/src/ap/ieee802_11.c
++++ b/src/ap/ieee802_11.c
+@@ -1242,6 +1242,9 @@ static void handle_beacon(struct hostapd
+                                            sizeof(mgmt->u.beacon)), &elems,
+                                     0);
++      if (!elems.ht_capabilities)
++              hostapd_trigger_20mhz(hapd->iface);
++
+       ap_list_process_beacon(hapd->iface, mgmt, &elems, fi);
+ }
+--- a/src/ap/ieee802_11.h
++++ b/src/ap/ieee802_11.h
+@@ -65,4 +65,17 @@ void hostapd_tx_status(struct hostapd_da
+ void ieee802_11_rx_from_unknown(struct hostapd_data *hapd, const u8 *src,
+                               int wds);
++#ifdef CONFIG_IEEE80211N
++void hostapd_trigger_20mhz(struct hostapd_iface *iface);
++void hostapd_deinit_ht(struct hostapd_iface *iface);
++
++#else
++static inline void hostapd_deinit_ht(struct hostapd_iface *iface)
++{
++}
++static inline void hostapd_trigger_20mhz(struct hostapd_iface *iface)
++{
++}
++#endif /* CONFIG_IEEE80211N */
++
+ #endif /* IEEE802_11_H */
+--- a/src/ap/ieee802_11_ht.c
++++ b/src/ap/ieee802_11_ht.c
+@@ -20,9 +20,11 @@
+ #include "drivers/driver.h"
+ #include "hostapd.h"
+ #include "ap_config.h"
++#include "ap_drv_ops.h"
+ #include "sta_info.h"
+ #include "beacon.h"
+ #include "ieee802_11.h"
++#include "utils/eloop.h"
+ u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid)
+@@ -70,12 +72,15 @@ u8 * hostapd_eid_ht_operation(struct hos
+       oper->control_chan = hapd->iconf->channel;
+       oper->operation_mode = host_to_le16(hapd->iface->ht_op_mode);
+-      if (hapd->iconf->secondary_channel == 1)
+-              oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE |
+-                      HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH;
+-      if (hapd->iconf->secondary_channel == -1)
+-              oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW |
+-                      HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH;
++
++      if (!hapd->iface->force_20mhz) {
++              if (hapd->iconf->secondary_channel == 1)
++                      oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE |
++                              HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH;
++              if (hapd->iconf->secondary_channel == -1)
++                      oper->ht_param |= HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW |
++                              HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH;
++      }
+       pos += sizeof(*oper);
+@@ -265,3 +270,80 @@ void hostapd_get_ht_capab(struct hostapd
+       neg_ht_cap->ht_capabilities_info = host_to_le16(cap);
+ }
++
++static void hostapd_set_force_20mhz(struct hostapd_iface *iface);
++
++static void hostapd_restore_40mhz(void *eloop_data, void *user_ctx)
++{
++      struct hostapd_iface *iface = eloop_data;
++      struct os_time time;
++      int timeout;
++
++      if (!iface->last_20mhz_trigger.sec)
++          return;
++
++      os_get_time(&time);
++      timeout = iface->last_20mhz_trigger.sec + iface->conf->dynamic_ht40 -
++                time.sec;
++
++      if (timeout > 0) {
++              eloop_register_timeout(timeout, 0, hostapd_restore_40mhz,
++                                     iface, NULL);
++              return;
++      }
++
++      iface->last_20mhz_trigger.sec = 0;
++      iface->last_20mhz_trigger.usec = 0;
++
++      iface->force_20mhz = 0;
++      hostapd_set_force_20mhz(iface);
++}
++
++static void hostapd_set_force_20mhz(struct hostapd_iface *iface)
++{
++      int secondary_channel;
++      int i;
++
++      ieee802_11_set_beacons(iface);
++
++      for (i = 0; i < iface->num_bss; i++) {
++              struct hostapd_data *hapd = iface->bss[i];
++
++              if (iface->force_20mhz)
++                      secondary_channel = 0;
++              else
++                      secondary_channel = hapd->iconf->secondary_channel;
++
++              if (hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq,
++                                       hapd->iconf->channel,
++                                       hapd->iconf->ieee80211n,
++                                       secondary_channel)) {
++                      wpa_printf(MSG_ERROR, "Could not set channel for "
++                                 "kernel driver");
++              }
++      }
++}
++
++void hostapd_deinit_ht(struct hostapd_iface *iface)
++{
++      eloop_cancel_timeout(hostapd_restore_40mhz, iface, NULL);
++}
++
++void hostapd_trigger_20mhz(struct hostapd_iface *iface)
++{
++      if (!iface->conf->dynamic_ht40)
++              return;
++
++      if (!iface->force_20mhz) {
++              iface->force_20mhz = 1;
++              hostapd_set_force_20mhz(iface);
++      }
++
++      if (!iface->last_20mhz_trigger.sec) {
++              eloop_cancel_timeout(hostapd_restore_40mhz, iface, NULL);
++              eloop_register_timeout(iface->conf->dynamic_ht40, 0,
++                                     hostapd_restore_40mhz, iface, NULL);
++      }
++
++      os_get_time(&iface->last_20mhz_trigger);
++}