From ad1507756b17a278d92721d7b9ec24f906d7bd2c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 9 Mar 2010 21:16:38 +0000 Subject: [PATCH] hostapd: remove the hotplug script for adding wds station interfaces to a bridge - it suffers from race conditions. instead let hostapd add the interfaces to the bridge SVN-Revision: 20104 --- package/hostapd/Makefile | 2 - package/hostapd/files/hostapd.hotplug | 12 ---- package/hostapd/patches/360-wds_bridge.patch | 75 ++++++++++++++++++++ 3 files changed, 75 insertions(+), 14 deletions(-) delete mode 100644 package/hostapd/files/hostapd.hotplug create mode 100644 package/hostapd/patches/360-wds_bridge.patch diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile index 37b228c618fa..ad76e9da52bc 100644 --- a/package/hostapd/Makefile +++ b/package/hostapd/Makefile @@ -262,8 +262,6 @@ define Build/Compile endef define Install/hostapd - $(INSTALL_DIR) $(1)/etc/hotplug.d/net - $(INSTALL_DATA) ./files/hostapd.hotplug $(1)/etc/hotplug.d/net/ $(INSTALL_DIR) $(1)/lib/wifi $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh $(INSTALL_DIR) $(1)/usr/sbin diff --git a/package/hostapd/files/hostapd.hotplug b/package/hostapd/files/hostapd.hotplug deleted file mode 100644 index 296422428436..000000000000 --- a/package/hostapd/files/hostapd.hotplug +++ /dev/null @@ -1,12 +0,0 @@ -if [ "$ACTION" = "add" -o "$ACTION" = "register" ]; then - case "$INTERFACE" in - wlan*.sta*) - local BASEIF="${INTERFACE%%\.*}" - - include /lib/network - scan_interfaces - local CONFIG="$(find_config "$BASEIF")" - [ -n "$CONFIG" ] && setup_interface "$INTERFACE" "$CONFIG" - ;; - esac -fi diff --git a/package/hostapd/patches/360-wds_bridge.patch b/package/hostapd/patches/360-wds_bridge.patch new file mode 100644 index 000000000000..d563bdbd8298 --- /dev/null +++ b/package/hostapd/patches/360-wds_bridge.patch @@ -0,0 +1,75 @@ +--- 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 +@@ -1193,6 +1193,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 +@@ -4425,7 +4425,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; +@@ -4439,6 +4440,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 +@@ -253,9 +253,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 +@@ -1610,7 +1610,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 -- 2.30.2