hostapd: fix ap+sta issues

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33311 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Felix Fietkau 2012-08-29 16:06:24 +00:00
parent 22fef4fdc7
commit a57015d0dc
7 changed files with 29 additions and 48 deletions

View File

@ -1,10 +1,20 @@
--- a/src/ap/hostapd.c --- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c +++ b/src/ap/hostapd.c
@@ -137,6 +137,10 @@ int hostapd_reload_config(struct hostapd @@ -137,6 +137,20 @@ int hostapd_reload_config(struct hostapd
oldconf = hapd->iconf; oldconf = hapd->iconf;
iface->conf = newconf; iface->conf = newconf;
+ iface->freq = hostapd_hw_get_freq(hapd, hapd->iconf->channel); + hostapd_select_hw_mode(iface);
+ iface->freq = hostapd_hw_get_freq(hapd, newconf->channel);
+
+ if (hostapd_set_freq(hapd, newconf->hw_mode, iface->freq,
+ newconf->channel,
+ newconf->ieee80211n,
+ newconf->secondary_channel)) {
+ wpa_printf(MSG_ERROR, "Could not set channel for "
+ "kernel driver");
+ }
+
+ if (iface->current_mode) + if (iface->current_mode)
+ hostapd_prepare_rates(iface, iface->current_mode); + hostapd_prepare_rates(iface, iface->current_mode);
+ +

View File

@ -58,7 +58,7 @@
+ conf->ht_capab &= atoi(val); + conf->ht_capab &= atoi(val);
+ else if ((val = get_option(opt, "sec_chan="))) + else if ((val = get_option(opt, "sec_chan=")))
+ conf->secondary_channel = atoi(val); + conf->secondary_channel = atoi(val);
+ else if ((val = get_option(opt, "hwmode="))) + else if ((val = get_option(opt, "hw_mode=")))
+ conf->hw_mode = atoi(val); + conf->hw_mode = atoi(val);
+ else if ((val = get_option(opt, "ieee80211n="))) + else if ((val = get_option(opt, "ieee80211n=")))
+ conf->ieee80211n = atoi(val); + conf->ieee80211n = atoi(val);

View File

@ -1,6 +1,6 @@
--- a/src/ap/hostapd.c --- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c +++ b/src/ap/hostapd.c
@@ -768,11 +768,8 @@ int hostapd_setup_interface_complete(str @@ -778,11 +778,8 @@ int hostapd_setup_interface_complete(str
size_t j; size_t j;
u8 *prev_addr; u8 *prev_addr;
@ -14,7 +14,7 @@
wpa_printf(MSG_DEBUG, "Completing interface initialization"); wpa_printf(MSG_DEBUG, "Completing interface initialization");
if (hapd->iconf->channel) { if (hapd->iconf->channel) {
@@ -788,7 +785,7 @@ int hostapd_setup_interface_complete(str @@ -798,7 +795,7 @@ int hostapd_setup_interface_complete(str
hapd->iconf->secondary_channel)) { hapd->iconf->secondary_channel)) {
wpa_printf(MSG_ERROR, "Could not set channel for " wpa_printf(MSG_ERROR, "Could not set channel for "
"kernel driver"); "kernel driver");
@ -23,7 +23,7 @@
} }
} }
@@ -799,7 +796,7 @@ int hostapd_setup_interface_complete(str @@ -809,7 +806,7 @@ int hostapd_setup_interface_complete(str
hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_WARNING, HOSTAPD_LEVEL_WARNING,
"Failed to prepare rates table."); "Failed to prepare rates table.");
@ -32,7 +32,7 @@
} }
} }
@@ -807,14 +804,14 @@ int hostapd_setup_interface_complete(str @@ -817,14 +814,14 @@ int hostapd_setup_interface_complete(str
hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) { hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) {
wpa_printf(MSG_ERROR, "Could not set RTS threshold for " wpa_printf(MSG_ERROR, "Could not set RTS threshold for "
"kernel driver"); "kernel driver");
@ -49,7 +49,7 @@
} }
prev_addr = hapd->own_addr; prev_addr = hapd->own_addr;
@@ -824,7 +821,7 @@ int hostapd_setup_interface_complete(str @@ -834,7 +831,7 @@ int hostapd_setup_interface_complete(str
if (j) if (j)
os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN); os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN);
if (hostapd_setup_bss(hapd, j == 0)) if (hostapd_setup_bss(hapd, j == 0))
@ -58,7 +58,7 @@
if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0) if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0)
prev_addr = hapd->own_addr; prev_addr = hapd->own_addr;
} }
@@ -836,7 +833,7 @@ int hostapd_setup_interface_complete(str @@ -846,7 +843,7 @@ int hostapd_setup_interface_complete(str
if (hostapd_driver_commit(hapd) < 0) { if (hostapd_driver_commit(hapd) < 0) {
wpa_printf(MSG_ERROR, "%s: Failed to commit driver " wpa_printf(MSG_ERROR, "%s: Failed to commit driver "
"configuration", __func__); "configuration", __func__);
@ -67,7 +67,7 @@
} }
/* /*
@@ -860,6 +857,11 @@ int hostapd_setup_interface_complete(str @@ -870,6 +867,11 @@ int hostapd_setup_interface_complete(str
iface->init_complete(iface); iface->init_complete(iface);
return 0; return 0;

View File

@ -31,7 +31,7 @@
#include "ieee802_11_auth.h" #include "ieee802_11_auth.h"
#include "vlan_init.h" #include "vlan_init.h"
#include "wpa_auth.h" #include "wpa_auth.h"
@@ -307,6 +308,7 @@ static void hostapd_cleanup_iface_pre(st @@ -317,6 +318,7 @@ static void hostapd_cleanup_iface_pre(st
static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
{ {

View File

@ -12,8 +12,6 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
wpa_supplicant/wpa_supplicant.c | 23 +++++++--- wpa_supplicant/wpa_supplicant.c | 23 +++++++---
4 files changed, 124 insertions(+), 7 deletions(-) 4 files changed, 124 insertions(+), 7 deletions(-)
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 5ee92f7..d204148 100644
--- a/src/drivers/driver.h --- a/src/drivers/driver.h
+++ b/src/drivers/driver.h +++ b/src/drivers/driver.h
@@ -19,6 +19,7 @@ @@ -19,6 +19,7 @@
@ -36,8 +34,6 @@ index 5ee92f7..d204148 100644
/** /**
* bg_scan_period - Background scan period in seconds, 0 to disable * bg_scan_period - Background scan period in seconds, 0 to disable
* background scan, or -1 to indicate no change to default driver * background scan, or -1 to indicate no change to default driver
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index c423bc3..be566ee 100644
--- a/wpa_supplicant/config.c --- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c
@@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
@ -48,7 +44,7 @@ index c423bc3..be566ee 100644
#include "config.h" #include "config.h"
@@ -1431,6 +1432,97 @@ static char * wpa_config_write_p2p_client_list(const struct parse_data *data, @@ -1431,6 +1432,97 @@ static char * wpa_config_write_p2p_clien
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
@ -146,7 +142,7 @@ index c423bc3..be566ee 100644
/* Helper macros for network block parser */ /* Helper macros for network block parser */
#ifdef OFFSET #ifdef OFFSET
@@ -1605,6 +1697,10 @@ static const struct parse_data ssid_fields[] = { @@ -1605,6 +1697,10 @@ static const struct parse_data ssid_fiel
{ STR(ht_mcs) }, { STR(ht_mcs) },
#endif /* CONFIG_HT_OVERRIDES */ #endif /* CONFIG_HT_OVERRIDES */
{ INT(ap_max_inactivity) }, { INT(ap_max_inactivity) },
@ -157,8 +153,6 @@ index c423bc3..be566ee 100644
}; };
#undef OFFSET #undef OFFSET
diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h
index 80d4382..8d152a4 100644
--- a/wpa_supplicant/config_ssid.h --- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
@ -181,11 +175,9 @@ index 80d4382..8d152a4 100644
}; };
#endif /* CONFIG_SSID_H */ #endif /* CONFIG_SSID_H */
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index cc85f1e..1473d91 100644
--- a/wpa_supplicant/wpa_supplicant.c --- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c
@@ -1395,15 +1395,24 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, @@ -1395,15 +1395,24 @@ void wpa_supplicant_associate(struct wpa
params.ssid_len = ssid->ssid_len; params.ssid_len = ssid->ssid_len;
} }
@ -217,6 +209,3 @@ index cc85f1e..1473d91 100644
params.wpa_ie = wpa_ie; params.wpa_ie = wpa_ie;
params.wpa_ie_len = wpa_ie_len; params.wpa_ie_len = wpa_ie_len;
params.pairwise_suite = cipher_pairwise; params.pairwise_suite = cipher_pairwise;
--
1.7.9.4

View File

@ -8,11 +8,9 @@ Signed-hostap: Antonio Quartulli <ordex@autistici.org>
src/drivers/driver_nl80211.c | 33 ++++++++++++++++++++++++++++++++- src/drivers/driver_nl80211.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-) 1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 22e7075..f510d18 100644
--- a/src/drivers/driver_nl80211.c --- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c
@@ -6481,7 +6481,7 @@ static int wpa_driver_nl80211_ibss(struct wpa_driver_nl80211_data *drv, @@ -6481,7 +6481,7 @@ static int wpa_driver_nl80211_ibss(struc
struct wpa_driver_associate_params *params) struct wpa_driver_associate_params *params)
{ {
struct nl_msg *msg; struct nl_msg *msg;
@ -59,6 +57,3 @@ index 22e7075..f510d18 100644
ret = nl80211_set_conn_keys(params, msg); ret = nl80211_set_conn_keys(params, msg);
if (ret) if (ret)
goto nla_put_failure; goto nla_put_failure;
--
1.7.9.4

View File

@ -14,8 +14,6 @@ Signed-off-by: Antonio Quartulli <ordex@autistici.org>
wpa_supplicant/wpa_supplicant.c | 2 ++ wpa_supplicant/wpa_supplicant.c | 2 ++
5 files changed, 88 insertions(+) 5 files changed, 88 insertions(+)
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index dda2fbc..28bd181 100644
--- a/src/drivers/driver.h --- a/src/drivers/driver.h
+++ b/src/drivers/driver.h +++ b/src/drivers/driver.h
@@ -337,6 +337,8 @@ struct wpa_driver_associate_params { @@ -337,6 +337,8 @@ struct wpa_driver_associate_params {
@ -27,11 +25,9 @@ index dda2fbc..28bd181 100644
/** /**
* bg_scan_period - Background scan period in seconds, 0 to disable * bg_scan_period - Background scan period in seconds, 0 to disable
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 9783c96..d1257a7 100644
--- a/src/drivers/driver_nl80211.c --- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c
@@ -6493,6 +6493,22 @@ retry: @@ -6545,6 +6545,22 @@ retry:
NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate); NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate);
} }
@ -54,11 +50,9 @@ index 9783c96..d1257a7 100644
ret = nl80211_set_conn_keys(params, msg); ret = nl80211_set_conn_keys(params, msg);
if (ret) if (ret)
goto nla_put_failure; goto nla_put_failure;
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 3d6c0e6..d96b2ea 100644
--- a/wpa_supplicant/config.c --- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c
@@ -1468,6 +1468,71 @@ static char * wpa_config_write_mcast_rate(const struct parse_data *data, @@ -1463,6 +1463,71 @@ static char * wpa_config_write_mcast_rat
} }
#endif /* NO_CONFIG_WRITE */ #endif /* NO_CONFIG_WRITE */
@ -130,7 +124,7 @@ index 3d6c0e6..d96b2ea 100644
static int wpa_config_parse_rates(const struct parse_data *data, static int wpa_config_parse_rates(const struct parse_data *data,
struct wpa_ssid *ssid, int line, struct wpa_ssid *ssid, int line,
const char *value) const char *value)
@@ -1706,6 +1771,7 @@ static const struct parse_data ssid_fields[] = { @@ -1701,6 +1766,7 @@ static const struct parse_data ssid_fiel
{ INT_RANGE(beacon_interval, 0, 1000) }, { INT_RANGE(beacon_interval, 0, 1000) },
{ FUNC(rates) }, { FUNC(rates) },
{ FUNC(mcast_rate) }, { FUNC(mcast_rate) },
@ -138,8 +132,6 @@ index 3d6c0e6..d96b2ea 100644
}; };
#undef OFFSET #undef OFFSET
diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h
index 8d152a4..7143277 100644
--- a/wpa_supplicant/config_ssid.h --- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h
@@ -505,6 +505,8 @@ struct wpa_ssid { @@ -505,6 +505,8 @@ struct wpa_ssid {
@ -151,11 +143,9 @@ index 8d152a4..7143277 100644
}; };
#endif /* CONFIG_SSID_H */ #endif /* CONFIG_SSID_H */
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 59efa16..fc8762f 100644
--- a/wpa_supplicant/wpa_supplicant.c --- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c
@@ -1379,6 +1379,8 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, @@ -1411,6 +1411,8 @@ void wpa_supplicant_associate(struct wpa
i++; i++;
} }
params.mcast_rate = ssid->mcast_rate; params.mcast_rate = ssid->mcast_rate;
@ -164,6 +154,3 @@ index 59efa16..fc8762f 100644
} }
params.wpa_ie = wpa_ie; params.wpa_ie = wpa_ie;
--
1.7.9.4