Wireshark-dev: Re: [Wireshark-dev] Duplicate dissectors error

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Mon, 29 Aug 2016 17:31:38 -0700
On Aug 29, 2016, at 3:59 PM, Juan Jose Martin Carrascosa <juanjo@xxxxxxx> wrote:

> Hi everybody,
> 
> I am adding plugins to my Wireshark installation, so they register themselves in the table rtps.type_name (created in packet-rtps.c).
> 
> Duplicate dissectors (null) and (null) for protocol Custom in dissector table rtps.type_name
> Duplicate dissectors (null) and (null) for protocol Custom_A in dissector table rtps.type_name
> Duplicate dissectors (null) and (null) for protocol Custom_A in dissector table rtps.type_name
> Duplicate dissectors (null) and (null) for protocol Custom_A in dissector table rtps.type_name
> Duplicate dissectors (null) and (null) for protocol (none) in dissector table rtps.type_name
> 
> That error message comes from dissector_add_for_decode_as(). Actually, I don't expect my dissectors to be called from decode_as...
> 
> Few things:
> 
> 1) This message is printed to stderr instead of using any Logging API. Should we change that?

Well, that would first involve having a logging API to use.

For command-line based programs such as TShark, it would print them to stderr; for Wireshark, it could put them in an "error console" window that the user could pop up.  (On some OSes, output to stderr from GUI programs shows up in a log window, but that's not guaranteed.)

> 2) Which is the right way to design this so I don't get those errors? I could change the value DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE to DISSECTOR_TABLE_ALLOW_DUPLICATE when I create the rtps.type_name table but I'd prefer to solve the issue instead of patching it.

So what's the code that's registering your plugins (the reg_handoff routines for them)?