aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2011-12-17 10:41:00 (GMT)
committerJouni Malinen <j@w1.fi>2011-12-17 10:41:00 (GMT)
commitc84b868a712d8ff2a9ce229480eca2192d334417 (patch)
tree73989f5ba2535c1654ca16ff984d5bb258dd5c28 /src
parent5d06163714df56d3f4ffc9e9a8db025c4e07bbb4 (diff)
downloadhostap-c84b868a712d8ff2a9ce229480eca2192d334417.zip
hostap-c84b868a712d8ff2a9ce229480eca2192d334417.tar.gz
hostap-c84b868a712d8ff2a9ce229480eca2192d334417.tar.bz2
Make hostapd_eid_wmm_valid() return more logical return values
Return 1/0 instead 0/-1 to indicate valid/invalid element so that the if statement makes more sense with !wmm_valid(). Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src')
-rw-r--r--src/ap/ieee802_11.c2
-rw-r--r--src/ap/wmm.c14
2 files changed, 9 insertions, 7 deletions
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 51a95c4..a1a7270 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -555,7 +555,7 @@ static u16 check_wmm(struct hostapd_data *hapd, struct sta_info *sta,
if (wmm_ie && hapd->conf->wmm_enabled) {
struct wmm_information_element *wmm;
- if (hostapd_eid_wmm_valid(hapd, wmm_ie, wmm_ie_len)) {
+ if (!hostapd_eid_wmm_valid(hapd, wmm_ie, wmm_ie_len)) {
hostapd_logger(hapd, sta->addr,
HOSTAPD_MODULE_WPA,
HOSTAPD_LEVEL_DEBUG,
diff --git a/src/ap/wmm.c b/src/ap/wmm.c
index 1d05c4f..d21c82f 100644
--- a/src/ap/wmm.c
+++ b/src/ap/wmm.c
@@ -98,9 +98,11 @@ u8 * hostapd_eid_wmm(struct hostapd_data *hapd, u8 *eid)
}
-/* This function is called when a station sends an association request with
- * WMM info element. The function returns zero on success or non-zero on any
- * error in WMM element. eid does not include Element ID and Length octets. */
+/*
+ * This function is called when a station sends an association request with
+ * WMM info element. The function returns 1 on success or 0 on any error in WMM
+ * element. eid does not include Element ID and Length octets.
+ */
int hostapd_eid_wmm_valid(struct hostapd_data *hapd, const u8 *eid, size_t len)
{
struct wmm_information_element *wmm;
@@ -110,7 +112,7 @@ int hostapd_eid_wmm_valid(struct hostapd_data *hapd, const u8 *eid, size_t len)
if (len < sizeof(struct wmm_information_element)) {
wpa_printf(MSG_DEBUG, "Too short WMM IE (len=%lu)",
(unsigned long) len);
- return -1;
+ return 0;
}
wmm = (struct wmm_information_element *) eid;
@@ -121,10 +123,10 @@ int hostapd_eid_wmm_valid(struct hostapd_data *hapd, const u8 *eid, size_t len)
if (wmm->oui_subtype != WMM_OUI_SUBTYPE_INFORMATION_ELEMENT ||
wmm->version != WMM_VERSION) {
wpa_printf(MSG_DEBUG, "Unsupported WMM IE Subtype/Version");
- return -1;
+ return 0;
}
- return 0;
+ return 1;
}