summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-03-09 23:42:21 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2017-04-10 13:37:24 +0200
commit961d572472dce5b7ae0cae7d614f66548322cdbc (patch)
tree14351c808d798ec94bc624da2695195af83632d1
parent0c6097ccbe0af832eaab50beb637a8c75108fd46 (diff)
downloadNetworkManager-961d572472dce5b7ae0cae7d614f66548322cdbc.tar.gz
wifi: rename ieee80211_eid capability defines
IEEE_80211_IE_VHT_CAP has zero hits searching the internet. WLAN_EID_VHT_CAPABILITY is how the same define is called by kernel's "include/linux/ieee80211.h". Use the same name as kernel. Also, collect the maximum of @max_rate.
-rw-r--r--src/devices/wifi/nm-wifi-ap.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/devices/wifi/nm-wifi-ap.c b/src/devices/wifi/nm-wifi-ap.c
index 99b8681f06..a923cf245a 100644
--- a/src/devices/wifi/nm-wifi-ap.c
+++ b/src/devices/wifi/nm-wifi-ap.c
@@ -680,8 +680,9 @@ get_max_rate_vht (guint32 vht_cap, guint16 tx_map)
return 0;
}
-#define IEEE_80211_IE_HT_CAP 45
-#define IEEE_80211_IE_VHT_CAP 191
+/* Management Frame Information Element IDs, ieee80211_eid */
+#define WLAN_EID_HT_CAPABILITY 45
+#define WLAN_EID_VHT_CAPABILITY 191
static guint32
get_max_rate (const guint8 *bytes, gsize len)
@@ -700,11 +701,14 @@ get_max_rate (const guint8 *bytes, gsize len)
if (elem_len > len)
return 0;
- if (id == IEEE_80211_IE_HT_CAP)
- max_rate = get_max_rate_ht (*bytes, bytes+3);
-
- if (id == IEEE_80211_IE_VHT_CAP)
- max_rate = get_max_rate_vht (*bytes, *(bytes+8));
+ switch (id) {
+ case WLAN_EID_HT_CAPABILITY:
+ max_rate = NM_MAX (max_rate, get_max_rate_ht (*bytes, bytes+3));
+ break;
+ case WLAN_EID_VHT_CAPABILITY:
+ max_rate = NM_MAX (max_rate, get_max_rate_vht (*bytes, *(bytes+8)));
+ break;
+ }
len -= elem_len;
bytes += elem_len;