summaryrefslogtreecommitdiff
path: root/osdep
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@zerotier.com>2017-07-06 16:29:11 -0700
committerAdam Ierymenko <adam.ierymenko@zerotier.com>2017-07-06 16:29:11 -0700
commit88997a03145c36845df6939d56e518343a12e630 (patch)
treeb4c195a5be680db43990b0c262f989e2a25f19c6 /osdep
parentd2415dee00914ab3fd7016758f4184d46bb407a5 (diff)
downloadinfinitytier-88997a03145c36845df6939d56e518343a12e630.tar.gz
infinitytier-88997a03145c36845df6939d56e518343a12e630.zip
Windows build fixes.
Diffstat (limited to 'osdep')
-rw-r--r--osdep/Binder.hpp4
-rw-r--r--osdep/WindowsEthernetTap.cpp55
2 files changed, 30 insertions, 29 deletions
diff --git a/osdep/Binder.hpp b/osdep/Binder.hpp
index 040f3e46..f956a67e 100644
--- a/osdep/Binder.hpp
+++ b/osdep/Binder.hpp
@@ -150,7 +150,7 @@ public:
case InetAddress::IP_SCOPE_GLOBAL:
case InetAddress::IP_SCOPE_SHARED:
case InetAddress::IP_SCOPE_PRIVATE:
- for(int x=0;x<portCount;++x) {
+ for(int x=0;x<(int)portCount;++x) {
ip.setPort(ports[x]);
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
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((const void *)"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",16,ports[x]),std::string()));
}
diff --git a/osdep/WindowsEthernetTap.cpp b/osdep/WindowsEthernetTap.cpp
index 5344268f..22179cb6 100644
--- a/osdep/WindowsEthernetTap.cpp
+++ b/osdep/WindowsEthernetTap.cpp
@@ -722,20 +722,21 @@ bool WindowsEthernetTap::removeIp(const InetAddress &ip)
DeleteUnicastIpAddressEntry(&(ipt->Table[i]));
FreeMibTable(ipt);
- if (ip.isV4()) {
- std::vector<std::string> regIps(_getRegistryIPv4Value("IPAddress"));
- std::vector<std::string> regSubnetMasks(_getRegistryIPv4Value("SubnetMask"));
- std::string ipstr(ip.toIpString());
- for (std::vector<std::string>::iterator rip(regIps.begin()), rm(regSubnetMasks.begin()); ((rip != regIps.end()) && (rm != regSubnetMasks.end())); ++rip, ++rm) {
- if (*rip == ipstr) {
- regIps.erase(rip);
- regSubnetMasks.erase(rm);
- _setRegistryIPv4Value("IPAddress", regIps);
- _setRegistryIPv4Value("SubnetMask", regSubnetMasks);
- break;
- }
- }
- }
+ if (ip.isV4()) {
+ std::vector<std::string> regIps(_getRegistryIPv4Value("IPAddress"));
+ std::vector<std::string> regSubnetMasks(_getRegistryIPv4Value("SubnetMask"));
+ char ipbuf[64];
+ std::string ipstr(ip.toIpString(ipbuf));
+ for (std::vector<std::string>::iterator rip(regIps.begin()), rm(regSubnetMasks.begin()); ((rip != regIps.end()) && (rm != regSubnetMasks.end())); ++rip, ++rm) {
+ if (*rip == ipstr) {
+ regIps.erase(rip);
+ regSubnetMasks.erase(rm);
+ _setRegistryIPv4Value("IPAddress", regIps);
+ _setRegistryIPv4Value("SubnetMask", regSubnetMasks);
+ break;
+ }
+ }
+ }
return true;
}
@@ -750,7 +751,7 @@ bool WindowsEthernetTap::removeIp(const InetAddress &ip)
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;
if (!_initialized)
@@ -1226,18 +1227,18 @@ void WindowsEthernetTap::_syncIps()
CreateUnicastIpAddressEntry(&ipr);
}
- if (aip->isV4())
- {
- std::string ipStr(aip->toIpString());
- std::vector<std::string> regIps(_getRegistryIPv4Value("IPAddress"));
- if (std::find(regIps.begin(), regIps.end(), ipStr) == regIps.end()) {
- std::vector<std::string> regSubnetMasks(_getRegistryIPv4Value("SubnetMask"));
- regIps.push_back(ipStr);
- regSubnetMasks.push_back(aip->netmask().toIpString());
- _setRegistryIPv4Value("IPAddress", regIps);
- _setRegistryIPv4Value("SubnetMask", regSubnetMasks);
- }
- }
+ if (aip->isV4()) {
+ char ipbuf[64];
+ std::string ipStr(aip->toIpString(ipbuf));
+ std::vector<std::string> regIps(_getRegistryIPv4Value("IPAddress"));
+ if (std::find(regIps.begin(), regIps.end(), ipStr) == regIps.end()) {
+ std::vector<std::string> regSubnetMasks(_getRegistryIPv4Value("SubnetMask"));
+ regIps.push_back(ipStr);
+ regSubnetMasks.push_back(aip->netmask().toIpString(ipbuf));
+ _setRegistryIPv4Value("IPAddress", regIps);
+ _setRegistryIPv4Value("SubnetMask", regSubnetMasks);
+ }
+ }
}
}