Add physical MTU recommendation hint to network config via API.

This commit is contained in:
Adam Ierymenko 2016-09-14 16:55:25 -07:00
parent 8d0b2b781e
commit 15402933bc
2 changed files with 9 additions and 0 deletions

View File

@ -977,6 +977,11 @@ typedef struct
*/ */
unsigned int mtu; 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 * If nonzero, the network this port belongs to indicates DHCP availability
* *
@ -1604,6 +1609,9 @@ typedef int (*ZT_PathCheckFunction)(
* Note that this can take a few seconds the first time it's called, as it * Note that this can take a few seconds the first time it's called, as it
* will generate an identity. * 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 node Result: pointer is set to new node instance on success
* @param uptr User pointer to pass to functions/callbacks * @param uptr User pointer to pass to functions/callbacks
* @param now Current clock in milliseconds * @param now Current clock in milliseconds

View File

@ -1224,6 +1224,7 @@ void Network::_externalConfig(ZT_VirtualNetworkConfig *ec) const
ec->status = _status(); ec->status = _status();
ec->type = (_config) ? (_config.isPrivate() ? ZT_NETWORK_TYPE_PRIVATE : ZT_NETWORK_TYPE_PUBLIC) : ZT_NETWORK_TYPE_PRIVATE; ec->type = (_config) ? (_config.isPrivate() ? ZT_NETWORK_TYPE_PRIVATE : ZT_NETWORK_TYPE_PUBLIC) : ZT_NETWORK_TYPE_PRIVATE;
ec->mtu = ZT_IF_MTU; ec->mtu = ZT_IF_MTU;
ec->physicalMtu = ZT_UDP_DEFAULT_PAYLOAD_MTU - (ZT_PACKET_IDX_PAYLOAD + 16);
ec->dhcp = 0; ec->dhcp = 0;
std::vector<Address> ab(_config.activeBridges()); std::vector<Address> ab(_config.activeBridges());
ec->bridge = ((_config.allowPassiveBridging())||(std::find(ab.begin(),ab.end(),RR->identity.address()) != ab.end())) ? 1 : 0; ec->bridge = ((_config.allowPassiveBridging())||(std::find(ab.begin(),ab.end(),RR->identity.address()) != ab.end())) ? 1 : 0;