Ethereal-dev: [Ethereal-dev] Fix for WTP dissector

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

Date: Mon, 27 May 2002 12:00:30 +0300
Current code outputs "WSP Unknown PDU type" on Info and "PDU Type: Unknown" on protocol tree when 
the datagram contains multiple (concatenated) WTP PDU's. There is an length check to see PDU has
upper layer (WSP) data, but this check works only for last PDU of concatenated list.
Following patch fixes the problem of WTP PDU's not containing user data.

Regards,

Kari



% diff -u packet-wtp.c-1.32 packet-wtp.c
--- packet-wtp.c-1.32   Sun Apr 21 19:07:01 2002
+++ packet-wtp.c        Mon May 27 11:09:59 2002
@@ -437,7 +437,8 @@
           it, if possible, summarize what's in the packet, so that a user looking
           at the list of packets can tell what type of packet it is. */
        if (check_col(pinfo->cinfo, COL_INFO) &&
-           (tvb_length_remaining(tvb, offCur + cbHeader + vHeader) <= 0)) {
+           ((tvb_length_remaining(tvb, offCur + cbHeader + vHeader) <= 0) || 
+             (pdut == ACK) || (pdut==NEGATIVE_ACK) || (pdut==ABORT)) ) {
 #ifdef DEBUG
                fprintf( stderr, "dissect_wtp: (6) About to set info_col header to %s\n", szInfo );
 #endif
@@ -574,10 +575,11 @@
 #endif
        }
        /*
-        * Any remaining data ought to be WSP data,
+        * Any remaining data ought to be WSP data (if not WTP ACK, NACK or ABORT pdu),
         * so hand off (defragmented) to the WSP dissector
         */
-       if (tvb_length_remaining(tvb, offCur + cbHeader + vHeader) > 0)
+       if ( (tvb_length_remaining(tvb, offCur + cbHeader + vHeader) > 0) && 
+             ! ((pdut==ACK) || (pdut==NEGATIVE_ACK) || (pdut==ABORT)))
        {
                int     dataOffset = offCur + cbHeader + vHeader;
                guint32 dataLen = tvb_length_remaining(tvb, offCur + cbHeader + vHeader);