Dissector: how to get wlan radiotap data from upper layers?
I am creating a custom dissector that filters a specific ethertype and dissects the encapsulated data:
custom_handle = create_dissector_handle(dissect_custom, proto_custom);
dissector_add_uint("ethertype", CUSTOM_PROTO_ETHERTYPE, custom_handle);
The dissector works, but among other information, I have a requirement to add the packet RSSI to the Info column. The RSSI is in the radiotap header, so the question is how can I get it?
I have tried the signal fields in the packet_info struct, like: gint8 rssi = pinfo->pseudo_header->ieee_802_11.signal_dbm;
, but they are always zero (why?). I have also searched how to get data from upper layers, but I have not found any clear information either (replies to questions asking this always show a workaround to avoid doing it, so I suspect there is a good reason to avoid this approach).
After a lot of reading, I do not know if I have to create my own radiotap dissector variant and use the p_add_proto_data()
function, or if I have to register a tap interface, or maybe I can somehow get the info from pinfo->rec
, or if I have to somehow register the dissector at a lower level and manually call the dissectors for the intermediate levels... I am really confused, how can I get the radiotap info?