aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/starcraft.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/protocols/starcraft.c')
-rw-r--r--src/lib/protocols/starcraft.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/lib/protocols/starcraft.c b/src/lib/protocols/starcraft.c
index 9419b7a5b..c26b76a0a 100644
--- a/src/lib/protocols/starcraft.c
+++ b/src/lib/protocols/starcraft.c
@@ -49,10 +49,12 @@ u_int8_t sc2_match_logon_ip(struct ndpi_packet_struct* packet)
*/
u_int8_t ndpi_check_starcraft_tcp(struct ndpi_detection_module_struct* ndpi_struct, struct ndpi_flow_struct* flow)
{
- if (sc2_match_logon_ip(&flow->packet)
- && flow->packet.tcp->dest == htons(1119) //bnetgame port
- && (ndpi_match_strprefix(flow->packet.payload, flow->packet.payload_packet_len, "\x4a\x00\x00\x0a\x66\x02\x0a\xed\x2d\x66")
- || ndpi_match_strprefix(flow->packet.payload, flow->packet.payload_packet_len, "\x49\x00\x00\x0a\x66\x02\x0a\xed\x2d\x66")))
+ struct ndpi_packet_struct* packet = &ndpi_struct->packet;
+
+ if (sc2_match_logon_ip(packet)
+ && packet->tcp->dest == htons(1119) //bnetgame port
+ && (ndpi_match_strprefix(packet->payload, packet->payload_packet_len, "\x4a\x00\x00\x0a\x66\x02\x0a\xed\x2d\x66")
+ || ndpi_match_strprefix(packet->payload, packet->payload_packet_len, "\x49\x00\x00\x0a\x66\x02\x0a\xed\x2d\x66")))
return 1;
else
return -1;
@@ -66,7 +68,7 @@ u_int8_t ndpi_check_starcraft_tcp(struct ndpi_detection_module_struct* ndpi_stru
*/
u_int8_t ndpi_check_starcraft_udp(struct ndpi_detection_module_struct* ndpi_struct, struct ndpi_flow_struct* flow)
{
- struct ndpi_packet_struct* packet = &flow->packet;
+ struct ndpi_packet_struct* packet = &ndpi_struct->packet;
/* First off, filter out any traffic not using port 1119, removing the chance of any false positive if we assume that non allowed protocols don't use the port */
if (packet->udp->source != htons(1119) && packet->udp->dest != htons(1119))
@@ -114,9 +116,10 @@ u_int8_t ndpi_check_starcraft_udp(struct ndpi_detection_module_struct* ndpi_stru
void ndpi_search_starcraft(struct ndpi_detection_module_struct* ndpi_struct, struct ndpi_flow_struct* flow)
{
+ struct ndpi_packet_struct* packet = &ndpi_struct->packet;
+
NDPI_LOG_DBG(ndpi_struct, "search Starcraft\n");
if (flow->detected_protocol_stack[0] != NDPI_PROTOCOL_STARCRAFT) {
- struct ndpi_packet_struct* packet = &flow->packet;
int8_t result = 0;
if (packet->udp != NULL) {