aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-netperfmeter.c
diff options
context:
space:
mode:
authorThomas Dreibholz <dreibh@simula.no>2021-02-21 16:45:11 +0100
committerThomas Dreibholz <dreibh@simula.no>2021-02-21 16:45:11 +0100
commit2fe740c00d11ccc2f0fad9cae829e36023653e6f (patch)
tree16a59fd24cbab015f50a4bf8eee860e435015448 /epan/dissectors/packet-netperfmeter.c
parentcdbbf5d3848a1daa6cd13db976a76bd0a3fd330e (diff)
Removed unnecessary check for transport protocol.
Diffstat (limited to 'epan/dissectors/packet-netperfmeter.c')
-rw-r--r--epan/dissectors/packet-netperfmeter.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/epan/dissectors/packet-netperfmeter.c b/epan/dissectors/packet-netperfmeter.c
index a84aa51543..77ae635463 100644
--- a/epan/dissectors/packet-netperfmeter.c
+++ b/epan/dissectors/packet-netperfmeter.c
@@ -446,34 +446,32 @@ heur_dissect_npmp(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, v
if (length < 4)
return FALSE;
- if((pinfo->ptype == PT_TCP) || (pinfo->ptype == PT_UDP) || (pinfo->ptype == PT_DCCP)) {
- /* For TCP, UDP or DCCP:
- Type must either be NETPERFMETER_DATA or NETPERFMETER_IDENTIFY_FLOW */
- const guint8 type = tvb_get_guint8(message_tvb, offset_message_type);
- switch(type) {
- case NETPERFMETER_DATA:
- if (length < offset_data_payload + 8)
- return FALSE;
- /* Identify NetPerfMeter flow by payload pattern */
- for(int i = 0; i < 8; i++) {
- guint8 d = tvb_get_guint8(message_tvb, offset_data_payload + i);
- if(d != 30 + i)
- return FALSE;
- }
- break;
- case NETPERFMETER_IDENTIFY_FLOW:
- if (length < offset_identifyflow_streamid + length_identifyflow_streamid)
- return FALSE;
- if (tvb_get_ntoh64(message_tvb, offset_identifyflow_magicnumber) != NETPERFMETER_IDENTIFY_FLOW_MAGIC_NUMBER) {
- /* Identify NetPerfMeter flow by NETPERFMETER_IDENTIFY_FLOW_MAGIC_NUMBER */
- return FALSE;
- }
- break;
- default:
- /* Not a NetPerfMeter packet */
+ /* For TCP, UDP or DCCP:
+ Type must either be NETPERFMETER_DATA or NETPERFMETER_IDENTIFY_FLOW */
+ const guint8 type = tvb_get_guint8(message_tvb, offset_message_type);
+ switch(type) {
+ case NETPERFMETER_DATA:
+ if (length < offset_data_payload + 8)
+ return FALSE;
+ /* Identify NetPerfMeter flow by payload pattern */
+ for(int i = 0; i < 8; i++) {
+ guint8 d = tvb_get_guint8(message_tvb, offset_data_payload + i);
+ if(d != 30 + i)
return FALSE;
- break;
- }
+ }
+ break;
+ case NETPERFMETER_IDENTIFY_FLOW:
+ if (length < offset_identifyflow_streamid + length_identifyflow_streamid)
+ return FALSE;
+ if (tvb_get_ntoh64(message_tvb, offset_identifyflow_magicnumber) != NETPERFMETER_IDENTIFY_FLOW_MAGIC_NUMBER) {
+ /* Identify NetPerfMeter flow by NETPERFMETER_IDENTIFY_FLOW_MAGIC_NUMBER */
+ return FALSE;
+ }
+ break;
+ default:
+ /* Not a NetPerfMeter packet */
+ return FALSE;
+ break;
}
return dissect_npmp(message_tvb, pinfo, tree, data);