Windows build fixes.

This commit is contained in:
Adam Ierymenko 2017-07-06 16:29:11 -07:00
parent d2415dee00
commit 88997a0314
4 changed files with 33 additions and 32 deletions

View file

@ -1,7 +1,7 @@
$packageName = 'zerotier-one' $packageName = 'zerotier-one'
$installerType = 'msi' $installerType = 'msi'
$url = 'https://download.zerotier.com/RELEASES/1.1.14/dist/ZeroTier%20One.msi' $url = 'https://download.zerotier.com/RELEASES/1.2.4/dist/ZeroTier%20One.msi'
$url64 = 'https://download.zerotier.com/RELEASES/1.1.14/dist/ZeroTier%20One.msi' $url64 = 'https://download.zerotier.com/RELEASES/1.2.4/dist/ZeroTier%20One.msi'
$silentArgs = '/quiet' $silentArgs = '/quiet'
$validExitCodes = @(0,3010) $validExitCodes = @(0,3010)

View file

@ -150,7 +150,7 @@ public:
case InetAddress::IP_SCOPE_GLOBAL: case InetAddress::IP_SCOPE_GLOBAL:
case InetAddress::IP_SCOPE_SHARED: case InetAddress::IP_SCOPE_SHARED:
case InetAddress::IP_SCOPE_PRIVATE: case InetAddress::IP_SCOPE_PRIVATE:
for(int x=0;x<portCount;++x) { for(int x=0;x<(int)portCount;++x) {
ip.setPort(ports[x]); ip.setPort(ports[x]);
localIfAddrs.insert(std::pair<InetAddress,std::string>(ip,std::string())); localIfAddrs.insert(std::pair<InetAddress,std::string>(ip,std::string()));
} }
@ -315,7 +315,7 @@ public:
// Default to binding to wildcard if we can't enumerate addresses // Default to binding to wildcard if we can't enumerate addresses
if (localIfAddrs.empty()) { if (localIfAddrs.empty()) {
for(int x=0;x<portCount;++x) { for(int x=0;x<(int)portCount;++x) {
localIfAddrs.insert(std::pair<InetAddress,std::string>(InetAddress((uint32_t)0,ports[x]),std::string())); localIfAddrs.insert(std::pair<InetAddress,std::string>(InetAddress((uint32_t)0,ports[x]),std::string()));
localIfAddrs.insert(std::pair<InetAddress,std::string>(InetAddress((const void *)"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",16,ports[x]),std::string())); localIfAddrs.insert(std::pair<InetAddress,std::string>(InetAddress((const void *)"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",16,ports[x]),std::string()));
} }

View file

@ -722,20 +722,21 @@ bool WindowsEthernetTap::removeIp(const InetAddress &ip)
DeleteUnicastIpAddressEntry(&(ipt->Table[i])); DeleteUnicastIpAddressEntry(&(ipt->Table[i]));
FreeMibTable(ipt); FreeMibTable(ipt);
if (ip.isV4()) { if (ip.isV4()) {
std::vector<std::string> regIps(_getRegistryIPv4Value("IPAddress")); std::vector<std::string> regIps(_getRegistryIPv4Value("IPAddress"));
std::vector<std::string> regSubnetMasks(_getRegistryIPv4Value("SubnetMask")); std::vector<std::string> regSubnetMasks(_getRegistryIPv4Value("SubnetMask"));
std::string ipstr(ip.toIpString()); char ipbuf[64];
for (std::vector<std::string>::iterator rip(regIps.begin()), rm(regSubnetMasks.begin()); ((rip != regIps.end()) && (rm != regSubnetMasks.end())); ++rip, ++rm) { std::string ipstr(ip.toIpString(ipbuf));
if (*rip == ipstr) { for (std::vector<std::string>::iterator rip(regIps.begin()), rm(regSubnetMasks.begin()); ((rip != regIps.end()) && (rm != regSubnetMasks.end())); ++rip, ++rm) {
regIps.erase(rip); if (*rip == ipstr) {
regSubnetMasks.erase(rm); regIps.erase(rip);
_setRegistryIPv4Value("IPAddress", regIps); regSubnetMasks.erase(rm);
_setRegistryIPv4Value("SubnetMask", regSubnetMasks); _setRegistryIPv4Value("IPAddress", regIps);
break; _setRegistryIPv4Value("SubnetMask", regSubnetMasks);
} break;
} }
} }
}
return true; return true;
} }
@ -750,7 +751,7 @@ bool WindowsEthernetTap::removeIp(const InetAddress &ip)
std::vector<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::vector<InetAddress> addrs; std::vector<InetAddress> addrs;
if (!_initialized) if (!_initialized)
@ -1226,18 +1227,18 @@ void WindowsEthernetTap::_syncIps()
CreateUnicastIpAddressEntry(&ipr); CreateUnicastIpAddressEntry(&ipr);
} }
if (aip->isV4()) if (aip->isV4()) {
{ char ipbuf[64];
std::string ipStr(aip->toIpString()); std::string ipStr(aip->toIpString(ipbuf));
std::vector<std::string> regIps(_getRegistryIPv4Value("IPAddress")); std::vector<std::string> regIps(_getRegistryIPv4Value("IPAddress"));
if (std::find(regIps.begin(), regIps.end(), ipStr) == regIps.end()) { if (std::find(regIps.begin(), regIps.end(), ipStr) == regIps.end()) {
std::vector<std::string> regSubnetMasks(_getRegistryIPv4Value("SubnetMask")); std::vector<std::string> regSubnetMasks(_getRegistryIPv4Value("SubnetMask"));
regIps.push_back(ipStr); regIps.push_back(ipStr);
regSubnetMasks.push_back(aip->netmask().toIpString()); regSubnetMasks.push_back(aip->netmask().toIpString(ipbuf));
_setRegistryIPv4Value("IPAddress", regIps); _setRegistryIPv4Value("IPAddress", regIps);
_setRegistryIPv4Value("SubnetMask", regSubnetMasks); _setRegistryIPv4Value("SubnetMask", regSubnetMasks);
} }
} }
} }
} }

View file

@ -363,7 +363,7 @@ struct TcpConnection
OneServiceImpl *parent; OneServiceImpl *parent;
PhySocket *sock; PhySocket *sock;
InetAddress remoteAddr; InetAddress remoteAddr;
unsigned long lastReceive; uint64_t lastReceive;
// Used for inbound HTTP connections // Used for inbound HTTP connections
http_parser parser; http_parser parser;