Module: wine Branch: master Commit: 7b243afc6322fa82ac42cec6de247a642e16b5a5 URL: https://gitlab.winehq.org/wine/wine/-/commit/7b243afc6322fa82ac42cec6de247a6...
Author: Paul Gofman pgofman@codeweavers.com Date: Mon Jul 24 19:38:56 2023 -0600
nsiproxy.sys: Detect wireless interface type on Linux.
---
configure | 6 ++++++ configure.ac | 1 + dlls/nsiproxy.sys/ndis.c | 19 +++++++++++++++++++ include/config.h.in | 3 +++ 4 files changed, 29 insertions(+)
diff --git a/configure b/configure index d65d819b148..36ae965fe34 100755 --- a/configure +++ b/configure @@ -7974,6 +7974,12 @@ if test "x$ac_cv_header_linux_ucdrom_h" = xyes then : printf "%s\n" "#define HAVE_LINUX_UCDROM_H 1" >>confdefs.h
+fi +ac_fn_c_check_header_compile "$LINENO" "linux/wireless.h" "ac_cv_header_linux_wireless_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_wireless_h" = xyes +then : + printf "%s\n" "#define HAVE_LINUX_WIRELESS_H 1" >>confdefs.h + fi ac_fn_c_check_header_compile "$LINENO" "lwp.h" "ac_cv_header_lwp_h" "$ac_includes_default" if test "x$ac_cv_header_lwp_h" = xyes 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..9d53c1591f6 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,6 +177,21 @@ 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; diff --git a/include/config.h.in b/include/config.h.in index 2e806157ebd..9836ec64cf9 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -195,6 +195,9 @@ /* Define to 1 if you have the <linux/videodev2.h> header file. */ #undef HAVE_LINUX_VIDEODEV2_H
+/* Define to 1 if you have the <linux/wireless.h> header file. */ +#undef HAVE_LINUX_WIRELESS_H + /* Define to 1 if you have the <lwp.h> header file. */ #undef HAVE_LWP_H