diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-08-24 14:28:16 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-08-24 14:28:16 -0700 |
| commit | ccea3d04d63e39a020e140b348aa87e272747c7e (patch) | |
| tree | 9c8dbbea3a62ecffa00cb0083dded59fba80d181 /node/Node.cpp | |
| parent | 90bd3e07a0f8f2c2b0657e8cbf0b842f683b7f9c (diff) | |
| download | infinitytier-ccea3d04d63e39a020e140b348aa87e272747c7e.tar.gz infinitytier-ccea3d04d63e39a020e140b348aa87e272747c7e.zip | |
Push NETWORK_CONFIG_REFRESH on POSTs to /member/... in controller.
Diffstat (limited to 'node/Node.cpp')
| -rw-r--r-- | node/Node.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/node/Node.cpp b/node/Node.cpp index 4da79347..ff564eee 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -548,6 +548,31 @@ void Node::circuitTestEnd(ZT_CircuitTest *test) } } +void Node::pushNetworkRefresh(uint64_t dest,uint64_t nwid,const uint64_t *blacklistAddresses,const uint64_t *blacklistBeforeTimestamps,unsigned int blacklistCount) +{ + Packet outp(Address(dest),RR->identity.address(),Packet::VERB_NETWORK_CONFIG_REFRESH); + outp.append(nwid); + outp.addSize(2); + unsigned int c = 0; + for(unsigned int i=0;i<blacklistCount;++i) { + if ((outp.size() + 13) >= ZT_PROTO_MAX_PACKET_LENGTH) { + outp.setAt<uint16_t>(ZT_PACKET_IDX_PAYLOAD + 8,(uint16_t)c); + RR->sw->send(outp,true); + outp = Packet(Address(dest),RR->identity.address(),Packet::VERB_NETWORK_CONFIG_REFRESH); + outp.append(nwid); + outp.addSize(2); + c = 0; + } + Address(blacklistAddresses[i]).appendTo(outp); + outp.append(blacklistBeforeTimestamps[i]); + ++c; + } + if (c > 0) { + outp.setAt<uint16_t>(ZT_PACKET_IDX_PAYLOAD + 8,(uint16_t)c); + RR->sw->send(outp,true); + } +} + ZT_ResultCode Node::clusterInit( unsigned int myId, const struct sockaddr_storage *zeroTierPhysicalEndpoints, @@ -935,6 +960,13 @@ void ZT_Node_circuitTestEnd(ZT_Node *node,ZT_CircuitTest *test) } catch ( ... ) {} } +void ZT_Node_pushNetworkRefresh(ZT_Node *node,uint64_t dest,uint64_t nwid,const uint64_t *blacklistAddresses,const uint64_t *blacklistBeforeTimestamps,unsigned int blacklistCount) +{ + try { + reinterpret_cast<ZeroTier::Node *>(node)->pushNetworkRefresh(dest,nwid,blacklistAddresses,blacklistBeforeTimestamps,blacklistCount); + } catch ( ... ) {} +} + enum ZT_ResultCode ZT_Node_clusterInit( ZT_Node *node, unsigned int myId, |
