From 87714181701fa92016c37937f786bbf5434ef182 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 23 Jan 2014 16:10:24 -0800 Subject: 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! --- node/EthernetTap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'node') 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); } } -- cgit v1.2.3