summaryrefslogtreecommitdiffstats
path: root/package/network
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-06-30 21:01:13 +0000
committerFelix Fietkau <nbd@openwrt.org>2013-06-30 21:01:13 +0000
commitee68734929edb30f90a95bc3150038333b345476 (patch)
tree6b66081ac9aae8fdf95fbd7504d77d2dcec36412 /package/network
parent60b040bbafc2adf2c439e1b80cba6c6c5fd0d244 (diff)
downloadmaster-31e0f0ae-ee68734929edb30f90a95bc3150038333b345476.tar.gz
master-31e0f0ae-ee68734929edb30f90a95bc3150038333b345476.tar.bz2
master-31e0f0ae-ee68734929edb30f90a95bc3150038333b345476.zip
hostapd: fix multi-ssid and AP+STA, clean up code
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 37111
Diffstat (limited to 'package/network')
-rw-r--r--package/network/services/hostapd/patches/450-reload_freq_change.patch94
-rw-r--r--package/network/services/hostapd/patches/453-ap_sta_support.patch21
-rw-r--r--package/network/services/hostapd/patches/480-terminate_on_setup_failure.patch14
-rw-r--r--package/network/services/hostapd/patches/540-dynamic_20_40_mhz.patch2
-rw-r--r--package/network/services/hostapd/patches/601-wpa_supplicant-add-new-config-params-to-be-used-with.patch2
-rw-r--r--package/network/services/hostapd/patches/604-wpa_s-support-htmode-param.patch2
-rw-r--r--package/network/services/hostapd/patches/700-ubus_support.patch10
7 files changed, 98 insertions, 47 deletions
diff --git a/package/network/services/hostapd/patches/450-reload_freq_change.patch b/package/network/services/hostapd/patches/450-reload_freq_change.patch
index ffa757e9ca..5dc2a85549 100644
--- a/package/network/services/hostapd/patches/450-reload_freq_change.patch
+++ b/package/network/services/hostapd/patches/450-reload_freq_change.patch
@@ -1,27 +1,85 @@
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -156,6 +156,24 @@ int hostapd_reload_config(struct hostapd
- oldconf = hapd->iconf;
- iface->conf = newconf;
+@@ -133,38 +133,51 @@ static void hostapd_clear_old(struct hos
+ int hostapd_reload_config(struct hostapd_iface *iface)
+ {
+ struct hostapd_data *hapd = iface->bss[0];
+- struct hostapd_config *newconf, *oldconf;
++ struct hostapd_config *conf = hapd->iconf, *oldconf = NULL;
+ size_t j;
-+ hostapd_select_hw_mode(iface);
-+ iface->freq = hostapd_hw_get_freq(hapd, newconf->channel);
+- if (iface->config_fname == NULL) {
+- /* Only in-memory config in use - assume it has been updated */
++ if (iface->config_fname) {
++ if (iface->interfaces == NULL ||
++ iface->interfaces->config_read_cb == NULL)
++ return -1;
++ conf = iface->interfaces->config_read_cb(iface->config_fname);
++ if (conf == NULL)
++ return -1;
+
-+ if (hostapd_set_freq(hapd, newconf->hw_mode, iface->freq,
-+ newconf->channel,
-+ newconf->ieee80211n,
-+ newconf->ieee80211ac,
-+ newconf->secondary_channel,
-+ newconf->vht_oper_chwidth,
-+ newconf->vht_oper_centr_freq_seg0_idx,
-+ newconf->vht_oper_centr_freq_seg1_idx)) {
-+ wpa_printf(MSG_ERROR, "Could not set channel for "
-+ "kernel driver");
+ hostapd_clear_old(iface);
+- for (j = 0; j < iface->num_bss; j++)
+- hostapd_reload_bss(iface->bss[j]);
+- return 0;
+- }
+
+- if (iface->interfaces == NULL ||
+- iface->interfaces->config_read_cb == NULL)
+- return -1;
+- newconf = iface->interfaces->config_read_cb(iface->config_fname);
+- if (newconf == NULL)
+- return -1;
++ oldconf = hapd->iconf;
++ iface->conf = conf;
+ }
-+
+
+- hostapd_clear_old(iface);
++ hostapd_select_hw_mode(iface);
++ iface->freq = hostapd_hw_get_freq(hapd, conf->channel);
+
+- oldconf = hapd->iconf;
+- iface->conf = newconf;
+ if (iface->current_mode)
+ hostapd_prepare_rates(iface, iface->current_mode);
-+
+
for (j = 0; j < iface->num_bss; j++) {
hapd = iface->bss[j];
- hapd->iconf = newconf;
+- hapd->iconf = newconf;
+- hapd->conf = &newconf->bss[j];
++ hapd->iconf = iface->conf;
++ hapd->conf = &iface->conf->bss[j];
++
++ if (hostapd_set_freq(hapd, conf->hw_mode, iface->freq,
++ conf->channel,
++ conf->ieee80211n,
++ conf->ieee80211ac,
++ conf->secondary_channel,
++ conf->vht_oper_chwidth,
++ conf->vht_oper_centr_freq_seg0_idx,
++ conf->vht_oper_centr_freq_seg1_idx)) {
++ wpa_printf(MSG_ERROR, "Could not set channel for "
++ "kernel driver");
++ }
++
+ hostapd_reload_bss(hapd);
+ }
+
+- hostapd_config_free(oldconf);
+-
++ if (oldconf)
++ hostapd_config_free(oldconf);
+
+ return 0;
+ }
+--- a/src/drivers/driver_nl80211.c
++++ b/src/drivers/driver_nl80211.c
+@@ -6466,7 +6466,7 @@ static int wpa_driver_nl80211_set_freq(s
+
+ nl80211_cmd(drv, msg, 0, NL80211_CMD_SET_WIPHY);
+
+- NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
++ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, bss->ifindex);
+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq->freq);
+ if (freq->vht_enabled) {
+ switch (freq->bandwidth) {
diff --git a/package/network/services/hostapd/patches/453-ap_sta_support.patch b/package/network/services/hostapd/patches/453-ap_sta_support.patch
index 5481529014..9ccc3dd0cf 100644
--- a/package/network/services/hostapd/patches/453-ap_sta_support.patch
+++ b/package/network/services/hostapd/patches/453-ap_sta_support.patch
@@ -47,7 +47,7 @@
CONFIG_OS=win32
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -109,6 +109,55 @@ extern int wpa_debug_show_keys;
+@@ -109,6 +109,48 @@ extern int wpa_debug_show_keys;
extern int wpa_debug_timestamp;
extern struct wpa_driver_ops *wpa_drivers[];
@@ -70,24 +70,17 @@
+ char *cmd = NULL;
+ char buf[256];
+ int len = sizeof(buf);
-+ int channel, hw_mode;
++ enum hostapd_hw_mode hw_mode;
++ u8 channel;
+ int ret;
+
+ if (!bss)
+ return;
+
-+ if (bss->freq < 4000) {
-+ hw_mode = HOSTAPD_MODE_IEEE80211G;
-+ channel = (bss->freq - 2407) / 5;
-+ } else {
-+ hw_mode = HOSTAPD_MODE_IEEE80211A;
-+ channel = (bss->freq - 5000) / 5;
-+ }
-+
++ hw_mode = ieee80211_freq_to_chan(bss->freq, &channel);
+ if (asprintf(&cmd, "UPDATE channel=%d sec_chan=0 hw_mode=%d ieee80211n=%d",
-+ channel, hw_mode, !!bss->ht_capab) < 0) {
++ channel, hw_mode, !!bss->ht_capab) < 0)
+ return -1;
-+ }
+
+ ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL);
+ free(cmd);
@@ -103,7 +96,7 @@
/* Configure default/group WEP keys for static WEP */
int wpa_set_wep_keys(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid)
{
-@@ -675,8 +724,16 @@ void wpa_supplicant_set_state(struct wpa
+@@ -675,8 +717,16 @@ void wpa_supplicant_set_state(struct wpa
#endif /* CONFIG_P2P */
sme_sched_obss_scan(wpa_s, 1);
@@ -120,7 +113,7 @@
wpa_s->new_connection = 1;
wpa_drv_set_operstate(wpa_s, 0);
#ifndef IEEE8021X_EAPOL
-@@ -2866,6 +2923,21 @@ static int wpa_supplicant_init_iface(str
+@@ -2866,6 +2916,21 @@ static int wpa_supplicant_init_iface(str
os_strlcpy(wpa_s->bridge_ifname, iface->bridge_ifname,
sizeof(wpa_s->bridge_ifname));
}
diff --git a/package/network/services/hostapd/patches/480-terminate_on_setup_failure.patch b/package/network/services/hostapd/patches/480-terminate_on_setup_failure.patch
index 8e042c45dc..5ba7ec1c15 100644
--- a/package/network/services/hostapd/patches/480-terminate_on_setup_failure.patch
+++ b/package/network/services/hostapd/patches/480-terminate_on_setup_failure.patch
@@ -1,6 +1,6 @@
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -979,11 +979,8 @@ int hostapd_setup_interface_complete(str
+@@ -974,11 +974,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) {
-@@ -1003,7 +1000,7 @@ int hostapd_setup_interface_complete(str
+@@ -998,7 +995,7 @@ int hostapd_setup_interface_complete(str
hapd->iconf->vht_oper_centr_freq_seg1_idx)) {
wpa_printf(MSG_ERROR, "Could not set channel for "
"kernel driver");
@@ -23,7 +23,7 @@
}
}
-@@ -1014,7 +1011,7 @@ int hostapd_setup_interface_complete(str
+@@ -1009,7 +1006,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 @@
}
}
-@@ -1022,14 +1019,14 @@ int hostapd_setup_interface_complete(str
+@@ -1017,14 +1014,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;
-@@ -1039,7 +1036,7 @@ int hostapd_setup_interface_complete(str
+@@ -1034,7 +1031,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;
}
-@@ -1053,7 +1050,7 @@ int hostapd_setup_interface_complete(str
+@@ -1048,7 +1045,7 @@ int hostapd_setup_interface_complete(str
if (hostapd_driver_commit(hapd) < 0) {
wpa_printf(MSG_ERROR, "%s: Failed to commit driver "
"configuration", __func__);
@@ -67,7 +67,7 @@
}
/*
-@@ -1074,6 +1071,11 @@ int hostapd_setup_interface_complete(str
+@@ -1069,6 +1066,11 @@ int hostapd_setup_interface_complete(str
iface->bss[0]->conf->iface);
return 0;
diff --git a/package/network/services/hostapd/patches/540-dynamic_20_40_mhz.patch b/package/network/services/hostapd/patches/540-dynamic_20_40_mhz.patch
index d64b206574..a71f5600ca 100644
--- a/package/network/services/hostapd/patches/540-dynamic_20_40_mhz.patch
+++ b/package/network/services/hostapd/patches/540-dynamic_20_40_mhz.patch
@@ -31,7 +31,7 @@
#include "ieee802_11_auth.h"
#include "vlan_init.h"
#include "wpa_auth.h"
-@@ -348,6 +349,7 @@ static void hostapd_cleanup_iface_pre(st
+@@ -343,6 +344,7 @@ static void hostapd_cleanup_iface_pre(st
static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
{
diff --git a/package/network/services/hostapd/patches/601-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/package/network/services/hostapd/patches/601-wpa_supplicant-add-new-config-params-to-be-used-with.patch
index f5fb8cb565..e61e85d2d8 100644
--- a/package/network/services/hostapd/patches/601-wpa_supplicant-add-new-config-params-to-be-used-with.patch
+++ b/package/network/services/hostapd/patches/601-wpa_supplicant-add-new-config-params-to-be-used-with.patch
@@ -175,7 +175,7 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
#endif /* CONFIG_SSID_H */
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -1606,15 +1606,24 @@ void wpa_supplicant_associate(struct wpa
+@@ -1599,15 +1599,24 @@ void wpa_supplicant_associate(struct wpa
params.ssid_len = ssid->ssid_len;
}
diff --git a/package/network/services/hostapd/patches/604-wpa_s-support-htmode-param.patch b/package/network/services/hostapd/patches/604-wpa_s-support-htmode-param.patch
index 2914baa748..b068fa92d4 100644
--- a/package/network/services/hostapd/patches/604-wpa_s-support-htmode-param.patch
+++ b/package/network/services/hostapd/patches/604-wpa_s-support-htmode-param.patch
@@ -145,7 +145,7 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
#endif /* CONFIG_SSID_H */
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -1622,6 +1622,8 @@ void wpa_supplicant_associate(struct wpa
+@@ -1615,6 +1615,8 @@ void wpa_supplicant_associate(struct wpa
i++;
}
params.mcast_rate = ssid->mcast_rate;
diff --git a/package/network/services/hostapd/patches/700-ubus_support.patch b/package/network/services/hostapd/patches/700-ubus_support.patch
index c5ff795233..81ada8c3cd 100644
--- a/package/network/services/hostapd/patches/700-ubus_support.patch
+++ b/package/network/services/hostapd/patches/700-ubus_support.patch
@@ -480,7 +480,7 @@
+#endif
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -270,6 +270,7 @@ static int hostapd_broadcast_wep_set(str
+@@ -265,6 +265,7 @@ static int hostapd_broadcast_wep_set(str
static void hostapd_free_hapd_data(struct hostapd_data *hapd)
{
@@ -488,7 +488,7 @@
iapp_deinit(hapd->iapp);
hapd->iapp = NULL;
accounting_deinit(hapd);
-@@ -834,6 +835,8 @@ static int hostapd_setup_bss(struct host
+@@ -829,6 +830,8 @@ static int hostapd_setup_bss(struct host
if (hapd->driver && hapd->driver->set_operstate)
hapd->driver->set_operstate(hapd->drv_priv, 1);
@@ -497,7 +497,7 @@
return 0;
}
-@@ -984,6 +987,7 @@ int hostapd_setup_interface_complete(str
+@@ -979,6 +982,7 @@ int hostapd_setup_interface_complete(str
if (err)
goto error;
@@ -505,7 +505,7 @@
wpa_printf(MSG_DEBUG, "Completing interface initialization");
if (hapd->iconf->channel) {
iface->freq = hostapd_hw_get_freq(hapd, hapd->iconf->channel);
-@@ -1076,6 +1080,7 @@ int hostapd_setup_interface_complete(str
+@@ -1071,6 +1075,7 @@ int hostapd_setup_interface_complete(str
error:
wpa_printf(MSG_ERROR, "Interface initialization failed");
@@ -513,7 +513,7 @@
eloop_terminate();
return -1;
}
-@@ -1174,6 +1179,8 @@ void hostapd_interface_deinit_free(struc
+@@ -1169,6 +1174,8 @@ void hostapd_interface_deinit_free(struc
void *drv_priv;
if (iface == NULL)
return;