This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Renaming of “eth” dissector to “eth_withoutfcs”

1

Renaming of "eth" dissector to "eth_withoutfcs"

I asked about the usage of "eth" and how it was not working. Your response was prompt and timely. Thank you.

For compatibility purposes I would like to know in what version this renaming occurred. I would like my dissector to run in earlier versions and I assume I can detect the current version of Wireshark and ask for the properly named ethernet dissector based on that.

Thanks Randy

So it has been suggested that I try one then then the other. I have done so with the following code.

local default_dissector = Dissector.get( "eth" )

if ( default_dissector ~= nil ) then

default_dissector:call( tvb , pinfo , tree )

else

local default_dissector = Dissector.get( "eth_withoutfcs" )

if ( default_dissector ~= nil ) then

    default_dissector:call( tvb , pinfo , tree )

end

end

Here is the hard error I get. Am I doing something wrong in the code up above. Lua is very new to me.

Lua Error: [string "D:\Applications\ThirdParty\Wireshark\Install…."]:1973: bad argument #1 to 'get' (Dissector_get: No such dissector)
[Expert Info (Error/Undecoded): Lua Error: [string "D:\Applications\ThirdParty\Wireshark\Install…."]:1973: bad argument #1 to 'get' (Dissector_get: No such dissector)]
[Lua Error: [string "D:\Applications\ThirdParty\Wireshark\Install…."]:1973: bad argument #1 to 'get' (Dissector_get: No such dissector)]
[Severity level: Error]
[Group: Undecoded]

asked 17 Oct ‘16, 07:13

Randy%20Rohrbach's gravatar image

Randy Rohrbach
21225
accept rate: 0%

edited 18 Oct ‘16, 01:51

Lekensteyn's gravatar image

Lekensteyn
2.2k3724


One Answer:

1

At the moment the Lua API throws errors whenever something unusual happens. This shows nicely in the tree, but it is not natural to the Lua programmer. As a workaround you can use pcall to catch the error and prevent it from propagating:

local success, eth_dissector = pcall(Dissector.get, "eth_withoutfcs")
if not success or not eth_dissector then
    eth_dissector = Dissector.get("eth")
end

Strictly speaking, or not eth_dissector is not necessary, but maybe the API will change to make it return nil for the above reasons and then you have forward compatibility.

answered 18 Oct '16, 01:50

Lekensteyn's gravatar image

Lekensteyn
2.2k3724
accept rate: 30%