ieee802_11h.c 788 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * hostapd / IEEE 802.11h
  3. * Copyright (c) 2005-2006, Devicescape Software, Inc.
  4. * Copyright (c) 2007, Jouni Malinen <j@w1.fi>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * Alternatively, this software may be distributed under the terms of BSD
  11. * license.
  12. *
  13. * See README and COPYING for more details.
  14. */
  15. #include "includes.h"
  16. #include "hostapd.h"
  17. int hostapd_check_power_cap(struct hostapd_data *hapd, u8 *power, u8 len)
  18. {
  19. unsigned int max_pwr;
  20. if (len < 2) {
  21. wpa_printf(MSG_DEBUG, "Too short power capability IE");
  22. return -1;
  23. }
  24. max_pwr = power[1];
  25. if (max_pwr > hapd->iface->sta_max_power)
  26. return -1;
  27. return 0;
  28. }