subtree:add displays "<MISSING>" value
Hello,
I am attempting to write a simple Lua dissector that displays a BLE advertisement's raw payload data, nothing fancy. This raw payload data is already defined with the field: "btcommon.eir_ad.entry.data". I want to use this field instead of manually parsing the whole tvb buffer from the dissector callback function.
However, after running the script on some example vendor/manufacturer-specific advertisements, the raw payload data is returned with the value <missing>. I tried diagnosing using the console, but it seems like printing the value is working.
I am using a nRF BLE Sniffer Dongle & the related capture plugin to capture the BLE advertisements, so this is why the "btcommon.eir_ad.entry.data" field is being used, and where the data is supposed to be coming from. This may be the issue - is it possible to reference a field rather than the whole tvb buffer?
Please see the below code:
local msgData = Field.new('btcommon.eir_ad.entry.data')
local bgNotificationData = Proto('bgadv', 'Background Notification Data')
local rawMessage = ProtoField.bytes('bgadv.data')
bgNotificationData.fields =
{
rawMessage,
}
function bgNotificationData.dissector(tvb, pinfo, tree)
local btMsgData = msgData()
local subtree = tree:add(bgNotificationData, btMsgData, "Message Data")
subtree:add(rawMessage, tostring(btMsgData))
end
register_postdissector(bgNotificationData)
I have a feeling the issue is in the below line:
subtree:add(rawMessage, tostring(btMsgData))
But I can't find any info about subtree:add returning the value <missing>. tostring(btMsgData) returns the string that I am looking for... any help would be great, TIA!
Sample capture with this field attached to
12103: Nordic dll dissector plugin makes Wireshark crash during startup