Merge branch 'dev' of github.com:zerotier/ZeroTierOne into dev

This commit is contained in:
Adam Ierymenko 2020-09-23 21:59:14 -04:00
commit 70efa5f606
7 changed files with 56 additions and 19 deletions

View File

@ -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;
}
}

View File

@ -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
endif
# 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 \

View File

@ -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

View File

@ -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)

View File

@ -111,13 +111,21 @@
#include <mmintrin.h>
#endif
#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
#endif
#else
#ifndef ZT_ARCH_ARM_HAS_NEON
#define ZT_ARCH_ARM_HAS_NEON 1
#endif
#include <arm_neon.h>
/*#include <arm_acle.h>*/
#endif
#endif
// 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)))

View File

@ -42,6 +42,14 @@
#include "Mutex.hpp"
#include "Salsa20.hpp"
#ifdef __APPLE__
#include <TargetConditionals.h>
#endif
#if defined(__ANDROID__) && defined(__aarch64__)
#include <asm/hwcap.h>
#endif
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;
#else
#ifdef HWCAP2_AES
if (sizeof(void *) == 4) {
const long hwcaps2 = getauxval(AT_HWCAP2);
@ -70,6 +85,7 @@ Utils::ARMCapabilities::ARMCapabilities() noexcept
#ifdef HWCAP2_AES
}
#endif
#endif // TARGET_OS_IPHONE
}
const Utils::ARMCapabilities Utils::ARMCAP;

View File

@ -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 ));