mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-19 04:57:53 +00:00
FreeBSD works, and some documentation fixes.
This commit is contained in:
parent
536bcf6505
commit
f60dfe4963
@ -1,17 +1,18 @@
|
||||
Building ZeroTier One on different platforms:
|
||||
Building ZeroTier One From Source
|
||||
======
|
||||
|
||||
(See RUNNING.txt for what to do next.)
|
||||
(See RUNNING.md for what to do next.)
|
||||
|
||||
Developers note: there is currently no management of dependencies on *nix
|
||||
platforms, so you should make clean ; make if you change a header. Will
|
||||
do this eventually.
|
||||
|
||||
-- Linux
|
||||
### Linux and FreeBSD
|
||||
|
||||
Just type 'make'. You'll need gcc and g++ installed, but ZeroTier One requires
|
||||
no other third party libraries beyond the standard libc, libstdc++, and libm.
|
||||
|
||||
-- MacOS
|
||||
### MacOS
|
||||
|
||||
make
|
||||
|
||||
@ -32,6 +33,7 @@ be symbolically linked into "Qt" in the parent directory of the ZeroTier
|
||||
One source tree. Then you can type "make mac-ui" and the UI should build.
|
||||
You can also load the UI in Qt Creator and build/test it that way.
|
||||
|
||||
-- Windows
|
||||
### Windows
|
||||
|
||||
Here be dragons.
|
||||
There's a Visual Studio 2012 solution file in windows/ that can be used.
|
||||
I've never tried it with MinGW, but theoretically this should be possible.
|
@ -1,10 +1,13 @@
|
||||
This guide is for those building and running from source. See BUILDING.txt
|
||||
Running ZeroTier One
|
||||
======
|
||||
|
||||
This guide is for those building and running from source. See BUILDING.md
|
||||
first.
|
||||
|
||||
The wiki at GitHub contains several pages that are probably also of interest:
|
||||
https://github.com/zerotier/ZeroTierOne/wiki
|
||||
|
||||
--- MacOS
|
||||
### MacOS
|
||||
|
||||
On Mac, the default ZeroTier home is:
|
||||
|
||||
@ -24,7 +27,7 @@ If run with no options, it will use the default home directory above.
|
||||
|
||||
sudo ./zerotier-one &
|
||||
|
||||
--- LINUX
|
||||
### LINUX
|
||||
|
||||
On Linux, the default ZeroTier home is:
|
||||
|
||||
@ -56,11 +59,18 @@ sudo ufw allow 9993/udp
|
||||
|
||||
You should now be able to ping and browse earth.zerotier.net
|
||||
|
||||
--- WINDOWS
|
||||
### FreeBSD
|
||||
|
||||
A windows port is in progress.
|
||||
FreeBSD is identical to Linux except that the default home is
|
||||
/var/db/zerotier-one instead of /var/lib.
|
||||
|
||||
--- ONCE IT'S RUNNING:
|
||||
### WINDOWS
|
||||
|
||||
Run zerotier-one.exe -h for help. There's a command to install the current
|
||||
binary as a service to run it that way, and another option to run it from
|
||||
the Windows console.
|
||||
|
||||
### Once you're up and running...
|
||||
|
||||
To use the command line interface, see this guide:
|
||||
https://github.com/zerotier/ZeroTierOne/wiki/Command-Line-Interface
|
||||
@ -68,7 +78,7 @@ To use the command line interface, see this guide:
|
||||
If you want to test by joining the Earth network, try:
|
||||
sudo ./zerotier-cli join 8056c2e21c000001
|
||||
|
||||
An interface called 'zt0' should appear and should get an IP address in
|
||||
An interface called 'zt####' should appear and should get an IP address in
|
||||
the 28.0.0.0/7 range (28.* or 29.*) within a few seconds or so. Then try
|
||||
pinging earth.zerotier.net or navigating to http://earth.zerotier.net/ in
|
||||
a web browser.
|
@ -51,14 +51,24 @@ static inline std::string _mkDefaultHomePath()
|
||||
#ifdef __UNIX_LIKE__
|
||||
|
||||
#ifdef __APPLE__
|
||||
// /Library/... on Apple
|
||||
return std::string("/Library/Application Support/ZeroTier/One");
|
||||
#else
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
// FreeBSD likes /var/db instead of /var/lib
|
||||
return std::string("/var/db/zerotier-one");
|
||||
#else
|
||||
// Use /var/lib for Linux and other *nix
|
||||
return std::string("/var/lib/zerotier-one");
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#else // not __UNIX_LIKE__
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
// Look up app data folder on Windows, e.g. C:\ProgramData\...
|
||||
char buf[16384];
|
||||
if (SUCCEEDED(SHGetFolderPathA(NULL,CSIDL_COMMON_APPDATA,NULL,0,buf)))
|
||||
return (std::string(buf) + "\\ZeroTier\\One");
|
||||
|
@ -117,10 +117,11 @@ BSDEthernetTap::BSDEthernetTap(
|
||||
|
||||
// On BSD we create taps and they can have high numbers, so use ones starting
|
||||
// at 9993 to not conflict with other stuff. Then we rename it to zt<base32 of nwid>
|
||||
for(int i=9993;i<500;++i) {
|
||||
std::map<std::string,bool> devFiles(Utils::listDirectory("/dev"));
|
||||
for(int i=9993;i<(9993+128);++i) {
|
||||
Utils::snprintf(tmpdevname,sizeof(tmpdevname),"tap%d",i);
|
||||
Utils::snprintf(devpath,sizeof(devpath),"/dev/%s",tmpdevname);
|
||||
if (stat(devpath,&stattmp)) {
|
||||
if (devFiles.count(std::string(tmpdevname)) == 0) {
|
||||
long cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
::execl("/sbin/ifconfig","/sbin/ifconfig",tmpdevname,"create",(const char *)0);
|
||||
@ -146,6 +147,8 @@ BSDEthernetTap::BSDEthernetTap(
|
||||
if (_fd > 0)
|
||||
break;
|
||||
else throw std::runtime_error("unable to open created tap device");
|
||||
} else {
|
||||
throw std::runtime_error("cannot find /dev node for newly created tap device");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -190,6 +193,15 @@ BSDEthernetTap::~BSDEthernetTap()
|
||||
::close(_fd);
|
||||
::close(_shutdownSignalPipe[0]);
|
||||
::close(_shutdownSignalPipe[1]);
|
||||
|
||||
long cpid = (long)vfork();
|
||||
if (cpid == 0) {
|
||||
::execl("/sbin/ifconfig","/sbin/ifconfig",_dev.c_str(),"destroy",(const char *)0);
|
||||
::_exit(-1);
|
||||
} else if (cpid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(cpid,&exitcode,0);
|
||||
}
|
||||
}
|
||||
|
||||
void BSDEthernetTap::setEnabled(bool en)
|
||||
|
Loading…
Reference in New Issue
Block a user