aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/ieee802_11h.c
blob: e1777bcafa1fdc7800c5a15152fa2b0e893ab3c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * hostapd / IEEE 802.11h
 * Copyright (c) 2005-2006, Devicescape Software, Inc.
 * Copyright (c) 2007, Jouni Malinen <jkmaline@cc.hut.fi>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * Alternatively, this software may be distributed under the terms of BSD
 * license.
 *
 * See README and COPYING for more details.
 */

#include "includes.h"

#include "hostapd.h"


int hostapd_check_power_cap(struct hostapd_data *hapd, u8 *power, u8 len)
{
	unsigned int max_pwr;

	if (len < 2) {
		HOSTAPD_DEBUG(HOSTAPD_DEBUG_MINIMAL,
			      "Too short power capability IE\n");
		return -1;
	}
	max_pwr = power[1];
	if (max_pwr > hapd->iface->sta_max_power)
		return -1;
	return 0;
}