(1) Tweak LAN locator beacon frequencies, (2) Windows virtual networks
now show up as *real* networks and prompt the user to set their location and firewall status (public, private, home/work, etc.). The hack used to achieve #2 should not be examined by children or those suffering from epilepsy or heart conditions.
This commit is contained in:
parent
f25bd41a03
commit
f8d4611d15
9 changed files with 255 additions and 63 deletions
|
@ -387,12 +387,12 @@
|
|||
/**
|
||||
* How often to broadcast beacons over physical local LANs
|
||||
*/
|
||||
#define ZT_BEACON_INTERVAL ZT_PEER_DIRECT_PING_DELAY
|
||||
#define ZT_BEACON_INTERVAL 30000
|
||||
|
||||
/**
|
||||
* Do not respond to any beacon more often than this
|
||||
*/
|
||||
#define ZT_MIN_BEACON_RESPONSE_INTERVAL (ZT_BEACON_INTERVAL / 64)
|
||||
#define ZT_MIN_BEACON_RESPONSE_INTERVAL (ZT_BEACON_INTERVAL / 32)
|
||||
|
||||
/**
|
||||
* Minimum interval between attempts to do a software update
|
||||
|
|
|
@ -196,21 +196,6 @@ public:
|
|||
*/
|
||||
virtual bool updateMulticastGroups(std::set<MulticastGroup> &groups) = 0;
|
||||
|
||||
/**
|
||||
* Should this tap device get a pseudo-default-route?
|
||||
*
|
||||
* Some platforms (cough Windows) want all "real" network devices to have a
|
||||
* routing table entry for default, even if it's got a high metric and is
|
||||
* never used and goes nowhere. If this returns true, the underlying node
|
||||
* code will use RoutingTable to create one if no default route is
|
||||
* otherwise defined.
|
||||
*
|
||||
* Base class default returns false. Override to return true if needed.
|
||||
*
|
||||
* @return True if pseudo-default-route should always exist
|
||||
*/
|
||||
virtual bool createPseudoDefaultRoute() const { return false; }
|
||||
|
||||
protected:
|
||||
const char *_implName;
|
||||
MAC _mac;
|
||||
|
|
|
@ -39,6 +39,8 @@ namespace ZeroTier {
|
|||
|
||||
const InetAddress InetAddress::LO4("127.0.0.1",0);
|
||||
const InetAddress InetAddress::LO6("::1",0);
|
||||
const InetAddress InetAddress::DEFAULT4((uint32_t)0,0);
|
||||
const InetAddress InetAddress::DEFAULT6((const void *)0,16,0);
|
||||
|
||||
void InetAddress::set(const std::string &ip,unsigned int port)
|
||||
throw()
|
||||
|
@ -63,11 +65,13 @@ void InetAddress::set(const void *ipBytes,unsigned int ipLen,unsigned int port)
|
|||
memset(&_sa,0,sizeof(_sa));
|
||||
if (ipLen == 4) {
|
||||
setV4();
|
||||
memcpy(rawIpData(),ipBytes,4);
|
||||
if (ipBytes)
|
||||
memcpy(rawIpData(),ipBytes,4);
|
||||
setPort(port);
|
||||
} else if (ipLen == 16) {
|
||||
setV6();
|
||||
memcpy(rawIpData(),ipBytes,16);
|
||||
if (ipBytes)
|
||||
memcpy(rawIpData(),ipBytes,16);
|
||||
setPort(port);
|
||||
}
|
||||
}
|
||||
|
@ -91,6 +95,16 @@ bool InetAddress::isLinkLocal() const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool InetAddress::isDefaultRoute() const
|
||||
throw()
|
||||
{
|
||||
if (_sa.saddr.sa_family == AF_INET)
|
||||
return ((_sa.sin.sin_addr.s_addr == 0)&&(_sa.sin.sin_port == 0));
|
||||
else if (_sa.saddr.sa_family == AF_INET6)
|
||||
return ((Utils::isZero(_sa.sin6.sin6_addr.s6_addr,16))&&(_sa.sin6.sin6_port == 0));
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string InetAddress::toString() const
|
||||
{
|
||||
char buf[128],buf2[128];
|
||||
|
|
|
@ -77,6 +77,16 @@ public:
|
|||
*/
|
||||
static const InetAddress LO6;
|
||||
|
||||
/**
|
||||
* 0.0.0.0/0
|
||||
*/
|
||||
static const InetAddress DEFAULT4;
|
||||
|
||||
/**
|
||||
* ::/0
|
||||
*/
|
||||
static const InetAddress DEFAULT6;
|
||||
|
||||
InetAddress() throw() { memset(&_sa,0,sizeof(_sa)); }
|
||||
InetAddress(const InetAddress &a) throw() { memcpy(&_sa,&a._sa,sizeof(_sa)); }
|
||||
InetAddress(const struct sockaddr *sa) throw() { this->set(sa); }
|
||||
|
@ -147,6 +157,12 @@ public:
|
|||
bool isLinkLocal() const
|
||||
throw();
|
||||
|
||||
/**
|
||||
* @return True if this ip/netmask would represent a default route (e.g. 0.0.0.0/0)
|
||||
*/
|
||||
bool isDefaultRoute() const
|
||||
throw();
|
||||
|
||||
/**
|
||||
* @return True if this is a loopback address
|
||||
*/
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "Buffer.hpp"
|
||||
#include "EthernetTap.hpp"
|
||||
#include "EthernetTapFactory.hpp"
|
||||
#include "RoutingTable.hpp"
|
||||
|
||||
#define ZT_NETWORK_CERT_WRITE_BUF_SIZE 131072
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue