| 1 | --- a/src/ap/ap_config.h |
| 2 | +++ b/src/ap/ap_config.h |
| 3 | @@ -148,6 +148,7 @@ struct hostapd_wmm_ac_params { |
| 4 | struct hostapd_bss_config { |
| 5 | char iface[IFNAMSIZ + 1]; |
| 6 | char bridge[IFNAMSIZ + 1]; |
| 7 | + char wds_bridge[IFNAMSIZ + 1]; |
| 8 | |
| 9 | enum hostapd_logger_level logger_syslog_level, logger_stdout_level; |
| 10 | |
| 11 | --- a/hostapd/config_file.c |
| 12 | +++ b/hostapd/config_file.c |
| 13 | @@ -1193,6 +1193,8 @@ struct hostapd_config * hostapd_config_r |
| 14 | sizeof(conf->bss[0].iface)); |
| 15 | } else if (os_strcmp(buf, "bridge") == 0) { |
| 16 | os_strlcpy(bss->bridge, pos, sizeof(bss->bridge)); |
| 17 | + } else if (os_strcmp(buf, "wds_bridge") == 0) { |
| 18 | + os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge)); |
| 19 | } else if (os_strcmp(buf, "driver") == 0) { |
| 20 | int j; |
| 21 | /* clear to get error below if setting is invalid */ |
| 22 | --- a/src/drivers/driver_nl80211.c |
| 23 | +++ b/src/drivers/driver_nl80211.c |
| 24 | @@ -4566,7 +4566,8 @@ static int i802_set_sta_vlan(void *priv, |
| 25 | } |
| 26 | |
| 27 | |
| 28 | -static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val) |
| 29 | +static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val, |
| 30 | + const char *bridge_ifname) |
| 31 | { |
| 32 | struct i802_bss *bss = priv; |
| 33 | struct wpa_driver_nl80211_data *drv = bss->drv; |
| 34 | @@ -4580,6 +4581,10 @@ static int i802_set_wds_sta(void *priv, |
| 35 | if (nl80211_create_iface(drv, name, NL80211_IFTYPE_AP_VLAN, |
| 36 | NULL, 1) < 0) |
| 37 | return -1; |
| 38 | + if (bridge_ifname) { |
| 39 | + if (linux_br_add_if(drv->ioctl_sock, bridge_ifname, name) < 0) |
| 40 | + return -1; |
| 41 | + } |
| 42 | } |
| 43 | linux_set_iface_flags(drv->ioctl_sock, name, 1); |
| 44 | return i802_set_sta_vlan(priv, addr, name, 0); |
| 45 | --- a/src/ap/ap_drv_ops.c |
| 46 | +++ b/src/ap/ap_drv_ops.c |
| 47 | @@ -265,9 +265,15 @@ static int hostapd_vlan_if_remove(struct |
| 48 | static int hostapd_set_wds_sta(struct hostapd_data *hapd, const u8 *addr, |
| 49 | int aid, int val) |
| 50 | { |
| 51 | + const char *bridge = NULL; |
| 52 | + |
| 53 | if (hapd->driver == NULL || hapd->driver->set_wds_sta == NULL) |
| 54 | return 0; |
| 55 | - return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val); |
| 56 | + if (hapd->conf->wds_bridge[0]) |
| 57 | + bridge = hapd->conf->wds_bridge; |
| 58 | + else if (hapd->conf->bridge[0]) |
| 59 | + bridge = hapd->conf->bridge; |
| 60 | + return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val, bridge); |
| 61 | } |
| 62 | |
| 63 | |
| 64 | --- a/src/drivers/driver.h |
| 65 | +++ b/src/drivers/driver.h |
| 66 | @@ -1622,7 +1622,8 @@ struct wpa_driver_ops { |
| 67 | * @val: 1 = bind to 4-address WDS; 0 = unbind |
| 68 | * Returns: 0 on success, -1 on failure |
| 69 | */ |
| 70 | - int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val); |
| 71 | + int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val, |
| 72 | + const char *bridge_ifname); |
| 73 | |
| 74 | /** |
| 75 | * send_action - Transmit an Action frame |
| 76 | |