Bug 6874 - New dissector: performance co-pilot protocol
Summary: New dissector: performance co-pilot protocol
Status: RESOLVED FIXED
Alias: None
Product: Wireshark
Classification: Unclassified
Component: GTK+ UI (show other bugs)
Version: Git
Hardware: All All
: Low Enhancement (vote)
Target Milestone: ---
Assignee: Bugzilla Administrator
URL:
Depends on:
Blocks:
 
Reported: 2012-02-26 18:59 UTC by Ryan Doyle
Modified: 2012-03-28 01:49 UTC (History)
1 user (show)

See Also:


Attachments
Patch implementing PCP protocol dissection (64.68 KB, patch)
2012-02-26 18:59 UTC, Ryan Doyle
Details
Additional patch to properly decode the results (8.94 KB, patch)
2012-02-27 15:09 UTC, Ryan Doyle
Details
Updated patch for inclusion (70.85 KB, patch)
2012-03-04 02:47 UTC, Ryan Doyle
Details
PCP Protocol dissector - remove use of proto_tree_add_(init|uint...) (70.06 KB, patch)
2012-03-04 20:53 UTC, Ryan Doyle
Details
PM_TYPE case fallthough (865 bytes, patch)
2012-03-27 19:13 UTC, Ryan Doyle
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Doyle 2012-02-26 18:59:31 UTC
Created attachment 7902 [details]
Patch implementing PCP protocol dissection

Build Information:
TShark 1.7.1 (SVNRev 41198 from /trunk)

Copyright 1998-2012 Gerald Combs <gerald@wireshark.org> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled (64-bit) with GLib 2.24.1, with libpcap, with libz 1.2.3.3, without
POSIX capabilities, without SMI, without c-ares, without ADNS, without Lua,
without Python, without GnuTLS, without Gcrypt, with MIT Kerberos, without
GeoIP.

Running on Linux 2.6.32-33-generic, with locale en_AU.UTF-8, with libpcap
version 1.0.0, with libz 1.2.3.3.

Built using gcc 4.4.3.

--
Attached patch implements dissection of the Performance Co-Pilot (PCP) protocol.

Further details and sample capture file: http://wiki.wireshark.org/PCP
This sample capture contains all PDUs, and fuzz-test.sh has been run successfully for over 20000 iterations.
Comment 1 Ryan Doyle 2012-02-27 15:09:59 UTC
Created attachment 7904 [details]
Additional patch to properly decode the results

Additional patch. Fixes the results to be displayed properly for each type of instance(int/uint/init64/uint64/etc...)
Comment 2 Alexis La Goutte 2012-02-28 01:44:37 UTC
Hi,

Quick Review :
Missing modification for Cmake (epan/CmakeFiles.txt)
Use FALSE / TRUE for encoding attribut of proto_tree_add_item is obsolete, you need to use ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN (there is the fix-encoding-args tools for help you)
Add also modeline information 

And for finish, there is some Clang Warning : 
packet-pcp.c:526:2: warning: Value stored to 'bits_offset' is never read
packet-pcp.c:1061:2: warning: Value stored to 'bits_offset' is never read
packet-pcp.c:1089:10: warning: Value stored to 'bits_offset' during its initialization is never read
packet-pcp.c:1140:2: warning: Value stored to 'bits_offset' is never read
packet-pcp.c:1475:5: warning: Value stored to 'offset' is never read
packet-pcp.c:1438:6: warning: Value stored to 'offset' is never read
packet-pcp.c:1483:5: warning: Value stored to 'offset' is never read
packet-pcp.c:1451:5: warning: Value stored to 'offset' is never read
packet-pcp.c:1463:5: warning: Value stored to 'offset' is never read
packet-pcp.c:1447:5: warning: Value stored to 'offset' is never read
packet-pcp.c:1491:5: warning: Value stored to 'offset' is never read
packet-pcp.c:1471:5: warning: Value stored to 'offset' is never read
packet-pcp.c:1459:5: warning: Value stored to 'offset' is never read
packet-pcp.c:1467:5: warning: Value stored to 'offset' is never read
packet-pcp.c:1487:5: warning: Value stored to 'offset' is never read
packet-pcp.c:1455:5: warning: Value stored to 'offset' is never read
packet-pcp.c:1443:5: warning: Value stored to 'offset' is never read
packet-pcp.c:1436:6: warning: Value stored to 'offset' is never read
packet-pcp.c:1428:5: warning: Value stored to 'offset' is never read
packet-pcp.c:1479:5: warning: Value stored to 'offset' is never read
packet-pcp.c:1508:2: warning: Value stored to 'offset' is never read
Comment 3 Alexis La Goutte 2012-02-28 01:45:31 UTC
Comment on attachment 7904 [details]
Additional patch to properly decode the results

And about this patch

Why use proto_tree_add_int/float...

and not directly proto_tree_add_item?
Comment 4 Ryan Doyle 2012-03-04 02:47:43 UTC
Created attachment 7944 [details]
Updated patch for inclusion

Thanks for the review so far

I've uploaded a new patch for review which obsoletes the existing two (is this the preferred way or would you prefer patch sets?).

I've changed all instances proto_tree_add_item to use the ENC_* constants. Regarding the Clang warnings, I've changed most of the decoding routines to return void as the returned offset is not used again. I've still elected to increment the offset after it has passed through the dissecting routines purely for consistency sake. I did not have any warnings compiling this using GCC 4.6.2.

Regarding the use of proto_tree_add_int/float it seems like I needed to do this to dissect non-contiguous bytes in the packet but keep the values stored under the same tree (see comment at line 928 of packet-pcp.c).

Depending on the "valfmt type", the 4 bytes stored after the instance (line 912 of packet-pcp.c) is either the value _or_ a pointer to further in the packet of another data structure which contains the value.
Comment 5 Alexis La Goutte 2012-03-04 03:08:40 UTC
Hi,

(In reply to comment #4)
> Created attachment 7944 [details]
> Updated patch for inclusion
> 
> Thanks for the review so far
> 
> I've uploaded a new patch for review which obsoletes the existing two (is this
> the preferred way or would you prefer patch sets?).
Prefer new patch !
> 
> I've changed all instances proto_tree_add_item to use the ENC_* constants.
> Regarding the Clang warnings, I've changed most of the decoding routines to
> return void as the returned offset is not used again. I've still elected to
> increment the offset after it has passed through the dissecting routines purely
> for consistency sake. I did not have any warnings compiling this using GCC
> 4.6.2.
I will check !
> 
> Regarding the use of proto_tree_add_int/float it seems like I needed to do this
> to dissect non-contiguous bytes in the packet but keep the values stored under
> the same tree (see comment at line 928 of packet-pcp.c).
> 
> Depending on the "valfmt type", the 4 bytes stored after the instance (line 912
> of packet-pcp.c) is either the value _or_ a pointer to further in the packet of
> another data structure which contains the value.

There is no problem ! proto_tree_add_item can be used
Comment 6 Ryan Doyle 2012-03-04 20:53:05 UTC
Created attachment 7953 [details]
PCP Protocol dissector - remove use of proto_tree_add_(init|uint...)

Thanks for the info,

I've updated the patch to use proto_tree_add_item instead of proto_tree_add_(int|uint|float...) and have tested it is working as before.

Please let me know if there is anything else required to get this merged.

Kind regards,
Ryan
Comment 7 Alexis La Goutte 2012-03-05 01:50:01 UTC
Thanks !
Committed inRevision 41353 with small change (See revision log)
Comment 8 Christopher Maynard 2012-03-20 18:40:13 UTC
Coverity reports a missing break between the PM_TYPE_AGGREGATE and PM_TYPE_AGGREGATE_STATIC cases of the switch statement in dissect_pcp_message_result() around line 986.

It looks like the code is identical for both cases.  So, should the proto_tree_add_item() call be deleted from the PM_TYPE_AGGREGATE case and allow execution to fall-through to PM_TYPE_AGGREGATE_STATIC, or should there be some difference in the code, in which case a break; statement should be added and the the code fixed?
Comment 9 Ryan Doyle 2012-03-27 19:13:45 UTC
Created attachment 8099 [details]
PM_TYPE case fallthough

Attached is the patch to allow PM_TYPE_AGGREGATE to fall through to PM_TYPE_AGGREGATE_STATIC.

Cheers
Comment 10 Alexis La Goutte 2012-03-28 01:49:06 UTC
Comment on attachment 8099 [details]
PM_TYPE case fallthough

Fix committed inRevision 41812