Ethereal-dev: [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: HelgeKruse@xxxxxxxxxxx (Helge Kruse)
Date: Mon, 10 Jan 2005 22:42:59 +0100

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?

 

/Helge