aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/cassandra.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/protocols/cassandra.c')
-rw-r--r--src/lib/protocols/cassandra.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/protocols/cassandra.c b/src/lib/protocols/cassandra.c
index effb9d255..191932ceb 100644
--- a/src/lib/protocols/cassandra.c
+++ b/src/lib/protocols/cassandra.c
@@ -33,12 +33,12 @@
static inline int ndpi_validate_cassandra_response(u_int8_t response)
{
- return (response >= 0x81 && response <= 0x84) ? 1 : -1;
+ return (response >= 0x81 && response <= 0x85) ? 1 : -1;
}
static inline int ndpi_validate_cassandra_request(u_int8_t request)
{
- return (request >= 0x01 && request <= 0x04) ? 1 : -1;
+ return (request >= 0x01 && request <= 0x05) ? 1 : -1;
}
static void ndpi_int_cassandra_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
@@ -58,6 +58,14 @@ static void ndpi_search_cassandra(struct ndpi_detection_module_struct *ndpi_stru
NDPI_LOG_DBG(ndpi_struct, "search Cassandra CQL\n");
+ if (packet->payload_packet_len == 19 &&
+ ntohl(get_u_int32_t(packet->payload, 0)) == 0xCA552DFA)
+ {
+ NDPI_LOG_INFO(ndpi_struct, "found Cassandra Internode Communication\n");
+ ndpi_int_cassandra_add_connection(ndpi_struct, flow);
+ return;
+ }
+
if (packet->payload_packet_len < 9 ||
(!ndpi_validate_cassandra_response(packet->payload[0]) ||
!ndpi_validate_cassandra_request(packet->payload[0])))
@@ -74,9 +82,8 @@ static void ndpi_search_cassandra(struct ndpi_detection_module_struct *ndpi_stru
/* Looking for a 'STARTUP' message from the client,
* which should always contain the CQL_VERSION string
*/
- if (packet->payload_packet_len > 24 &&
- (packet->payload[4] == 0x01 &&
- (strncmp((char *)&packet->payload[13], "CQL_VERSION", 11) == 0)))
+ if (packet->payload_packet_len > 60 &&
+ memcmp(&packet->payload[packet->payload_packet_len-20], "CQL_VERSION", 11) == 0)
{
NDPI_LOG_INFO(ndpi_struct, "found Cassandra CQL\n");
ndpi_int_cassandra_add_connection(ndpi_struct, flow);