summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--osdep/Http.cpp2
-rw-r--r--osdep/Phy.hpp12
-rw-r--r--selftest.cpp2
-rw-r--r--service/OneService.cpp2
-rw-r--r--tcp-proxy/tcp-proxy.cpp2
5 files changed, 14 insertions, 6 deletions
diff --git a/osdep/Http.cpp b/osdep/Http.cpp
index cd3cf137..d491b062 100644
--- a/osdep/Http.cpp
+++ b/osdep/Http.cpp
@@ -232,7 +232,7 @@ unsigned int Http::_do(
handler.error = false;
handler.done = false;
- Phy<HttpPhyHandler *> phy(&handler,true);
+ Phy<HttpPhyHandler *> phy(&handler,true,true);
bool instantConnect = false;
handler.phy = &phy;
diff --git a/osdep/Phy.hpp b/osdep/Phy.hpp
index ec01625b..5afd715b 100644
--- a/osdep/Phy.hpp
+++ b/osdep/Phy.hpp
@@ -144,7 +144,7 @@ private:
fd_set _readfds;
fd_set _writefds;
#if defined(_WIN32) || defined(_WIN64)
- fd_set _exceptfds;
+ fd_set _exceptfds;
#endif
long _nfds;
@@ -152,13 +152,15 @@ private:
ZT_PHY_SOCKFD_TYPE _whackSendSocket;
bool _noDelay;
+ bool _noCheck;
public:
/**
* @param handler Pointer of type HANDLER_PTR_TYPE to handler
* @param noDelay If true, disable TCP NAGLE algorithm on TCP sockets
+ * @param noCheck If true, attempt to set UDP SO_NO_CHECK option to disable sending checksums
*/
- Phy(HANDLER_PTR_TYPE handler,bool noDelay) :
+ Phy(HANDLER_PTR_TYPE handler,bool noDelay,bool noCheck) :
_handler(handler)
{
FD_ZERO(&_readfds);
@@ -202,6 +204,7 @@ public:
_whackReceiveSocket = pipes[0];
_whackSendSocket = pipes[1];
_noDelay = noDelay;
+ _noCheck = noCheck;
}
~Phy()
@@ -297,6 +300,11 @@ public:
#ifdef IP_MTU_DISCOVER
f = 0; setsockopt(s,IPPROTO_IP,IP_MTU_DISCOVER,&f,sizeof(f));
#endif
+#ifdef SO_NO_CHECK
+ if (_noCheck) {
+ f = 1; setsockopt(s,SOL_SOCKET,SO_NO_CHECK,(void *)&f,sizeof(f));
+ }
+#endif
}
#endif // Windows or not
diff --git a/selftest.cpp b/selftest.cpp
index cf20fdf3..714964cb 100644
--- a/selftest.cpp
+++ b/selftest.cpp
@@ -696,7 +696,7 @@ static int testPhy()
std::cout << "[phy] Creating phy endpoint..." << std::endl;
TestPhyHandlers testPhyHandlers;
- testPhyInstance = new Phy<TestPhyHandlers *>(&testPhyHandlers,false);
+ testPhyInstance = new Phy<TestPhyHandlers *>(&testPhyHandlers,false,true);
std::cout << "[phy] Binding UDP listen socket to 127.0.0.1/60002... ";
PhySocket *udpListenSock = testPhyInstance->udpBind((const struct sockaddr *)&bindaddr);
diff --git a/service/OneService.cpp b/service/OneService.cpp
index d582a893..b83cd83f 100644
--- a/service/OneService.cpp
+++ b/service/OneService.cpp
@@ -404,7 +404,7 @@ public:
#ifdef ZT_ENABLE_NETWORK_CONTROLLER
_controller((_homePath + ZT_PATH_SEPARATOR_S + ZT1_CONTROLLER_DB_PATH).c_str()),
#endif
- _phy(this,false),
+ _phy(this,false,true),
_overrideRootTopology((overrideRootTopology) ? overrideRootTopology : ""),
_node((Node *)0),
_controlPlane((ControlPlane *)0),
diff --git a/tcp-proxy/tcp-proxy.cpp b/tcp-proxy/tcp-proxy.cpp
index 6acf7b42..70c0281a 100644
--- a/tcp-proxy/tcp-proxy.cpp
+++ b/tcp-proxy/tcp-proxy.cpp
@@ -297,7 +297,7 @@ int main(int argc,char **argv)
srand(time((time_t *)0));
TcpProxyService svc;
- Phy<TcpProxyService *> phy(&svc,false);
+ Phy<TcpProxyService *> phy(&svc,false,true);
svc.phy = &phy;
svc.udpPortCounter = 1023;