711-wds_bridge_force.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. From: Felix Fietkau <[email protected]>
  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. Both hostapd and netifd attempt to add a VLAN device to a bridge.
  6. Depending on which one wins the race, bridge vlan settings might be incomplete,
  7. or hostapd might run into an error and refuse to service the client.
  8. Fix this by preventing hostapd from adding interfaces to the bridge and
  9. instead rely entirely on netifd handling this properly
  10. --- a/hostapd/config_file.c
  11. +++ b/hostapd/config_file.c
  12. @@ -2241,6 +2241,8 @@ static int hostapd_config_fill(struct ho
  13. sizeof(conf->bss[0]->iface));
  14. } else if (os_strcmp(buf, "bridge") == 0) {
  15. os_strlcpy(bss->bridge, pos, sizeof(bss->bridge));
  16. + if (!bss->wds_bridge[0])
  17. + os_strlcpy(bss->wds_bridge, pos, sizeof(bss->wds_bridge));
  18. } else if (os_strcmp(buf, "bridge_hairpin") == 0) {
  19. bss->bridge_hairpin = atoi(pos);
  20. } else if (os_strcmp(buf, "vlan_bridge") == 0) {
  21. --- a/src/ap/ap_drv_ops.c
  22. +++ b/src/ap/ap_drv_ops.c
  23. @@ -390,8 +390,6 @@ int hostapd_set_wds_sta(struct hostapd_d
  24. return -1;
  25. if (hapd->conf->wds_bridge[0])
  26. bridge = hapd->conf->wds_bridge;
  27. - else if (hapd->conf->bridge[0])
  28. - bridge = hapd->conf->bridge;
  29. return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val,
  30. bridge, ifname_wds);
  31. }