1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-24 05:04:40 +02:00

hostapd: update to 2010-11-11

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@23969 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd 2010-11-11 22:39:19 +00:00
parent b8702bf547
commit a6e86dfede
19 changed files with 24 additions and 440 deletions

View File

@ -8,9 +8,9 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=hostapd
PKG_VERSION:=20101109
PKG_VERSION:=20101111
PKG_RELEASE:=1
PKG_REV:=8672562b04a6f51cba5dad19b27a296caa17f0c0
PKG_REV:=5db8cf314ef169cd256483e32dcc49e31e605121
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git

View File

@ -1,18 +0,0 @@
--- a/src/drivers/driver_madwifi.c
+++ b/src/drivers/driver_madwifi.c
@@ -69,6 +69,7 @@
#define MADWIFI_NG
#endif /* IEEE80211_IOCTL_SETWMMPARAMS */
+#define WPA_KEY_RSC_LEN 8
#ifdef HOSTAPD
@@ -1510,7 +1511,6 @@ wpa_driver_madwifi_set_key(const char *i
wk.ik_keyix = key_idx;
wk.ik_keylen = key_len;
#ifdef WORDS_BIGENDIAN
-#define WPA_KEY_RSC_LEN 8
{
size_t i;
u8 tmp[WPA_KEY_RSC_LEN];

View File

@ -1,14 +0,0 @@
--- a/src/drivers/driver_roboswitch.c
+++ b/src/drivers/driver_roboswitch.c
@@ -14,10 +14,10 @@
#include "includes.h"
#include <sys/ioctl.h>
-#include <linux/if.h>
#include <linux/sockios.h>
#include <linux/if_ether.h>
#include <linux/mii.h>
+#include <net/if.h>
#include "common.h"
#include "driver.h"

View File

@ -114,7 +114,7 @@
#endif /* HOSTAPD */
if (addr && iftype != NL80211_IFTYPE_MONITOR &&
@@ -5177,6 +5174,7 @@ static void *i802_init(struct hostapd_da
@@ -5155,6 +5152,7 @@ static void *i802_init(struct hostapd_da
return NULL;
drv = bss->drv;

View File

@ -1,28 +0,0 @@
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4987,9 +4987,11 @@ static int i802_set_wds_sta(void *priv,
wpa_printf(MSG_DEBUG, "nl80211: Set WDS STA addr=" MACSTR
" aid=%d val=%d name=%s", MAC2STR(addr), aid, val, name);
if (val) {
- if (nl80211_create_iface(drv, name, NL80211_IFTYPE_AP_VLAN,
+ if (!if_nametoindex(name)) {
+ if (nl80211_create_iface(drv, name, NL80211_IFTYPE_AP_VLAN,
NULL, 1) < 0)
- return -1;
+ return -1;
+ }
linux_set_iface_flags(drv->ioctl_sock, name, 1);
return i802_set_sta_vlan(priv, addr, name, 0);
} else {
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -1659,6 +1659,9 @@ static void handle_assoc_cb(struct hosta
"Could not add STA to kernel driver");
}
+ if (sta->flags & WLAN_STA_WDS)
+ hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 1);
+
if (sta->eapol_sm == NULL) {
/*
* This STA does not use RADIUS server for EAP authentication,

View File

@ -34,7 +34,7 @@
return 0;
}
@@ -5184,8 +5197,6 @@ static void *i802_init(struct hostapd_da
@@ -5162,8 +5175,6 @@ static void *i802_init(struct hostapd_da
br_ifindex = 0;
}

View File

@ -1,75 +0,0 @@
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -148,6 +148,7 @@ struct hostapd_wmm_ac_params {
struct hostapd_bss_config {
char iface[IFNAMSIZ + 1];
char bridge[IFNAMSIZ + 1];
+ char wds_bridge[IFNAMSIZ + 1];
enum hostapd_logger_level logger_syslog_level, logger_stdout_level;
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -1208,6 +1208,8 @@ struct hostapd_config * hostapd_config_r
sizeof(conf->bss[0].iface));
} else if (os_strcmp(buf, "bridge") == 0) {
os_strlcpy(bss->bridge, pos, sizeof(bss->bridge));
+ } else if (os_strcmp(buf, "wds_bridge") == 0) {
+ os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge));
} else if (os_strcmp(buf, "driver") == 0) {
int j;
/* clear to get error below if setting is invalid */
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4977,7 +4977,8 @@ static int i802_set_sta_vlan(void *priv,
}
-static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val)
+static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,
+ const char *bridge_ifname)
{
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
@@ -4991,6 +4992,10 @@ static int i802_set_wds_sta(void *priv,
if (nl80211_create_iface(drv, name, NL80211_IFTYPE_AP_VLAN,
NULL, 1) < 0)
return -1;
+ if (bridge_ifname) {
+ if (linux_br_add_if(drv->ioctl_sock, bridge_ifname, name) < 0)
+ return -1;
+ }
}
linux_set_iface_flags(drv->ioctl_sock, name, 1);
return i802_set_sta_vlan(priv, addr, name, 0);
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -366,9 +366,15 @@ static int hostapd_vlan_if_remove(struct
static int hostapd_set_wds_sta(struct hostapd_data *hapd, const u8 *addr,
int aid, int val)
{
+ const char *bridge = NULL;
+
if (hapd->driver == NULL || hapd->driver->set_wds_sta == NULL)
return 0;
- return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val);
+ if (hapd->conf->wds_bridge[0])
+ bridge = hapd->conf->wds_bridge;
+ else if (hapd->conf->bridge[0])
+ bridge = hapd->conf->bridge;
+ return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val, bridge);
}
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1700,7 +1700,8 @@ struct wpa_driver_ops {
* @val: 1 = bind to 4-address WDS; 0 = unbind
* Returns: 0 on success, -1 on failure
*/
- int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val);
+ int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
+ const char *bridge_ifname);
/**
* send_action - Transmit an Action frame

View File

@ -1,70 +0,0 @@
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -728,6 +728,16 @@ int hostapd_setup_interface_complete(str
}
}
+ if (iface->current_mode) {
+ if (hostapd_prepare_rates(hapd, iface->current_mode)) {
+ wpa_printf(MSG_ERROR, "Failed to prepare rates table.");
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_WARNING,
+ "Failed to prepare rates table.");
+ return -1;
+ }
+ }
+
if (hapd->iconf->rts_threshold > -1 &&
hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) {
wpa_printf(MSG_ERROR, "Could not set RTS threshold for "
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -101,8 +101,8 @@ int hostapd_get_hw_features(struct hosta
}
-static int hostapd_prepare_rates(struct hostapd_data *hapd,
- struct hostapd_hw_modes *mode)
+int hostapd_prepare_rates(struct hostapd_data *hapd,
+ struct hostapd_hw_modes *mode)
{
int i, num_basic_rates = 0;
int basic_rates_a[] = { 60, 120, 240, -1 };
@@ -668,14 +668,6 @@ int hostapd_select_hw_mode(struct hostap
return -1;
}
- if (hostapd_prepare_rates(iface->bss[0], iface->current_mode)) {
- wpa_printf(MSG_ERROR, "Failed to prepare rates table.");
- hostapd_logger(iface->bss[0], NULL, HOSTAPD_MODULE_IEEE80211,
- HOSTAPD_LEVEL_WARNING,
- "Failed to prepare rates table.");
- return -1;
- }
-
return 0;
}
--- a/src/ap/hw_features.h
+++ b/src/ap/hw_features.h
@@ -25,6 +25,8 @@ const char * hostapd_hw_mode_txt(int mod
int hostapd_hw_get_freq(struct hostapd_data *hapd, int chan);
int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq);
int hostapd_check_ht_capab(struct hostapd_iface *iface);
+int hostapd_prepare_rates(struct hostapd_data *hapd,
+ struct hostapd_hw_modes *mode);
#else /* NEED_AP_MLME */
static inline void
hostapd_free_hw_features(struct hostapd_hw_modes *hw_features,
@@ -56,6 +58,11 @@ static inline int hostapd_check_ht_capab
{
return 0;
}
+static inline int hostapd_prepare_rates(struct hostapd_data *hapd,
+ struct hostapd_hw_modes *mode)
+{
+ return 0;
+}
#endif /* NEED_AP_MLME */

View File

@ -1,108 +0,0 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -1281,6 +1281,8 @@ struct hostapd_config * hostapd_config_r
}
} else if (os_strcmp(buf, "wds_sta") == 0) {
bss->wds_sta = atoi(pos);
+ } else if (os_strcmp(buf, "ap_isolate") == 0) {
+ bss->isolate = atoi(pos);
} else if (os_strcmp(buf, "ap_max_inactivity") == 0) {
bss->ap_max_inactivity = atoi(pos);
} else if (os_strcmp(buf, "country_code") == 0) {
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -199,6 +199,7 @@ struct hostapd_bss_config {
struct mac_acl_entry *deny_mac;
int num_deny_mac;
int wds_sta;
+ int isolate;
int auth_algs; /* bitfield of allowed IEEE 802.11 authentication
* algorithms, WPA_AUTH_ALG_{OPEN,SHARED,LEAP} */
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1704,6 +1704,14 @@ struct wpa_driver_ops {
const char *bridge_ifname);
/**
+ * set_ap_isolate - Enable/disable AP isolation
+ * @priv: private driver interface data
+ * @val: 1 = enabled; 0 = disabled
+ * Returns: 0 on success, -1 on failure
+ */
+ int (*set_ap_isolate)(void *priv, int val);
+
+ /**
* send_action - Transmit an Action frame
* @priv: Private driver interface data
* @freq: Frequency (in MHz) of the channel
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4661,6 +4661,29 @@ static int i802_set_rate_sets(void *priv
return -ENOBUFS;
}
+static int i802_set_ap_isolate(void *priv, int val)
+{
+ struct i802_bss *bss = priv;
+ struct wpa_driver_nl80211_data *drv = bss->drv;
+ struct nl_msg *msg;
+ int i;
+
+ msg = nlmsg_alloc();
+ if (!msg)
+ return -ENOMEM;
+
+ genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
+ NL80211_CMD_SET_BSS, 0);
+
+ NLA_PUT_U8(msg, NL80211_ATTR_AP_ISOLATE, !!val);
+
+ NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(bss->ifname));
+
+ return send_and_recv_msgs(drv, msg, NULL, NULL);
+ nla_put_failure:
+ return -ENOBUFS;
+}
+
#endif /* HOSTAPD */
@@ -5840,6 +5863,7 @@ const struct wpa_driver_ops wpa_driver_n
.set_tx_queue_params = i802_set_tx_queue_params,
.set_sta_vlan = i802_set_sta_vlan,
.set_wds_sta = i802_set_wds_sta,
+ .set_ap_isolate = i802_set_ap_isolate,
#endif /* HOSTAPD */
.set_freq = i802_set_freq,
.send_action = wpa_driver_nl80211_send_action,
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -281,6 +281,14 @@ static int hostapd_set_radius_acl_expire
}
+static int hostapd_set_ap_isolate(struct hostapd_data *hapd, int value)
+{
+ if (hapd->driver == NULL || hapd->driver->set_ap_isolate == NULL)
+ return 0;
+ hapd->driver->set_ap_isolate(hapd->drv_priv, value);
+}
+
+
static int hostapd_set_bss_params(struct hostapd_data *hapd,
int use_protection)
{
@@ -330,6 +338,12 @@ static int hostapd_set_bss_params(struct
"driver");
ret = -1;
}
+ if (hostapd_set_ap_isolate(hapd, hapd->conf->isolate) &&
+ !hapd->conf->isolate) {
+ wpa_printf(MSG_ERROR, "Could not enable AP isolation in "
+ "kernel driver");
+ ret = -1;
+ }
return ret;
}

View File

@ -1,22 +0,0 @@
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -550,6 +550,9 @@ void wpa_supplicant_set_state(struct wpa
wpa_s->new_connection = 0;
wpa_s->reassociated_connection = 1;
wpa_drv_set_operstate(wpa_s, 1);
+#ifndef IEEE8021X_EAPOL
+ wpa_drv_set_supp_port(wpa_s, 1);
+#endif
wpa_s->after_wps = 0;
#ifdef CONFIG_P2P
wpas_p2p_completed(wpa_s);
@@ -558,6 +561,9 @@ void wpa_supplicant_set_state(struct wpa
state == WPA_ASSOCIATED) {
wpa_s->new_connection = 1;
wpa_drv_set_operstate(wpa_s, 0);
+#ifndef IEEE8021X_EAPOL
+ wpa_drv_set_supp_port(wpa_s, 0);
+#endif
}
wpa_s->wpa_state = state;

View File

@ -1,89 +0,0 @@
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -43,37 +43,8 @@ static int hostapd_setup_encryption(char
extern int wpa_debug_level;
-
-int hostapd_reload_config(struct hostapd_iface *iface)
+static int hostapd_reload_bss(struct hostapd_data *hapd)
{
- struct hostapd_data *hapd = iface->bss[0];
- struct hostapd_config *newconf, *oldconf;
- size_t j;
-
- if (iface->config_read_cb == NULL)
- return -1;
- newconf = iface->config_read_cb(iface->config_fname);
- if (newconf == NULL)
- return -1;
-
- /*
- * Deauthenticate all stations since the new configuration may not
- * allow them to use the BSS anymore.
- */
- for (j = 0; j < iface->num_bss; j++)
- hostapd_flush_old_stations(iface->bss[j]);
-
-#ifndef CONFIG_NO_RADIUS
- /* TODO: update dynamic data based on changed configuration
- * items (e.g., open/close sockets, etc.) */
- radius_client_flush(hapd->radius, 0);
-#endif /* CONFIG_NO_RADIUS */
-
- oldconf = hapd->iconf;
- hapd->iconf = newconf;
- hapd->conf = &newconf->bss[0];
- iface->conf = newconf;
-
if (hostapd_setup_wpa_psk(hapd->conf)) {
wpa_printf(MSG_ERROR, "Failed to re-configure WPA PSK "
"after reloading configuration");
@@ -111,10 +82,46 @@ int hostapd_reload_config(struct hostapd
wpa_printf(MSG_ERROR, "Could not set SSID for kernel driver");
/* try to continue */
}
+ wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface);
+}
+
+int hostapd_reload_config(struct hostapd_iface *iface)
+{
+ struct hostapd_data *hapd = iface->bss[0];
+ struct hostapd_config *newconf, *oldconf;
+ size_t j;
+
+ if (iface->config_read_cb == NULL)
+ return -1;
+ newconf = iface->config_read_cb(iface->config_fname);
+ if (newconf == NULL)
+ return -1;
+
+ /*
+ * Deauthenticate all stations since the new configuration may not
+ * allow them to use the BSS anymore.
+ */
+ for (j = 0; j < iface->num_bss; j++)
+ hostapd_flush_old_stations(iface->bss[j]);
+
+#ifndef CONFIG_NO_RADIUS
+ /* TODO: update dynamic data based on changed configuration
+ * items (e.g., open/close sockets, etc.) */
+ radius_client_flush(hapd->radius, 0);
+#endif /* CONFIG_NO_RADIUS */
+
+ oldconf = hapd->iconf;
+ iface->conf = newconf;
+
+ for (j = 0; j < iface->num_bss; j++) {
+ hapd = iface->bss[j];
+ hapd->iconf = newconf;
+ hapd->conf = &newconf->bss[j];
+ hostapd_reload_bss(hapd);
+ }
hostapd_config_free(oldconf);
- wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface);
return 0;
}

View File

@ -10,7 +10,7 @@
/* hostapd.c */
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -784,6 +784,9 @@ int hostapd_setup_interface_complete(str
@@ -787,6 +787,9 @@ int hostapd_setup_interface_complete(str
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
iface->bss[0]->conf->iface);
@ -116,7 +116,7 @@
os_program_deinit();
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -1882,6 +1882,8 @@ struct hostapd_config * hostapd_config_r
@@ -1890,6 +1890,8 @@ struct hostapd_config * hostapd_config_r
}
#endif /* CONFIG_IEEE80211W */
#ifdef CONFIG_IEEE80211N

View File

@ -114,7 +114,7 @@
wpa_cli.exe: wpa_cli
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2667,8 +2667,8 @@ union wpa_event_data {
@@ -2684,8 +2684,8 @@ union wpa_event_data {
* Driver wrapper code should call this function whenever an event is received
* from the driver.
*/
@ -182,7 +182,7 @@
u16 reason_code = 0;
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2314,6 +2314,9 @@ struct wpa_supplicant * wpa_supplicant_g
@@ -2320,6 +2320,9 @@ struct wpa_supplicant * wpa_supplicant_g
return NULL;
}
@ -192,7 +192,7 @@
/**
* wpa_supplicant_init - Initialize %wpa_supplicant
@@ -2332,6 +2335,7 @@ struct wpa_global * wpa_supplicant_init(
@@ -2338,6 +2341,7 @@ struct wpa_global * wpa_supplicant_init(
if (params == NULL)
return NULL;

View File

@ -241,7 +241,15 @@
endif
ifdef CONFIG_DRIVER_HERMES
@@ -183,6 +181,7 @@ endif
@@ -170,7 +168,6 @@ endif
ifdef CONFIG_WIRELESS_EXTENSION
DRV_WPA_CFLAGS += -DCONFIG_WIRELESS_EXTENSION
DRV_WPA_OBJS += ../src/drivers/driver_wext.o
-NEED_RFKILL=y
endif
ifdef NEED_NETLINK
@@ -183,6 +180,7 @@ endif
ifdef NEED_RFKILL
DRV_OBJS += ../src/drivers/rfkill.o

View File

@ -1,6 +1,6 @@
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -113,6 +113,10 @@ int hostapd_reload_config(struct hostapd
@@ -115,6 +115,10 @@ int hostapd_reload_config(struct hostapd
oldconf = hapd->iconf;
iface->conf = newconf;

View File

@ -44,7 +44,7 @@
/**
* wpa_driver_nl80211_deinit - Deinitialize nl80211 driver interface
@@ -5905,4 +5923,5 @@ const struct wpa_driver_ops wpa_driver_n
@@ -5882,4 +5900,5 @@ const struct wpa_driver_ops wpa_driver_n
.signal_monitor = nl80211_signal_monitor,
.send_frame = nl80211_send_frame,
.set_intra_bss = nl80211_set_intra_bss,
@ -52,7 +52,7 @@
};
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1915,6 +1915,8 @@ struct wpa_driver_ops {
@@ -1909,6 +1909,8 @@ struct wpa_driver_ops {
* set_intra_bss - Enables/Disables intra BSS bridging
*/
int (*set_intra_bss)(void *priv, int enabled);

View File

@ -16,7 +16,7 @@
static void hostapd_ctrl_iface_send(struct hostapd_data *hapd, int level,
const char *buf, size_t len);
@@ -318,6 +320,66 @@ static int hostapd_ctrl_iface_disassocia
@@ -322,6 +324,66 @@ static int hostapd_ctrl_iface_disassocia
return 0;
}
@ -83,7 +83,7 @@
#ifdef CONFIG_IEEE80211W
#ifdef NEED_AP_MLME
@@ -814,6 +876,10 @@ static void hostapd_ctrl_iface_receive(i
@@ -818,6 +880,10 @@ static void hostapd_ctrl_iface_receive(i
reply_len += res;
}
#endif /* CONFIG_NO_RADIUS */

View File

@ -107,7 +107,7 @@
wpa_s->new_connection = 1;
wpa_drv_set_operstate(wpa_s, 0);
#ifndef IEEE8021X_EAPOL
@@ -2027,6 +2084,21 @@ static int wpa_supplicant_init_iface(str
@@ -2033,6 +2090,21 @@ static int wpa_supplicant_init_iface(str
os_strlcpy(wpa_s->bridge_ifname, iface->bridge_ifname,
sizeof(wpa_s->bridge_ifname));
}