aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-11-09 14:12:42 (GMT)
committerJouni Malinen <j@w1.fi>2010-11-09 14:12:42 (GMT)
commitd38ae2ea85d7f67062c04f91b33fc045f9e792b5 (patch)
tree32109ef7a5ceaf5892f7d6930b805dd3099003bb
parent4a8c72959e3f889d4611660b1d9764515c815d86 (diff)
downloadhostap-d38ae2ea85d7f67062c04f91b33fc045f9e792b5.zip
hostap-d38ae2ea85d7f67062c04f91b33fc045f9e792b5.tar.gz
hostap-d38ae2ea85d7f67062c04f91b33fc045f9e792b5.tar.bz2
Add bridge handling for WDS STA interfaces
By default, add them to the configured bridge of the AP interface (if present), but allow the user to specify a separate bridge.
-rw-r--r--hostapd/config_file.c3
-rw-r--r--hostapd/hostapd.conf5
-rw-r--r--src/ap/ap_config.h1
-rw-r--r--src/ap/ap_drv_ops.c8
-rw-r--r--src/drivers/driver.h5
-rw-r--r--src/drivers/driver_nl80211.c17
6 files changed, 32 insertions, 7 deletions
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index ac69f24..c2083f6 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -1208,6 +1208,9 @@ struct hostapd_config * hostapd_config_read(const char *fname)
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 */
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index a9cd023..afeb206 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -352,6 +352,11 @@ wmm_ac_vo_acm=0
# bridging to be used.
#wds_sta=1
+# If bridge parameter is set, the WDS STA interface will be added to the same
+# bridge by default. This can be overridden with the wds_bridge parameter to
+# use a separate bridge.
+#wds_bridge=wds-br0
+
##### IEEE 802.11n related configuration ######################################
# ieee80211n: Whether IEEE 802.11n (HT) is enabled
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index fd2abce..be2e334 100644
--- 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;
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index 3fd2761..001c4c7 100644
--- 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 hostapd_data *hapd,
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);
}
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index e0ee183..da2daaf 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1698,9 +1698,12 @@ struct wpa_driver_ops {
* @addr: MAC address of the associated station
* @aid: Association ID
* @val: 1 = bind to 4-address WDS; 0 = unbind
+ * @bridge_ifname: Bridge interface to use for the WDS station or %NULL
+ * to indicate that bridge is not to be used
* 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
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 0f2408b..24fd887 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4977,7 +4977,8 @@ static int i802_set_sta_vlan(void *priv, const u8 *addr,
}
-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;
@@ -4987,10 +4988,16 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val)
wpa_printf(MSG_DEBUG, "nl80211: Set WDS STA addr=" MACSTR
" aid=%d val=%d name=%s", MAC2STR(addr), aid, val, name);
if (val) {
- if (!if_nametoindex(name) &&
- nl80211_create_iface(drv, name, NL80211_IFTYPE_AP_VLAN,
- NULL, 1) < 0)
- return -1;
+ if (!if_nametoindex(name)) {
+ if (nl80211_create_iface(drv, name,
+ NL80211_IFTYPE_AP_VLAN,
+ NULL, 1) < 0)
+ return -1;
+ if (bridge_ifname &&
+ 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);
} else {