diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 5b3ccb85c..d73340c50 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,6 +1,12 @@ ZeroTier Release Notes ====== +# 2021-08-31 -- Version 1.8.0 + + * A *completely* rewritten desktop UI for Mac and Windows! + * Implement a workaround for one potential source of a "coma" bug, which can occur if buggy NATs/routers stop allowing the service to communicate on a given port. ZeroTier now reassigns a new secondary port if it's offline for a while unless a secondary port is manually specified in local.conf. + * Fix for MacOS MTU issue on feth devices. + # 2021-04-13 -- Version 1.6.5 * Fix a bug in potential network path filtering that could in some circumstances lead to "software laser" effects. diff --git a/ext/installfiles/mac/launch.sh b/ext/installfiles/mac/launch.sh index b02a66708..ab274cbfb 100755 --- a/ext/installfiles/mac/launch.sh +++ b/ext/installfiles/mac/launch.sh @@ -1,3 +1,4 @@ #!/bin/bash export PATH="/Library/Application Support/ZeroTier/One:/bin:/usr/bin:/sbin:/usr/sbin" +/usr/bin/killall MacEthernetTapAgent >>/dev/null 2>&1 exec zerotier-one diff --git a/ext/installfiles/mac/postinst.sh b/ext/installfiles/mac/postinst.sh index ed672d039..dd6ce375d 100755 --- a/ext/installfiles/mac/postinst.sh +++ b/ext/installfiles/mac/postinst.sh @@ -11,6 +11,21 @@ if [ ! -f authtoken.secret ]; then chmod 0600 authtoken.secret fi +if [ -f zerotier-one.pid ]; then + kill `cat zerotier-one.pid` + sleep 1 + killall MacEthernetTapAgent + sleep 1 + killall -9 MacEthernetTapAgent + sleep 1 + if [ -f zerotier-one.pid ]; then + kill -9 `cat zerotier-one.pid` + rm -f zerotier-one.pid + fi +fi +launchctl load /Library/LaunchDaemons/com.zerotier.one.plist >>/dev/null 2>&1 +sleep 1 + rm -f zerotier-cli zerotier-idtool ln -sf zerotier-one zerotier-cli ln -sf zerotier-one zerotier-idtool @@ -22,9 +37,6 @@ rm -f zerotier-cli zerotier-idtool ln -sf "/Library/Application Support/ZeroTier/One/zerotier-one" zerotier-cli ln -sf "/Library/Application Support/ZeroTier/One/zerotier-one" zerotier-idtool -launchctl load /Library/LaunchDaemons/com.zerotier.one.plist >>/dev/null 2>&1 -sleep 2 - if [ -f /tmp/zt1-gui-restart.tmp ]; then for u in `cat /tmp/zt1-gui-restart.tmp`; do if [ -f '/Applications/ZeroTier One.app/Contents/MacOS/ZeroTier One' ]; then diff --git a/ext/installfiles/mac/preinst.sh b/ext/installfiles/mac/preinst.sh index 03cb36043..d2df6a3a8 100755 --- a/ext/installfiles/mac/preinst.sh +++ b/ext/installfiles/mac/preinst.sh @@ -25,16 +25,15 @@ for i in `ps axuwww | tr -s ' ' ',' | grep -F '/Applications/ZeroTier.app' | gre done chmod 0600 /tmp/zt1-gui-restart.tmp -if [ -f /Library/LaunchDaemons/com.zerotier.one.plist ]; then - launchctl unload /Library/LaunchDaemons/com.zerotier.one.plist >>/dev/null 2>&1 - sleep 5 -fi -if [ -f '/Library/Application Support/ZeroTier/One/zerotier-one.pid' ]; then - kill -9 `cat /Library/Application Support/ZeroTier/One/zerotier-one.pid` -fi - cd "/Applications" rm -rf "ZeroTier One.app" rm -rf "ZeroTier.app" +if [ -d '/Library/Application Support/ZeroTier/One' ]; then + cd '/Library/Application Support/ZeroTier/One' + # ensure that file locking doesn't cause issues with replacing the binary + rm -f zerotier-one + rm -f MacEthernetTapAgent +fi + exit 0 diff --git a/ext/installfiles/mac/uninstall.sh b/ext/installfiles/mac/uninstall.sh index 52c09b630..4b6abe13a 100755 --- a/ext/installfiles/mac/uninstall.sh +++ b/ext/installfiles/mac/uninstall.sh @@ -21,12 +21,10 @@ killall -TERM zerotier-one >>/dev/null 2>&1 sleep 1 killall -KILL zerotier-one >>/dev/null 2>&1 -echo "Making sure kext is unloaded..." -kextunload '/Library/Application Support/ZeroTier/One/tap.kext' >>/dev/null 2>&1 - echo "Removing ZeroTier One files..." rm -rf '/Applications/ZeroTier One.app' +rm -rf '/Applications/ZeroTier.app' rm -f '/usr/local/bin/zerotier-one' '/usr/local/bin/zerotier-idtool' '/usr/local/bin/zerotier-cli' '/Library/LaunchDaemons/com.zerotier.one.plist' cd '/Library/Application Support/ZeroTier/One' diff --git a/service/OneService.cpp b/service/OneService.cpp index 549c394e6..758904be0 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -1028,8 +1028,11 @@ public: } } + // Make a copy so lookups don't modify in place; + json lc(_localConfig); + // Get any trusted paths in local.conf (we'll parse the rest of physical[] elsewhere) - json &physical = _localConfig["physical"]; + json &physical = lc["physical"]; if (physical.is_object()) { for(json::iterator phy(physical.begin());phy!=physical.end();++phy) { InetAddress net(OSUtils::jsonString(phy.key(),"").c_str()); @@ -1046,7 +1049,7 @@ public: } } - json &settings = _localConfig["settings"]; + json &settings = lc["settings"]; if (settings.is_object()) { // Allow controller DB path to be put somewhere else const std::string cdbp(OSUtils::jsonString(settings["controllerDbPath"],"")); @@ -1289,8 +1292,11 @@ public: } else { scode = 400; /* bond controller is not enabled */ } - } - if (ps[0] == "status") { + } else if (ps[0] == "config") { + Mutex::Lock lc(_localConfig_m); + res = _localConfig; + scode = 200; + } else if (ps[0] == "status") { ZT_NodeStatus status; _node->status(&status); @@ -1496,8 +1502,35 @@ public: } else { scode = 400; /* bond controller is not enabled */ } - } - if (ps[0] == "moon") { + } else if (ps[0] == "config") { + // Right now we only support writing the things the UI supports changing. + if (ps.size() == 2) { + if (ps[1] == "settings") { + try { + json j(OSUtils::jsonParse(body)); + if (j.is_object()) { + Mutex::Lock lcl(_localConfig_m); + json lc(_localConfig); + for(json::const_iterator s(j.begin());s!=j.end();++s) { + lc["settings"][s.key()] = s.value(); + } + std::string lcStr = OSUtils::jsonDump(lc, 4); + if (OSUtils::writeFile((_homePath + ZT_PATH_SEPARATOR_S "local.conf").c_str(), lcStr)) { + _localConfig = lc; + } + } else { + scode = 400; + } + } catch ( ... ) { + scode = 400; + } + } else { + scode = 404; + } + } else { + scode = 404; + } + } else if (ps[0] == "moon") { if (ps.size() == 2) { uint64_t seed = 0; @@ -3115,6 +3148,7 @@ public: if (_trialBind(randp)) break; } + return randp; } bool _trialBind(unsigned int port)