From: Paul Gofman pgofman@codeweavers.com
--- configure.ac | 1 + dlls/nsiproxy.sys/ndis.c | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac index 758f6250eec..c782c17ac61 100644 --- a/configure.ac +++ b/configure.ac @@ -423,6 +423,7 @@ AC_CHECK_HEADERS(\ linux/serial.h \ linux/types.h \ linux/ucdrom.h \ + linux/wireless.h \ lwp.h \ mach-o/loader.h \ mach/mach.h \ diff --git a/dlls/nsiproxy.sys/ndis.c b/dlls/nsiproxy.sys/ndis.c index 1fc66c3611b..3d3791d3560 100644 --- a/dlls/nsiproxy.sys/ndis.c +++ b/dlls/nsiproxy.sys/ndis.c @@ -62,6 +62,10 @@ #include <net/if_types.h> #endif
+#ifdef HAVE_LINUX_WIRELESS_H +#include <linux/wireless.h> +#endif + #include <pthread.h>
#define NONAMELESSUNION @@ -173,13 +177,27 @@ static NTSTATUS if_get_physical( const char *name, UINT *type, IF_PHYSICAL_ADDRE if (*type == MIB_IF_TYPE_OTHER && !ioctl( fd, SIOCGIFFLAGS, &ifr ) && ifr.ifr_flags & IFF_POINTOPOINT) *type = MIB_IF_TYPE_PPP;
+#ifdef HAVE_LINUX_WIRELESS_H + if (*type == MIB_IF_TYPE_ETHERNET) + { + struct iwreq pwrq; + + memset( &pwrq, 0, sizeof(pwrq) ); + memcpy( pwrq.ifr_name, name, size ); + if (ioctl( fd, SIOCGIWNAME, &pwrq ) != -1) + { + TRACE( "iface %s, wireless protocol %s.\n", debugstr_a(name), debugstr_a(pwrq.u.name) ); + *type = IF_TYPE_IEEE80211; + } + } +#endif + err: close( fd ); return ret; }
#elif defined (HAVE_SYS_SYSCTL_H) && defined (HAVE_NET_IF_DL_H) - static NTSTATUS if_get_physical( const char *name, UINT *type, IF_PHYSICAL_ADDRESS *phys_addr ) { struct if_msghdr *ifm;
IF_TYPE_IEEE80211 is the interface type returned on modern Windows for WiFi interfaces. It seems like the "wirelessness" of the interface cannot be determined in a more straightforward way on Linux. SIOCGIWNAME returns wireless protocol name and fails for non-WiFi interfaces.