aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/collectd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/protocols/collectd.c')
-rw-r--r--src/lib/protocols/collectd.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/lib/protocols/collectd.c b/src/lib/protocols/collectd.c
index f9ec9a783..4e37a0768 100644
--- a/src/lib/protocols/collectd.c
+++ b/src/lib/protocols/collectd.c
@@ -103,14 +103,13 @@ static int ndpi_int_collectd_check_type(u_int16_t block_type)
static int ndpi_int_collectd_dissect_hostname(struct ndpi_flow_struct * const flow,
struct ndpi_packet_struct const * const packet,
- u_int16_t block_offset, u_int16_t block_length)
+ u_int16_t block_length)
{
return (ndpi_hostname_sni_set(flow, &packet->payload[4], block_length, NDPI_HOSTNAME_NORM_ALL) == NULL);
}
static int ndpi_int_collectd_dissect_username(struct ndpi_flow_struct * const flow,
- struct ndpi_packet_struct const * const packet,
- u_int16_t block_offset)
+ struct ndpi_packet_struct const * const packet)
{
u_int16_t username_length = ntohs(get_u_int16_t(packet->payload, 4));
@@ -134,7 +133,7 @@ static void ndpi_search_collectd(struct ndpi_detection_module_struct *ndpi_struc
struct ndpi_packet_struct const * const packet = &ndpi_struct->packet;
u_int16_t num_blocks;
u_int16_t block_offset = 0, block_type, block_length;
- u_int16_t hostname_offset, hostname_length = 0;
+ u_int16_t hostname_length = 0;
NDPI_LOG_DBG(ndpi_struct, "search collectd\n");
@@ -158,7 +157,6 @@ static void ndpi_search_collectd(struct ndpi_detection_module_struct *ndpi_struc
* Dissect the hostname later, when we are sure that it is
* the collectd protocol.
*/
- hostname_offset = block_offset;
if(block_length > 4)
hostname_length = block_length - 4; /* Ignore type and length fields */
} else if (block_type == COLELCTD_TYPE_ENCR_AES256) {
@@ -169,7 +167,7 @@ static void ndpi_search_collectd(struct ndpi_detection_module_struct *ndpi_struc
*/
if (block_length != packet->payload_packet_len ||
block_length < COLLECTD_ENCR_AES256_MIN_BLOCK_SIZE ||
- ndpi_int_collectd_dissect_username(flow, packet, block_offset) != 0)
+ ndpi_int_collectd_dissect_username(flow, packet) != 0)
{
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
} else {
@@ -187,10 +185,9 @@ static void ndpi_search_collectd(struct ndpi_detection_module_struct *ndpi_struc
}
if (hostname_length > 0 &&
- ndpi_int_collectd_dissect_hostname(flow, packet, hostname_offset,
- hostname_length) != 0)
+ ndpi_int_collectd_dissect_hostname(flow, packet, hostname_length) != 0)
{
- ndpi_set_risk(ndpi_struct, flow, NDPI_MALFORMED_PACKET, "Invalid collectd Header");
+ ndpi_set_risk(flow, NDPI_MALFORMED_PACKET, "Invalid collectd Header");
}
ndpi_int_collectd_add_connection(ndpi_struct, flow);