Ethereal-dev: Re: [Ethereal-dev] dissector_add problem

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Tue, 11 Jan 2005 02:31:24 +0100
Helge Kruse wrote:

Hello,

I write a dissector for a protocol on UDP. In the plugin_init function I call

myProtocol = proto_register_protocol("My Genial Protocol", "MyProtocol", "myproto");

I also register the subtree_array, and the subtree_arrays. In the plugin_reg_handoff function, I call this:

hDissector = create_dissector_handle(DissectorFunc, myProtocol); dissector_add("udp.port", 2002, hDissector); dissector_add("udp.port", 2001, hDissector);

The DissectorFunc is called for all UDP packets from/to UDP port 2001 but for none UDP packet from/to port 2002. This does not change, when I exchange the two dissector_add calls or remove the first call.

When I select “Decode As” and assign the protocol to the UDP port 2002, the DissectorFunc is called and the packet is displayed as expected.

I have no clue, what is wrong. Can you give advise?

It seems to be ok what you are doing, some other dissectors are doing it the same way.

I would think you have a bug somewhere at registering the stuff in your proto_register_... function, so Ethereal's internal data gets a bit confused.

You may try to reduce the stuff in your registering function to a minimum and see if the problem still remains.

Regards, ULFL