Wireshark-dev: Re: [Wireshark-dev] Unable to detect custom protocol dissector
expert_module_t* expert_geonw; module_t *geonw_module; proto_geonw = proto_register_protocol("GeoNetworking", "GNW", "gnw"); geonw_handle = register_dissector("gnw", dissect_geonw, proto_geonw); proto_register_field_array(proto_geonw, hf_geonw, array_length(hf_geonw)); proto_register_subtree_array(ett, array_length(ett)); expert_geonw = expert_register_protocol(proto_geonw); expert_register_field_array(expert_geonw, ei, array_length(ei));
___________________________________________________________________________CONFIDENTIALITY NOTICE: This message is the property of International Game Technology PLC and/or its subsidiaries and may contain proprietary, confidential or trade secret information. This message is intended solely for the use of the addressee. If you are not the intended recipient and have received this message in error, please delete this message from your system. Any unauthorized reading, distribution, copying, or other use of this message or its attachments is strictly prohibited.I’m not sure what you’re trying to do, but there’s already a Wireshark built-in dissector for GeoNetworking[1].
If you’re trying to replace it for some reason, then you may either need to disable that one or remove it completely. And if you’re trying to implement in Lua, then you’ll need to register it as a heuristic dissector using register_heuristic[2]. However, it seems that there might be a bug with respect to this function[3], as the following simple Lua script seems to indicate:
local p_gnw = Proto("gnwHdr", "GeoNetworkingHdr")
function p_gnw.dissector(tvbuf, pinfo, tree)
local ethertype = tvbuf(12, 2):uint()
if ethertype == 35143 then
pinfo.cols.protocol:set("GNW")
return true
else
return false
end
end
p_gnw.register_heuristic("eth", p_gnw.dissector)
When Wireshark is started with this gnw.lua script loaded, the following error message is encountered:
Lua: Error during loading:
path\to\gnw.lua:14:bad
argument #1 to ‘register_heuristic’ (userdata expected, got string)
stack traceback:
[C]: in function ‘register_heuristic’
path\to\gnw.lua:14:
in main chunk
- Chris
[2]: https://www.wireshark.org/docs/wsdg_html_chunked/lua_module_Proto.html (Section 11.6.5.3)
From: Wireshark-dev <wireshark-dev-bounces@xxxxxxxxxxxxx> On Behalf Of sandip gangakhedkar
Sent: Wednesday, February 12, 2020 4:46 PM
To: wireshark-dev@xxxxxxxxxxxxx
Subject: [Wireshark-dev] Unable to detect custom protocol dissector
Hi,
I am using a Custom protocol dissector (Lua script) for the GeoNetworking header. I have build wireshark 3.2.1 from source on Ubuntu 18.04 and placed the Lua script in the Global plugins directory. However, the script fails when to find the Geonetworking protocol when I invoke it in the script:
Dissector.get("gnw"):call(newTvb, pkt, root)
So I tried another approach:
gnw_dissector = DissectorTable.get("ethertype"):get_dissector(35143)
The protocol gnw (GeoNetworking) corresponds to an EtherType of 35143 in my Wireshark protocols configuration. However, this also fails to find the "gnw" protocol.
How can I get wireshark to detect the GeoNetworking protocol from my custom Lua script?
Thanks in advance.
Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives: https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
- Follow-Ups:
- Re: [Wireshark-dev] Unable to detect custom protocol dissector
- From: Anders Broman
- Re: [Wireshark-dev] Unable to detect custom protocol dissector
- References:
- [Wireshark-dev] Unable to detect custom protocol dissector
- From: sandip gangakhedkar
- Re: [Wireshark-dev] Unable to detect custom protocol dissector
- From: Maynard, Chris
- [Wireshark-dev] Unable to detect custom protocol dissector
- Prev by Date: Re: [Wireshark-dev] Unable to detect custom protocol dissector
- Next by Date: Re: [Wireshark-dev] Unable to detect custom protocol dissector
- Previous by thread: Re: [Wireshark-dev] Unable to detect custom protocol dissector
- Next by thread: Re: [Wireshark-dev] Unable to detect custom protocol dissector
- Index(es):