From 75eb921a04e8e49de68ae828c0baa1c92c4bbb44 Mon Sep 17 00:00:00 2001 From: Marcos Del Sol Vives Date: Mon, 25 Mar 2024 19:03:02 +0100 Subject: [PATCH] Improve VPN heuristics under Windows The NDIS interface type will now be used also for matching, improving the heuristics for multiple popular VPN implementations. Fixes #1233 --- app/backend/nvcomputer.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/backend/nvcomputer.cpp b/app/backend/nvcomputer.cpp index 6b35f09e..f86e1df1 100644 --- a/app/backend/nvcomputer.cpp +++ b/app/backend/nvcomputer.cpp @@ -407,6 +407,19 @@ NvComputer::ReachabilityType NvComputer::getActiveAddressReachability() const return ReachabilityType::RI_VPN; } +#ifdef Q_OS_WINDOWS + if (nic.name().startsWith("iftype53_") || nic.name().startsWith("iftype131_")) { + // Match by NDIS interface type. These values are Microsoft's recommended values for VPN connections: + // https://learn.microsoft.com/en-US/troubleshoot/windows-client/networking/windows-connection-manager-disconnects-wlan#more-information + // + // The following VPNs use IF_TYPE_PROP_VIRTUAL under Windows: + // - WireguardNT VPNs + // - All WinTun-based VPNs (such as Slack Nebula) + // - OpenVPN with tap-windows6 + return ReachabilityType::RI_VPN; + } +#endif + if (nic.hardwareAddress().startsWith("00:FF", Qt::CaseInsensitive)) { // OpenVPN TAP interfaces have a MAC address starting with 00:FF on Windows return ReachabilityType::RI_VPN;