Skip to content

Commit

Permalink
Renamed ips_match to ndpi_ips_match
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaderi committed Jan 17, 2025
1 parent f1c62ca commit 1bda2a2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/include/ndpi_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 2 additions & 3 deletions src/lib/ndpi_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
10 changes: 5 additions & 5 deletions src/lib/protocols/starcraft.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/*
Expand Down

0 comments on commit 1bda2a2

Please sign in to comment.