Wireshark mailing list archives

Re: How to register a UDP src port for one protocol and dst port for another?


From: Guy Harris <guy () alum mit edu>
Date: Tue, 25 Nov 2014 11:48:53 -0800


On Nov 24, 2014, at 5:39 PM, Andy Howell <andy () gamubaru com> wrote:

I'm writing some dissectors for a set of UDP based protocols that use the same port number
as the source port in one direction, and the destination port in the other direction. Its
a different protocol going each way.

It seems that I can only call dissector_add_uint with "udp.port", not "udp.srcport" or
"udp.dstport". Is that correct?

Yes.

Ideally I like to register a different dissector for each direction. Is that not possible?

No.

But what you can do is register a dissector with that port number and then, in the dissector, check whether 
pinfo->match_uint is equal to pinfo->srcport (in which case the packet came *from* that port) or pinfo->destport (in 
which case the packet was sent *to* that port).

(Solving this problem, regardless of what mechanisms are available, if the source and destination port numbers are the 
same is left as an exercise to the reader.)

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: