Ethereal-dev: Re: Re(2): [Ethereal-dev] get a protocol id from port number

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

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Tue, 9 Jan 2001 00:40:58 -0800
On Mon, Jan 08, 2001 at 11:48:59PM +0100, Michael Tüxen wrote:
> I'm working on the SCTP/M3UA interaction. If the SCTP dissector does not
> know the upper layer protocol it dissects the payload inside a data_chunk
> inside the sctp packet. If there is an M3UA payload

How does the SCTP dissector determine whether there's M3UA payload or
not?  Is it just checking the Payload Protocol Identifier field in a
DATA chunk?

If so, perhaps the right way to handle this is to create a dissector
table "sctp.ppi" (or whatever), have the M3UA dissector register itself
in that table, and have the SCTP dissector call "dissector_try_port()"
on the Payload Protocol Identifier.  If "dissector_try_port()" returns
false rather than true, it'd dissect the payload as data.

That wouldn't work right at the moment; however, I've just checked in
changes to have all dissectors that register themselves in a dissector
table pass the protocol ID of their protocol as an argument to
"dissector_add()", so if I were to change "dissector_try_port()" to
ignore dissectors if the protocol is disabled (rather than calling
"dissect_data()"), that would cause "dissectory_try_port()" to return
false.

(It would also, for example, allow some *other* dissector to dissect the
frame, which could come in handy for cases where both source and
destination ports have dissectors associated with them - if Ethereal
picks the wrong dissector, disabling the wrong one would be one way to
get it to pick the right dissector, although it's a bit of a brute-force
way of doing it, and having a GUI option to explicitly choose a
different dissector - which might, by default, select the "other port's"
dissector if both ports have dissectors associated with them - might be
better.)