Browse Source

Linux build fixes

Adam Ierymenko 5 years ago
parent
commit
782b75a64e
8 changed files with 12 additions and 9 deletions
  1. 2 2
      go/native/CoreTests.cpp
  2. 1 1
      node/AES.cpp
  3. 1 0
      node/Hashtable.hpp
  4. 1 1
      node/Identity.hpp
  5. 1 1
      node/OS.hpp
  6. 1 1
      osdep/LinuxEthernetTap.cpp
  7. 4 3
      osdep/NeighborDiscovery.cpp
  8. 1 0
      root/root.cpp

+ 2 - 2
go/native/CoreTests.cpp

@@ -45,6 +45,8 @@
 
 using namespace ZeroTier;
 
+static volatile uint8_t foo = 0;
+
 #define KNOWN_GOOD_IDENTITY_0 "8e4df28b72:0:ac3d46abe0c21f3cfe7a6c8d6a85cfcffcb82fbd55af6a4d6350657c68200843fa2e16f9418bbd9702cae365f2af5fb4c420908b803a681d4daef6114d78a2d7:bd8dd6e4ce7022d2f812797a80c6ee8ad180dc4ebf301dec8b06d1be08832bddd63a2f1cfa7b2c504474c75bdc8898ba476ef92e8e2d0509f8441985171ff16e"
 #define KNOWN_BAD_IDENTITY_0 "9e4df28b72:0:ac3d46abe0c21f3cfe7a6c8d6a85cfcffcb82fbd55af6a4d6350657c68200843fa2e16f9418bbd9702cae365f2af5fb4c420908b803a681d4daef6114d78a2d7:bd8dd6e4ce7022d2f812797a80c6ee8ad180dc4ebf301dec8b06d1be08832bddd63a2f1cfa7b2c504474c75bdc8898ba476ef92e8e2d0509f8441985171ff16e"
 
@@ -147,7 +149,6 @@ extern "C" int ZT_TestCrypto()
 {
 	static uint8_t buf1[16384],buf2[16384],buf3[16384];
 	static char hexbuf[1024];
-	volatile unsigned char *dummy = (volatile unsigned char *)&(buf1[100]);
 
 	for(int i=0;i<3;++i) {
 		Utils::getSecureRandom(buf1,64);
@@ -385,7 +386,6 @@ extern "C" int ZT_TestCrypto()
 	std::cout << "[crypto] Benchmarking asymmetric crypto..." ZT_EOL_S;
 	{
 		uint8_t pub[128],priv[128],hash[128],sig[128];
-		volatile uint8_t foo = 0;
 		Utils::getSecureRandom(hash,sizeof(hash));
 
 		C25519::generate(pub,priv);

+ 1 - 1
node/AES.cpp

@@ -380,7 +380,7 @@ void AES::_gmacSW(const uint8_t iv[12],const uint8_t *in,unsigned int len,uint8_
 
 #ifdef ZT_AES_AESNI
 
-static ZT_ALWAYS_INLINE inline __m128i _mult_block_aesni(__m128i shuf,__m128i h,__m128i y)
+static ZT_ALWAYS_INLINE __m128i _mult_block_aesni(__m128i shuf,__m128i h,__m128i y)
 {
 	y = _mm_shuffle_epi8(y,shuf);
 	__m128i t1 = _mm_clmulepi64_si128(h,y,0x00);

+ 1 - 0
node/Hashtable.hpp

@@ -17,6 +17,7 @@
 #include "Constants.hpp"
 
 #include <cstdlib>
+#include <cstring>
 #include <stdexcept>
 #include <vector>
 

+ 1 - 1
node/Identity.hpp

@@ -380,7 +380,7 @@ public:
 					_hasPrivate = true;
 					memcpy(&_priv,data + ZT_ADDRESS_LENGTH + 1 + ZT_IDENTITY_P384_COMPOUND_PUBLIC_KEY_SIZE + 1,ZT_IDENTITY_P384_COMPOUND_PRIVATE_KEY_SIZE);
 					privlen = data[ZT_ADDRESS_LENGTH + 1 + ZT_IDENTITY_P384_COMPOUND_PUBLIC_KEY_SIZE + 1 + ZT_IDENTITY_P384_COMPOUND_PRIVATE_KEY_SIZE];
-					if (len < (privlen + (ZT_ADDRESS_LENGTH + 1 + ZT_IDENTITY_P384_COMPOUND_PUBLIC_KEY_SIZE + 1 + ZT_IDENTITY_P384_COMPOUND_PRIVATE_KEY_SIZE + 1)))
+					if (len < (int)(privlen + (ZT_ADDRESS_LENGTH + 1 + ZT_IDENTITY_P384_COMPOUND_PUBLIC_KEY_SIZE + 1 + ZT_IDENTITY_P384_COMPOUND_PRIVATE_KEY_SIZE + 1)))
 						return -1;
 					return (int)(privlen + (unsigned int)(ZT_ADDRESS_LENGTH + 1 + ZT_IDENTITY_P384_COMPOUND_PUBLIC_KEY_SIZE + 1 + ZT_IDENTITY_P384_COMPOUND_PRIVATE_KEY_SIZE + 1));
 				} else if (privlen == 0) {

+ 1 - 1
node/OS.hpp

@@ -117,7 +117,7 @@
 #endif
 
 #if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__)
-#define ZT_ALWAYS_INLINE __attribute__((always_inline))
+#define ZT_ALWAYS_INLINE __attribute__((always_inline)) inline
 #ifndef restrict
 #define restrict __restrict__
 #endif

+ 1 - 1
osdep/LinuxEthernetTap.cpp

@@ -415,7 +415,7 @@ void LinuxEthernetTap::scanMulticastGroups(std::vector<MulticastGroup> &added,st
 						mcastmac = f;
 					++fno;
 				}
-				if ((devname)&&(!strcmp(devname,_dev.c_str()))&&(mcastmac)&&(Utils::unhex(mcastmac,mac,6) == 6))
+				if ((devname)&&(!strcmp(devname,_dev.c_str()))&&(mcastmac)&&(Utils::unhex(mcastmac,strlen(mcastmac),mac,6) == 6))
 					newGroups.push_back(MulticastGroup(MAC(mac,6),0));
 			}
 		}

+ 4 - 3
osdep/NeighborDiscovery.cpp

@@ -15,7 +15,8 @@
 #include "NeighborDiscovery.hpp"
 #include "OSUtils.hpp"
 
-#include <assert.h>
+#include <cstdlib>
+#include <cstring>
 
 namespace ZeroTier {
 
@@ -175,8 +176,8 @@ void NeighborDiscovery::remove(const sockaddr_storage &address)
 
 sockaddr_storage NeighborDiscovery::processIncomingND(const uint8_t *nd, unsigned int len, const sockaddr_storage &localIp, uint8_t *response, unsigned int &responseLen, MAC &responseDest)
 {
-    assert(sizeof(_neighbor_solicitation) == 28);
-    assert(sizeof(_neighbor_advertisement) == 32);
+    // assert(sizeof(_neighbor_solicitation) == 28);
+    // assert(sizeof(_neighbor_advertisement) == 32);
 
     const uint64_t now = OSUtils::now();
     sockaddr_storage ip = {0};

+ 1 - 0
root/root.cpp

@@ -92,6 +92,7 @@
 #include <set>
 #include <vector>
 #include <iostream>
+#include <iomanip>
 #include <unordered_map>
 #include <unordered_set>
 #include <vector>