diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2018-03-21 15:31:48 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2018-03-21 15:31:48 -0700 |
commit | 494cf4049ea84bb43cf86a106e4af03036ae8652 (patch) | |
tree | b68591b623caf074e36cd2586ca9f8374fb673ab /node | |
parent | 916077012ed4810492d6e45ed07222cdbb750fc0 (diff) | |
download | infinitytier-494cf4049ea84bb43cf86a106e4af03036ae8652.tar.gz infinitytier-494cf4049ea84bb43cf86a106e4af03036ae8652.zip |
Add specification of anchor and multicast hub address (optional) to new multicast and IPv4 enabled ad-hoc network ID format.
Diffstat (limited to 'node')
-rw-r--r-- | node/Network.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/node/Network.cpp b/node/Network.cpp index 0015f2bf..a75d9fd1 100644 --- a/node/Network.cpp +++ b/node/Network.cpp @@ -1144,8 +1144,10 @@ void Network::requestConfiguration(void *tPtr) this->setNotFound(); } } else if ((_id & 0xff) == 0x01) { - // ffAA__________01 + // ffAAaaaaaaaaaa01 -- where AA is the IPv4 /8 to use and aaaaaaaaaa is the anchor node for multicast gather and replication const uint64_t myAddress = RR->identity.address().toInt(); + const uint64_t networkHub = (_id >> 8) & 0xffffffffffULL; + uint8_t ipv4[4]; ipv4[0] = (uint8_t)((_id >> 48) & 0xff); ipv4[1] = (uint8_t)((myAddress >> 16) & 0xff); @@ -1165,8 +1167,13 @@ void Network::requestConfiguration(void *tPtr) nconf->flags = ZT_NETWORKCONFIG_FLAG_ENABLE_IPV6_NDP_EMULATION; nconf->mtu = ZT_DEFAULT_MTU; nconf->multicastLimit = 1024; + nconf->specialistCount = (networkHub == 0) ? 0 : 1; nconf->staticIpCount = 2; nconf->ruleCount = 1; + + if (networkHub != 0) + nconf->specialists[0] = networkHub; + nconf->staticIps[0] = InetAddress::makeIpv66plane(_id,myAddress); nconf->staticIps[1].set(ipv4,4,8); |