050-Fix-OpenWrt-13156.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. From 26cd9bafc1d25e602952ee86cd2a5b8c3a995490 Mon Sep 17 00:00:00 2001
  2. From: Stijn Tintel <[email protected]>
  3. Date: Fri, 28 Jul 2023 16:27:47 +0300
  4. Subject: [PATCH] Revert "Do prune_association only after the STA is
  5. authorized"
  6. Commit e978072baaca ("Do prune_association only after the STA is
  7. authorized") causes issues when an STA roams from one interface to
  8. another interface on the same PHY. The mt7915 driver is not able to
  9. handle this properly. While the commits fixes a DoS, there are other
  10. devices and drivers with the same limitation, so revert to the orginal
  11. behavior for now, until we have a better solution in place.
  12. Ref: https://github.com/openwrt/openwrt/issues/13156
  13. Signed-off-by: Stijn Tintel <[email protected]>
  14. ---
  15. src/ap/hostapd.c | 14 +++++++++++---
  16. src/ap/sta_info.c | 3 ---
  17. 2 files changed, 11 insertions(+), 6 deletions(-)
  18. --- a/src/ap/hostapd.c
  19. +++ b/src/ap/hostapd.c
  20. @@ -4110,6 +4110,8 @@ int hostapd_remove_iface(struct hapd_int
  21. void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
  22. int reassoc)
  23. {
  24. + int mld_assoc_link_id = -1;
  25. +
  26. if (hapd->tkip_countermeasures) {
  27. hostapd_drv_sta_deauth(hapd, sta->addr,
  28. WLAN_REASON_MICHAEL_MIC_FAILURE);
  29. @@ -4117,10 +4119,16 @@ void hostapd_new_assoc_sta(struct hostap
  30. }
  31. #ifdef CONFIG_IEEE80211BE
  32. - if (ap_sta_is_mld(hapd, sta) &&
  33. - sta->mld_assoc_link_id != hapd->mld_link_id)
  34. - return;
  35. + if (ap_sta_is_mld(hapd, sta)) {
  36. + if (sta->mld_assoc_link_id == hapd->mld_link_id) {
  37. + mld_assoc_link_id = sta->mld_assoc_link_id;
  38. + } else {
  39. + return;
  40. + }
  41. + }
  42. #endif /* CONFIG_IEEE80211BE */
  43. + if (mld_assoc_link_id != -2)
  44. + hostapd_prune_associations(hapd, sta->addr, mld_assoc_link_id);
  45. ap_sta_clear_disconnect_timeouts(hapd, sta);
  46. ap_sta_clear_assoc_timeout(hapd, sta);
  47. --- a/src/ap/sta_info.c
  48. +++ b/src/ap/sta_info.c
  49. @@ -1554,9 +1554,6 @@ bool ap_sta_set_authorized_flag(struct h
  50. mld_assoc_link_id = -2;
  51. }
  52. #endif /* CONFIG_IEEE80211BE */
  53. - if (mld_assoc_link_id != -2)
  54. - hostapd_prune_associations(hapd, sta->addr,
  55. - mld_assoc_link_id);
  56. sta->flags |= WLAN_STA_AUTHORIZED;
  57. } else {
  58. sta->flags &= ~WLAN_STA_AUTHORIZED;