diff --git a/dll/base.cpp b/dll/base.cpp index d37955d..d1e14f4 100644 --- a/dll/base.cpp +++ b/dll/base.cpp @@ -519,11 +519,11 @@ struct ips_test { uint32_t ip_to; }; -static std::vector adapter_ips; +static std::vector whitelist_ips; -void set_adapter_ips(uint32_t *from, uint32_t *to, unsigned num_ips) +void set_whitelist_ips(uint32_t *from, uint32_t *to, unsigned num_ips) { - adapter_ips.clear(); + whitelist_ips.clear(); for (unsigned i = 0; i < num_ips; ++i) { struct ips_test ip_a; PRINT_DEBUG("from: %hhu.%hhu.%hhu.%hhu\n", ((unsigned char *)&from[i])[0], ((unsigned char *)&from[i])[1], ((unsigned char *)&from[i])[2], ((unsigned char *)&from[i])[3]); @@ -533,19 +533,19 @@ void set_adapter_ips(uint32_t *from, uint32_t *to, unsigned num_ips) if (ip_a.ip_to < ip_a.ip_from) continue; if ((ip_a.ip_to - ip_a.ip_from) > (1 << 25)) continue; PRINT_DEBUG("added\n"); - adapter_ips.push_back(ip_a); + whitelist_ips.push_back(ip_a); } } -static bool is_adapter_ip(unsigned char *ip) +static bool is_whitelist_ip(unsigned char *ip) { uint32_t ip_temp = 0; memcpy(&ip_temp, ip, sizeof(ip_temp)); ip_temp = ntohl(ip_temp); - for (auto &i : adapter_ips) { + for (auto &i : whitelist_ips) { if (i.ip_from <= ip_temp && ip_temp <= i.ip_to) { - PRINT_DEBUG("ADAPTER IP %hhu.%hhu.%hhu.%hhu\n", ip[0], ip[1], ip[2], ip[3]); + PRINT_DEBUG("WHITELISTED IP %hhu.%hhu.%hhu.%hhu\n", ip[0], ip[1], ip[2], ip[3]); return true; } } @@ -562,7 +562,7 @@ static bool is_lan_ip(const sockaddr *addr, int namelen) unsigned char ip[4]; memcpy(ip, &addr_in->sin_addr, sizeof(ip)); PRINT_DEBUG("CHECK LAN IP %hhu.%hhu.%hhu.%hhu:%u\n", ip[0], ip[1], ip[2], ip[3], ntohs(addr_in->sin_port)); - if (is_adapter_ip(ip)) return true; + if (is_whitelist_ip(ip)) return true; if (ip[0] == 127) return true; if (ip[0] == 10) return true; if (ip[0] == 192 && ip[1] == 168) return true; @@ -838,13 +838,13 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD dwReason, LPVOID ) { return TRUE; } #else -void set_adapter_ips(uint32_t *from, uint32_t *to, unsigned num_ips) +void set_whitelist_ips(uint32_t *from, uint32_t *to, unsigned num_ips) { } #endif #else -void set_adapter_ips(uint32_t *from, uint32_t *to, unsigned num_ips) +void set_whitelist_ips(uint32_t *from, uint32_t *to, unsigned num_ips) { } diff --git a/dll/base.h b/dll/base.h index b69de48..c7a2c58 100644 --- a/dll/base.h +++ b/dll/base.h @@ -456,7 +456,7 @@ public: } }; -void set_adapter_ips(uint32_t *from, uint32_t *to, unsigned num_ips); +void set_whitelist_ips(uint32_t *from, uint32_t *to, unsigned num_ips); #ifdef EMU_EXPERIMENTAL_BUILD bool crack_SteamAPI_RestartAppIfNecessary(uint32 unOwnAppID); bool crack_SteamAPI_Init(); diff --git a/dll/network.cpp b/dll/network.cpp index d9d94d8..892e4d6 100644 --- a/dll/network.cpp +++ b/dll/network.cpp @@ -314,7 +314,13 @@ static bool send_broadcasts(sock_t sock, uint16 port, char *data, unsigned long if (number_broadcasts < 0 || check_timedout(last_get_broadcast_info, 60.0)) { PRINT_DEBUG("get_broadcast_info\n"); get_broadcast_info(port); - set_adapter_ips(lower_range_ips, upper_range_ips, number_broadcasts); + std::vector lower_range(lower_range_ips, lower_range_ips + number_broadcasts), upper_range(upper_range_ips, upper_range_ips + number_broadcasts); + for(auto &addr : *custom_broadcasts) { + lower_range.push_back(addr.ip); + upper_range.push_back(addr.ip); + } + + set_whitelist_ips(lower_range.data(), upper_range.data(), lower_range.size()); last_get_broadcast_info = std::chrono::high_resolution_clock::now(); }