Browse Source

platform_compat: фикс Windows-сборки (Ipv4IfIndex/Ipv6IfIndex отсутствуют, GetBestInterfaceEx без const)

topo_upd
Evgeny 2 months ago
parent
commit
1ec94de852
  1. 4
      lib/platform_compat.c

4
lib/platform_compat.c

@ -298,7 +298,7 @@ static PIP_ADAPTER_ADDRESSES plat_win_get_adapters(ULONG family) {
static PIP_ADAPTER_ADDRESSES plat_win_find_adapter(PIP_ADAPTER_ADDRESSES adapters, uint32_t ifindex) {
for (PIP_ADAPTER_ADDRESSES a = adapters; a; a = a->Next) {
if (a->IfIndex == ifindex || a->Ipv4IfIndex == ifindex || a->Ipv6IfIndex == ifindex) return a;
if (a->IfIndex == ifindex) return a;
}
return NULL;
}
@ -368,7 +368,7 @@ uint32_t get_default_route_netif_index(int family) {
return 0;
}
DWORD idx = 0;
if (GetBestInterfaceEx((const SOCKADDR*)&dst, &idx) != NO_ERROR) return 0;
if (GetBestInterfaceEx((SOCKADDR*)&dst, &idx) != NO_ERROR) return 0;
return (uint32_t)idx;
}
#endif

Loading…
Cancel
Save