Index: make-bsd.mk
--- make-bsd.mk.orig	2022-06-13 20:18:54.000000000 +0200
+++ make-bsd.mk	2022-06-14 11:23:02.859764000 +0200
@@ -44,10 +44,10 @@
 	# C25519 in particular is almost UNUSABLE in heavy testing without it.
 node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
 else
-	CFLAGS?=-O3 -fstack-protector
-	CFLAGS+=-Wall -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
-	LDFLAGS+=-pie -Wl,-z,relro,-z,now
-	STRIP=strip --strip-all
+	CFLAGS?=-O2
+	CFLAGS+=-fvisibility=hidden -pthread $(INCLUDES) -DNDEBUG $(DEFS)
+	LDFLAGS+=
+	STRIP=true
 endif
 
 ifeq ($(ZT_TRACE),1)
Index: make-linux.mk
--- make-linux.mk.orig	2022-06-14 11:23:02.859913000 +0200
+++ make-linux.mk	2022-06-14 11:25:18.948408000 +0200
@@ -66,11 +66,11 @@
 	# C25519 in particular is almost UNUSABLE in -O0 even on a 3ghz box!
 node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CXXFLAGS=-Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
 else
-	CFLAGS?=-O3 -fstack-protector
-	override CFLAGS+=-Wall -Wno-deprecated -pthread $(INCLUDES) -DNDEBUG $(DEFS)
-	CXXFLAGS?=-O3 -fstack-protector
-	override CXXFLAGS+=-Wall -Wno-deprecated -std=c++17 -pthread $(INCLUDES) -DNDEBUG $(DEFS)
-	LDFLAGS=-pie -Wl,-z,relro,-z,now
+	CFLAGS?=-O2
+	override CFLAGS+=-Wno-deprecated -pthread $(INCLUDES) -DNDEBUG $(DEFS)
+	CXXFLAGS?=-O2
+	override CXXFLAGS+=-Wno-deprecated -std=c++17 -pthread $(INCLUDES) -DNDEBUG $(DEFS)
+	LDFLAGS=
 	RUSTFLAGS=--release
 endif
 
Index: osdep/OSUtils.cpp
--- osdep/OSUtils.cpp.orig	2022-06-13 20:18:54.000000000 +0200
+++ osdep/OSUtils.cpp	2022-06-14 11:23:02.860094000 +0200
@@ -368,75 +368,7 @@
 
 std::string OSUtils::platformDefaultHomePath()
 {
-#ifdef __QNAP__
-	char *cmd = "/sbin/getcfg zerotier Install_Path -f /etc/config/qpkg.conf";
-    char buf[128];
-    FILE *fp;
-    if ((fp = popen(cmd, "r")) == NULL) {
-        printf("Error opening pipe!\n");
-        return NULL;
-    }
-    while (fgets(buf, 128, fp) != NULL) { }
-    if(pclose(fp))  {
-        printf("Command not found or exited with error status\n");
-        return NULL;
-    }
-    std::string homeDir = std::string(buf);
-    homeDir.erase(std::remove(homeDir.begin(), homeDir.end(), '\n'), homeDir.end());
-    return homeDir;
-#endif
-#ifdef __UBIQUITI__
-	// Only persistent location after firmware upgrades
-	return std::string("/config/zerotier-one");
-#endif
-
-    // Check for user-defined environment variable before using defaults
-#ifdef __WINDOWS__
-	DWORD bufferSize = 65535;
-	std::string userDefinedPath;
-	bufferSize = GetEnvironmentVariable("ZEROTIER_HOME", &userDefinedPath[0], bufferSize);
-	if (bufferSize) {
-		return userDefinedPath;
-	}
-#else
-	if(const char* userDefinedPath = getenv("ZEROTIER_HOME")) {
-		return std::string(userDefinedPath);
-	}
-#endif
-
-	// Finally, resort to using default paths if no user-defined path was provided
-#ifdef __UNIX_LIKE__
-
-#ifdef __APPLE__
-	// /Library/... on Apple
-	return std::string("/Library/Application Support/ZeroTier/One");
-#else
-
-#ifdef __BSD__
-	// BSD 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");
-	else return std::string("C:\\ZeroTier\\One");
-#else
-
-	return (std::string(ZT_PATH_SEPARATOR_S) + "ZeroTier" + ZT_PATH_SEPARATOR_S + "One"); // UNKNOWN PLATFORM
-
-#endif
-
-#endif // __UNIX_LIKE__ or not...
+    return std::string("@l_prefix@/var/zerotier/db");
 }
 
 #ifndef OMIT_JSON_SUPPORT
