summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOdd Stranne <odd@mullvad.net>2019-07-04 12:33:21 +0200
committerOdd Stranne <odd@mullvad.net>2019-07-04 12:33:21 +0200
commit967a9db4c2cfd323eb2d16ec918843d75f899764 (patch)
tree7887f8a8bfa4c47e5449f1356e451c3554cc5c87
parent42c6e211e1232d8f655f27605e140b1ad5784390 (diff)
parent85da89dfe43ad66a2f9429c86614564835593f5b (diff)
downloadmullvadvpn-967a9db4c2cfd323eb2d16ec918843d75f899764.tar.xz
mullvadvpn-967a9db4c2cfd323eb2d16ec918843d75f899764.zip
Merge branch 'win-fix-online-check'
-rw-r--r--CHANGELOG.md5
-rw-r--r--windows/winnet/src/extras/loader/loader.cpp8
-rw-r--r--windows/winnet/src/winnet/netmonitor.cpp13
-rw-r--r--windows/winnet/src/winnet/winnet.cpp4
4 files changed, 18 insertions, 12 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dd98d5d9c0..d724488824 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -29,6 +29,11 @@ Line wrap the file at 100 chars. Th
#### Windows
- Add migration logic to restore lost settings after major Windows update.
+### Fixed
+
+#### Windows
+- Adjust network interface checks in offline detection logic.
+
## [2019.5] - 2019-06-17
### Added
- Add Norwegian translations
diff --git a/windows/winnet/src/extras/loader/loader.cpp b/windows/winnet/src/extras/loader/loader.cpp
index 4a09a890eb..648c16f37b 100644
--- a/windows/winnet/src/extras/loader/loader.cpp
+++ b/windows/winnet/src/extras/loader/loader.cpp
@@ -2,7 +2,7 @@
#include "../../winnet/winnet.h"
#include <iostream>
-void __stdcall ConnectivityChanged(uint8_t connected)
+void __stdcall ConnectivityChanged(bool connected, void *)
{
std::wcout << (0 != connected? L"Connected" : L"NOT connected") << std::endl;
}
@@ -27,12 +27,12 @@ int main()
// }
//};
- uint8_t currentConnectivity = 0;
+ bool currentConnectivity = 0;
- const auto status = WinNet_ActivateConnectivityMonitor(ConnectivityChanged, &currentConnectivity, nullptr, nullptr);
+ const auto status = WinNet_ActivateConnectivityMonitor(ConnectivityChanged, nullptr, &currentConnectivity, nullptr, nullptr);
std::wcout << L"Current connectivity: "
- << (0 != currentConnectivity ? L"Connected" : L"NOT connected") << std::endl;
+ << (currentConnectivity ? L"Connected" : L"NOT connected") << std::endl;
_getwch();
diff --git a/windows/winnet/src/winnet/netmonitor.cpp b/windows/winnet/src/winnet/netmonitor.cpp
index 4de068f9cd..a6c2903397 100644
--- a/windows/winnet/src/winnet/netmonitor.cpp
+++ b/windows/winnet/src/winnet/netmonitor.cpp
@@ -18,7 +18,8 @@ bool ValidInterfaceType(const MIB_IF_ROW2 &iface)
}
}
- if (FALSE == iface.InterfaceAndOperStatusFlags.ConnectorPresent
+ if (FALSE != iface.InterfaceAndOperStatusFlags.FilterInterface
+ || 0 == iface.PhysicalAddressLength
|| FALSE != iface.InterfaceAndOperStatusFlags.EndPointInterface)
{
return false;
@@ -85,17 +86,17 @@ void NetMonitor::AddCacheEntry(Cache &cache, const MIB_IF_ROW2 &iface)
{
CacheEntry e;
- if (false == ValidInterfaceType(iface))
+ if (ValidInterfaceType(iface))
{
e.luid = iface.InterfaceLuid.Value;
- e.valid = false;
- e.connected = false;
+ e.valid = true;
+ e.connected = (MediaConnectStateConnected == iface.MediaConnectState);
}
else
{
e.luid = iface.InterfaceLuid.Value;
- e.valid = true;
- e.connected = (MediaConnectStateConnected == iface.MediaConnectState);
+ e.valid = false;
+ e.connected = false;
}
cache.insert(std::make_pair(e.luid, e));
diff --git a/windows/winnet/src/winnet/winnet.cpp b/windows/winnet/src/winnet/winnet.cpp
index aa23adbc8d..2465ec667b 100644
--- a/windows/winnet/src/winnet/winnet.cpp
+++ b/windows/winnet/src/winnet/winnet.cpp
@@ -215,8 +215,8 @@ WINNET_LINKAGE
WINNET_CC_STATUS
WINNET_API
WinNet_CheckConnectivity(
- WinNetErrorSink errorSink,
- void *errorSinkContext
+ WinNetErrorSink errorSink,
+ void *errorSinkContext
)
{
try