commit 922e10e82cb7d2c59c7f20fba588755df5181c93
parent c18b1289a5197ee9f99aa2e4559c4c100c42f747
Author: James Prestwood <james.prestwood@linux.intel.com>
Date: Fri, 22 Feb 2019 15:39:39 -0800
ie: add macro for calculating an IE's length
All over the place we do "ie[1] + 2" for getting the IE length. It
is much clearer to use a macro to do this. The macro also checks
for NULL, and returns zero in this case.
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/ie.h b/src/ie.h
@@ -258,6 +258,9 @@ enum ie_rsn_akm_suite {
((akm == IE_RSN_AKM_SUITE_SAE_SHA256) || \
(akm == IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256))
+#define IE_LEN(ie) \
+ (ie) ? (ie)[1] + 2 : 0
+
struct ie_tlv_iter {
unsigned int max;
unsigned int pos;