hostapd: upgrade to latest git version, add patches to fix multi-bss support with a single hostapd instance

SVN-Revision: 19234
owl
Felix Fietkau 2010-01-20 02:26:00 +00:00
parent 131c3e1c72
commit c61daab867
5 changed files with 1351 additions and 2 deletions

View File

@ -8,9 +8,9 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=hostapd
PKG_VERSION:=20100108
PKG_VERSION:=20100117
PKG_RELEASE:=1
PKG_REV:=d97572a40fd7ec77094e2e4ef83424a4c0f7e24d
PKG_REV:=43a7fe2e0e614e52fa05ff4d78af91bd4e17d3b2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git

View File

@ -0,0 +1,148 @@
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -238,6 +238,7 @@ struct hostapd_iface {
int (*for_each_interface)(struct hapd_interfaces *interfaces,
int (*cb)(struct hostapd_iface *iface,
void *ctx), void *ctx);
+ int (*init_complete)(struct hostapd_iface *iface);
};
/* hostapd.c */
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -745,6 +745,9 @@ int hostapd_setup_interface_complete(str
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
iface->bss[0]->conf->iface);
+ if (iface->init_complete)
+ iface->init_complete(iface);
+
return 0;
}
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -35,6 +35,8 @@
extern int wpa_debug_level;
extern int wpa_debug_show_keys;
extern int wpa_debug_timestamp;
+static int daemonize = 0;
+static char *pid_file = NULL;
struct hapd_interfaces {
@@ -162,6 +164,15 @@ static void hostapd_logger_cb(void *ctx,
}
#endif /* CONFIG_NO_HOSTAPD_LOGGER */
+static int hostapd_init_complete(struct hostapd_iface *iface)
+{
+ if (daemonize && os_daemonize(pid_file)) {
+ perror("daemon");
+ return -1;
+ }
+ daemonize = 0;
+}
+
/**
* hostapd_init - Allocate and initialize per-interface data
@@ -183,6 +194,7 @@ static struct hostapd_iface * hostapd_in
if (hapd_iface == NULL)
goto fail;
+ hapd_iface->init_complete = hostapd_init_complete;
hapd_iface->reload_config = hostapd_reload_config;
hapd_iface->config_read_cb = hostapd_config_read;
hapd_iface->config_fname = os_strdup(config_file);
@@ -390,7 +402,7 @@ static int hostapd_global_init(struct ha
}
-static void hostapd_global_deinit(const char *pid_file)
+static void hostapd_global_deinit(void)
{
#ifdef EAP_SERVER_TNC
tncs_global_deinit();
@@ -408,8 +420,7 @@ static void hostapd_global_deinit(const
}
-static int hostapd_global_run(struct hapd_interfaces *ifaces, int daemonize,
- const char *pid_file)
+static int hostapd_global_run(struct hapd_interfaces *iface)
{
#ifdef EAP_SERVER_TNC
int tnc = 0;
@@ -430,11 +441,6 @@ static int hostapd_global_run(struct hap
}
#endif /* EAP_SERVER_TNC */
- if (daemonize && os_daemonize(pid_file)) {
- perror("daemon");
- return -1;
- }
-
eloop_run();
return 0;
@@ -478,8 +484,7 @@ int main(int argc, char *argv[])
struct hapd_interfaces interfaces;
int ret = 1;
size_t i;
- int c, debug = 0, daemonize = 0;
- char *pid_file = NULL;
+ int c, debug = 0;
if (os_program_init())
return -1;
@@ -544,7 +549,7 @@ int main(int argc, char *argv[])
goto out;
}
- if (hostapd_global_run(&interfaces, daemonize, pid_file))
+ if (hostapd_global_run(&interfaces))
goto out;
ret = 0;
@@ -555,7 +560,7 @@ int main(int argc, char *argv[])
hostapd_interface_deinit_free(interfaces.iface[i]);
os_free(interfaces.iface);
- hostapd_global_deinit(pid_file);
+ hostapd_global_deinit();
os_free(pid_file);
os_program_deinit();
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -1854,6 +1854,8 @@ struct hostapd_config * hostapd_config_r
}
#endif /* CONFIG_IEEE80211W */
#ifdef CONFIG_IEEE80211N
+ } else if (os_strcmp(buf, "noscan") == 0) {
+ conf->noscan = atoi(pos);
} else if (os_strcmp(buf, "ieee80211n") == 0) {
conf->ieee80211n = atoi(pos);
} else if (os_strcmp(buf, "ht_capab") == 0) {
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -366,6 +366,7 @@ struct hostapd_config {
int ht_op_mode_fixed;
u16 ht_capab;
+ int noscan;
int ieee80211n;
int secondary_channel;
};
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -460,7 +460,7 @@ static int ieee80211n_check_40mhz(struct
{
struct wpa_driver_scan_params params;
- if (!iface->conf->secondary_channel)
+ if (!iface->conf->secondary_channel || iface->conf->noscan)
return 0; /* HT40 not used */
wpa_printf(MSG_DEBUG, "Scan for neighboring BSSes prior to enabling "

View File

@ -0,0 +1,12 @@
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -121,7 +121,8 @@ void ap_free_sta(struct hostapd_data *ha
accounting_sta_stop(hapd, sta);
- hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0);
+ if (sta->flags & WLAN_STA_WDS)
+ hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0);
if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC) &&
!(sta->flags & WLAN_STA_PREAUTH))
hapd->drv.sta_remove(hapd, sta->addr);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,79 @@
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -32,8 +32,8 @@
#include "vlan_init.h"
#include "sta_info.h"
-static int ap_sta_in_other_bss(struct hostapd_data *hapd,
- struct sta_info *sta, u32 flags);
+static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
+ struct sta_info *sta);
static void ap_handle_session_timer(void *eloop_ctx, void *timeout_ctx);
#ifdef CONFIG_IEEE80211W
static void ap_sa_query_timer(void *eloop_ctx, void *timeout_ctx);
@@ -123,8 +123,8 @@ void ap_free_sta(struct hostapd_data *ha
if (sta->flags & WLAN_STA_WDS)
hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0);
- if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC) &&
- !(sta->flags & WLAN_STA_PREAUTH))
+
+ if (!(sta->flags & WLAN_STA_PREAUTH))
hapd->drv.sta_remove(hapd, sta->addr);
ap_sta_hash_del(hapd, sta);
@@ -451,6 +451,7 @@ struct sta_info * ap_sta_add(struct host
hapd->num_sta++;
ap_sta_hash_add(hapd, sta);
sta->ssid = &hapd->conf->ssid;
+ ap_sta_remove_in_other_bss(hapd, sta);
return sta;
}
@@ -472,8 +473,8 @@ static int ap_sta_remove(struct hostapd_
}
-static int ap_sta_in_other_bss(struct hostapd_data *hapd,
- struct sta_info *sta, u32 flags)
+static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
+ struct sta_info *sta)
{
struct hostapd_iface *iface = hapd->iface;
size_t i;
@@ -488,11 +489,11 @@ static int ap_sta_in_other_bss(struct ho
if (bss == hapd || bss == NULL)
continue;
sta2 = ap_get_sta(bss, sta->addr);
- if (sta2 && ((sta2->flags & flags) == flags))
- return 1;
- }
+ if (!sta2)
+ continue;
- return 0;
+ ap_sta_disconnect(bss, sta2, sta2->addr, WLAN_REASON_DEAUTH_LEAVING);
+ }
}
@@ -502,8 +503,7 @@ void ap_sta_disassociate(struct hostapd_
wpa_printf(MSG_DEBUG, "%s: disassociate STA " MACSTR,
hapd->conf->iface, MAC2STR(sta->addr));
sta->flags &= ~WLAN_STA_ASSOC;
- if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC))
- ap_sta_remove(hapd, sta);
+ ap_sta_remove(hapd, sta);
sta->timeout_next = STA_DEAUTH;
eloop_cancel_timeout(ap_handle_timer, hapd, sta);
eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DISASSOC, 0,
@@ -521,8 +521,7 @@ void ap_sta_deauthenticate(struct hostap
wpa_printf(MSG_DEBUG, "%s: deauthenticate STA " MACSTR,
hapd->conf->iface, MAC2STR(sta->addr));
sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
- if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC))
- ap_sta_remove(hapd, sta);
+ ap_sta_remove(hapd, sta);
sta->timeout_next = STA_REMOVE;
eloop_cancel_timeout(ap_handle_timer, hapd, sta);
eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DEAUTH, 0,