summaryrefslogtreecommitdiff
path: root/osdep
diff options
context:
space:
mode:
authorGrant Limberg <glimberg@gmail.com>2015-07-07 19:24:02 -0700
committerGrant Limberg <glimberg@gmail.com>2015-07-07 19:24:02 -0700
commit1ad2cfeedfa2a9f4fc1f512e1009e5bb1b0630cb (patch)
treed8264c9bd4f6b9dce3f5237b94fe1f2fc521cf19 /osdep
parent6d398beefddb48d91f27e5f41bf39f40eb77222f (diff)
parent412389ec755528108e0254e75a9cf43fc53e331a (diff)
downloadinfinitytier-1ad2cfeedfa2a9f4fc1f512e1009e5bb1b0630cb.tar.gz
infinitytier-1ad2cfeedfa2a9f4fc1f512e1009e5bb1b0630cb.zip
Merge branch 'adamierymenko-dev' into android-jni
Diffstat (limited to 'osdep')
-rw-r--r--osdep/WindowsEthernetTap.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/osdep/WindowsEthernetTap.cpp b/osdep/WindowsEthernetTap.cpp
index d477f2e3..b2d3ed8b 100644
--- a/osdep/WindowsEthernetTap.cpp
+++ b/osdep/WindowsEthernetTap.cpp
@@ -692,17 +692,20 @@ void WindowsEthernetTap::threadMain()
ULONGLONG tc = GetTickCount64();
if ((tc - timeOfLastBorkCheck) >= 2500) {
timeOfLastBorkCheck = tc;
- MIB_IF_TABLE2 *ift = NULL;
- if ((GetIfTable2(&ift) == NO_ERROR)&&(ift)) {
+ char aabuf[16384];
+ ULONG aalen = sizeof(aabuf);
+ if (GetAdaptersAddresses(AF_UNSPEC,GAA_FLAG_SKIP_UNICAST|GAA_FLAG_SKIP_ANYCAST|GAA_FLAG_SKIP_MULTICAST|GAA_FLAG_SKIP_DNS_SERVER|GAA_FLAG_SKIP_FRIENDLY_NAME,(void *)0,reinterpret_cast<PIP_ADAPTER_ADDRESSES>(aabuf),&aalen) == NO_ERROR) {
bool isBorked = false;
- for(ULONG r=0;r<ift->NumEntries;++r) {
- if (ift->Table[r].InterfaceLuid.Value == _deviceLuid.Value) {
- if ((ift->Table[r].InterfaceAndOperStatusFlags.NotMediaConnected)||(ift->Table[r].MediaConnectState == MediaConnectStateDisconnected))
- isBorked = true;
+
+ PIP_ADAPTER_ADDRESSES aa = reinterpret_cast<PIP_ADAPTER_ADDRESSES>(aabuf);
+ while (aa) {
+ if (_deviceLuid.Value == aa->Luid.Value) {
+ isBorked = (aa->OperStatus != IfOperStatusUp);
break;
}
+ aa = aa->Next;
}
- FreeMibTable(ift);
+
if (isBorked) {
// Close and reopen tap device if there's an issue (outer loop)
break;