Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Duplicate dissectors (anonymous) and (anonymous) for protoco

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 25 Oct 2017 14:29:14 -0700
On Oct 25, 2017, at 1:44 PM, John Dill <John.Dill@xxxxxxxxxxxxxxxxx> wrote:

> I just happened to turn on console printing to troubleshoot a different problem and I'm getting a couple of interesting messages when I change my protocol preferences.
>  
> Duplicate dissectors (anonymous) and (anonymous) for protocol xxx in dissector table tcp.port

	...

> I have a proto_reg_handoff_xxx that creates a couple of TCP port dissector handles using 'dissector_add_uint("tcp.port", MY_TCP_PORT, tcp_handle)',

Why *two* handles?  You can register the handle tcp_handle twice with two different TCP ports.

If the format of the packets is the same for both ports, you *should* use the same dissector handle; if *that* causes an error, that's a bug.

If the format of the packets is *not* the same for both ports, then you should use different dissector handles - with different dissector functions - *and* ensure that the dissectors have different names (which means they have to *have* names, so use "register_dissector()" rather than "create_dissector_handle()" to create the handles), so that, as Michael Mann noted, the user can choose one or the other of them for "Decode As...".