mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
Merge branch 'adamierymenko-dev' into android-jni
This commit is contained in:
commit
0f808e11df
27 changed files with 512 additions and 385 deletions
|
@ -178,6 +178,7 @@ SqliteNetworkController::SqliteNetworkController(const char *dbPath) :
|
||||||
||(sqlite3_prepare_v2(_db,"INSERT INTO Network (networkId,name,creationTime,revision) VALUES (?,?,?,1)",-1,&_sCreateNetwork,(const char **)0) != SQLITE_OK)
|
||(sqlite3_prepare_v2(_db,"INSERT INTO Network (networkId,name,creationTime,revision) VALUES (?,?,?,1)",-1,&_sCreateNetwork,(const char **)0) != SQLITE_OK)
|
||||||
||(sqlite3_prepare_v2(_db,"UPDATE Network SET ? = ? WHERE networkId = ?",-1,&_sUpdateNetworkField,(const char **)0) != SQLITE_OK)
|
||(sqlite3_prepare_v2(_db,"UPDATE Network SET ? = ? WHERE networkId = ?",-1,&_sUpdateNetworkField,(const char **)0) != SQLITE_OK)
|
||||||
||(sqlite3_prepare_v2(_db,"SELECT revision FROM Network WHERE id = ?",-1,&_sGetNetworkRevision,(const char **)0) != SQLITE_OK)
|
||(sqlite3_prepare_v2(_db,"SELECT revision FROM Network WHERE id = ?",-1,&_sGetNetworkRevision,(const char **)0) != SQLITE_OK)
|
||||||
|
||(sqlite3_prepare_v2(_db,"UPDATE Network SET revision = ? WHERE id = ?",-1,&_sSetNetworkRevision,(const char **)0) != SQLITE_OK)
|
||||||
||(sqlite3_prepare_v2(_db,"SELECT ip,ipNetmaskBits,ipVersion FROM IpAssignment WHERE networkId = ? AND nodeId = ?",-1,&_sGetIpAssignmentsForNode2,(const char **)0) != SQLITE_OK)
|
||(sqlite3_prepare_v2(_db,"SELECT ip,ipNetmaskBits,ipVersion FROM IpAssignment WHERE networkId = ? AND nodeId = ?",-1,&_sGetIpAssignmentsForNode2,(const char **)0) != SQLITE_OK)
|
||||||
||(sqlite3_prepare_v2(_db,"DELETE FROM Relay WHERE networkId = ?",-1,&_sDeleteRelaysForNetwork,(const char **)0) != SQLITE_OK)
|
||(sqlite3_prepare_v2(_db,"DELETE FROM Relay WHERE networkId = ?",-1,&_sDeleteRelaysForNetwork,(const char **)0) != SQLITE_OK)
|
||||||
||(sqlite3_prepare_v2(_db,"INSERT INTO Relay (networkId,nodeId,phyAddress) VALUES (?,?,?)",-1,&_sCreateRelay,(const char **)0) != SQLITE_OK)
|
||(sqlite3_prepare_v2(_db,"INSERT INTO Relay (networkId,nodeId,phyAddress) VALUES (?,?,?)",-1,&_sCreateRelay,(const char **)0) != SQLITE_OK)
|
||||||
|
@ -220,6 +221,7 @@ SqliteNetworkController::~SqliteNetworkController()
|
||||||
sqlite3_finalize(_sCreateNetwork);
|
sqlite3_finalize(_sCreateNetwork);
|
||||||
sqlite3_finalize(_sUpdateNetworkField);
|
sqlite3_finalize(_sUpdateNetworkField);
|
||||||
sqlite3_finalize(_sGetNetworkRevision);
|
sqlite3_finalize(_sGetNetworkRevision);
|
||||||
|
sqlite3_finalize(_sSetNetworkRevision);
|
||||||
sqlite3_finalize(_sGetIpAssignmentsForNode2);
|
sqlite3_finalize(_sGetIpAssignmentsForNode2);
|
||||||
sqlite3_finalize(_sDeleteRelaysForNetwork);
|
sqlite3_finalize(_sDeleteRelaysForNetwork);
|
||||||
sqlite3_finalize(_sCreateRelay);
|
sqlite3_finalize(_sCreateRelay);
|
||||||
|
@ -841,11 +843,17 @@ unsigned int SqliteNetworkController::handleControlPlaneHttpPOST(
|
||||||
int64_t revision = 0;
|
int64_t revision = 0;
|
||||||
sqlite3_reset(_sGetNetworkRevision);
|
sqlite3_reset(_sGetNetworkRevision);
|
||||||
sqlite3_bind_text(_sGetNetworkRevision,1,nwids,16,SQLITE_STATIC);
|
sqlite3_bind_text(_sGetNetworkRevision,1,nwids,16,SQLITE_STATIC);
|
||||||
if (sqlite3_step(_sGetNetworkRevision) == SQLITE_ROW)
|
bool networkExists = false;
|
||||||
|
if (sqlite3_step(_sGetNetworkRevision) == SQLITE_ROW) {
|
||||||
|
networkExists = true;
|
||||||
revision = sqlite3_column_int64(_sGetNetworkRevision,0);
|
revision = sqlite3_column_int64(_sGetNetworkRevision,0);
|
||||||
|
}
|
||||||
|
|
||||||
if (path.size() >= 3) {
|
if (path.size() >= 3) {
|
||||||
|
|
||||||
|
if (!networkExists)
|
||||||
|
return 404;
|
||||||
|
|
||||||
if ((path.size() == 4)&&(path[2] == "member")&&(path[3].length() == 10)) {
|
if ((path.size() == 4)&&(path[2] == "member")&&(path[3].length() == 10)) {
|
||||||
uint64_t address = Utils::hexStrToU64(path[3].c_str());
|
uint64_t address = Utils::hexStrToU64(path[3].c_str());
|
||||||
char addrs[24];
|
char addrs[24];
|
||||||
|
@ -856,7 +864,7 @@ unsigned int SqliteNetworkController::handleControlPlaneHttpPOST(
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (revision <= 0) {
|
if (!networkExists) {
|
||||||
sqlite3_reset(_sCreateNetwork);
|
sqlite3_reset(_sCreateNetwork);
|
||||||
sqlite3_bind_text(_sCreateNetwork,1,nwids,16,SQLITE_STATIC);
|
sqlite3_bind_text(_sCreateNetwork,1,nwids,16,SQLITE_STATIC);
|
||||||
sqlite3_bind_text(_sCreateNetwork,2,nwids,16,SQLITE_STATIC); // default name, will be changed below if a name is specified in JSON
|
sqlite3_bind_text(_sCreateNetwork,2,nwids,16,SQLITE_STATIC); // default name, will be changed below if a name is specified in JSON
|
||||||
|
@ -1081,6 +1089,11 @@ unsigned int SqliteNetworkController::handleControlPlaneHttpPOST(
|
||||||
json_value_free(j);
|
json_value_free(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sqlite3_reset(_sSetNetworkRevision);
|
||||||
|
sqlite3_bind_int64(_sSetNetworkRevision,1,revision += 1);
|
||||||
|
sqlite3_bind_text(_sSetNetworkRevision,2,nwids,16,SQLITE_STATIC);
|
||||||
|
sqlite3_step(_sSetNetworkRevision);
|
||||||
|
|
||||||
return handleControlPlaneHttpGET(path,urlArgs,headers,body,responseBody,responseContentType);
|
return handleControlPlaneHttpGET(path,urlArgs,headers,body,responseBody,responseContentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,7 @@ private:
|
||||||
sqlite3_stmt *_sCreateNetwork;
|
sqlite3_stmt *_sCreateNetwork;
|
||||||
sqlite3_stmt *_sUpdateNetworkField;
|
sqlite3_stmt *_sUpdateNetworkField;
|
||||||
sqlite3_stmt *_sGetNetworkRevision;
|
sqlite3_stmt *_sGetNetworkRevision;
|
||||||
|
sqlite3_stmt *_sSetNetworkRevision;
|
||||||
sqlite3_stmt *_sGetIpAssignmentsForNode2;
|
sqlite3_stmt *_sGetIpAssignmentsForNode2;
|
||||||
sqlite3_stmt *_sDeleteRelaysForNetwork;
|
sqlite3_stmt *_sDeleteRelaysForNetwork;
|
||||||
sqlite3_stmt *_sCreateRelay;
|
sqlite3_stmt *_sCreateRelay;
|
||||||
|
|
42
controller/controller-api-test.sh
Executable file
42
controller/controller-api-test.sh
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$#" -ne "2" ]; then
|
||||||
|
echo 'Usage: controller-api-test.sh <network ID to create> <local TCP port for HTTP API>'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
network_json=$(cat <<EOF
|
||||||
|
{
|
||||||
|
name: "test network",
|
||||||
|
private: true,
|
||||||
|
v4AssignMode: "zt",
|
||||||
|
v6AssignMode: "none",
|
||||||
|
multicastLimit: 100,
|
||||||
|
ipAssignmentPools: [
|
||||||
|
{
|
||||||
|
network: "10.1.2.0",
|
||||||
|
netmaskBits: 24
|
||||||
|
}
|
||||||
|
],
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
ruleId: 100,
|
||||||
|
etherType: 0x0800,
|
||||||
|
action: "accept"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ruleId: 200,
|
||||||
|
etherType: 0x0806,
|
||||||
|
action: "accept"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ruleId: 300,
|
||||||
|
etherType: 0x86dd,
|
||||||
|
action: "accept"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "$network_json" | curl -d - -v "http://127.0.0.1:$2/controller/network/$1"
|
|
@ -33,6 +33,7 @@
|
||||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
#pragma warning(disable:4996)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const struct _json_value json_value_none;
|
const struct _json_value json_value_none;
|
||||||
|
|
|
@ -28,10 +28,13 @@
|
||||||
#ifndef ZT_BWACCOUNT_HPP
|
#ifndef ZT_BWACCOUNT_HPP
|
||||||
#define ZT_BWACCOUNT_HPP
|
#define ZT_BWACCOUNT_HPP
|
||||||
|
|
||||||
|
#include "Constants.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "Constants.hpp"
|
|
||||||
#include "Utils.hpp"
|
#include "Utils.hpp"
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
|
|
@ -91,7 +91,9 @@
|
||||||
#ifndef __WINDOWS__
|
#ifndef __WINDOWS__
|
||||||
#define __WINDOWS__
|
#define __WINDOWS__
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NOMINMAX
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
#pragma warning(disable : 4290)
|
#pragma warning(disable : 4290)
|
||||||
#pragma warning(disable : 4996)
|
#pragma warning(disable : 4996)
|
||||||
#pragma warning(disable : 4101)
|
#pragma warning(disable : 4101)
|
||||||
|
|
|
@ -685,7 +685,7 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons
|
||||||
outp.append(pid);
|
outp.append(pid);
|
||||||
outp.append(nwid);
|
outp.append(nwid);
|
||||||
outp.append((uint16_t)netconfStr.length());
|
outp.append((uint16_t)netconfStr.length());
|
||||||
outp.append(netconfStr.data(),netconfStr.length());
|
outp.append(netconfStr.data(),(unsigned int)netconfStr.length());
|
||||||
outp.compress();
|
outp.compress();
|
||||||
if (outp.size() > ZT_PROTO_MAX_PACKET_LENGTH) {
|
if (outp.size() > ZT_PROTO_MAX_PACKET_LENGTH) {
|
||||||
TRACE("NETWORK_CONFIG_REQUEST failed: internal error: netconf size %u is too large",(unsigned int)netconfStr.length());
|
TRACE("NETWORK_CONFIG_REQUEST failed: internal error: netconf size %u is too large",(unsigned int)netconfStr.length());
|
||||||
|
|
|
@ -437,7 +437,7 @@ void Network::learnBridgeRoute(const MAC &mac,const Address &addr)
|
||||||
void Network::learnBridgedMulticastGroup(const MulticastGroup &mg,uint64_t now)
|
void Network::learnBridgedMulticastGroup(const MulticastGroup &mg,uint64_t now)
|
||||||
{
|
{
|
||||||
Mutex::Lock _l(_lock);
|
Mutex::Lock _l(_lock);
|
||||||
unsigned long tmp = _multicastGroupsBehindMe.size();
|
unsigned long tmp = (unsigned long)_multicastGroupsBehindMe.size();
|
||||||
_multicastGroupsBehindMe[mg] = now;
|
_multicastGroupsBehindMe[mg] = now;
|
||||||
if (tmp != _multicastGroupsBehindMe.size())
|
if (tmp != _multicastGroupsBehindMe.size())
|
||||||
_announceMulticastGroups();
|
_announceMulticastGroups();
|
||||||
|
|
|
@ -60,7 +60,7 @@ Node::Node(
|
||||||
ZT1_EventCallback eventCallback,
|
ZT1_EventCallback eventCallback,
|
||||||
const char *overrideRootTopology) :
|
const char *overrideRootTopology) :
|
||||||
RR(new RuntimeEnvironment(this)),
|
RR(new RuntimeEnvironment(this)),
|
||||||
_uptr(uptr),
|
_uPtr(uptr),
|
||||||
_dataStoreGetFunction(dataStoreGetFunction),
|
_dataStoreGetFunction(dataStoreGetFunction),
|
||||||
_dataStorePutFunction(dataStorePutFunction),
|
_dataStorePutFunction(dataStorePutFunction),
|
||||||
_wirePacketSendFunction(wirePacketSendFunction),
|
_wirePacketSendFunction(wirePacketSendFunction),
|
||||||
|
@ -426,7 +426,7 @@ std::string Node::dataStoreGet(const char *name)
|
||||||
std::string r;
|
std::string r;
|
||||||
unsigned long olen = 0;
|
unsigned long olen = 0;
|
||||||
do {
|
do {
|
||||||
long n = _dataStoreGetFunction(reinterpret_cast<ZT1_Node *>(this),_uptr,name,buf,sizeof(buf),r.length(),&olen);
|
long n = _dataStoreGetFunction(reinterpret_cast<ZT1_Node *>(this),_uPtr,name,buf,sizeof(buf),(unsigned long)r.length(),&olen);
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
return std::string();
|
return std::string();
|
||||||
r.append(buf,n);
|
r.append(buf,n);
|
||||||
|
@ -454,14 +454,14 @@ void Node::postTrace(const char *module,unsigned int line,const char *fmt,...)
|
||||||
|
|
||||||
Mutex::Lock _l(traceLock);
|
Mutex::Lock _l(traceLock);
|
||||||
|
|
||||||
|
time_t now = (time_t)(_now / 1000ULL);
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
ctime_s(tmp3,sizeof(tmp3),&now);
|
ctime_s(tmp3,sizeof(tmp3),&now);
|
||||||
char *nowstr = tmp3;
|
char *nowstr = tmp3;
|
||||||
#else
|
#else
|
||||||
time_t now = (time_t)(_now / 1000ULL);
|
|
||||||
char *nowstr = ctime_r(&now,tmp3);
|
char *nowstr = ctime_r(&now,tmp3);
|
||||||
#endif
|
#endif
|
||||||
unsigned long nowstrlen = strlen(nowstr);
|
unsigned long nowstrlen = (unsigned long)strlen(nowstr);
|
||||||
if (nowstr[nowstrlen-1] == '\n')
|
if (nowstr[nowstrlen-1] == '\n')
|
||||||
nowstr[--nowstrlen] = (char)0;
|
nowstr[--nowstrlen] = (char)0;
|
||||||
if (nowstr[nowstrlen-1] == '\r')
|
if (nowstr[nowstrlen-1] == '\r')
|
||||||
|
|
|
@ -127,7 +127,7 @@ public:
|
||||||
{
|
{
|
||||||
return (_wirePacketSendFunction(
|
return (_wirePacketSendFunction(
|
||||||
reinterpret_cast<ZT1_Node *>(this),
|
reinterpret_cast<ZT1_Node *>(this),
|
||||||
_uptr,
|
_uPtr,
|
||||||
reinterpret_cast<const struct sockaddr_storage *>(&addr),
|
reinterpret_cast<const struct sockaddr_storage *>(&addr),
|
||||||
desperation,
|
desperation,
|
||||||
data,
|
data,
|
||||||
|
@ -149,7 +149,7 @@ public:
|
||||||
{
|
{
|
||||||
_virtualNetworkFrameFunction(
|
_virtualNetworkFrameFunction(
|
||||||
reinterpret_cast<ZT1_Node *>(this),
|
reinterpret_cast<ZT1_Node *>(this),
|
||||||
_uptr,
|
_uPtr,
|
||||||
nwid,
|
nwid,
|
||||||
source.toInt(),
|
source.toInt(),
|
||||||
dest.toInt(),
|
dest.toInt(),
|
||||||
|
@ -192,9 +192,9 @@ public:
|
||||||
*/
|
*/
|
||||||
inline unsigned int coreDesperation() const throw() { return _coreDesperation; }
|
inline unsigned int coreDesperation() const throw() { return _coreDesperation; }
|
||||||
|
|
||||||
inline bool dataStorePut(const char *name,const void *data,unsigned int len,bool secure) { return (_dataStorePutFunction(reinterpret_cast<ZT1_Node *>(this),_uptr,name,data,len,(int)secure) == 0); }
|
inline bool dataStorePut(const char *name,const void *data,unsigned int len,bool secure) { return (_dataStorePutFunction(reinterpret_cast<ZT1_Node *>(this),_uPtr,name,data,len,(int)secure) == 0); }
|
||||||
inline bool dataStorePut(const char *name,const std::string &data,bool secure) { return dataStorePut(name,(const void *)data.data(),(unsigned int)data.length(),secure); }
|
inline bool dataStorePut(const char *name,const std::string &data,bool secure) { return dataStorePut(name,(const void *)data.data(),(unsigned int)data.length(),secure); }
|
||||||
inline void dataStoreDelete(const char *name) { _dataStorePutFunction(reinterpret_cast<ZT1_Node *>(this),_uptr,name,(const void *)0,0,0); }
|
inline void dataStoreDelete(const char *name) { _dataStorePutFunction(reinterpret_cast<ZT1_Node *>(this),_uPtr,name,(const void *)0,0,0); }
|
||||||
std::string dataStoreGet(const char *name);
|
std::string dataStoreGet(const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -203,7 +203,7 @@ public:
|
||||||
* @param ev Event type
|
* @param ev Event type
|
||||||
* @param md Meta-data (default: NULL/none)
|
* @param md Meta-data (default: NULL/none)
|
||||||
*/
|
*/
|
||||||
inline void postEvent(ZT1_Event ev,const void *md = (const void *)0) { _eventCallback(reinterpret_cast<ZT1_Node *>(this),_uptr,ev,md); }
|
inline void postEvent(ZT1_Event ev,const void *md = (const void *)0) { _eventCallback(reinterpret_cast<ZT1_Node *>(this),_uPtr,ev,md); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update virtual network port configuration
|
* Update virtual network port configuration
|
||||||
|
@ -212,7 +212,7 @@ public:
|
||||||
* @param op Configuration operation
|
* @param op Configuration operation
|
||||||
* @param nc Network configuration
|
* @param nc Network configuration
|
||||||
*/
|
*/
|
||||||
inline int configureVirtualNetworkPort(uint64_t nwid,ZT1_VirtualNetworkConfigOperation op,const ZT1_VirtualNetworkConfig *nc) { return _virtualNetworkConfigFunction(reinterpret_cast<ZT1_Node *>(this),_uptr,nwid,op,nc); }
|
inline int configureVirtualNetworkPort(uint64_t nwid,ZT1_VirtualNetworkConfigOperation op,const ZT1_VirtualNetworkConfig *nc) { return _virtualNetworkConfigFunction(reinterpret_cast<ZT1_Node *>(this),_uPtr,nwid,op,nc); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return True if we appear to be online
|
* @return True if we appear to be online
|
||||||
|
@ -231,7 +231,7 @@ public:
|
||||||
private:
|
private:
|
||||||
RuntimeEnvironment *RR;
|
RuntimeEnvironment *RR;
|
||||||
|
|
||||||
void *_uptr;
|
void *_uPtr; // _uptr (lower case) is reserved in Visual Studio :P
|
||||||
|
|
||||||
ZT1_DataStoreGetFunction _dataStoreGetFunction;
|
ZT1_DataStoreGetFunction _dataStoreGetFunction;
|
||||||
ZT1_DataStorePutFunction _dataStorePutFunction;
|
ZT1_DataStorePutFunction _dataStorePutFunction;
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "Constants.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -37,7 +39,6 @@
|
||||||
|
|
||||||
#include "../include/ZeroTierOne.h"
|
#include "../include/ZeroTierOne.h"
|
||||||
|
|
||||||
#include "Constants.hpp"
|
|
||||||
#include "RuntimeEnvironment.hpp"
|
#include "RuntimeEnvironment.hpp"
|
||||||
#include "Path.hpp"
|
#include "Path.hpp"
|
||||||
#include "Address.hpp"
|
#include "Address.hpp"
|
||||||
|
|
11
one.cpp
11
one.cpp
|
@ -32,6 +32,8 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include "node/Constants.hpp"
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
#include <WinSock2.h>
|
#include <WinSock2.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
@ -60,7 +62,6 @@
|
||||||
|
|
||||||
#include "ext/json-parser/json.h"
|
#include "ext/json-parser/json.h"
|
||||||
|
|
||||||
#include "node/Constants.hpp"
|
|
||||||
#include "node/Identity.hpp"
|
#include "node/Identity.hpp"
|
||||||
#include "node/CertificateOfMembership.hpp"
|
#include "node/CertificateOfMembership.hpp"
|
||||||
#include "node/Utils.hpp"
|
#include "node/Utils.hpp"
|
||||||
|
@ -499,7 +500,7 @@ static int cli(int argc,char **argv)
|
||||||
cliPrintHelp(argv[0],stderr);
|
cliPrintHelp(argv[0],stderr);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
unsigned int scode = Http::DELETE(
|
unsigned int scode = Http::DEL(
|
||||||
1024 * 1024 * 16,
|
1024 * 1024 * 16,
|
||||||
60000,
|
60000,
|
||||||
(const struct sockaddr *)&addr,
|
(const struct sockaddr *)&addr,
|
||||||
|
@ -731,9 +732,9 @@ static BOOL WINAPI _winConsoleCtrlHandler(DWORD dwCtrlType)
|
||||||
case CTRL_BREAK_EVENT:
|
case CTRL_BREAK_EVENT:
|
||||||
case CTRL_CLOSE_EVENT:
|
case CTRL_CLOSE_EVENT:
|
||||||
case CTRL_SHUTDOWN_EVENT:
|
case CTRL_SHUTDOWN_EVENT:
|
||||||
Node *n = node;
|
OneService *s = zt1Service;
|
||||||
if (n)
|
if (s)
|
||||||
n->terminate(Node::NODE_NORMAL_TERMINATION,"terminated by signal");
|
s->terminate();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -130,7 +130,7 @@ static int ShttpOnUrl(http_parser *parser,const char *ptr,size_t length)
|
||||||
static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length)
|
static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length)
|
||||||
{
|
{
|
||||||
HttpPhyHandler *hh = reinterpret_cast<HttpPhyHandler *>(parser->data);
|
HttpPhyHandler *hh = reinterpret_cast<HttpPhyHandler *>(parser->data);
|
||||||
hh->messageSize += length;
|
hh->messageSize += (unsigned long)length;
|
||||||
if (hh->messageSize > hh->maxResponseSize)
|
if (hh->messageSize > hh->maxResponseSize)
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -138,13 +138,13 @@ static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length)
|
||||||
static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length)
|
static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length)
|
||||||
{
|
{
|
||||||
HttpPhyHandler *hh = reinterpret_cast<HttpPhyHandler *>(parser->data);
|
HttpPhyHandler *hh = reinterpret_cast<HttpPhyHandler *>(parser->data);
|
||||||
hh->messageSize += length;
|
hh->messageSize += (unsigned long)length;
|
||||||
if (hh->messageSize > hh->maxResponseSize)
|
if (hh->messageSize > hh->maxResponseSize)
|
||||||
return -1;
|
return -1;
|
||||||
if ((hh->currentHeaderField.length())&&(hh->currentHeaderValue.length())) {
|
if ((hh->currentHeaderField.length())&&(hh->currentHeaderValue.length())) {
|
||||||
(*hh->responseHeaders)[hh->currentHeaderField] = hh->currentHeaderValue;
|
(*hh->responseHeaders)[hh->currentHeaderField] = hh->currentHeaderValue;
|
||||||
hh->currentHeaderField.assign("",0);
|
hh->currentHeaderField = "";
|
||||||
hh->currentHeaderValue.assign("",0);
|
hh->currentHeaderValue = "";
|
||||||
}
|
}
|
||||||
for(size_t i=0;i<length;++i)
|
for(size_t i=0;i<length;++i)
|
||||||
hh->currentHeaderField.push_back(OSUtils::toLower(ptr[i]));
|
hh->currentHeaderField.push_back(OSUtils::toLower(ptr[i]));
|
||||||
|
@ -153,7 +153,7 @@ static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length)
|
||||||
static int ShttpOnValue(http_parser *parser,const char *ptr,size_t length)
|
static int ShttpOnValue(http_parser *parser,const char *ptr,size_t length)
|
||||||
{
|
{
|
||||||
HttpPhyHandler *hh = reinterpret_cast<HttpPhyHandler *>(parser->data);
|
HttpPhyHandler *hh = reinterpret_cast<HttpPhyHandler *>(parser->data);
|
||||||
hh->messageSize += length;
|
hh->messageSize += (unsigned long)length;
|
||||||
if (hh->messageSize > hh->maxResponseSize)
|
if (hh->messageSize > hh->maxResponseSize)
|
||||||
return -1;
|
return -1;
|
||||||
hh->currentHeaderValue.append(ptr,length);
|
hh->currentHeaderValue.append(ptr,length);
|
||||||
|
@ -169,7 +169,7 @@ static int ShttpOnHeadersComplete(http_parser *parser)
|
||||||
static int ShttpOnBody(http_parser *parser,const char *ptr,size_t length)
|
static int ShttpOnBody(http_parser *parser,const char *ptr,size_t length)
|
||||||
{
|
{
|
||||||
HttpPhyHandler *hh = reinterpret_cast<HttpPhyHandler *>(parser->data);
|
HttpPhyHandler *hh = reinterpret_cast<HttpPhyHandler *>(parser->data);
|
||||||
hh->messageSize += length;
|
hh->messageSize += (unsigned long)length;
|
||||||
if (hh->messageSize > hh->maxResponseSize)
|
if (hh->messageSize > hh->maxResponseSize)
|
||||||
return -1;
|
return -1;
|
||||||
hh->responseBody->append(ptr,length);
|
hh->responseBody->append(ptr,length);
|
||||||
|
@ -198,7 +198,7 @@ unsigned int Http::_do(
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
responseHeaders.clear();
|
responseHeaders.clear();
|
||||||
responseBody.assign("",0);
|
responseBody = "";
|
||||||
|
|
||||||
HttpPhyHandler handler;
|
HttpPhyHandler handler;
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return HTTP status code or 0 on error (responseBody will contain error message)
|
* @return HTTP status code or 0 on error (responseBody will contain error message)
|
||||||
*/
|
*/
|
||||||
static inline unsigned int DELETE(
|
static inline unsigned int DEL(
|
||||||
unsigned long maxResponseSize,
|
unsigned long maxResponseSize,
|
||||||
unsigned long timeout,
|
unsigned long timeout,
|
||||||
const struct sockaddr *remoteAddress,
|
const struct sockaddr *remoteAddress,
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
#include <WinSock2.h>
|
#include <WinSock2.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
#include <Shlwapi.h>
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -96,9 +97,15 @@ public:
|
||||||
static inline bool mkdir(const char *path)
|
static inline bool mkdir(const char *path)
|
||||||
throw()
|
throw()
|
||||||
{
|
{
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
if (::PathIsDirectoryA(path))
|
||||||
|
return true;
|
||||||
|
return (::CreateDirectoryA(path,NULL) == TRUE);
|
||||||
|
#else
|
||||||
if (::mkdir(path,0755) != 0)
|
if (::mkdir(path,0755) != 0)
|
||||||
return (errno == EEXIST);
|
return (errno == EEXIST);
|
||||||
return true;
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static inline bool mkdir(const std::string &path) throw() { return OSUtils::mkdir(path.c_str()); }
|
static inline bool mkdir(const std::string &path) throw() { return OSUtils::mkdir(path.c_str()); }
|
||||||
|
|
||||||
|
|
|
@ -339,7 +339,11 @@ public:
|
||||||
inline bool udpSend(PhySocket *sock,const struct sockaddr *remoteAddress,const void *data,unsigned long len)
|
inline bool udpSend(PhySocket *sock,const struct sockaddr *remoteAddress,const void *data,unsigned long len)
|
||||||
{
|
{
|
||||||
PhySocketImpl &sws = *(reinterpret_cast<PhySocketImpl *>(sock));
|
PhySocketImpl &sws = *(reinterpret_cast<PhySocketImpl *>(sock));
|
||||||
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
return ((long)::sendto(sws.sock,reinterpret_cast<const char *>(data),len,0,remoteAddress,(remoteAddress->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)) == (long)len);
|
||||||
|
#else
|
||||||
return ((long)::sendto(sws.sock,data,len,0,remoteAddress,(remoteAddress->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)) == (long)len);
|
return ((long)::sendto(sws.sock,data,len,0,remoteAddress,(remoteAddress->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)) == (long)len);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -522,8 +526,8 @@ public:
|
||||||
inline long tcpSend(PhySocket *sock,const void *data,unsigned long len,bool callCloseHandler = true)
|
inline long tcpSend(PhySocket *sock,const void *data,unsigned long len,bool callCloseHandler = true)
|
||||||
{
|
{
|
||||||
PhySocketImpl &sws = *(reinterpret_cast<PhySocketImpl *>(sock));
|
PhySocketImpl &sws = *(reinterpret_cast<PhySocketImpl *>(sock));
|
||||||
long n = (long)::send(sws.sock,data,len,0);
|
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
long n = (long)::send(sws.sock,reinterpret_cast<const char *>(data),len,0);
|
||||||
if (n == SOCKET_ERROR) {
|
if (n == SOCKET_ERROR) {
|
||||||
switch(WSAGetLastError()) {
|
switch(WSAGetLastError()) {
|
||||||
case WSAEINTR:
|
case WSAEINTR:
|
||||||
|
@ -535,6 +539,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else // not Windows
|
#else // not Windows
|
||||||
|
long n = (long)::send(sws.sock,data,len,0);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
switch(errno) {
|
switch(errno) {
|
||||||
#ifdef EAGAIN
|
#ifdef EAGAIN
|
||||||
|
@ -614,8 +619,10 @@ public:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for(typename std::list<PhySocketImpl>::iterator s(_socks.begin()),nexts;s!=_socks.end();s=nexts) {
|
bool atEnd = false;
|
||||||
|
for(typename std::list<PhySocketImpl>::iterator s(_socks.begin()),nexts;(!atEnd);s=nexts) {
|
||||||
nexts = s; ++nexts; // we can delete the linked list item, so traverse now
|
nexts = s; ++nexts; // we can delete the linked list item, so traverse now
|
||||||
|
atEnd = (nexts == _socks.end()); // if we delete the last element, s!=_socks.end() will no longer terminate our loop
|
||||||
|
|
||||||
switch (s->type) {
|
switch (s->type) {
|
||||||
|
|
||||||
|
@ -644,9 +651,10 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZT_PHY_SOCKET_TCP_OUT_CONNECTED:
|
case ZT_PHY_SOCKET_TCP_OUT_CONNECTED:
|
||||||
case ZT_PHY_SOCKET_TCP_IN:
|
case ZT_PHY_SOCKET_TCP_IN: {
|
||||||
if (FD_ISSET(s->sock,&rfds)) {
|
ZT_PHY_SOCKFD_TYPE sock = s->sock; // if closed, s->sock becomes invalid as s is no longer dereferencable
|
||||||
long n = (long)::recv(s->sock,buf,sizeof(buf),0);
|
if (FD_ISSET(sock,&rfds)) {
|
||||||
|
long n = (long)::recv(sock,buf,sizeof(buf),0);
|
||||||
if (n <= 0) {
|
if (n <= 0) {
|
||||||
this->close((PhySocket *)&(*s),true);
|
this->close((PhySocket *)&(*s),true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -655,12 +663,12 @@ public:
|
||||||
} catch ( ... ) {}
|
} catch ( ... ) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((FD_ISSET(s->sock,&wfds))&&(FD_ISSET(s->sock,&_writefds))) {
|
if ((FD_ISSET(sock,&wfds))&&(FD_ISSET(sock,&_writefds))) {
|
||||||
try {
|
try {
|
||||||
_handler->phyOnTcpWritable((PhySocket *)&(*s),&(s->uptr));
|
_handler->phyOnTcpWritable((PhySocket *)&(*s),&(s->uptr));
|
||||||
} catch ( ... ) {}
|
} catch ( ... ) {}
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
|
|
||||||
case ZT_PHY_SOCKET_TCP_LISTEN:
|
case ZT_PHY_SOCKET_TCP_LISTEN:
|
||||||
if (FD_ISSET(s->sock,&rfds)) {
|
if (FD_ISSET(s->sock,&rfds)) {
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include <WinSock2.h>
|
#include <WinSock2.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "Mutex.hpp"
|
#include "../node/Mutex.hpp"
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
|
|
|
@ -44,42 +44,71 @@
|
||||||
#include <nldef.h>
|
#include <nldef.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
#include "../node/Constants.hpp"
|
#include "../node/Constants.hpp"
|
||||||
#include "../node/Utils.hpp"
|
#include "../node/Utils.hpp"
|
||||||
#include "../node/Mutex.hpp"
|
#include "../node/Mutex.hpp"
|
||||||
|
|
||||||
#include "WindowsEthernetTap.hpp"
|
#include "WindowsEthernetTap.hpp"
|
||||||
|
#include "OSUtils.hpp"
|
||||||
|
|
||||||
#include "..\windows\TapDriver\tap-windows.h"
|
#include "..\windows\TapDriver\tap-windows.h"
|
||||||
|
|
||||||
// ff:ff:ff:ff:ff:ff with no ADI
|
// ff:ff:ff:ff:ff:ff with no ADI
|
||||||
static const ZeroTier::MulticastGroup _blindWildcardMulticastGroup(ZeroTier::MAC(0xff),0);
|
//static const ZeroTier::MulticastGroup _blindWildcardMulticastGroup(ZeroTier::MAC(0xff),0);
|
||||||
|
|
||||||
#define ZT_WINDOWS_CREATE_FAKE_DEFAULT_ROUTE
|
#define ZT_WINDOWS_CREATE_FAKE_DEFAULT_ROUTE
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
class WindowsEthernetTapEnv
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WindowsEthernetTapEnv()
|
||||||
|
{
|
||||||
|
#ifdef _WIN64
|
||||||
|
is64Bit = TRUE;
|
||||||
|
devcon = "\\devcon_x64.exe";
|
||||||
|
tapDriver = "\\tap-windows\\x64\\zttap200.inf";
|
||||||
|
#else
|
||||||
|
is64Bit = FALSE;
|
||||||
|
IsWow64Process(GetCurrentProcess(),&is64Bit);
|
||||||
|
devcon = ((is64Bit == TRUE) ? "\\devcon_x64.exe" : "\\devcon_x86.exe");
|
||||||
|
tapDriver = ((is64Bit == TRUE) ? "\\tap-windows\\x64\\zttap200.inf" : "\\tap-windows\\x86\\zttap200.inf");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL is64Bit;
|
||||||
|
std::string devcon;
|
||||||
|
std::string tapDriver;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const WindowsEthernetTapEnv WINENV;
|
||||||
|
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
// Only create or delete devices one at a time
|
// Only create or delete devices one at a time
|
||||||
static Mutex _systemTapInitLock;
|
static Mutex _systemTapInitLock;
|
||||||
|
|
||||||
WindowsEthernetTap::WindowsEthernetTap(
|
WindowsEthernetTap::WindowsEthernetTap(
|
||||||
const char *pathToHelpers,
|
const char *hp,
|
||||||
const MAC &mac,
|
const MAC &mac,
|
||||||
unsigned int mtu,
|
unsigned int mtu,
|
||||||
unsigned int metric,
|
unsigned int metric,
|
||||||
uint64_t nwid,
|
uint64_t nwid,
|
||||||
const char *desiredDevice,
|
|
||||||
const char *friendlyName,
|
const char *friendlyName,
|
||||||
void (*handler)(void *,const MAC &,const MAC &,unsigned int,const Buffer<4096> &),
|
void (*handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int),
|
||||||
void *arg) :
|
void *arg) :
|
||||||
EthernetTap("WindowsEthernetTap",mac,mtu,metric),
|
|
||||||
_handler(handler),
|
_handler(handler),
|
||||||
_arg(arg),
|
_arg(arg),
|
||||||
|
_mac(mac),
|
||||||
_nwid(nwid),
|
_nwid(nwid),
|
||||||
_tap(INVALID_HANDLE_VALUE),
|
_tap(INVALID_HANDLE_VALUE),
|
||||||
_injectSemaphore(INVALID_HANDLE_VALUE),
|
_injectSemaphore(INVALID_HANDLE_VALUE),
|
||||||
_pathToHelpers(pathToHelpers),
|
_pathToHelpers(hp),
|
||||||
_run(true),
|
_run(true),
|
||||||
_initialized(false),
|
_initialized(false),
|
||||||
_enabled(true)
|
_enabled(true)
|
||||||
|
@ -169,11 +198,11 @@ WindowsEthernetTap::WindowsEthernetTap(
|
||||||
PROCESS_INFORMATION processInfo;
|
PROCESS_INFORMATION processInfo;
|
||||||
memset(&startupInfo,0,sizeof(STARTUPINFOA));
|
memset(&startupInfo,0,sizeof(STARTUPINFOA));
|
||||||
memset(&processInfo,0,sizeof(PROCESS_INFORMATION));
|
memset(&processInfo,0,sizeof(PROCESS_INFORMATION));
|
||||||
if (!CreateProcessA(NULL,(LPSTR)(std::string("\"") + _pathToHelpers + WindowsEthernetTapFactory::WINENV.devcon + "\" install \"" + _pathToHelpers + WindowsEthernetTapFactory::WINENV.tapDriver + "\" zttap200").c_str(),NULL,NULL,FALSE,0,NULL,NULL,&startupInfo,&processInfo)) {
|
if (!CreateProcessA(NULL,(LPSTR)(std::string("\"") + _pathToHelpers + WINENV.devcon + "\" install \"" + _pathToHelpers + WINENV.tapDriver + "\" zttap200").c_str(),NULL,NULL,FALSE,0,NULL,NULL,&startupInfo,&processInfo)) {
|
||||||
RegCloseKey(nwAdapters);
|
RegCloseKey(nwAdapters);
|
||||||
if (devconLog != INVALID_HANDLE_VALUE)
|
if (devconLog != INVALID_HANDLE_VALUE)
|
||||||
CloseHandle(devconLog);
|
CloseHandle(devconLog);
|
||||||
throw std::runtime_error(std::string("unable to find or execute devcon at ") + WindowsEthernetTapFactory::WINENV.devcon);
|
throw std::runtime_error(std::string("unable to find or execute devcon at ") + WINENV.devcon);
|
||||||
}
|
}
|
||||||
WaitForSingleObject(processInfo.hProcess,INFINITE);
|
WaitForSingleObject(processInfo.hProcess,INFINITE);
|
||||||
CloseHandle(processInfo.hProcess);
|
CloseHandle(processInfo.hProcess);
|
||||||
|
@ -296,18 +325,18 @@ bool WindowsEthernetTap::enabled() const
|
||||||
return _enabled;
|
return _enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WindowsEthernetTap::addIP(const InetAddress &ip)
|
bool WindowsEthernetTap::addIp(const InetAddress &ip)
|
||||||
{
|
{
|
||||||
if (!_initialized)
|
if (!_initialized)
|
||||||
return false;
|
return false;
|
||||||
if (!ip.netmaskBits()) // sanity check... netmask of 0.0.0.0 is WUT?
|
if (!ip.netmaskBits()) // sanity check... netmask of 0.0.0.0 is WUT?
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::set<InetAddress> haveIps(ips());
|
std::vector<InetAddress> haveIps(ips());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Add IP to interface at the netlink level if not already assigned.
|
// Add IP to interface at the netlink level if not already assigned.
|
||||||
if (!haveIps.count(ip)) {
|
if (!std::binary_search(haveIps.begin(),haveIps.end(),ip)) {
|
||||||
MIB_UNICASTIPADDRESS_ROW ipr;
|
MIB_UNICASTIPADDRESS_ROW ipr;
|
||||||
|
|
||||||
InitializeUnicastIpAddressEntry(&ipr);
|
InitializeUnicastIpAddressEntry(&ipr);
|
||||||
|
@ -333,12 +362,9 @@ bool WindowsEthernetTap::addIP(const InetAddress &ip)
|
||||||
ipr.InterfaceLuid = _deviceLuid;
|
ipr.InterfaceLuid = _deviceLuid;
|
||||||
ipr.InterfaceIndex = _getDeviceIndex();
|
ipr.InterfaceIndex = _getDeviceIndex();
|
||||||
|
|
||||||
if (CreateUnicastIpAddressEntry(&ipr) == NO_ERROR) {
|
if (CreateUnicastIpAddressEntry(&ipr) != NO_ERROR)
|
||||||
haveIps.insert(ip);
|
|
||||||
} else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> regIps(_getRegistryIPv4Value("IPAddress"));
|
std::vector<std::string> regIps(_getRegistryIPv4Value("IPAddress"));
|
||||||
if (std::find(regIps.begin(),regIps.end(),ip.toIpString()) == regIps.end()) {
|
if (std::find(regIps.begin(),regIps.end(),ip.toIpString()) == regIps.end()) {
|
||||||
|
@ -348,14 +374,13 @@ bool WindowsEthernetTap::addIP(const InetAddress &ip)
|
||||||
_setRegistryIPv4Value("IPAddress",regIps);
|
_setRegistryIPv4Value("IPAddress",regIps);
|
||||||
_setRegistryIPv4Value("SubnetMask",regSubnetMasks);
|
_setRegistryIPv4Value("SubnetMask",regSubnetMasks);
|
||||||
}
|
}
|
||||||
//_syncIpsWithRegistry(haveIps,_netCfgInstanceId);
|
|
||||||
} catch ( ... ) {
|
} catch ( ... ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WindowsEthernetTap::removeIP(const InetAddress &ip)
|
bool WindowsEthernetTap::removeIp(const InetAddress &ip)
|
||||||
{
|
{
|
||||||
if (!_initialized)
|
if (!_initialized)
|
||||||
return false;
|
return false;
|
||||||
|
@ -371,7 +396,7 @@ bool WindowsEthernetTap::removeIP(const InetAddress &ip)
|
||||||
break;
|
break;
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
addr.set(ipt->Table[i].Address.Ipv6.sin6_addr.u.Byte,16,ipt->Table[i].OnLinkPrefixLength);
|
addr.set(ipt->Table[i].Address.Ipv6.sin6_addr.u.Byte,16,ipt->Table[i].OnLinkPrefixLength);
|
||||||
if (addr.isLinkLocal())
|
if (addr.ipScope() == InetAddress::IP_SCOPE_LINK_LOCAL)
|
||||||
continue; // can't remove link-local IPv6 addresses
|
continue; // can't remove link-local IPv6 addresses
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -402,10 +427,10 @@ bool WindowsEthernetTap::removeIP(const InetAddress &ip)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<InetAddress> WindowsEthernetTap::ips() const
|
std::vector<InetAddress> WindowsEthernetTap::ips() const
|
||||||
{
|
{
|
||||||
static const InetAddress linkLocalLoopback("fe80::1",64); // what is this and why does Windows assign it?
|
static const InetAddress linkLocalLoopback("fe80::1",64); // what is this and why does Windows assign it?
|
||||||
std::set<InetAddress> addrs;
|
std::vector<InetAddress> addrs;
|
||||||
|
|
||||||
if (!_initialized)
|
if (!_initialized)
|
||||||
return addrs;
|
return addrs;
|
||||||
|
@ -419,12 +444,12 @@ std::set<InetAddress> WindowsEthernetTap::ips() const
|
||||||
case AF_INET: {
|
case AF_INET: {
|
||||||
InetAddress ip(&(ipt->Table[i].Address.Ipv4.sin_addr.S_un.S_addr),4,ipt->Table[i].OnLinkPrefixLength);
|
InetAddress ip(&(ipt->Table[i].Address.Ipv4.sin_addr.S_un.S_addr),4,ipt->Table[i].OnLinkPrefixLength);
|
||||||
if (ip != InetAddress::LO4)
|
if (ip != InetAddress::LO4)
|
||||||
addrs.insert(ip);
|
addrs.push_back(ip);
|
||||||
} break;
|
} break;
|
||||||
case AF_INET6: {
|
case AF_INET6: {
|
||||||
InetAddress ip(ipt->Table[i].Address.Ipv6.sin6_addr.u.Byte,16,ipt->Table[i].OnLinkPrefixLength);
|
InetAddress ip(ipt->Table[i].Address.Ipv6.sin6_addr.u.Byte,16,ipt->Table[i].OnLinkPrefixLength);
|
||||||
if ((ip != linkLocalLoopback)&&(ip != InetAddress::LO6))
|
if ((ip != linkLocalLoopback)&&(ip != InetAddress::LO6))
|
||||||
addrs.insert(ip);
|
addrs.push_back(ip);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -433,6 +458,9 @@ std::set<InetAddress> WindowsEthernetTap::ips() const
|
||||||
}
|
}
|
||||||
} catch ( ... ) {} // sanity check, shouldn't happen unless out of memory
|
} catch ( ... ) {} // sanity check, shouldn't happen unless out of memory
|
||||||
|
|
||||||
|
std::sort(addrs.begin(),addrs.end());
|
||||||
|
std::unique(addrs.begin(),addrs.end());
|
||||||
|
|
||||||
return addrs;
|
return addrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,23 +500,15 @@ void WindowsEthernetTap::setFriendlyName(const char *dn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WindowsEthernetTap::updateMulticastGroups(std::set<MulticastGroup> &groups)
|
void WindowsEthernetTap::scanMulticastGroups(std::vector<MulticastGroup> &added,std::vector<MulticastGroup> &removed)
|
||||||
{
|
{
|
||||||
if (!_initialized)
|
if (!_initialized)
|
||||||
return false;
|
return;
|
||||||
HANDLE t = _tap;
|
HANDLE t = _tap;
|
||||||
if (t == INVALID_HANDLE_VALUE)
|
if (t == INVALID_HANDLE_VALUE)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
std::set<MulticastGroup> newGroups;
|
std::vector<MulticastGroup> newGroups;
|
||||||
|
|
||||||
// Ensure that groups are added for each IP... this handles the MAC:ADI
|
|
||||||
// groups that are created from IPv4 addresses. Some of these may end
|
|
||||||
// up being duplicates of what the IOCTL returns but that's okay since
|
|
||||||
// the set<> will filter that.
|
|
||||||
std::set<InetAddress> ipaddrs(ips());
|
|
||||||
for(std::set<InetAddress>::const_iterator i(ipaddrs.begin());i!=ipaddrs.end();++i)
|
|
||||||
newGroups.insert(MulticastGroup::deriveMulticastGroupForAddressResolution(*i));
|
|
||||||
|
|
||||||
// The ZT1 tap driver supports an IOCTL to get multicast memberships at the L2
|
// The ZT1 tap driver supports an IOCTL to get multicast memberships at the L2
|
||||||
// level... something Windows does not seem to expose ordinarily. This lets
|
// level... something Windows does not seem to expose ordinarily. This lets
|
||||||
|
@ -503,32 +523,28 @@ bool WindowsEthernetTap::updateMulticastGroups(std::set<MulticastGroup> &groups)
|
||||||
i += 6;
|
i += 6;
|
||||||
if ((mac.isMulticast())&&(!mac.isBroadcast())) {
|
if ((mac.isMulticast())&&(!mac.isBroadcast())) {
|
||||||
// exclude the nulls that may be returned or any other junk Windows puts in there
|
// exclude the nulls that may be returned or any other junk Windows puts in there
|
||||||
newGroups.insert(MulticastGroup(mac,0));
|
newGroups.push_back(MulticastGroup(mac,0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool changed = false;
|
std::vector<InetAddress> allIps(ips());
|
||||||
|
for(std::vector<InetAddress>::iterator ip(allIps.begin());ip!=allIps.end();++ip)
|
||||||
|
newGroups.push_back(MulticastGroup::deriveMulticastGroupForAddressResolution(*ip));
|
||||||
|
|
||||||
for(std::set<MulticastGroup>::iterator mg(newGroups.begin());mg!=newGroups.end();++mg) {
|
std::sort(newGroups.begin(),newGroups.end());
|
||||||
if (!groups.count(*mg)) {
|
std::unique(newGroups.begin(),newGroups.end());
|
||||||
groups.insert(*mg);
|
|
||||||
changed = true;
|
for(std::vector<MulticastGroup>::iterator m(newGroups.begin());m!=newGroups.end();++m) {
|
||||||
|
if (!std::binary_search(_multicastGroups.begin(),_multicastGroups.end(),*m))
|
||||||
|
added.push_back(*m);
|
||||||
}
|
}
|
||||||
}
|
for(std::vector<MulticastGroup>::iterator m(_multicastGroups.begin());m!=_multicastGroups.end();++m) {
|
||||||
for(std::set<MulticastGroup>::iterator mg(groups.begin());mg!=groups.end();) {
|
if (!std::binary_search(newGroups.begin(),newGroups.end(),*m))
|
||||||
if ((!newGroups.count(*mg))&&(*mg != _blindWildcardMulticastGroup)) {
|
removed.push_back(*m);
|
||||||
groups.erase(mg++);
|
|
||||||
changed = true;
|
|
||||||
} else ++mg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return changed;
|
_multicastGroups.swap(newGroups);
|
||||||
}
|
|
||||||
|
|
||||||
bool WindowsEthernetTap::injectPacketFromHost(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowsEthernetTap::threadMain()
|
void WindowsEthernetTap::threadMain()
|
||||||
|
@ -699,8 +715,8 @@ void WindowsEthernetTap::threadMain()
|
||||||
MAC from(tapReadBuf + 6,6);
|
MAC from(tapReadBuf + 6,6);
|
||||||
unsigned int etherType = ((((unsigned int)tapReadBuf[12]) & 0xff) << 8) | (((unsigned int)tapReadBuf[13]) & 0xff);
|
unsigned int etherType = ((((unsigned int)tapReadBuf[12]) & 0xff) << 8) | (((unsigned int)tapReadBuf[13]) & 0xff);
|
||||||
try {
|
try {
|
||||||
Buffer<4096> tmp(tapReadBuf + 14,bytesRead - 14);
|
// TODO: decode vlans
|
||||||
_handler(_arg,from,to,etherType,tmp);
|
_handler(_arg,_nwid,from,to,etherType,0,tapReadBuf + 14,bytesRead - 14);
|
||||||
} catch ( ... ) {} // handlers should not throw
|
} catch ( ... ) {} // handlers should not throw
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -733,6 +749,71 @@ void WindowsEthernetTap::threadMain()
|
||||||
::free(tapReadBuf);
|
::free(tapReadBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowsEthernetTap::destroyAllPersistentTapDevices(const char *pathToHelpers)
|
||||||
|
{
|
||||||
|
char subkeyName[4096];
|
||||||
|
char subkeyClass[4096];
|
||||||
|
char data[4096];
|
||||||
|
|
||||||
|
std::set<std::string> instanceIdPathsToRemove;
|
||||||
|
{
|
||||||
|
HKEY nwAdapters;
|
||||||
|
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}",0,KEY_READ|KEY_WRITE,&nwAdapters) != ERROR_SUCCESS)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(DWORD subkeyIndex=0;;++subkeyIndex) {
|
||||||
|
DWORD type;
|
||||||
|
DWORD dataLen;
|
||||||
|
DWORD subkeyNameLen = sizeof(subkeyName);
|
||||||
|
DWORD subkeyClassLen = sizeof(subkeyClass);
|
||||||
|
FILETIME lastWriteTime;
|
||||||
|
if (RegEnumKeyExA(nwAdapters,subkeyIndex,subkeyName,&subkeyNameLen,(DWORD *)0,subkeyClass,&subkeyClassLen,&lastWriteTime) == ERROR_SUCCESS) {
|
||||||
|
type = 0;
|
||||||
|
dataLen = sizeof(data);
|
||||||
|
if (RegGetValueA(nwAdapters,subkeyName,"ComponentId",RRF_RT_ANY,&type,(PVOID)data,&dataLen) == ERROR_SUCCESS) {
|
||||||
|
data[dataLen] = '\0';
|
||||||
|
if (!strnicmp(data,"zttap",5)) {
|
||||||
|
std::string instanceIdPath;
|
||||||
|
type = 0;
|
||||||
|
dataLen = sizeof(data);
|
||||||
|
if (RegGetValueA(nwAdapters,subkeyName,"DeviceInstanceID",RRF_RT_ANY,&type,(PVOID)data,&dataLen) == ERROR_SUCCESS)
|
||||||
|
instanceIdPath.assign(data,dataLen);
|
||||||
|
if (instanceIdPath.length() != 0)
|
||||||
|
instanceIdPathsToRemove.insert(instanceIdPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else break; // end of list or failure
|
||||||
|
}
|
||||||
|
|
||||||
|
RegCloseKey(nwAdapters);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(std::set<std::string>::iterator iidp(instanceIdPathsToRemove.begin());iidp!=instanceIdPathsToRemove.end();++iidp)
|
||||||
|
deletePersistentTapDevice(pathToHelpers,iidp->c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowsEthernetTap::deletePersistentTapDevice(const char *pathToHelpers,const char *instanceId)
|
||||||
|
{
|
||||||
|
HANDLE devconLog = CreateFileA((std::string(pathToHelpers) + "\\devcon.log").c_str(),GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
|
||||||
|
STARTUPINFOA startupInfo;
|
||||||
|
startupInfo.cb = sizeof(startupInfo);
|
||||||
|
if (devconLog != INVALID_HANDLE_VALUE) {
|
||||||
|
SetFilePointer(devconLog,0,0,FILE_END);
|
||||||
|
startupInfo.hStdOutput = devconLog;
|
||||||
|
startupInfo.hStdError = devconLog;
|
||||||
|
}
|
||||||
|
PROCESS_INFORMATION processInfo;
|
||||||
|
memset(&startupInfo,0,sizeof(STARTUPINFOA));
|
||||||
|
memset(&processInfo,0,sizeof(PROCESS_INFORMATION));
|
||||||
|
if (CreateProcessA(NULL,(LPSTR)(std::string("\"") + pathToHelpers + WINENV.devcon + "\" remove @" + instanceId).c_str(),NULL,NULL,FALSE,0,NULL,NULL,&startupInfo,&processInfo)) {
|
||||||
|
WaitForSingleObject(processInfo.hProcess,INFINITE);
|
||||||
|
CloseHandle(processInfo.hProcess);
|
||||||
|
CloseHandle(processInfo.hThread);
|
||||||
|
}
|
||||||
|
if (devconLog != INVALID_HANDLE_VALUE)
|
||||||
|
CloseHandle(devconLog);
|
||||||
|
}
|
||||||
|
|
||||||
bool WindowsEthernetTap::_disableTapDevice()
|
bool WindowsEthernetTap::_disableTapDevice()
|
||||||
{
|
{
|
||||||
HANDLE devconLog = CreateFileA((_pathToHelpers + "\\devcon.log").c_str(),GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
|
HANDLE devconLog = CreateFileA((_pathToHelpers + "\\devcon.log").c_str(),GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
|
||||||
|
@ -748,7 +829,7 @@ bool WindowsEthernetTap::_disableTapDevice()
|
||||||
PROCESS_INFORMATION processInfo;
|
PROCESS_INFORMATION processInfo;
|
||||||
memset(&startupInfo,0,sizeof(STARTUPINFOA));
|
memset(&startupInfo,0,sizeof(STARTUPINFOA));
|
||||||
memset(&processInfo,0,sizeof(PROCESS_INFORMATION));
|
memset(&processInfo,0,sizeof(PROCESS_INFORMATION));
|
||||||
if (!CreateProcessA(NULL,(LPSTR)(std::string("\"") + _pathToHelpers + WindowsEthernetTapFactory::WINENV.devcon + "\" disable @" + _deviceInstanceId).c_str(),NULL,NULL,FALSE,0,NULL,NULL,&startupInfo,&processInfo)) {
|
if (!CreateProcessA(NULL,(LPSTR)(std::string("\"") + _pathToHelpers + WINENV.devcon + "\" disable @" + _deviceInstanceId).c_str(),NULL,NULL,FALSE,0,NULL,NULL,&startupInfo,&processInfo)) {
|
||||||
if (devconLog != INVALID_HANDLE_VALUE)
|
if (devconLog != INVALID_HANDLE_VALUE)
|
||||||
CloseHandle(devconLog);
|
CloseHandle(devconLog);
|
||||||
return false;
|
return false;
|
||||||
|
@ -778,7 +859,7 @@ bool WindowsEthernetTap::_enableTapDevice()
|
||||||
PROCESS_INFORMATION processInfo;
|
PROCESS_INFORMATION processInfo;
|
||||||
memset(&startupInfo,0,sizeof(STARTUPINFOA));
|
memset(&startupInfo,0,sizeof(STARTUPINFOA));
|
||||||
memset(&processInfo,0,sizeof(PROCESS_INFORMATION));
|
memset(&processInfo,0,sizeof(PROCESS_INFORMATION));
|
||||||
if (!CreateProcessA(NULL,(LPSTR)(std::string("\"") + _pathToHelpers + WindowsEthernetTapFactory::WINENV.devcon + "\" enable @" + _deviceInstanceId).c_str(),NULL,NULL,FALSE,0,NULL,NULL,&startupInfo,&processInfo)) {
|
if (!CreateProcessA(NULL,(LPSTR)(std::string("\"") + _pathToHelpers + WINENV.devcon + "\" enable @" + _deviceInstanceId).c_str(),NULL,NULL,FALSE,0,NULL,NULL,&startupInfo,&processInfo)) {
|
||||||
if (devconLog != INVALID_HANDLE_VALUE)
|
if (devconLog != INVALID_HANDLE_VALUE)
|
||||||
CloseHandle(devconLog);
|
CloseHandle(devconLog);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -37,42 +37,38 @@
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "EthernetTap.hpp"
|
|
||||||
|
|
||||||
#include "../node/Constants.hpp"
|
#include "../node/Constants.hpp"
|
||||||
#include "../node/Mutex.hpp"
|
#include "../node/Mutex.hpp"
|
||||||
#include "../node/Thread.hpp"
|
|
||||||
#include "../node/Array.hpp"
|
#include "../node/Array.hpp"
|
||||||
#include "../node/MulticastGroup.hpp"
|
#include "../node/MulticastGroup.hpp"
|
||||||
|
#include "../osdep/Thread.hpp"
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
class WindowsEthernetTap : public EthernetTap
|
class WindowsEthernetTap
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WindowsEthernetTap(
|
WindowsEthernetTap(
|
||||||
const char *pathToHelpers,
|
const char *hp,
|
||||||
const MAC &mac,
|
const MAC &mac,
|
||||||
unsigned int mtu,
|
unsigned int mtu,
|
||||||
unsigned int metric,
|
unsigned int metric,
|
||||||
uint64_t nwid,
|
uint64_t nwid,
|
||||||
const char *desiredDevice,
|
|
||||||
const char *friendlyName,
|
const char *friendlyName,
|
||||||
void (*handler)(void *,const MAC &,const MAC &,unsigned int,const Buffer<4096> &),
|
void (*handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int),
|
||||||
void *arg);
|
void *arg);
|
||||||
|
|
||||||
virtual ~WindowsEthernetTap();
|
~WindowsEthernetTap();
|
||||||
|
|
||||||
virtual void setEnabled(bool en);
|
void setEnabled(bool en);
|
||||||
virtual bool enabled() const;
|
bool enabled() const;
|
||||||
virtual bool addIP(const InetAddress &ip);
|
bool addIp(const InetAddress &ip);
|
||||||
virtual bool removeIP(const InetAddress &ip);
|
bool removeIp(const InetAddress &ip);
|
||||||
virtual std::set<InetAddress> ips() const;
|
std::vector<InetAddress> ips() const;
|
||||||
virtual void put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len);
|
void put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len);
|
||||||
virtual std::string deviceName() const;
|
std::string deviceName() const;
|
||||||
virtual void setFriendlyName(const char *friendlyName);
|
void setFriendlyName(const char *friendlyName);
|
||||||
virtual bool updateMulticastGroups(std::set<MulticastGroup> &groups);
|
void scanMulticastGroups(std::vector<MulticastGroup> &added,std::vector<MulticastGroup> &removed);
|
||||||
virtual bool injectPacketFromHost(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len);
|
|
||||||
|
|
||||||
inline const NET_LUID &luid() const { return _deviceLuid; }
|
inline const NET_LUID &luid() const { return _deviceLuid; }
|
||||||
inline const GUID &guid() const { return _deviceGuid; }
|
inline const GUID &guid() const { return _deviceGuid; }
|
||||||
|
@ -81,6 +77,9 @@ public:
|
||||||
void threadMain()
|
void threadMain()
|
||||||
throw();
|
throw();
|
||||||
|
|
||||||
|
static void destroyAllPersistentTapDevices(const char *pathToHelpers);
|
||||||
|
static void deletePersistentTapDevice(const char *pathToHelpers,const char *instanceId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _disableTapDevice();
|
bool _disableTapDevice();
|
||||||
bool _enableTapDevice();
|
bool _enableTapDevice();
|
||||||
|
@ -88,8 +87,9 @@ private:
|
||||||
std::vector<std::string> _getRegistryIPv4Value(const char *regKey);
|
std::vector<std::string> _getRegistryIPv4Value(const char *regKey);
|
||||||
void _setRegistryIPv4Value(const char *regKey,const std::vector<std::string> &value);
|
void _setRegistryIPv4Value(const char *regKey,const std::vector<std::string> &value);
|
||||||
|
|
||||||
void (*_handler)(void *,const MAC &,const MAC &,unsigned int,const Buffer<4096> &);
|
void (*_handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int);
|
||||||
void *_arg;
|
void *_arg;
|
||||||
|
MAC _mac;
|
||||||
uint64_t _nwid;
|
uint64_t _nwid;
|
||||||
Thread _thread;
|
Thread _thread;
|
||||||
|
|
||||||
|
@ -101,6 +101,8 @@ private:
|
||||||
std::string _netCfgInstanceId; // NetCfgInstanceId, a GUID
|
std::string _netCfgInstanceId; // NetCfgInstanceId, a GUID
|
||||||
std::string _deviceInstanceId; // DeviceInstanceID, another kind of "instance ID"
|
std::string _deviceInstanceId; // DeviceInstanceID, another kind of "instance ID"
|
||||||
|
|
||||||
|
std::vector<MulticastGroup> _multicastGroups;
|
||||||
|
|
||||||
std::queue< std::pair< Array<char,ZT_IF_MTU + 32>,unsigned int > > _injectPending;
|
std::queue< std::pair< Array<char,ZT_IF_MTU + 32>,unsigned int > > _injectPending;
|
||||||
Mutex _injectPending_m;
|
Mutex _injectPending_m;
|
||||||
|
|
||||||
|
|
|
@ -628,7 +628,7 @@ struct TestPhyHandlers
|
||||||
{
|
{
|
||||||
std::string *testMessage = (std::string *)*uptr;
|
std::string *testMessage = (std::string *)*uptr;
|
||||||
if ((testMessage)&&(testMessage->length() > 0)) {
|
if ((testMessage)&&(testMessage->length() > 0)) {
|
||||||
long sent = testPhyInstance->tcpSend(sock,(const void *)testMessage->data(),testMessage->length(),true);
|
long sent = testPhyInstance->tcpSend(sock,(const void *)testMessage->data(),(unsigned long)testMessage->length(),true);
|
||||||
if (sent > 0)
|
if (sent > 0)
|
||||||
testMessage->erase(0,sent);
|
testMessage->erase(0,sent);
|
||||||
}
|
}
|
||||||
|
@ -804,6 +804,11 @@ int main(int argc,char **argv)
|
||||||
{
|
{
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
WSADATA wsaData;
|
||||||
|
WSAStartup(MAKEWORD(2,2),&wsaData);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Code to generate the C25519 test vectors -- did this once and then
|
// Code to generate the C25519 test vectors -- did this once and then
|
||||||
// put these up top so that we can ensure that every platform produces
|
// put these up top so that we can ensure that every platform produces
|
||||||
// the same result.
|
// the same result.
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ControlPlane.hpp"
|
#include "ControlPlane.hpp"
|
||||||
|
#include "ControlPlaneSubsystem.hpp"
|
||||||
#include "OneService.hpp"
|
#include "OneService.hpp"
|
||||||
|
|
||||||
#include "../version.h"
|
#include "../version.h"
|
||||||
|
@ -241,10 +242,9 @@ static void _jsonAppend(unsigned int depth,std::string &buf,const ZT1_Peer *peer
|
||||||
buf.append(json);
|
buf.append(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlPlane::ControlPlane(OneService *svc,Node *n,SqliteNetworkController *nc) :
|
ControlPlane::ControlPlane(OneService *svc,Node *n) :
|
||||||
_svc(svc),
|
_svc(svc),
|
||||||
_node(n),
|
_node(n)
|
||||||
_controller(nc)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ namespace ZeroTier {
|
||||||
|
|
||||||
class OneService;
|
class OneService;
|
||||||
class Node;
|
class Node;
|
||||||
|
class ControlPlaneSubsystem;
|
||||||
struct InetAddress;
|
struct InetAddress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -53,6 +53,10 @@
|
||||||
#include "OneService.hpp"
|
#include "OneService.hpp"
|
||||||
#include "ControlPlane.hpp"
|
#include "ControlPlane.hpp"
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
#include <ShlObj.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// Include the right tap device driver for this platform -- add new platforms here
|
// Include the right tap device driver for this platform -- add new platforms here
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include "../osdep/OSXEthernetTap.hpp"
|
#include "../osdep/OSXEthernetTap.hpp"
|
||||||
|
@ -62,6 +66,10 @@ namespace ZeroTier { typedef OSXEthernetTap EthernetTap; }
|
||||||
#include "../osdep/LinuxEthernetTap.hpp"
|
#include "../osdep/LinuxEthernetTap.hpp"
|
||||||
namespace ZeroTier { typedef LinuxEthernetTap EthernetTap; }
|
namespace ZeroTier { typedef LinuxEthernetTap EthernetTap; }
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
#include "../osdep/WindowsEthernetTap.hpp"
|
||||||
|
namespace ZeroTier { typedef WindowsEthernetTap EthernetTap; }
|
||||||
|
#endif
|
||||||
|
|
||||||
// Sanity limits for HTTP
|
// Sanity limits for HTTP
|
||||||
#define ZT_MAX_HTTP_MESSAGE_SIZE (1024 * 1024 * 8)
|
#define ZT_MAX_HTTP_MESSAGE_SIZE (1024 * 1024 * 8)
|
||||||
|
@ -214,7 +222,7 @@ public:
|
||||||
_controlPlane = new ControlPlane(this,_node);
|
_controlPlane = new ControlPlane(this,_node);
|
||||||
_controlPlane->addAuthToken(authToken.c_str());
|
_controlPlane->addAuthToken(authToken.c_str());
|
||||||
if (_master)
|
if (_master)
|
||||||
_controlPlane->mount("controller",_master);
|
_controlPlane->mount("controller",reinterpret_cast<ControlPlaneSubsystem *>(_master));
|
||||||
|
|
||||||
{ // Remember networks from previous session
|
{ // Remember networks from previous session
|
||||||
std::vector<std::string> networksDotD(OSUtils::listDirectory((_homePath + ZT_PATH_SEPARATOR_S + "networks.d").c_str()));
|
std::vector<std::string> networksDotD(OSUtils::listDirectory((_homePath + ZT_PATH_SEPARATOR_S + "networks.d").c_str()));
|
||||||
|
@ -384,7 +392,7 @@ public:
|
||||||
inline void phyOnTcpWritable(PhySocket *sock,void **uptr)
|
inline void phyOnTcpWritable(PhySocket *sock,void **uptr)
|
||||||
{
|
{
|
||||||
HttpConnection *htc = reinterpret_cast<HttpConnection *>(*uptr);
|
HttpConnection *htc = reinterpret_cast<HttpConnection *>(*uptr);
|
||||||
long sent = _phy.tcpSend(sock,htc->body.data() + htc->writePtr,htc->body.length() - htc->writePtr,true);
|
long sent = _phy.tcpSend(sock,htc->body.data() + htc->writePtr,(unsigned long)htc->body.length() - htc->writePtr,true);
|
||||||
if (sent < 0) {
|
if (sent < 0) {
|
||||||
return; // close handler will have been called, so everything's dead
|
return; // close handler will have been called, so everything's dead
|
||||||
} else {
|
} else {
|
||||||
|
@ -395,7 +403,7 @@ public:
|
||||||
if (htc->shouldKeepAlive) {
|
if (htc->shouldKeepAlive) {
|
||||||
htc->writing = false;
|
htc->writing = false;
|
||||||
htc->writePtr = 0;
|
htc->writePtr = 0;
|
||||||
htc->body.assign("",0);
|
htc->body = "";
|
||||||
} else {
|
} else {
|
||||||
_phy.close(sock); // will call close handler to delete from _httpConnections
|
_phy.close(sock); // will call close handler to delete from _httpConnections
|
||||||
}
|
}
|
||||||
|
@ -417,7 +425,7 @@ public:
|
||||||
_homePath.c_str(),
|
_homePath.c_str(),
|
||||||
MAC(nwc->mac),
|
MAC(nwc->mac),
|
||||||
nwc->mtu,
|
nwc->mtu,
|
||||||
ZT_IF_METRIC,
|
(unsigned int)ZT_IF_METRIC,
|
||||||
nwid,
|
nwid,
|
||||||
friendlyName,
|
friendlyName,
|
||||||
StapFrameHandler,
|
StapFrameHandler,
|
||||||
|
@ -453,9 +461,16 @@ public:
|
||||||
case ZT1_VIRTUAL_NETWORK_CONFIG_OPERATION_DOWN:
|
case ZT1_VIRTUAL_NETWORK_CONFIG_OPERATION_DOWN:
|
||||||
case ZT1_VIRTUAL_NETWORK_CONFIG_OPERATION_DESTROY:
|
case ZT1_VIRTUAL_NETWORK_CONFIG_OPERATION_DESTROY:
|
||||||
if (t != _taps.end()) {
|
if (t != _taps.end()) {
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
std::string winInstanceId(t->second->instanceId());
|
||||||
|
#endif
|
||||||
delete t->second;
|
delete t->second;
|
||||||
_taps.erase(t);
|
_taps.erase(t);
|
||||||
_tapAssignedIps.erase(nwid);
|
_tapAssignedIps.erase(nwid);
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
if ((op == ZT1_VIRTUAL_NETWORK_CONFIG_OPERATION_DESTROY)&&(winInstanceId.length() > 0))
|
||||||
|
WindowsEthernetTap::deletePersistentTapDevice(_homePath.c_str(),winInstanceId.c_str());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -683,19 +698,19 @@ static void StapFrameHandler(void *uptr,uint64_t nwid,const MAC &from,const MAC
|
||||||
static int ShttpOnMessageBegin(http_parser *parser)
|
static int ShttpOnMessageBegin(http_parser *parser)
|
||||||
{
|
{
|
||||||
HttpConnection *htc = reinterpret_cast<HttpConnection *>(parser->data);
|
HttpConnection *htc = reinterpret_cast<HttpConnection *>(parser->data);
|
||||||
htc->currentHeaderField.assign("",0);
|
htc->currentHeaderField = "";
|
||||||
htc->currentHeaderValue.assign("",0);
|
htc->currentHeaderValue = "";
|
||||||
htc->messageSize = 0;
|
htc->messageSize = 0;
|
||||||
htc->url.assign("",0);
|
htc->url = "";
|
||||||
htc->status.assign("",0);
|
htc->status = "";
|
||||||
htc->headers.clear();
|
htc->headers.clear();
|
||||||
htc->body.assign("",0);
|
htc->body = "";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int ShttpOnUrl(http_parser *parser,const char *ptr,size_t length)
|
static int ShttpOnUrl(http_parser *parser,const char *ptr,size_t length)
|
||||||
{
|
{
|
||||||
HttpConnection *htc = reinterpret_cast<HttpConnection *>(parser->data);
|
HttpConnection *htc = reinterpret_cast<HttpConnection *>(parser->data);
|
||||||
htc->messageSize += length;
|
htc->messageSize += (unsigned long)length;
|
||||||
if (htc->messageSize > ZT_MAX_HTTP_MESSAGE_SIZE)
|
if (htc->messageSize > ZT_MAX_HTTP_MESSAGE_SIZE)
|
||||||
return -1;
|
return -1;
|
||||||
htc->url.append(ptr,length);
|
htc->url.append(ptr,length);
|
||||||
|
@ -704,7 +719,7 @@ static int ShttpOnUrl(http_parser *parser,const char *ptr,size_t length)
|
||||||
static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length)
|
static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length)
|
||||||
{
|
{
|
||||||
HttpConnection *htc = reinterpret_cast<HttpConnection *>(parser->data);
|
HttpConnection *htc = reinterpret_cast<HttpConnection *>(parser->data);
|
||||||
htc->messageSize += length;
|
htc->messageSize += (unsigned long)length;
|
||||||
if (htc->messageSize > ZT_MAX_HTTP_MESSAGE_SIZE)
|
if (htc->messageSize > ZT_MAX_HTTP_MESSAGE_SIZE)
|
||||||
return -1;
|
return -1;
|
||||||
htc->status.append(ptr,length);
|
htc->status.append(ptr,length);
|
||||||
|
@ -713,13 +728,13 @@ static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length)
|
||||||
static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length)
|
static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length)
|
||||||
{
|
{
|
||||||
HttpConnection *htc = reinterpret_cast<HttpConnection *>(parser->data);
|
HttpConnection *htc = reinterpret_cast<HttpConnection *>(parser->data);
|
||||||
htc->messageSize += length;
|
htc->messageSize += (unsigned long)length;
|
||||||
if (htc->messageSize > ZT_MAX_HTTP_MESSAGE_SIZE)
|
if (htc->messageSize > ZT_MAX_HTTP_MESSAGE_SIZE)
|
||||||
return -1;
|
return -1;
|
||||||
if ((htc->currentHeaderField.length())&&(htc->currentHeaderValue.length())) {
|
if ((htc->currentHeaderField.length())&&(htc->currentHeaderValue.length())) {
|
||||||
htc->headers[htc->currentHeaderField] = htc->currentHeaderValue;
|
htc->headers[htc->currentHeaderField] = htc->currentHeaderValue;
|
||||||
htc->currentHeaderField.assign("",0);
|
htc->currentHeaderField = "";
|
||||||
htc->currentHeaderValue.assign("",0);
|
htc->currentHeaderValue = "";
|
||||||
}
|
}
|
||||||
for(size_t i=0;i<length;++i)
|
for(size_t i=0;i<length;++i)
|
||||||
htc->currentHeaderField.push_back(OSUtils::toLower(ptr[i]));
|
htc->currentHeaderField.push_back(OSUtils::toLower(ptr[i]));
|
||||||
|
@ -728,7 +743,7 @@ static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length)
|
||||||
static int ShttpOnValue(http_parser *parser,const char *ptr,size_t length)
|
static int ShttpOnValue(http_parser *parser,const char *ptr,size_t length)
|
||||||
{
|
{
|
||||||
HttpConnection *htc = reinterpret_cast<HttpConnection *>(parser->data);
|
HttpConnection *htc = reinterpret_cast<HttpConnection *>(parser->data);
|
||||||
htc->messageSize += length;
|
htc->messageSize += (unsigned long)length;
|
||||||
if (htc->messageSize > ZT_MAX_HTTP_MESSAGE_SIZE)
|
if (htc->messageSize > ZT_MAX_HTTP_MESSAGE_SIZE)
|
||||||
return -1;
|
return -1;
|
||||||
htc->currentHeaderValue.append(ptr,length);
|
htc->currentHeaderValue.append(ptr,length);
|
||||||
|
@ -744,7 +759,7 @@ static int ShttpOnHeadersComplete(http_parser *parser)
|
||||||
static int ShttpOnBody(http_parser *parser,const char *ptr,size_t length)
|
static int ShttpOnBody(http_parser *parser,const char *ptr,size_t length)
|
||||||
{
|
{
|
||||||
HttpConnection *htc = reinterpret_cast<HttpConnection *>(parser->data);
|
HttpConnection *htc = reinterpret_cast<HttpConnection *>(parser->data);
|
||||||
htc->messageSize += length;
|
htc->messageSize += (unsigned long)length;
|
||||||
if (htc->messageSize > ZT_MAX_HTTP_MESSAGE_SIZE)
|
if (htc->messageSize > ZT_MAX_HTTP_MESSAGE_SIZE)
|
||||||
return -1;
|
return -1;
|
||||||
htc->body.append(ptr,length);
|
htc->body.append(ptr,length);
|
||||||
|
|
|
@ -19,87 +19,49 @@
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\control\IpcConnection.cpp" />
|
<ClCompile Include="..\..\ext\http-parser\http_parser.c" />
|
||||||
<ClCompile Include="..\..\control\IpcListener.cpp" />
|
<ClCompile Include="..\..\ext\json-parser\json.c" />
|
||||||
<ClCompile Include="..\..\control\NodeControlClient.cpp" />
|
|
||||||
<ClCompile Include="..\..\control\NodeControlService.cpp" />
|
|
||||||
<ClCompile Include="..\..\ext\lz4\lz4.c" />
|
<ClCompile Include="..\..\ext\lz4\lz4.c" />
|
||||||
<ClCompile Include="..\..\main.cpp" />
|
|
||||||
<ClCompile Include="..\..\node\C25519.cpp" />
|
<ClCompile Include="..\..\node\C25519.cpp" />
|
||||||
<ClCompile Include="..\..\node\CertificateOfMembership.cpp" />
|
<ClCompile Include="..\..\node\CertificateOfMembership.cpp" />
|
||||||
<ClCompile Include="..\..\node\Defaults.cpp" />
|
<ClCompile Include="..\..\node\Defaults.cpp" />
|
||||||
<ClCompile Include="..\..\node\Dictionary.cpp" />
|
<ClCompile Include="..\..\node\Dictionary.cpp" />
|
||||||
<ClCompile Include="..\..\node\HttpClient.cpp" />
|
|
||||||
<ClCompile Include="..\..\node\Identity.cpp" />
|
<ClCompile Include="..\..\node\Identity.cpp" />
|
||||||
<ClCompile Include="..\..\node\IncomingPacket.cpp" />
|
<ClCompile Include="..\..\node\IncomingPacket.cpp" />
|
||||||
<ClCompile Include="..\..\node\InetAddress.cpp" />
|
<ClCompile Include="..\..\node\InetAddress.cpp" />
|
||||||
<ClCompile Include="..\..\node\Logger.cpp" />
|
|
||||||
<ClCompile Include="..\..\node\Multicaster.cpp" />
|
<ClCompile Include="..\..\node\Multicaster.cpp" />
|
||||||
<ClCompile Include="..\..\node\Network.cpp" />
|
<ClCompile Include="..\..\node\Network.cpp" />
|
||||||
<ClCompile Include="..\..\node\NetworkConfig.cpp" />
|
<ClCompile Include="..\..\node\NetworkConfig.cpp" />
|
||||||
<ClCompile Include="..\..\node\Node.cpp" />
|
<ClCompile Include="..\..\node\Node.cpp" />
|
||||||
<ClCompile Include="..\..\node\NodeConfig.cpp" />
|
|
||||||
<ClCompile Include="..\..\node\OutboundMulticast.cpp" />
|
<ClCompile Include="..\..\node\OutboundMulticast.cpp" />
|
||||||
<ClCompile Include="..\..\node\Packet.cpp" />
|
<ClCompile Include="..\..\node\Packet.cpp" />
|
||||||
<ClCompile Include="..\..\node\Peer.cpp" />
|
<ClCompile Include="..\..\node\Peer.cpp" />
|
||||||
<ClCompile Include="..\..\node\Poly1305.cpp" />
|
<ClCompile Include="..\..\node\Poly1305.cpp" />
|
||||||
<ClCompile Include="..\..\node\RoutingTable.cpp" />
|
|
||||||
<ClCompile Include="..\..\node\Salsa20.cpp" />
|
<ClCompile Include="..\..\node\Salsa20.cpp" />
|
||||||
<ClCompile Include="..\..\node\Service.cpp" />
|
<ClCompile Include="..\..\node\SelfAwareness.cpp" />
|
||||||
<ClCompile Include="..\..\node\SHA512.cpp" />
|
<ClCompile Include="..\..\node\SHA512.cpp" />
|
||||||
<ClCompile Include="..\..\node\SoftwareUpdater.cpp" />
|
|
||||||
<ClCompile Include="..\..\node\Switch.cpp" />
|
<ClCompile Include="..\..\node\Switch.cpp" />
|
||||||
<ClCompile Include="..\..\node\Topology.cpp" />
|
<ClCompile Include="..\..\node\Topology.cpp" />
|
||||||
<ClCompile Include="..\..\node\Utils.cpp" />
|
<ClCompile Include="..\..\node\Utils.cpp" />
|
||||||
<ClCompile Include="..\..\osnet\NativeSocketManager.cpp" />
|
<ClCompile Include="..\..\one.cpp" />
|
||||||
<ClCompile Include="..\..\osnet\WindowsEthernetTap.cpp" />
|
<ClCompile Include="..\..\osdep\Http.cpp" />
|
||||||
<ClCompile Include="..\..\osnet\WindowsEthernetTapFactory.cpp" />
|
<ClCompile Include="..\..\osdep\OSUtils.cpp" />
|
||||||
<ClCompile Include="..\..\osnet\WindowsRoutingTable.cpp" />
|
<ClCompile Include="..\..\osdep\WindowsEthernetTap.cpp" />
|
||||||
<ClCompile Include="..\..\testnet.cpp">
|
<ClCompile Include="..\..\selftest.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\testnet\SimNet.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\testnet\SimNetSocketManager.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\testnet\TestEthernetTap.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\testnet\TestEthernetTapFactory.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\testnet\TestRoutingTable.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\service\ControlPlane.cpp" />
|
||||||
|
<ClCompile Include="..\..\service\OneService.cpp" />
|
||||||
<ClCompile Include="ServiceBase.cpp" />
|
<ClCompile Include="ServiceBase.cpp" />
|
||||||
<ClCompile Include="ServiceInstaller.cpp" />
|
<ClCompile Include="ServiceInstaller.cpp" />
|
||||||
<ClCompile Include="ZeroTierOneService.cpp" />
|
<ClCompile Include="ZeroTierOneService.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\control\IpcConnection.hpp" />
|
<ClInclude Include="..\..\ext\http-parser\http_parser.h" />
|
||||||
<ClInclude Include="..\..\control\IpcListener.hpp" />
|
<ClInclude Include="..\..\ext\json-parser\json.h" />
|
||||||
<ClInclude Include="..\..\control\NodeControlClient.hpp" />
|
|
||||||
<ClInclude Include="..\..\control\NodeControlService.hpp" />
|
|
||||||
<ClInclude Include="..\..\ext\lz4\lz4.h" />
|
<ClInclude Include="..\..\ext\lz4\lz4.h" />
|
||||||
<ClInclude Include="..\..\include\ZeroTierOne.h" />
|
<ClInclude Include="..\..\include\ZeroTierOne.h" />
|
||||||
<ClInclude Include="..\..\node\Address.hpp" />
|
<ClInclude Include="..\..\node\Address.hpp" />
|
||||||
|
@ -114,50 +76,39 @@
|
||||||
<ClInclude Include="..\..\node\Constants.hpp" />
|
<ClInclude Include="..\..\node\Constants.hpp" />
|
||||||
<ClInclude Include="..\..\node\Defaults.hpp" />
|
<ClInclude Include="..\..\node\Defaults.hpp" />
|
||||||
<ClInclude Include="..\..\node\Dictionary.hpp" />
|
<ClInclude Include="..\..\node\Dictionary.hpp" />
|
||||||
<ClInclude Include="..\..\node\EthernetTap.hpp" />
|
|
||||||
<ClInclude Include="..\..\node\EthernetTapFactory.hpp" />
|
|
||||||
<ClInclude Include="..\..\node\HttpClient.hpp" />
|
|
||||||
<ClInclude Include="..\..\node\Identity.hpp" />
|
<ClInclude Include="..\..\node\Identity.hpp" />
|
||||||
<ClInclude Include="..\..\node\IncomingPacket.hpp" />
|
<ClInclude Include="..\..\node\IncomingPacket.hpp" />
|
||||||
<ClInclude Include="..\..\node\InetAddress.hpp" />
|
<ClInclude Include="..\..\node\InetAddress.hpp" />
|
||||||
<ClInclude Include="..\..\node\Logger.hpp" />
|
|
||||||
<ClInclude Include="..\..\node\MAC.hpp" />
|
<ClInclude Include="..\..\node\MAC.hpp" />
|
||||||
<ClInclude Include="..\..\node\Multicaster.hpp" />
|
<ClInclude Include="..\..\node\Multicaster.hpp" />
|
||||||
<ClInclude Include="..\..\node\MulticastGroup.hpp" />
|
<ClInclude Include="..\..\node\MulticastGroup.hpp" />
|
||||||
<ClInclude Include="..\..\node\Mutex.hpp" />
|
<ClInclude Include="..\..\node\Mutex.hpp" />
|
||||||
<ClInclude Include="..\..\node\Network.hpp" />
|
<ClInclude Include="..\..\node\Network.hpp" />
|
||||||
<ClInclude Include="..\..\node\NetworkConfig.hpp" />
|
<ClInclude Include="..\..\node\NetworkConfig.hpp" />
|
||||||
|
<ClInclude Include="..\..\node\NetworkController.hpp" />
|
||||||
<ClInclude Include="..\..\node\Node.hpp" />
|
<ClInclude Include="..\..\node\Node.hpp" />
|
||||||
<ClInclude Include="..\..\node\NodeConfig.hpp" />
|
|
||||||
<ClInclude Include="..\..\node\NonCopyable.hpp" />
|
<ClInclude Include="..\..\node\NonCopyable.hpp" />
|
||||||
<ClInclude Include="..\..\node\OutboundMulticast.hpp" />
|
<ClInclude Include="..\..\node\OutboundMulticast.hpp" />
|
||||||
<ClInclude Include="..\..\node\Packet.hpp" />
|
<ClInclude Include="..\..\node\Packet.hpp" />
|
||||||
<ClInclude Include="..\..\node\Path.hpp" />
|
<ClInclude Include="..\..\node\Path.hpp" />
|
||||||
<ClInclude Include="..\..\node\Peer.hpp" />
|
<ClInclude Include="..\..\node\Peer.hpp" />
|
||||||
<ClInclude Include="..\..\node\Poly1305.hpp" />
|
<ClInclude Include="..\..\node\Poly1305.hpp" />
|
||||||
<ClInclude Include="..\..\node\RoutingTable.hpp" />
|
|
||||||
<ClInclude Include="..\..\node\RuntimeEnvironment.hpp" />
|
<ClInclude Include="..\..\node\RuntimeEnvironment.hpp" />
|
||||||
<ClInclude Include="..\..\node\Salsa20.hpp" />
|
<ClInclude Include="..\..\node\Salsa20.hpp" />
|
||||||
<ClInclude Include="..\..\node\Service.hpp" />
|
<ClInclude Include="..\..\node\SelfAwareness.hpp" />
|
||||||
<ClInclude Include="..\..\node\SHA512.hpp" />
|
<ClInclude Include="..\..\node\SHA512.hpp" />
|
||||||
<ClInclude Include="..\..\node\SharedPtr.hpp" />
|
<ClInclude Include="..\..\node\SharedPtr.hpp" />
|
||||||
<ClInclude Include="..\..\node\Socket.hpp" />
|
|
||||||
<ClInclude Include="..\..\node\SocketManager.hpp" />
|
|
||||||
<ClInclude Include="..\..\node\SoftwareUpdater.hpp" />
|
|
||||||
<ClInclude Include="..\..\node\Switch.hpp" />
|
<ClInclude Include="..\..\node\Switch.hpp" />
|
||||||
<ClInclude Include="..\..\node\Thread.hpp" />
|
|
||||||
<ClInclude Include="..\..\node\Topology.hpp" />
|
<ClInclude Include="..\..\node\Topology.hpp" />
|
||||||
<ClInclude Include="..\..\node\Utils.hpp" />
|
<ClInclude Include="..\..\node\Utils.hpp" />
|
||||||
<ClInclude Include="..\..\osnet\NativeSocketManager.hpp" />
|
<ClInclude Include="..\..\osdep\Http.hpp" />
|
||||||
<ClInclude Include="..\..\osnet\WindowsEthernetTap.hpp" />
|
<ClInclude Include="..\..\osdep\OSUtils.hpp" />
|
||||||
<ClInclude Include="..\..\osnet\WindowsEthernetTapFactory.hpp" />
|
<ClInclude Include="..\..\osdep\Phy.hpp" />
|
||||||
<ClInclude Include="..\..\osnet\WindowsRoutingTable.hpp" />
|
<ClInclude Include="..\..\osdep\Thread.hpp" />
|
||||||
<ClInclude Include="..\..\testnet\MTQ.hpp" />
|
<ClInclude Include="..\..\osdep\WindowsEthernetTap.hpp" />
|
||||||
<ClInclude Include="..\..\testnet\SimNet.hpp" />
|
<ClInclude Include="..\..\service\ControlPlane.hpp" />
|
||||||
<ClInclude Include="..\..\testnet\SimNetSocketManager.hpp" />
|
<ClInclude Include="..\..\service\ControlPlaneSubsystem.hpp" />
|
||||||
<ClInclude Include="..\..\testnet\TestEthernetTap.hpp" />
|
<ClInclude Include="..\..\service\OneService.hpp" />
|
||||||
<ClInclude Include="..\..\testnet\TestEthernetTapFactory.hpp" />
|
|
||||||
<ClInclude Include="..\..\testnet\TestRoutingTable.hpp" />
|
|
||||||
<ClInclude Include="..\..\version.h" />
|
<ClInclude Include="..\..\version.h" />
|
||||||
<ClInclude Include="resource.h" />
|
<ClInclude Include="resource.h" />
|
||||||
<ClInclude Include="ServiceBase.h" />
|
<ClInclude Include="ServiceBase.h" />
|
||||||
|
@ -240,11 +191,11 @@
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)\ext\bin\libcrypto\include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)\ext\bin\libcrypto\include</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>ZT_LOG_STDOUT;ZT_TRACE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NOMINMAX;ZT_TRACE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>wsock32.lib;ws2_32.lib;newdev.lib;winhttp.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>wsock32.lib;ws2_32.lib;newdev.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
@ -254,11 +205,11 @@
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)\ext\bin\libcrypto\include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)\ext\bin\libcrypto\include</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>ZT_LOG_STDOUT;ZT_TRACE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NOMINMAX;ZT_TRACE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>wsock32.lib;ws2_32.lib;newdev.lib;winhttp.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>wsock32.lib;ws2_32.lib;newdev.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
@ -270,7 +221,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)\ext\bin\libcrypto\include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)\ext\bin\libcrypto\include</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>ZT_OFFICIAL_RELEASE;ZT_AUTO_UPDATE;ZT_SALSA20_SSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>ZT_OFFICIAL_RELEASE;ZT_AUTO_UPDATE;ZT_SALSA20_SSE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
|
@ -282,7 +233,7 @@
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalDependencies>wsock32.lib;ws2_32.lib;newdev.lib;winhttp.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>wsock32.lib;ws2_32.lib;newdev.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
@ -294,7 +245,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)\ext\bin\libcrypto\include</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)\ext\bin\libcrypto\include</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>ZT_OFFICIAL_RELEASE;ZT_AUTO_UPDATE;ZT_SALSA20_SSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>ZT_OFFICIAL_RELEASE;ZT_AUTO_UPDATE;ZT_SALSA20_SSE;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
|
@ -306,7 +257,7 @@
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalDependencies>wsock32.lib;ws2_32.lib;newdev.lib;winhttp.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>wsock32.lib;ws2_32.lib;newdev.lib;Iphlpapi.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
|
|
@ -16,36 +16,78 @@
|
||||||
<Filter Include="Source Files\node">
|
<Filter Include="Source Files\node">
|
||||||
<UniqueIdentifier>{67b1c0f8-b018-4169-9c14-7032ed12c786}</UniqueIdentifier>
|
<UniqueIdentifier>{67b1c0f8-b018-4169-9c14-7032ed12c786}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Source Files\control">
|
|
||||||
<UniqueIdentifier>{64683235-3edd-443c-828c-c8e657d3bfd7}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Source Files\osnet">
|
|
||||||
<UniqueIdentifier>{c8a3c54f-bb49-4c3f-b406-5177bc14a447}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Source Files\testnet">
|
|
||||||
<UniqueIdentifier>{142d7af3-1770-44d7-bd87-d509bb25be1e}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Header Files\include">
|
<Filter Include="Header Files\include">
|
||||||
<UniqueIdentifier>{40761a4c-e8db-4a91-9cab-7afef332f4a8}</UniqueIdentifier>
|
<UniqueIdentifier>{40761a4c-e8db-4a91-9cab-7afef332f4a8}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files\control">
|
|
||||||
<UniqueIdentifier>{066d9967-d4f3-4b41-b9a8-b18ea763aca3}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Header Files\node">
|
<Filter Include="Header Files\node">
|
||||||
<UniqueIdentifier>{da3b8126-840c-45db-8abe-9d7e7976f8be}</UniqueIdentifier>
|
<UniqueIdentifier>{da3b8126-840c-45db-8abe-9d7e7976f8be}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files\osnet">
|
<Filter Include="Source Files\osdep">
|
||||||
<UniqueIdentifier>{173e391d-1519-41b8-960b-9b8dad083827}</UniqueIdentifier>
|
<UniqueIdentifier>{6054dfae-4ed2-4d69-8cf5-d6f27646f2d7}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files\testnet">
|
<Filter Include="Source Files\service">
|
||||||
<UniqueIdentifier>{6f36ddd5-a2e1-48e1-9543-1ab975f91780}</UniqueIdentifier>
|
<UniqueIdentifier>{9944293a-4a1a-40e9-b92a-eff31fe87e2c}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files\osdep">
|
||||||
|
<UniqueIdentifier>{ca21bd6b-ff4e-4f9e-bedd-c9f603d2d0d6}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files\service">
|
||||||
|
<UniqueIdentifier>{e1743b3c-1d18-47f1-ab5a-f5703c19f1df}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files\ext">
|
||||||
|
<UniqueIdentifier>{71865460-d693-4c73-84f6-dbff42f49df6}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files\ext\http-parser">
|
||||||
|
<UniqueIdentifier>{17ae9a01-d39f-4c6d-a800-8f2cd0804c96}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files\ext\json-parser">
|
||||||
|
<UniqueIdentifier>{736aad7f-8d95-4602-88df-3bb970869c6f}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files\ext\lz4">
|
||||||
|
<UniqueIdentifier>{3636527c-bc03-4852-bd3c-20ee25e56d82}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Source Files\ext">
|
||||||
|
<UniqueIdentifier>{7784af31-5b60-4300-b07e-44cf864c54db}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Source Files\ext\lz4">
|
||||||
|
<UniqueIdentifier>{29164186-10fc-45f5-b253-6d03f0ddd4db}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Source Files\ext\http-parser">
|
||||||
|
<UniqueIdentifier>{f8a1c208-15b8-4d85-a4cb-11d2b82f2d1e}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Source Files\ext\json-parser">
|
||||||
|
<UniqueIdentifier>{da28e961-1761-41d8-9a59-65b00dfb1302}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Source Files\windows">
|
||||||
|
<UniqueIdentifier>{43f75f84-c70d-4d44-a0ef-28a7a399abd4}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Source Files\windows\ZeroTierOne">
|
||||||
|
<UniqueIdentifier>{0da07a2f-8922-4827-ac51-29ca3f30f881}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files\windows">
|
||||||
|
<UniqueIdentifier>{b74916eb-bb6c-4449-a2a2-fa0b17f60121}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files\windows\ZeroTierOne">
|
||||||
|
<UniqueIdentifier>{bf604491-14c4-4a74-81a6-6105d07c5c7c}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\ext\lz4\lz4.c">
|
<ClCompile Include="..\..\service\ControlPlane.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files\service</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="ZeroTierOneService.cpp">
|
<ClCompile Include="..\..\service\OneService.cpp">
|
||||||
|
<Filter>Source Files\service</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\osdep\WindowsEthernetTap.cpp">
|
||||||
|
<Filter>Source Files\osdep</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\osdep\Http.cpp">
|
||||||
|
<Filter>Source Files\osdep</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\osdep\OSUtils.cpp">
|
||||||
|
<Filter>Source Files\osdep</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\selftest.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\node\C25519.cpp">
|
<ClCompile Include="..\..\node\C25519.cpp">
|
||||||
|
@ -60,9 +102,6 @@
|
||||||
<ClCompile Include="..\..\node\Dictionary.cpp">
|
<ClCompile Include="..\..\node\Dictionary.cpp">
|
||||||
<Filter>Source Files\node</Filter>
|
<Filter>Source Files\node</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\node\HttpClient.cpp">
|
|
||||||
<Filter>Source Files\node</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\node\Identity.cpp">
|
<ClCompile Include="..\..\node\Identity.cpp">
|
||||||
<Filter>Source Files\node</Filter>
|
<Filter>Source Files\node</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -72,9 +111,6 @@
|
||||||
<ClCompile Include="..\..\node\InetAddress.cpp">
|
<ClCompile Include="..\..\node\InetAddress.cpp">
|
||||||
<Filter>Source Files\node</Filter>
|
<Filter>Source Files\node</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\node\Logger.cpp">
|
|
||||||
<Filter>Source Files\node</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\node\Multicaster.cpp">
|
<ClCompile Include="..\..\node\Multicaster.cpp">
|
||||||
<Filter>Source Files\node</Filter>
|
<Filter>Source Files\node</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -87,9 +123,6 @@
|
||||||
<ClCompile Include="..\..\node\Node.cpp">
|
<ClCompile Include="..\..\node\Node.cpp">
|
||||||
<Filter>Source Files\node</Filter>
|
<Filter>Source Files\node</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\node\NodeConfig.cpp">
|
|
||||||
<Filter>Source Files\node</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\node\OutboundMulticast.cpp">
|
<ClCompile Include="..\..\node\OutboundMulticast.cpp">
|
||||||
<Filter>Source Files\node</Filter>
|
<Filter>Source Files\node</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -102,21 +135,15 @@
|
||||||
<ClCompile Include="..\..\node\Poly1305.cpp">
|
<ClCompile Include="..\..\node\Poly1305.cpp">
|
||||||
<Filter>Source Files\node</Filter>
|
<Filter>Source Files\node</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\node\RoutingTable.cpp">
|
|
||||||
<Filter>Source Files\node</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\node\Salsa20.cpp">
|
<ClCompile Include="..\..\node\Salsa20.cpp">
|
||||||
<Filter>Source Files\node</Filter>
|
<Filter>Source Files\node</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\node\Service.cpp">
|
<ClCompile Include="..\..\node\SelfAwareness.cpp">
|
||||||
<Filter>Source Files\node</Filter>
|
<Filter>Source Files\node</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\node\SHA512.cpp">
|
<ClCompile Include="..\..\node\SHA512.cpp">
|
||||||
<Filter>Source Files\node</Filter>
|
<Filter>Source Files\node</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\node\SoftwareUpdater.cpp">
|
|
||||||
<Filter>Source Files\node</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\node\Switch.cpp">
|
<ClCompile Include="..\..\node\Switch.cpp">
|
||||||
<Filter>Source Files\node</Filter>
|
<Filter>Source Files\node</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -126,118 +153,61 @@
|
||||||
<ClCompile Include="..\..\node\Utils.cpp">
|
<ClCompile Include="..\..\node\Utils.cpp">
|
||||||
<Filter>Source Files\node</Filter>
|
<Filter>Source Files\node</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\control\IpcConnection.cpp">
|
<ClCompile Include="..\..\ext\lz4\lz4.c">
|
||||||
<Filter>Source Files\control</Filter>
|
<Filter>Source Files\ext\lz4</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\control\IpcListener.cpp">
|
<ClCompile Include="..\..\ext\http-parser\http_parser.c">
|
||||||
<Filter>Source Files\control</Filter>
|
<Filter>Source Files\ext\http-parser</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\control\NodeControlClient.cpp">
|
<ClCompile Include="..\..\ext\json-parser\json.c">
|
||||||
<Filter>Source Files\control</Filter>
|
<Filter>Source Files\ext\json-parser</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\control\NodeControlService.cpp">
|
<ClCompile Include="..\..\one.cpp">
|
||||||
<Filter>Source Files\control</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\osnet\NativeSocketManager.cpp">
|
|
||||||
<Filter>Source Files\osnet</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\osnet\WindowsEthernetTap.cpp">
|
|
||||||
<Filter>Source Files\osnet</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\osnet\WindowsEthernetTapFactory.cpp">
|
|
||||||
<Filter>Source Files\osnet</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\osnet\WindowsRoutingTable.cpp">
|
|
||||||
<Filter>Source Files\osnet</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\testnet\SimNet.cpp">
|
|
||||||
<Filter>Source Files\testnet</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\testnet\SimNetSocketManager.cpp">
|
|
||||||
<Filter>Source Files\testnet</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\testnet\TestEthernetTap.cpp">
|
|
||||||
<Filter>Source Files\testnet</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\testnet\TestEthernetTapFactory.cpp">
|
|
||||||
<Filter>Source Files\testnet</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\testnet\TestRoutingTable.cpp">
|
|
||||||
<Filter>Source Files\testnet</Filter>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="ServiceBase.cpp">
|
<ClCompile Include="ServiceBase.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files\windows\ZeroTierOne</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="ServiceInstaller.cpp">
|
<ClCompile Include="ServiceInstaller.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files\windows\ZeroTierOne</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\testnet.cpp">
|
<ClCompile Include="ZeroTierOneService.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files\windows\ZeroTierOne</Filter>
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\main.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="resource.h">
|
<ClInclude Include="resource.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="ServiceBase.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="ServiceInstaller.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="ZeroTierOneService.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\version.h">
|
<ClInclude Include="..\..\version.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\testnet\MTQ.hpp">
|
|
||||||
<Filter>Header Files\testnet</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\testnet\SimNet.hpp">
|
|
||||||
<Filter>Header Files\testnet</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\testnet\SimNetSocketManager.hpp">
|
|
||||||
<Filter>Header Files\testnet</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\testnet\TestEthernetTap.hpp">
|
|
||||||
<Filter>Header Files\testnet</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\testnet\TestEthernetTapFactory.hpp">
|
|
||||||
<Filter>Header Files\testnet</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\testnet\TestRoutingTable.hpp">
|
|
||||||
<Filter>Header Files\testnet</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\include\ZeroTierOne.h">
|
<ClInclude Include="..\..\include\ZeroTierOne.h">
|
||||||
<Filter>Header Files\include</Filter>
|
<Filter>Header Files\include</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\control\IpcConnection.hpp">
|
<ClInclude Include="..\..\osdep\Http.hpp">
|
||||||
<Filter>Header Files\control</Filter>
|
<Filter>Header Files\osdep</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\control\IpcListener.hpp">
|
<ClInclude Include="..\..\osdep\OSUtils.hpp">
|
||||||
<Filter>Header Files\control</Filter>
|
<Filter>Header Files\osdep</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\control\NodeControlClient.hpp">
|
<ClInclude Include="..\..\osdep\Phy.hpp">
|
||||||
<Filter>Header Files\control</Filter>
|
<Filter>Header Files\osdep</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\control\NodeControlService.hpp">
|
<ClInclude Include="..\..\osdep\Thread.hpp">
|
||||||
<Filter>Header Files\control</Filter>
|
<Filter>Header Files\osdep</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\osnet\NativeSocketManager.hpp">
|
<ClInclude Include="..\..\osdep\WindowsEthernetTap.hpp">
|
||||||
<Filter>Header Files\osnet</Filter>
|
<Filter>Header Files\osdep</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\osnet\WindowsEthernetTap.hpp">
|
<ClInclude Include="..\..\service\ControlPlane.hpp">
|
||||||
<Filter>Header Files\osnet</Filter>
|
<Filter>Header Files\service</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\osnet\WindowsEthernetTapFactory.hpp">
|
<ClInclude Include="..\..\service\ControlPlaneSubsystem.hpp">
|
||||||
<Filter>Header Files\osnet</Filter>
|
<Filter>Header Files\service</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\osnet\WindowsRoutingTable.hpp">
|
<ClInclude Include="..\..\service\OneService.hpp">
|
||||||
<Filter>Header Files\osnet</Filter>
|
<Filter>Header Files\service</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\node\Address.hpp">
|
<ClInclude Include="..\..\node\Address.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
|
@ -275,15 +245,6 @@
|
||||||
<ClInclude Include="..\..\node\Dictionary.hpp">
|
<ClInclude Include="..\..\node\Dictionary.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\node\EthernetTap.hpp">
|
|
||||||
<Filter>Header Files\node</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\node\EthernetTapFactory.hpp">
|
|
||||||
<Filter>Header Files\node</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\node\HttpClient.hpp">
|
|
||||||
<Filter>Header Files\node</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\node\Identity.hpp">
|
<ClInclude Include="..\..\node\Identity.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -293,9 +254,6 @@
|
||||||
<ClInclude Include="..\..\node\InetAddress.hpp">
|
<ClInclude Include="..\..\node\InetAddress.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\node\Logger.hpp">
|
|
||||||
<Filter>Header Files\node</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\node\MAC.hpp">
|
<ClInclude Include="..\..\node\MAC.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -314,10 +272,10 @@
|
||||||
<ClInclude Include="..\..\node\NetworkConfig.hpp">
|
<ClInclude Include="..\..\node\NetworkConfig.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\node\Node.hpp">
|
<ClInclude Include="..\..\node\NetworkController.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\node\NodeConfig.hpp">
|
<ClInclude Include="..\..\node\Node.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\node\NonCopyable.hpp">
|
<ClInclude Include="..\..\node\NonCopyable.hpp">
|
||||||
|
@ -338,16 +296,13 @@
|
||||||
<ClInclude Include="..\..\node\Poly1305.hpp">
|
<ClInclude Include="..\..\node\Poly1305.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\node\RoutingTable.hpp">
|
|
||||||
<Filter>Header Files\node</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\node\RuntimeEnvironment.hpp">
|
<ClInclude Include="..\..\node\RuntimeEnvironment.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\node\Salsa20.hpp">
|
<ClInclude Include="..\..\node\Salsa20.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\node\Service.hpp">
|
<ClInclude Include="..\..\node\SelfAwareness.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\node\SHA512.hpp">
|
<ClInclude Include="..\..\node\SHA512.hpp">
|
||||||
|
@ -356,21 +311,9 @@
|
||||||
<ClInclude Include="..\..\node\SharedPtr.hpp">
|
<ClInclude Include="..\..\node\SharedPtr.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\node\Socket.hpp">
|
|
||||||
<Filter>Header Files\node</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\node\SocketManager.hpp">
|
|
||||||
<Filter>Header Files\node</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\node\SoftwareUpdater.hpp">
|
|
||||||
<Filter>Header Files\node</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\node\Switch.hpp">
|
<ClInclude Include="..\..\node\Switch.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\node\Thread.hpp">
|
|
||||||
<Filter>Header Files\node</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\node\Topology.hpp">
|
<ClInclude Include="..\..\node\Topology.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -378,7 +321,22 @@
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\ext\lz4\lz4.h">
|
<ClInclude Include="..\..\ext\lz4\lz4.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\ext\lz4</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\ext\json-parser\json.h">
|
||||||
|
<Filter>Header Files\ext\json-parser</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\ext\http-parser\http_parser.h">
|
||||||
|
<Filter>Header Files\ext\http-parser</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ServiceBase.h">
|
||||||
|
<Filter>Header Files\windows\ZeroTierOne</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ServiceInstaller.h">
|
||||||
|
<Filter>Header Files\windows\ZeroTierOne</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ZeroTierOneService.h">
|
||||||
|
<Filter>Header Files\windows\ZeroTierOne</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -34,15 +34,13 @@
|
||||||
|
|
||||||
#include "ZeroTierOneService.h"
|
#include "ZeroTierOneService.h"
|
||||||
|
|
||||||
#include "../../node/Defaults.hpp"
|
#include "../../version.h"
|
||||||
|
#include "../../include/ZeroTierOne.h"
|
||||||
|
|
||||||
|
#include "../../node/Constants.hpp"
|
||||||
#include "../../node/Utils.hpp"
|
#include "../../node/Utils.hpp"
|
||||||
|
#include "../../osdep/OSUtils.hpp"
|
||||||
#include "../../control/NodeControlClient.hpp"
|
#include "../../service/OneService.hpp"
|
||||||
#include "../../control/NodeControlService.hpp"
|
|
||||||
|
|
||||||
#include "../../osdep/WindowsEthernetTapFactory.hpp"
|
|
||||||
#include "../../osdep/WindowsRoutingTable.hpp"
|
|
||||||
#include "../../osdep/NativeSocketManager.hpp"
|
|
||||||
|
|
||||||
#pragma endregion // Includes
|
#pragma endregion // Includes
|
||||||
|
|
||||||
|
@ -53,7 +51,7 @@ ZeroTier::Mutex SVCDBGfile_m;
|
||||||
|
|
||||||
ZeroTierOneService::ZeroTierOneService() :
|
ZeroTierOneService::ZeroTierOneService() :
|
||||||
CServiceBase(ZT_SERVICE_NAME,TRUE,TRUE,FALSE),
|
CServiceBase(ZT_SERVICE_NAME,TRUE,TRUE,FALSE),
|
||||||
_node((ZeroTier::Node *)0)
|
_service((ZeroTier::OneService *)0)
|
||||||
{
|
{
|
||||||
#ifdef ZT_DEBUG_SERVICE
|
#ifdef ZT_DEBUG_SERVICE
|
||||||
SVCDBGfile_m.lock();
|
SVCDBGfile_m.lock();
|
||||||
|
@ -86,6 +84,41 @@ void ZeroTierOneService::threadMain()
|
||||||
|
|
||||||
restart_node:
|
restart_node:
|
||||||
try {
|
try {
|
||||||
|
{
|
||||||
|
ZeroTier::Mutex::Lock _l(_lock);
|
||||||
|
delete _service;
|
||||||
|
_service = (ZeroTier::OneService *)0; // in case newInstance() fails
|
||||||
|
_service = ZeroTier::OneService::newInstance(
|
||||||
|
ZeroTier::OneService::platformDefaultHomePath().c_str(),
|
||||||
|
ZT1_DEFAULT_PORT);
|
||||||
|
}
|
||||||
|
switch(_service->run()) {
|
||||||
|
case ZeroTier::OneService::ONE_UNRECOVERABLE_ERROR: {
|
||||||
|
std::string err("ZeroTier One encountered an unrecoverable error: ");
|
||||||
|
err.append(_service->fatalErrorMessage());
|
||||||
|
err.append(" (restarting in 5 seconds)");
|
||||||
|
WriteEventLogEntry(const_cast <PSTR>(err.c_str()),EVENTLOG_ERROR_TYPE);
|
||||||
|
Sleep(5000);
|
||||||
|
} goto restart_node;
|
||||||
|
|
||||||
|
case ZeroTier::OneService::ONE_IDENTITY_COLLISION: {
|
||||||
|
std::string homeDir(ZeroTier::OneService::platformDefaultHomePath());
|
||||||
|
delete _service;
|
||||||
|
_service = (ZeroTier::OneService *)0;
|
||||||
|
std::string oldid;
|
||||||
|
ZeroTier::OSUtils::readFile((homeDir + ZT_PATH_SEPARATOR_S + "identity.secret").c_str(),oldid);
|
||||||
|
if (oldid.length()) {
|
||||||
|
ZeroTier::OSUtils::writeFile((homeDir + ZT_PATH_SEPARATOR_S + "identity.secret.saved_after_collision").c_str(),oldid);
|
||||||
|
ZeroTier::OSUtils::rm((homeDir + ZT_PATH_SEPARATOR_S + "identity.secret").c_str());
|
||||||
|
ZeroTier::OSUtils::rm((homeDir + ZT_PATH_SEPARATOR_S + "identity.public").c_str());
|
||||||
|
}
|
||||||
|
} goto restart_node;
|
||||||
|
|
||||||
|
default: // normal termination
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
std::string authToken(ZeroTier::NodeControlClient::getAuthToken((ZeroTier::ZT_DEFAULTS.defaultHomePath + ZT_PATH_SEPARATOR_S + "authtoken.secret").c_str(),true));
|
std::string authToken(ZeroTier::NodeControlClient::getAuthToken((ZeroTier::ZT_DEFAULTS.defaultHomePath + ZT_PATH_SEPARATOR_S + "authtoken.secret").c_str(),true));
|
||||||
|
|
||||||
ZeroTier::WindowsEthernetTapFactory tapFactory(ZeroTier::ZT_DEFAULTS.defaultHomePath.c_str());
|
ZeroTier::WindowsEthernetTapFactory tapFactory(ZeroTier::ZT_DEFAULTS.defaultHomePath.c_str());
|
||||||
|
@ -154,6 +187,7 @@ restart_node:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} catch ( ... ) {
|
} catch ( ... ) {
|
||||||
// sanity check, shouldn't happen since Node::run() should catch all its own errors
|
// sanity check, shouldn't happen since Node::run() should catch all its own errors
|
||||||
// could also happen if we're out of memory though!
|
// could also happen if we're out of memory though!
|
||||||
|
@ -164,17 +198,19 @@ restart_node:
|
||||||
|
|
||||||
{
|
{
|
||||||
ZeroTier::Mutex::Lock _l(_lock);
|
ZeroTier::Mutex::Lock _l(_lock);
|
||||||
delete _node;
|
delete _service;
|
||||||
_node = (ZeroTier::Node *)0;
|
_service = (ZeroTier::OneService *)0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZeroTierOneService::doStartUpgrade(const std::string &msiPath)
|
bool ZeroTierOneService::doStartUpgrade(const std::string &msiPath)
|
||||||
{
|
{
|
||||||
std::string msiLog(ZeroTier::ZT_DEFAULTS.defaultHomePath + "\\LastUpdateLog.txt");
|
std::string homePath(ZeroTier::OneService::platformDefaultHomePath());
|
||||||
ZeroTier::Utils::rm(msiLog);
|
|
||||||
|
|
||||||
std::string bat(ZeroTier::ZT_DEFAULTS.defaultHomePath + "\\InstallAndRestartService.bat");
|
std::string msiLog(homePath + "\\LastUpdateLog.txt");
|
||||||
|
ZeroTier::OSUtils::rm(msiLog);
|
||||||
|
|
||||||
|
std::string bat(homePath + "\\InstallAndRestartService.bat");
|
||||||
FILE *batf = fopen(bat.c_str(),"wb");
|
FILE *batf = fopen(bat.c_str(),"wb");
|
||||||
if (!batf)
|
if (!batf)
|
||||||
return false;
|
return false;
|
||||||
|
@ -210,10 +246,11 @@ void ZeroTierOneService::OnStop()
|
||||||
ZT_SVCDBG("ZeroTierOneService::OnStop()\r\n");
|
ZT_SVCDBG("ZeroTierOneService::OnStop()\r\n");
|
||||||
|
|
||||||
_lock.lock();
|
_lock.lock();
|
||||||
ZeroTier::Node *n = _node;
|
ZeroTier::OneService *s = _service;
|
||||||
_lock.unlock();
|
_lock.unlock();
|
||||||
if (n) {
|
|
||||||
n->terminate(ZeroTier::Node::NODE_NORMAL_TERMINATION,"Windows service stopped");
|
if (s) {
|
||||||
|
s->terminate();
|
||||||
ZeroTier::Thread::join(_thread);
|
ZeroTier::Thread::join(_thread);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,9 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "../../node/Node.hpp"
|
|
||||||
#include "../../node/Defaults.hpp"
|
|
||||||
#include "../../node/Thread.hpp"
|
|
||||||
#include "../../node/Mutex.hpp"
|
#include "../../node/Mutex.hpp"
|
||||||
#include "../../node/Utils.hpp"
|
#include "../../osdep/Thread.hpp"
|
||||||
|
#include "../../service/OneService.hpp"
|
||||||
|
|
||||||
// Uncomment to make debugging Windows services suck slightly less hard.
|
// Uncomment to make debugging Windows services suck slightly less hard.
|
||||||
//#define ZT_DEBUG_SERVICE "C:\\ZeroTierOneServiceDebugLog.txt"
|
//#define ZT_DEBUG_SERVICE "C:\\ZeroTierOneServiceDebugLog.txt"
|
||||||
|
@ -79,7 +77,7 @@ protected:
|
||||||
virtual void OnShutdown();
|
virtual void OnShutdown();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ZeroTier::Node *volatile _node;
|
ZeroTier::OneService *volatile _service;
|
||||||
ZeroTier::Mutex _lock;
|
ZeroTier::Mutex _lock;
|
||||||
ZeroTier::Thread _thread;
|
ZeroTier::Thread _thread;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue