341-mesh-ctrl-iface-channel-switch.patch 948 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --- a/wpa_supplicant/ap.c
  2. +++ b/wpa_supplicant/ap.c
  3. @@ -1363,15 +1363,35 @@ int ap_switch_channel(struct wpa_supplic
  4. #ifdef CONFIG_CTRL_IFACE
  5. +
  6. +static int __ap_ctrl_iface_chanswitch(struct hostapd_iface *iface,
  7. + struct csa_settings *settings)
  8. +{
  9. +#ifdef NEED_AP_MLME
  10. + if (!iface || !iface->bss[0])
  11. + return 0;
  12. +
  13. + return hostapd_switch_channel(iface->bss[0], settings);
  14. +#else
  15. + return -1;
  16. +#endif
  17. +}
  18. +
  19. +
  20. int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *pos)
  21. {
  22. struct csa_settings settings;
  23. int ret = hostapd_parse_csa_settings(pos, &settings);
  24. + if (!(wpa_s->ap_iface && wpa_s->ap_iface->bss[0]) &&
  25. + !(wpa_s->ifmsh && wpa_s->ifmsh->bss[0]))
  26. + return -1;
  27. +
  28. + ret = __ap_ctrl_iface_chanswitch(wpa_s->ap_iface, &settings);
  29. if (ret)
  30. return ret;
  31. - return ap_switch_channel(wpa_s, &settings);
  32. + return __ap_ctrl_iface_chanswitch(wpa_s->ifmsh, &settings);
  33. }
  34. #endif /* CONFIG_CTRL_IFACE */