Add version info to OK(HELLO) so both sides know their version info.

This commit is contained in:
Adam Ierymenko 2013-09-13 13:35:31 -04:00
parent 07e1085dcc
commit d87a1d6b99
2 changed files with 8 additions and 1 deletions

View File

@ -374,6 +374,10 @@ public:
*
* OK payload:
* <[8] timestamp (echoed from original HELLO)>
* <[1] protocol version>
* <[1] software major version>
* <[1] software minor version>
* <[2] software revision>
*
* ERROR has no payload.
*/

View File

@ -151,11 +151,14 @@ void PacketDecoder::_CBaddPeerFromHello(void *arg,const SharedPtr<Peer> &p,Topol
case Topology::PEER_VERIFY_ACCEPTED_ALREADY_HAVE:
case Topology::PEER_VERIFY_ACCEPTED_DISPLACED_INVALID_ADDRESS: {
_r->sw->doAnythingWaitingForPeer(p);
Packet outp(req->source,_r->identity.address(),Packet::VERB_OK);
outp.append((unsigned char)Packet::VERB_HELLO);
outp.append(req->helloPacketId);
outp.append(req->helloTimestamp);
outp.append((unsigned char)ZT_PROTO_VERSION);
outp.append((unsigned char)ZEROTIER_ONE_VERSION_MAJOR);
outp.append((unsigned char)ZEROTIER_ONE_VERSION_MINOR);
outp.append((uint16_t)ZEROTIER_ONE_VERSION_REVISION);
outp.encrypt(p->cryptKey());
outp.hmacSet(p->macKey());
_r->demarc->send(req->localPort,req->remoteAddress,outp.data(),outp.size(),-1);