DissectorTable.get("mpls.label"):get_dissector(2097) returns nil
I'm attempting to build my first LUA dissector. Specifically I'm writing something to decode PWE3 ControlWords (RFC4385) in more detail than the default one. The dissector I've written works fine but I need to pass the payload to an ethernet dissector.
https://www.wireshark.org/docs/wsdg_h... 11.3 indicates that this should be possible
In another blog I found I should use a call of the form:
DissectorTable.get("mpls.label"):get_dissector(2097):call(buffer(4):tvb(), pinfo, tree)
But this just gives me LUA errors "attempt to index a null value"
I tried this:
local my_table = DissectorTable.list()
for k,v in pairs(my_table) do
print(k.." = "..v)
end
Which proved that the Dissector Table has entries
And this :
local my_dissectors = Dissector.list()
for k,v in pairs(my_dissectors) do
print(k.." = "..v)
end
Which shows:
...
2097 = pw_eth_nocw
...
So I think I must be pretty close.
Any help would be much appreciated
end
Section 10.3. Example: Dissector written in Lua in the WSDG has an example.
You might want to break down your call() into the component pieces and print the contents of each before the call statement to see if the nil value is displayed.
Or add
nil
checks for components: