summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-09-14 16:55:25 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-09-14 16:55:25 -0700
commit15402933bc93f930f9767f6b2fb16fdb29c3c50e (patch)
tree09a6a43e994d6354acd4742f7987e054f741c0d1
parent8d0b2b781e30f4a953b2ea5810249c7266f02b30 (diff)
downloadinfinitytier-15402933bc93f930f9767f6b2fb16fdb29c3c50e.tar.gz
infinitytier-15402933bc93f930f9767f6b2fb16fdb29c3c50e.zip
Add physical MTU recommendation hint to network config via API.
-rw-r--r--include/ZeroTierOne.h8
-rw-r--r--node/Network.cpp1
2 files changed, 9 insertions, 0 deletions
diff --git a/include/ZeroTierOne.h b/include/ZeroTierOne.h
index e4ea92b4..e0f6ca28 100644
--- a/include/ZeroTierOne.h
+++ b/include/ZeroTierOne.h
@@ -978,6 +978,11 @@ typedef struct
unsigned int mtu;
/**
+ * Recommended MTU to avoid fragmentation at the physical layer (hint)
+ */
+ unsigned int physicalMtu;
+
+ /**
* If nonzero, the network this port belongs to indicates DHCP availability
*
* This is a suggestion. The underlying implementation is free to ignore it
@@ -1604,6 +1609,9 @@ typedef int (*ZT_PathCheckFunction)(
* Note that this can take a few seconds the first time it's called, as it
* will generate an identity.
*
+ * TODO: should consolidate function pointers into versioned structure for
+ * better API stability.
+ *
* @param node Result: pointer is set to new node instance on success
* @param uptr User pointer to pass to functions/callbacks
* @param now Current clock in milliseconds
diff --git a/node/Network.cpp b/node/Network.cpp
index 5e3dae90..22aca0d8 100644
--- a/node/Network.cpp
+++ b/node/Network.cpp
@@ -1224,6 +1224,7 @@ void Network::_externalConfig(ZT_VirtualNetworkConfig *ec) const
ec->status = _status();
ec->type = (_config) ? (_config.isPrivate() ? ZT_NETWORK_TYPE_PRIVATE : ZT_NETWORK_TYPE_PUBLIC) : ZT_NETWORK_TYPE_PRIVATE;
ec->mtu = ZT_IF_MTU;
+ ec->physicalMtu = ZT_UDP_DEFAULT_PAYLOAD_MTU - (ZT_PACKET_IDX_PAYLOAD + 16);
ec->dhcp = 0;
std::vector<Address> ab(_config.activeBridges());
ec->bridge = ((_config.allowPassiveBridging())||(std::find(ab.begin(),ab.end(),RR->identity.address()) != ab.end())) ? 1 : 0;