ieee80211_ra...terator_init(9)
π ieee80211_radiotap_iterator_init β radiotap parser iterator initialization
okay so bestie, this one's from the Kernel API Manual, page ieee80211_ra...terator_init(9), and it's literally the glow-up ritual for your radiotap parser iterator. let's get into it π
β¨ NAME β¨
ieee80211_radiotap_iterator_init β radiotap parser iterator initialization
like. the setup. the origin story. the "get your iterator ready before the real work starts" moment π
π¦ SYNOPSIS π¦
int ieee80211_radiotap_iterator_init (struct ieee80211_radiotap_iterator
*iterator , struct ieee80211_radiotap_header *radiotap_header , int
max_length , const struct ieee80211_radiotap_vendor_namespaces *vns );
no cap, that's the whole signature. four args, one int coming back at you π«
πΈ ARGUMENTS πΈ
iteratorβ theradiotap_iteratoryou're initializing. this is the main character of the whole operation, honestly πradiotap_headerβ the radiotap header you're going to parse. the thing being read. iconic.max_lengthβ total length we can parse into (eg, whole packet length). like, how far you're allowed to go π«Άvnsβ vendor namespaces to parse. the little namespace situation π
π₯ RETURN π₯
0 or a negative error code if there is a problem.
that's it. 0 = slay, negative = uh oh π
β DESCRIPTION β
So this function initializes an opaque iterator struct which can then be passed to ieee80211_radiotap_iterator_next to visit every radiotap argument which is present in the header. It knows about extended present headers and handles them. fr fr, it's got you on the extended-present-header front β no manual fiddling required β¨
π§ how to use it, bestie
- call
__ieee80211_radiotap_iterator_initto init a semi-opaque iterator structieee80211_radiotap_iterator(no need to init the struct beforehand) checking for a good0return code. - then loop calling
__ieee80211_radiotap_iterator_next... it returns either0,-ENOENTif there are no more args to parse, or-EINVALif there is a problem.
the iterator's this_arg member points to the start of the argument associated with the current argument index that is present, which can be found in the iterator's this_arg_index member. This arg index corresponds to the IEEE80211_RADIOTAP_... defines. iykyk π
π radiotap header length
You can find the CPU-endian total radiotap header length in iterator->max_length after executing ieee80211_radiotap_iterator_init successfully. so like, once it actually works, the length's right there waiting for you π
β οΈ Alignment Gotcha
You must take care when dereferencingiterator.this_argfor multibyte types... the pointer is not aligned. Useget_unaligned((type *)iterator.this_arg)to dereferenceiterator.this_argfor type "type" safely on all arches.
not me warning you twice: the pointer is not aligned, bestie. do not just cast and deref like it's nothing. get_unaligned is the safe route on all arches, periodt π
π example code
See Documentation/networking/radiotap-headers.rst β go look, it's giving tutorial energy π
π SEE ALSO π
- Kernel file
./net/wireless/radiotap.c ieee80211_radiotap_iterator_next(9)
okay that's the whole page π«Ά this gem lives in ./net/wireless, dated October 2026, and it's from the Kernel API Manual β version vibes: ieee80211_ra...terator_init(9). go init that iterator, bestie, you're gonna eat ππ«
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms