summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--make-freebsd.mk3
-rw-r--r--make-linux.mk3
-rw-r--r--make-mac.mk3
-rw-r--r--one.cpp26
-rw-r--r--service/OneService.cpp6
5 files changed, 10 insertions, 31 deletions
diff --git a/make-freebsd.mk b/make-freebsd.mk
index 37968bdd..c381a0a8 100644
--- a/make-freebsd.mk
+++ b/make-freebsd.mk
@@ -60,7 +60,6 @@ all: one
one: $(OBJS) one.o
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-one $(OBJS) one.o $(LIBS)
$(STRIP) zerotier-one
- ln -sf zerotier-one zerotier-cli
ln -sf zerotier-one zerotier-idtool
selftest: $(OBJS) selftest.o
@@ -72,7 +71,7 @@ selftest: $(OBJS) selftest.o
# ./buildinstaller.sh
clean:
- rm -rf *.o node/*.o controller/*.o osdep/*.o service/*.o ext/http-parser/*.o ext/lz4/*.o build-* zerotier-* ZeroTierOneInstaller-*
+ rm -rf *.o node/*.o controller/*.o osdep/*.o service/*.o ext/http-parser/*.o ext/lz4/*.o build-* zerotier-one zerotier-idtool zerotier-selftest ZeroTierOneInstaller-*
debug: FORCE
make -j 4 ZT_DEBUG=1
diff --git a/make-linux.mk b/make-linux.mk
index c0fe973e..082ba07d 100644
--- a/make-linux.mk
+++ b/make-linux.mk
@@ -66,7 +66,6 @@ all: one
one: $(OBJS) one.o
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-one $(OBJS) one.o $(LIBS)
$(STRIP) zerotier-one
- ln -sf zerotier-one zerotier-cli
ln -sf zerotier-one zerotier-idtool
selftest: $(OBJS) selftest.o
@@ -77,7 +76,7 @@ installer: one FORCE
./buildinstaller.sh
clean:
- rm -rf *.o node/*.o controller/*.o osdep/*.o service/*.o ext/http-parser/*.o ext/lz4/*.o zerotier-* build-* ZeroTierOneInstaller-* *.deb *.rpm
+ rm -rf *.o node/*.o controller/*.o osdep/*.o service/*.o ext/http-parser/*.o ext/lz4/*.o zerotier-one zerotier-idtool zerotier-selftest build-* ZeroTierOneInstaller-* *.deb *.rpm
debug: FORCE
make -j 4 ZT_DEBUG=1
diff --git a/make-mac.mk b/make-mac.mk
index 649ea214..2a38714a 100644
--- a/make-mac.mk
+++ b/make-mac.mk
@@ -55,7 +55,6 @@ all: one
one: $(OBJS) one.o
$(CXX) $(CXXFLAGS) -o zerotier-one $(OBJS) one.o $(LIBS)
$(STRIP) zerotier-one
- ln -sf zerotier-one zerotier-cli
ln -sf zerotier-one zerotier-idtool
selftest: $(OBJS) selftest.o
@@ -76,7 +75,7 @@ selftest: $(OBJS) selftest.o
# $(CODESIGN) -vvv "build-ZeroTierUI-release/ZeroTier One.app"
clean:
- rm -rf *.dSYM build-* *.pkg *.dmg *.o node/*.o controller/*.o service/*.o osdep/*.o ext/http-parser/*.o ext/lz4/*.o zerotier-* ZeroTierOneInstaller-*
+ rm -rf *.dSYM build-* *.pkg *.dmg *.o node/*.o controller/*.o service/*.o osdep/*.o ext/http-parser/*.o ext/lz4/*.o zerotier-one zerotier-idtool zerotier-selftest ZeroTierOneInstaller-*
# For our use -- builds official signed binary, packages in installer and download DMG
official: FORCE
diff --git a/one.cpp b/one.cpp
index c5a3e99f..bcf27bd4 100644
--- a/one.cpp
+++ b/one.cpp
@@ -76,18 +76,6 @@ using namespace ZeroTier;
static OneService *volatile zt1Service = (OneService *)0;
/****************************************************************************/
-/* zerotier-cli personality */
-/****************************************************************************/
-
-#ifdef __WINDOWS__
-int cli(int argc, _TCHAR* argv[])
-#else
-int cli(int argc,char **argv)
-#endif
-{
-}
-
-/****************************************************************************/
/* zerotier-idtool personality */
/****************************************************************************/
@@ -435,7 +423,7 @@ static void printHelp(const char *cn,FILE *out)
{
fprintf(out,"ZeroTier One version %d.%d.%d"ZT_EOL_S"(c)2011-2015 ZeroTier, Inc."ZT_EOL_S,ZEROTIER_ONE_VERSION_MAJOR,ZEROTIER_ONE_VERSION_MINOR,ZEROTIER_ONE_VERSION_REVISION);
fprintf(out,"Licensed under the GNU General Public License v3"ZT_EOL_S""ZT_EOL_S);
- fprintf(out,"Usage: %s [-switches] [home directory] [-q <query>]"ZT_EOL_S""ZT_EOL_S,cn);
+ fprintf(out,"Usage: %s [-switches] [home directory]"ZT_EOL_S""ZT_EOL_S,cn);
fprintf(out,"Available switches:"ZT_EOL_S);
fprintf(out," -h - Display this help"ZT_EOL_S);
fprintf(out," -v - Show version"ZT_EOL_S);
@@ -444,7 +432,6 @@ static void printHelp(const char *cn,FILE *out)
#ifdef __UNIX_LIKE__
fprintf(out," -d - Fork and run as daemon (Unix-ish OSes)"ZT_EOL_S);
#endif // __UNIX_LIKE__
- fprintf(out," -q - Send a query to a running service (zerotier-cli)"ZT_EOL_S);
fprintf(out," -i - Generate and manage identities (zerotier-idtool)"ZT_EOL_S);
#ifdef __WINDOWS__
fprintf(out," -C - Run from command line instead of as service (Windows)"ZT_EOL_S);
@@ -495,8 +482,6 @@ int main(int argc,char **argv)
#endif
#endif // __WINDOWS__
- if ((strstr(argv[0],"zerotier-cli"))||(strstr(argv[0],"ZEROTIER-CLI")))
- return cli(argc,argv);
if ((strstr(argv[0],"zerotier-idtool"))||(strstr(argv[0],"ZEROTIER-IDTOOL")))
return idtool(argc,argv);
@@ -516,9 +501,6 @@ int main(int argc,char **argv)
}
break;
- case 't': // TCP port -- ignore, since we now bind to both UDP and TCP on the same port
- break;
-
#ifdef __UNIX_LIKE__
case 'd': // Run in background as daemon
runAsDaemon = true;
@@ -541,12 +523,6 @@ int main(int argc,char **argv)
printf("%d.%d.%d"ZT_EOL_S,ZEROTIER_ONE_VERSION_MAJOR,ZEROTIER_ONE_VERSION_MINOR,ZEROTIER_ONE_VERSION_REVISION);
return 0;
- case 'q': // Invoke cli personality
- if (argv[i][2]) {
- printHelp(argv[0],stdout);
- return 0;
- } else return cli(argc,argv);
-
case 'i': // Invoke idtool personality
if (argv[i][2]) {
printHelp(argv[0],stdout);
diff --git a/service/OneService.cpp b/service/OneService.cpp
index 1ba7a8c5..bb808304 100644
--- a/service/OneService.cpp
+++ b/service/OneService.cpp
@@ -131,6 +131,7 @@ class OneServiceImpl : public OneService
public:
OneServiceImpl(const char *hp,unsigned int port,NetworkController *master,const char *overrideRootTopology) :
_homePath((hp) ? hp : "."),
+ _port(port),
_phy(this,true),
_master(master),
_overrideRootTopology((overrideRootTopology) ? overrideRootTopology : ""),
@@ -160,6 +161,10 @@ public:
in6.sin6_port = in4.sin_port;
_v6UdpSocket = _phy.udpBind((const struct sockaddr *)&in6,this,131072);
_v6TcpListenSocket = _phy.tcpListen((const struct sockaddr *)&in6,this);
+
+ char portstr[64];
+ Utils::snprintf(portstr,sizeof(portstr),"%u",port);
+ OSUtils::writeFile((_homePath + ZT_PATH_SEPARATOR_S + "zerotier-one.port").c_str(),std::string(portstr));
}
virtual ~OneServiceImpl()
@@ -632,6 +637,7 @@ private:
}
const std::string _homePath;
+ unsigned int _port;
Phy<OneServiceImpl *> _phy;
NetworkController *_master;
std::string _overrideRootTopology;