From 1bda2a26507b0516a618c144546c310897d2b06b Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Fri, 17 Jan 2025 19:20:45 +0100 Subject: [PATCH] Renamed ips_match to ndpi_ips_match --- src/include/ndpi_private.h | 2 +- src/lib/ndpi_utils.c | 5 ++--- src/lib/protocols/starcraft.c | 10 +++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/include/ndpi_private.h b/src/include/ndpi_private.h index 0bf86b8236a..e1918495c5f 100644 --- a/src/include/ndpi_private.h +++ b/src/include/ndpi_private.h @@ -609,7 +609,7 @@ u_int8_t is_a_common_alpn(struct ndpi_detection_module_struct *ndpi_str, int64_t asn1_ber_decode_length(const unsigned char *payload, int payload_len, u_int16_t *value_len); -u_int8_t ips_match(u_int32_t src, u_int32_t dst, +u_int8_t ndpi_ips_match(u_int32_t src, u_int32_t dst, u_int32_t net, u_int32_t num_bits); u_int8_t ends_with(struct ndpi_detection_module_struct *ndpi_struct, diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index 3ea01c45714..4fcb5b26e1e 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -262,9 +262,8 @@ u_int8_t ndpi_net_match(u_int32_t ip_to_check, return(((ip_to_check & mask) == (net & mask)) ? 1 : 0); } -u_int8_t ips_match(u_int32_t src, u_int32_t dst, - u_int32_t net, u_int32_t num_bits) -{ +u_int8_t ndpi_ips_match(u_int32_t src, u_int32_t dst, + u_int32_t net, u_int32_t num_bits) { return(ndpi_net_match(src, net, num_bits) || ndpi_net_match(dst, net, num_bits)); } diff --git a/src/lib/protocols/starcraft.c b/src/lib/protocols/starcraft.c index a4d130e8e64..9e87ea2c810 100644 --- a/src/lib/protocols/starcraft.c +++ b/src/lib/protocols/starcraft.c @@ -35,11 +35,11 @@ static u_int8_t sc2_match_logon_ip(struct ndpi_packet_struct* packet) u_int32_t source_ip = ntohl(packet->iph->saddr); u_int32_t dest_ip = ntohl(packet->iph->daddr); - return (ips_match(source_ip, dest_ip, 0xD5F87F82, 32) // EU 213.248.127.130 - || ips_match(source_ip, dest_ip, 0x0C81CE82, 32) // US 12.129.206.130 - || ips_match(source_ip, dest_ip, 0x79FEC882, 32) // KR 121.254.200.130 - || ips_match(source_ip, dest_ip, 0xCA09424C, 32) // SG 202.9.66.76 - || ips_match(source_ip, dest_ip, 0x0C81ECFE, 32)); // BETA 12.129.236.254 + return (ndpi_ips_match(source_ip, dest_ip, 0xD5F87F82, 32) // EU 213.248.127.130 + || ndpi_ips_match(source_ip, dest_ip, 0x0C81CE82, 32) // US 12.129.206.130 + || ndpi_ips_match(source_ip, dest_ip, 0x79FEC882, 32) // KR 121.254.200.130 + || ndpi_ips_match(source_ip, dest_ip, 0xCA09424C, 32) // SG 202.9.66.76 + || ndpi_ips_match(source_ip, dest_ip, 0x0C81ECFE, 32)); // BETA 12.129.236.254 } /*