First time here? Check out the FAQ!
THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.
0

proto_new there cannot be two protocols with the same name

  • retag add tags

Hi there!

I am using Wireshark Version 3.0.2 .

I created new protocol dissector and get the same error msg: proto_new there cannot be two protocols with the same name.

I tried with:

MQTTPROTO = Proto.new("mqtt_new", "MQ Telemetry Transport New")

and

MQTTPROTO = Proto("mqtt_new", "MQ Telemetry Transport New")

both options throw exception.

rneustad's avatar
3
rneustad
asked 2021-10-19 12:45:20 +0000
grahamb's avatar
23.8k
grahamb
updated 2021-10-19 13:27:01 +0000
edit flag offensive 0 remove flag close merge delete

Comments

This works fine for me. Do you have more than one .lua file with the same "mqtt_new" name?

cmaynard's avatar cmaynard (2021-10-19 14:21:05 +0000) edit

Any reason why you try to add a disssector to an old version?

hugo.vanderkooij's avatar hugo.vanderkooij (2021-10-19 14:21:24 +0000) edit

@cmaynard I have a single file with this name. Maybe Wireshark use cheche somewhere? I reopen the app but no success

rneustad's avatar rneustad (2021-10-19 14:47:23 +0000) edit

@hugo.vanderkooij I don't understand what do you mean by "add a dissector to an old version". What do you mean? I want that in case of specific code in the packet to process the rest of the packet with costumed MQTT protocol.

if buffer(0,1):uint() == 0x1 then dofile([[path_to_lua_dissector_file]])

What I did wrong?

rneustad's avatar rneustad (2021-10-19 14:49:20 +0000) edit

You're working with Wireshark 3.0.2, which went EOL last year (See https://gitlab.com/wireshark/wireshar...), so @hugo.vanderkooij is wondering why you're not working with a newer version of Wireshark such as 3.4.9, which is currently the latest stable version of Wireshark.

cmaynard's avatar cmaynard (2021-10-19 15:03:25 +0000) edit
add a comment see more comments

1 Answer

0

Where is this being called from?

if buffer(0,1):uint() == 0x1 then dofile([[path_to_lua_dissector_file]])

Because I think that is likely the source of your problem. Your "mqtt_new" dissector is already registered but here you seem to be explicitly loading it again. Don't do that.

cmaynard's avatar
11.1k
cmaynard
answered 2021-10-19 17:59:59 +0000
edit flag offensive 0 remove flag delete link

Comments

Ho! That makes sense! so I should I call this file? The line appears in another protocol which works fine! (All the header is processed as expected, but when the it should load the new mqtt protocol there is an error)

rneustad's avatar rneustad (2021-10-19 18:15:57 +0000) edit

Maybe something like this?

if buffer(0,1):uint() == 0x1 then
    Dissector.get("mqtt_new"):call(tvb, pinfo, tree)
end
cmaynard's avatar cmaynard (2021-10-19 18:22:36 +0000) edit

tvb is just the typical "testy virtual buffer" name. You need to create the actual tvb from your buffer, i.e., the part of the buffer that gets passed to your "mqtt_new" dissector.

cmaynard's avatar cmaynard (2021-10-19 18:41:54 +0000) edit
1

Thank you very much! It works!!!

rneustad's avatar rneustad (2021-10-19 18:43:18 +0000) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer