summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@zerotier.com>2014-01-23 16:10:24 -0800
committerAdam Ierymenko <adam.ierymenko@zerotier.com>2014-01-23 16:10:24 -0800
commit87714181701fa92016c37937f786bbf5434ef182 (patch)
tree7fe6f11b838b381cb5ea8977de1e0369b281dca2
parent2f37ea842fc15790406d770a487725e70c1aa98c (diff)
downloadinfinitytier-87714181701fa92016c37937f786bbf5434ef182.tar.gz
infinitytier-87714181701fa92016c37937f786bbf5434ef182.zip
Fix bug in tap driver introduced during unused code purge (deleted the part that acknowledges writes!), and fix bug in EthernetTap causing 0000 for etherType. Windows works now! Yay!
-rw-r--r--ext/bin/tap-windows/x64/zttap200.catbin10549 -> 10549 bytes
-rw-r--r--ext/bin/tap-windows/x64/zttap200.inf2
-rw-r--r--ext/bin/tap-windows/x64/zttap200.sysbin31384 -> 31896 bytes
-rw-r--r--node/EthernetTap.cpp4
-rw-r--r--windows/TapDriver/tapdrvr.c32
5 files changed, 35 insertions, 3 deletions
diff --git a/ext/bin/tap-windows/x64/zttap200.cat b/ext/bin/tap-windows/x64/zttap200.cat
index 211ffff3..a3769e40 100644
--- a/ext/bin/tap-windows/x64/zttap200.cat
+++ b/ext/bin/tap-windows/x64/zttap200.cat
Binary files differ
diff --git a/ext/bin/tap-windows/x64/zttap200.inf b/ext/bin/tap-windows/x64/zttap200.inf
index 9dd9c406..dc1a7422 100644
--- a/ext/bin/tap-windows/x64/zttap200.inf
+++ b/ext/bin/tap-windows/x64/zttap200.inf
@@ -4,7 +4,7 @@ Class=Net
ClassGuid={4d36e972-e325-11ce-bfc1-08002be10318}
Provider=%Provider%
CatalogFile=zttap200.cat
-DriverVer=01/22/2014,22.4.22.918
+DriverVer=01/23/2014,15.19.17.816
[Strings]
DeviceDescription = "ZeroTier One Virtual Network Port"
diff --git a/ext/bin/tap-windows/x64/zttap200.sys b/ext/bin/tap-windows/x64/zttap200.sys
index b17cbce7..339351fb 100644
--- a/ext/bin/tap-windows/x64/zttap200.sys
+++ b/ext/bin/tap-windows/x64/zttap200.sys
Binary files differ
diff --git a/node/EthernetTap.cpp b/node/EthernetTap.cpp
index 47355cbc..81cf5c4f 100644
--- a/node/EthernetTap.cpp
+++ b/node/EthernetTap.cpp
@@ -1385,7 +1385,8 @@ void EthernetTap::put(const MAC &from,const MAC &to,unsigned int etherType,const
char *d = _injectPending.back().first.data;
memcpy(d,to.data,6);
memcpy(d + 6,from.data,6);
- *((uint16_t *)(d + 12)) = Utils::hton(etherType);
+ d[12] = (char)((etherType >> 8) & 0xff);
+ d[13] = (char)(etherType & 0xff);
memcpy(d + 14,data,len);
}
@@ -1475,7 +1476,6 @@ void EthernetTap::threadMain()
MAC from(_tapReadBuf + 6);
unsigned int etherType = Utils::ntoh(*((const uint16_t *)(_tapReadBuf + 12)));
Buffer<4096> tmp(_tapReadBuf + 14,bytesRead - 14);
- //printf("GOT FRAME: %u bytes: %s\r\n",(unsigned int)bytesRead,Utils::hex(_tapReadBuf,bytesRead).c_str());
_handler(_arg,from,to,etherType,tmp);
}
}
diff --git a/windows/TapDriver/tapdrvr.c b/windows/TapDriver/tapdrvr.c
index f541ebd7..d638cdf6 100644
--- a/windows/TapDriver/tapdrvr.c
+++ b/windows/TapDriver/tapdrvr.c
@@ -1833,6 +1833,38 @@ NTSTATUS
p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
p_IRP->IoStatus.Information = 0;
}
+ else if ((l_IrpSp->Parameters.Write.Length) >= ETHERNET_HEADER_SIZE)
+ {
+ __try
+ {
+ p_IRP->IoStatus.Information = l_IrpSp->Parameters.Write.Length;
+
+ DUMP_PACKET ("IRP_MJ_WRITE ETH",
+ (unsigned char *) p_IRP->AssociatedIrp.SystemBuffer,
+ l_IrpSp->Parameters.Write.Length);
+
+ NdisMEthIndicateReceive
+ (l_Adapter->m_MiniportAdapterHandle,
+ (NDIS_HANDLE) l_Adapter,
+ (PCHAR)p_IRP->AssociatedIrp.SystemBuffer,
+ ETHERNET_HEADER_SIZE,
+ (unsigned char *)p_IRP->AssociatedIrp.SystemBuffer + ETHERNET_HEADER_SIZE,
+ l_IrpSp->Parameters.Write.Length - ETHERNET_HEADER_SIZE,
+ l_IrpSp->Parameters.Write.Length - ETHERNET_HEADER_SIZE);
+
+ NdisMEthIndicateReceiveComplete (l_Adapter->m_MiniportAdapterHandle);
+
+ p_IRP->IoStatus.Status = l_Status = STATUS_SUCCESS;
+ }
+ __except (EXCEPTION_EXECUTE_HANDLER)
+ {
+ DEBUGP (("[%s] NdisMEthIndicateReceive failed in IRP_MJ_WRITE\n",
+ NAME (l_Adapter)));
+ NOTE_ERROR ();
+ p_IRP->IoStatus.Status = l_Status = STATUS_UNSUCCESSFUL;
+ p_IRP->IoStatus.Information = 0;
+ }
+ }
else
{
DEBUGP (("[%s] Bad buffer size in IRP_MJ_WRITE, len=%d\n",