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

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


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.

permanent link

answered 18 Oct '16, 01:50

Lekensteyn's gravatar image

Lekensteyn
2.2k3724
accept rate: 30%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×431
×87

question asked: 17 Oct '16, 07:13

question was seen: 1,507 times

last updated: 18 Oct '16, 01:51

p​o​w​e​r​e​d by O​S​Q​A