Removed unnecessary check for transport protocol.

This commit is contained in:
Thomas Dreibholz 2021-02-21 16:45:11 +01:00
parent cdbbf5d384
commit 2fe740c00d
No known key found for this signature in database
GPG Key ID: 5CD5D12AA0877B49
1 changed files with 25 additions and 27 deletions

View File

@ -446,34 +446,32 @@ heur_dissect_npmp(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, v
if (length < 4) if (length < 4)
return FALSE; return FALSE;
if((pinfo->ptype == PT_TCP) || (pinfo->ptype == PT_UDP) || (pinfo->ptype == PT_DCCP)) { /* For TCP, UDP or DCCP:
/* For TCP, UDP or DCCP: Type must either be NETPERFMETER_DATA or NETPERFMETER_IDENTIFY_FLOW */
Type must either be NETPERFMETER_DATA or NETPERFMETER_IDENTIFY_FLOW */ const guint8 type = tvb_get_guint8(message_tvb, offset_message_type);
const guint8 type = tvb_get_guint8(message_tvb, offset_message_type); switch(type) {
switch(type) { case NETPERFMETER_DATA:
case NETPERFMETER_DATA: if (length < offset_data_payload + 8)
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; return FALSE;
/* Identify NetPerfMeter flow by payload pattern */ }
for(int i = 0; i < 8; i++) { break;
guint8 d = tvb_get_guint8(message_tvb, offset_data_payload + i); case NETPERFMETER_IDENTIFY_FLOW:
if(d != 30 + i) if (length < offset_identifyflow_streamid + length_identifyflow_streamid)
return FALSE; return FALSE;
} if (tvb_get_ntoh64(message_tvb, offset_identifyflow_magicnumber) != NETPERFMETER_IDENTIFY_FLOW_MAGIC_NUMBER) {
break; /* Identify NetPerfMeter flow by NETPERFMETER_IDENTIFY_FLOW_MAGIC_NUMBER */
case NETPERFMETER_IDENTIFY_FLOW: return FALSE;
if (length < offset_identifyflow_streamid + length_identifyflow_streamid) }
return FALSE; break;
if (tvb_get_ntoh64(message_tvb, offset_identifyflow_magicnumber) != NETPERFMETER_IDENTIFY_FLOW_MAGIC_NUMBER) { default:
/* Identify NetPerfMeter flow by NETPERFMETER_IDENTIFY_FLOW_MAGIC_NUMBER */ /* Not a NetPerfMeter packet */
return FALSE; return FALSE;
} break;
break;
default:
/* Not a NetPerfMeter packet */
return FALSE;
break;
}
} }
return dissect_npmp(message_tvb, pinfo, tree, data); return dissect_npmp(message_tvb, pinfo, tree, data);