From d364b24378616ba6ab77c888a97c4ab54421e6ea Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 15 Mar 2024 20:04:51 -0500 Subject: [PATCH] Fix broken on-link detection that caused non-VPN WAN connections to use LAN MTU Fixes #1101 --- app/backend/nvcomputer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/backend/nvcomputer.cpp b/app/backend/nvcomputer.cpp index 1144d38f..6b35f09e 100644 --- a/app/backend/nvcomputer.cpp +++ b/app/backend/nvcomputer.cpp @@ -373,6 +373,7 @@ NvComputer::ReachabilityType NvComputer::getActiveAddressReachability() const s.connectToHost(copyOfActiveAddress.address(), copyOfActiveAddress.port()); if (s.waitForConnected(3000)) { Q_ASSERT(!s.localAddress().isNull()); + Q_ASSERT(!s.peerAddress().isNull()); for (const QNetworkInterface& nic : QNetworkInterface::allInterfaces()) { // Ensure the interface is up @@ -421,9 +422,9 @@ NvComputer::ReachabilityType NvComputer::getActiveAddressReachability() const return ReachabilityType::RI_VPN; } - // Didn't meet any of our VPN heuristics. Let's see if it's on-link. + // Didn't meet any of our VPN heuristics. Let's see if the peer address is on-link. Q_ASSERT(addr.prefixLength() >= 0); - if (addr.prefixLength() >= 0 && s.localAddress().isInSubnet(addr.ip(), addr.prefixLength())) { + if (addr.prefixLength() >= 0 && s.localAddress().isInSubnet(s.peerAddress(), addr.prefixLength())) { return ReachabilityType::RI_LAN; }