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.
This commit is contained in:
James Prestwood 2019-02-22 15:39:39 -08:00 committed by Denis Kenzior
parent c18b1289a5
commit 922e10e82c
1 changed files with 3 additions and 0 deletions

View File

@ -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;