summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
Diffstat (limited to 'node')
-rw-r--r--node/Network.cpp6
-rw-r--r--node/Network.hpp24
2 files changed, 30 insertions, 0 deletions
diff --git a/node/Network.cpp b/node/Network.cpp
index db84ada0..1c14e9f6 100644
--- a/node/Network.cpp
+++ b/node/Network.cpp
@@ -91,6 +91,8 @@ SharedPtr<Network> Network::newInstance(const RuntimeEnvironment *renv,uint64_t
nw->_isOpen = false;
nw->_emulateArp = false;
nw->_emulateNdp = false;
+ nw->_arpCacheTtl = 0;
+ nw->_ndpCacheTtl = 0;
nw->_multicastPrefixBits = ZT_DEFAULT_MULTICAST_PREFIX_BITS;
nw->_multicastDepth = ZT_DEFAULT_MULTICAST_DEPTH;
nw->_status = NETWORK_WAITING_FOR_FIRST_AUTOCONF;
@@ -120,6 +122,8 @@ void Network::setConfiguration(const Network::Config &conf,bool saveToDisk)
_isOpen = conf.isOpen();
_emulateArp = conf.emulateArp();
_emulateNdp = conf.emulateNdp();
+ _arpCacheTtl = conf.arpCacheTtl();
+ _ndpCacheTtl = conf.ndpCacheTtl();
_multicastPrefixBits = conf.multicastPrefixBits();
_multicastDepth = conf.multicastDepth();
@@ -153,6 +157,8 @@ void Network::setConfiguration(const Network::Config &conf,bool saveToDisk)
_isOpen = false;
_emulateArp = false;
_emulateNdp = false;
+ _arpCacheTtl = 0;
+ _ndpCacheTtl = 0;
_status = NETWORK_WAITING_FOR_FIRST_AUTOCONF;
_lastConfigUpdate = 0;
diff --git a/node/Network.hpp b/node/Network.hpp
index 5af16982..e72f9a4e 100644
--- a/node/Network.hpp
+++ b/node/Network.hpp
@@ -273,6 +273,28 @@ public:
}
/**
+ * @return ARP cache TTL in seconds or 0 for no ARP caching
+ */
+ inline unsigned int arpCacheTtl() const
+ {
+ const_iterator ttl(find("cARP"));
+ if (ttl == end())
+ return 0;
+ return Utils::hexStrToUInt(ttl->second.c_str());
+ }
+
+ /**
+ * @return NDP cache TTL in seconds or 0 for no NDP caching
+ */
+ inline unsigned int ndpCacheTtl() const
+ {
+ const_iterator ttl(find("cNDP"));
+ if (ttl == end())
+ return 0;
+ return Utils::hexStrToUInt(ttl->second.c_str());
+ }
+
+ /**
* @return Multicast rates for this network
*/
inline MulticastRates multicastRates() const
@@ -684,6 +706,8 @@ private:
bool _isOpen;
bool _emulateArp;
bool _emulateNdp;
+ unsigned int _arpCacheTtl;
+ unsigned int _ndpCacheTtl;
unsigned int _multicastPrefixBits;
unsigned int _multicastDepth;