hostapd: slightly clean up patches
[openwrt/openwrt.git] / package / network / services / hostapd / patches / 711-wds_bridge_force.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Wed, 20 Oct 2021 21:13:10 +0200
3 Subject: [PATCH] hostpad: fix a race condition on adding AP mode wds sta
4 interfaces
5
6 Both hostapd and netifd attempt to add a VLAN device to a bridge.
7 Depending on which one wins the race, bridge vlan settings might be incomplete,
8 or hostapd might run into an error and refuse to service the client.
9 Fix this by preventing hostapd from adding interfaces to the bridge and
10 instead rely entirely on netifd handling this properly
11
12 --- a/hostapd/config_file.c
13 +++ b/hostapd/config_file.c
14 @@ -2447,6 +2447,8 @@ static int hostapd_config_fill(struct ho
15 sizeof(conf->bss[0]->iface));
16 } else if (os_strcmp(buf, "bridge") == 0) {
17 os_strlcpy(bss->bridge, pos, sizeof(bss->bridge));
18 + if (!bss->wds_bridge[0])
19 + os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge));
20 } else if (os_strcmp(buf, "bridge_hairpin") == 0) {
21 bss->bridge_hairpin = atoi(pos);
22 } else if (os_strcmp(buf, "vlan_bridge") == 0) {
23 --- a/src/ap/ap_drv_ops.c
24 +++ b/src/ap/ap_drv_ops.c
25 @@ -387,8 +387,6 @@ int hostapd_set_wds_sta(struct hostapd_d
26 return -1;
27 if (hapd->conf->wds_bridge[0])
28 bridge = hapd->conf->wds_bridge;
29 - else if (hapd->conf->bridge[0])
30 - bridge = hapd->conf->bridge;
31 return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val,
32 bridge, ifname_wds);
33 }