@@ -1031,25 +1031,21 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpPOST(
if (b.count("dns")) {
json &dns = b["dns"];
- if (dns.is_array()) {
- json nda = json::array();
- for(unsigned int i=0;i<dns.size();++i) {
- json &d = dns[i];
- if (d.is_object()) {
- json nd = json::object();
- nd["domain"] = d["domain"];
- json &srv = d["servers"];
- if (srv.is_array()) {
- json ns = json::array();
- for(unsigned int j=0;j<srv.size();++j) {
- ns.push_back(srv[i]);
- }
- nd["servers"] = ns;
- nda.push_back(nd);
+ if (dns.is_object()) {
+ json nd;
+
+ nd["domain"] = dns["domain"];
+ json &srv = dns["servers"];
+ if (srv.is_array()) {
+ json ns = json::array();
+ for(unsigned int i=0;i<srv.size();++i) {
+ ns.push_back(srv[i]);
}
+ nd["servers"] = ns;
- network["dns"] = nda;
+ network["dns"] = nd;
@@ -11,10 +11,22 @@ LOCAL_C_INCLUDES := \
LOCAL_LDLIBS := -llog
# LOCAL_CFLAGS := -g
+APP_UNIFIED_HEADERS := true
LOCAL_CFLAGS := -DZT_USE_MINIUPNPC
+ifeq ($(TARGET_ARCH_ABI),x86_64)
+ LOCAL_CXXFLAGS := -maes -mpclmul -msse4.1
+endif
+ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
+ LOCAL_ARM_NEON := true
+ LOCAL_CXXFLAGS := -march=armv8-a+crypto -mfloat-abi=softfp -mfpu=neon -maes -isystem $NDK/sysroot/usr/include/$TRIPLE
# ZeroTierOne SDK source files
LOCAL_SRC_FILES := \
+ $(ZT1)/node/AES.cpp \
+ $(ZT1)/node/Bond.cpp \
+ $(ZT1)/node/BondController.cpp \
$(ZT1)/node/C25519.cpp \
$(ZT1)/node/Capability.cpp \
$(ZT1)/node/CertificateOfMembership.cpp \
@@ -1,5 +1,5 @@
# NDK_TOOLCHAIN_VERSION := clang3.5
APP_STL := c++_static
APP_CPPFLAGS := -Wall -fstack-protector -fexceptions -fno-strict-aliasing -frtti -Wno-deprecated-register -DZT_NO_TYPE_PUNNING=1
-APP_PLATFORM := android-14
+APP_PLATFORM := android-21
APP_ABI := all
@@ -18,6 +18,10 @@
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
+#ifdef __APPLE__
+#include <arm_neon.h>
+#endif
#define Te1_r(x) ZT_ROR32(Te0[x], 8U)
#define Te2_r(x) ZT_ROR32(Te0[x], 16U)
#define Te3_r(x) ZT_ROR32(Te0[x], 24U)
@@ -111,13 +111,21 @@
#include <mmintrin.h>
#if (defined(__ARM_NEON) || defined(__ARM_NEON__) || defined(ZT_ARCH_ARM_HAS_NEON))
+#if (defined(__APPLE__) && !defined(__LP64__)) || (defined(__ANDROID__) && defined(__arm__))
+#ifdef ZT_ARCH_ARM_HAS_NEON
+#undef ZT_ARCH_ARM_HAS_NEON
+#else
#ifndef ZT_ARCH_ARM_HAS_NEON
#define ZT_ARCH_ARM_HAS_NEON 1
#include <arm_neon.h>
/*#include <arm_acle.h>*/
// Define ZT_NO_TYPE_PUNNING to disable reckless casts on anything other than x86/x64.
#if (!(defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_AMD64) || defined(_M_X64) || defined(i386) || defined(__i386) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(_M_IX86) || defined(__X86__) || defined(_X86_) || defined(__I86__) || defined(__INTEL__) || defined(__386)))
@@ -42,6 +42,14 @@
#include "Mutex.hpp"
#include "Salsa20.hpp"
+#include <TargetConditionals.h>
+#if defined(__ANDROID__) && defined(__aarch64__)
+#include <asm/hwcap.h>
namespace ZeroTier {
const uint64_t Utils::ZERO256[4] = {0ULL,0ULL,0ULL,0ULL};
@@ -51,6 +59,13 @@ const char Utils::HEXCHARS[16] = { '0','1','2','3','4','5','6','7','8','9','a','
#ifdef ZT_ARCH_ARM_HAS_NEON
Utils::ARMCapabilities::ARMCapabilities() noexcept
{
+#if TARGET_OS_IPHONE
+ this->aes = true;
+ this->crc32 = true;
+ this->pmull = true;
+ this->sha1 = true;
+ this->sha2 = true;
#ifdef HWCAP2_AES
if (sizeof(void *) == 4) {
const long hwcaps2 = getauxval(AT_HWCAP2);
@@ -70,6 +85,7 @@ Utils::ARMCapabilities::ARMCapabilities() noexcept
+#endif // TARGET_OS_IPHONE
const Utils::ARMCapabilities Utils::ARMCAP;
@@ -272,7 +272,8 @@ tapReadConfiguration(
if (status == NDIS_STATUS_SUCCESS)
- if (configParameter->ParameterType == NdisParameterString)
+ if (configParameter->ParameterType == NdisParameterString
+ && configParameter->ParameterData.StringData.Length <= sizeof(Adapter->NetCfgInstanceIdBuffer) - sizeof(WCHAR))
DEBUGP (("[TAP] NdisReadConfiguration (NetCfgInstanceId=%wZ)\n",
&configParameter->ParameterData.StringData ));