From 046d2240dd3665340cc92ea4639ec9296bf81714 Mon Sep 17 00:00:00 2001 From: Thomas Karpiniec Date: Fri, 31 May 2024 12:18:40 +1000 Subject: [PATCH 1/1] Use AF_UNSPEC constant --- src/imp_win.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/imp_win.rs b/src/imp_win.rs index 15b115c..f34b207 100644 --- a/src/imp_win.rs +++ b/src/imp_win.rs @@ -12,7 +12,9 @@ use windows::Win32::NetworkManagement::IpHelper::{ use windows::Win32::NetworkManagement::IpHelper::{ GAA_FLAG_SKIP_ANYCAST, GAA_FLAG_SKIP_MULTICAST, IP_ADAPTER_ADDRESSES_LH, }; -use windows::Win32::Networking::WinSock::{AF_INET, AF_INET6, SOCKADDR, SOCKADDR_IN, SOCKADDR_IN6}; +use windows::Win32::Networking::WinSock::{ + AF_INET, AF_INET6, AF_UNSPEC, SOCKADDR, SOCKADDR_IN, SOCKADDR_IN6, +}; use crate::{Error, IfIndex, Interface}; @@ -27,7 +29,7 @@ pub(crate) fn list_interfaces() -> Result, Error> { loop { let bufptr = &mut buf[0] as *mut _ as *mut IP_ADAPTER_ADDRESSES_LH; let res = GetAdaptersAddresses( - 0, /* AF_UNSPEC */ + AF_UNSPEC.0.into(), GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST, None, Some(bufptr), -- 2.39.5