|
|
|
@ -31,7 +31,6 @@ |
|
|
|
#include <string.h> |
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__ |
|
|
|
#ifdef __APPLE__ |
|
|
|
#include <errno.h> |
|
|
|
|
|
|
|
#include <sys/sysctl.h> |
|
|
|
#include <sys/sysctl.h> |
|
|
|
#include "MacEthernetTap.hpp" |
|
|
|
#include "MacEthernetTap.hpp" |
|
|
|
#include "MacKextEthernetTap.hpp" |
|
|
|
#include "MacKextEthernetTap.hpp" |
|
|
|
@ -57,6 +56,12 @@ |
|
|
|
#include "BSDEthernetTap.hpp" |
|
|
|
#include "BSDEthernetTap.hpp" |
|
|
|
#endif // __OpenBSD__
|
|
|
|
#endif // __OpenBSD__
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ZT_SDK |
|
|
|
|
|
|
|
#include "../controller/EmbeddedNetworkController.hpp" |
|
|
|
|
|
|
|
#include "../node/Node.hpp" |
|
|
|
|
|
|
|
#include "../include/VirtualTap.hpp" |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
namespace ZeroTier { |
|
|
|
namespace ZeroTier { |
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<EthernetTap> EthernetTap::newInstance( |
|
|
|
std::shared_ptr<EthernetTap> EthernetTap::newInstance( |
|
|
|
@ -70,6 +75,11 @@ std::shared_ptr<EthernetTap> EthernetTap::newInstance( |
|
|
|
void (*handler)(void *,void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int), |
|
|
|
void (*handler)(void *,void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int), |
|
|
|
void *arg) |
|
|
|
void *arg) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ZT_SDK |
|
|
|
|
|
|
|
return std::shared_ptr<EthernetTap>(new VirtualTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); |
|
|
|
|
|
|
|
#else // not ZT_SDK
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__ |
|
|
|
#ifdef __APPLE__ |
|
|
|
char osrelease[256]; |
|
|
|
char osrelease[256]; |
|
|
|
size_t size = sizeof(osrelease); |
|
|
|
size_t size = sizeof(osrelease); |
|
|
|
@ -77,6 +87,7 @@ std::shared_ptr<EthernetTap> EthernetTap::newInstance( |
|
|
|
char *dotAt = strchr(osrelease,'.'); |
|
|
|
char *dotAt = strchr(osrelease,'.'); |
|
|
|
if (dotAt) { |
|
|
|
if (dotAt) { |
|
|
|
*dotAt = (char)0; |
|
|
|
*dotAt = (char)0; |
|
|
|
|
|
|
|
printf("%s\n",osrelease); |
|
|
|
// The "feth" virtual Ethernet device type appeared in Darwin 17.x.x. Older versions
|
|
|
|
// The "feth" virtual Ethernet device type appeared in Darwin 17.x.x. Older versions
|
|
|
|
// (Sierra and earlier) must use the a kernel extension.
|
|
|
|
// (Sierra and earlier) must use the a kernel extension.
|
|
|
|
if (strtol(osrelease,(char **)0,10) < 17) { |
|
|
|
if (strtol(osrelease,(char **)0,10) < 17) { |
|
|
|
@ -108,6 +119,8 @@ std::shared_ptr<EthernetTap> EthernetTap::newInstance( |
|
|
|
return std::shared_ptr<EthernetTap>(new BSDEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); |
|
|
|
return std::shared_ptr<EthernetTap>(new BSDEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); |
|
|
|
#endif // __OpenBSD__
|
|
|
|
#endif // __OpenBSD__
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // ZT_SDK?
|
|
|
|
|
|
|
|
|
|
|
|
return std::shared_ptr<EthernetTap>(); |
|
|
|
return std::shared_ptr<EthernetTap>(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|