Przeglądaj źródła

Build fixes for G++, building without SQLite3 present, and warning removal.

Adam Ierymenko 10 lat temu
rodzic
commit
2810cd7c15
4 zmienionych plików z 9 dodań i 8 usunięć
  1. 1 2
      node/InetAddress.cpp
  2. 4 2
      node/Node.cpp
  3. 2 4
      selftest.cpp
  4. 2 0
      service/ControlPlane.cpp

+ 1 - 2
node/InetAddress.cpp

@@ -137,8 +137,7 @@ void InetAddress::set(const void *ipBytes,unsigned int ipLen,unsigned int port)
 		reinterpret_cast<struct sockaddr_in *>(this)->sin_port = Utils::hton((uint16_t)port);
 		reinterpret_cast<struct sockaddr_in *>(this)->sin_port = Utils::hton((uint16_t)port);
 	} else if (ipLen == 16) {
 	} else if (ipLen == 16) {
 		ss_family = AF_INET6;
 		ss_family = AF_INET6;
-		(reinterpret_cast<uint64_t *>(reinterpret_cast<struct sockaddr_in6 *>(this)->sin6_addr.s6_addr))[0] = ((const uint64_t *)ipBytes)[0];
-		(reinterpret_cast<uint64_t *>(reinterpret_cast<struct sockaddr_in6 *>(this)->sin6_addr.s6_addr))[1] = ((const uint64_t *)ipBytes)[1];
+		memcpy(reinterpret_cast<struct sockaddr_in6 *>(this)->sin6_addr.s6_addr,ipBytes,16);
 		reinterpret_cast<struct sockaddr_in6 *>(this)->sin6_port = Utils::hton((uint16_t)port);
 		reinterpret_cast<struct sockaddr_in6 *>(this)->sin6_port = Utils::hton((uint16_t)port);
 	}
 	}
 }
 }

+ 4 - 2
node/Node.cpp

@@ -251,8 +251,10 @@ ZT1_ResultCode Node::processBackgroundTasks(uint64_t now,volatile uint64_t *next
 		if ((now - _lastBeacon) >= ZT_BEACON_INTERVAL) {
 		if ((now - _lastBeacon) >= ZT_BEACON_INTERVAL) {
 			_lastBeacon = now;
 			_lastBeacon = now;
 			char beacon[13];
 			char beacon[13];
-			*(reinterpret_cast<uint32_t *>(beacon)) = RR->prng->next32();
-			*(reinterpret_cast<uint32_t *>(beacon + 4)) = RR->prng->next32();
+			void *p = beacon;
+			*(reinterpret_cast<uint32_t *>(p)) = RR->prng->next32();
+			p = beacon + 4;
+			*(reinterpret_cast<uint32_t *>(p)) = RR->prng->next32();
 			RR->identity.address().copyTo(beacon + 8,5);
 			RR->identity.address().copyTo(beacon + 8,5);
 			RR->antiRec->logOutgoingZT(beacon,13);
 			RR->antiRec->logOutgoingZT(beacon,13);
 			putPacket(ZT_DEFAULTS.v4Broadcast,beacon,13,0);
 			putPacket(ZT_DEFAULTS.v4Broadcast,beacon,13,0);

+ 2 - 4
selftest.cpp

@@ -510,16 +510,14 @@ static int testCertificate()
 
 
 static int testPacket()
 static int testPacket()
 {
 {
-	unsigned char salsaKey[32],hmacKey[32];
+	unsigned char salsaKey[32];
 	Packet a,b;
 	Packet a,b;
 
 
 	a.burn();
 	a.burn();
 	b.burn();
 	b.burn();
 
 
-	for(unsigned int i=0;i<32;++i) {
+	for(unsigned int i=0;i<32;++i)
 		salsaKey[i] = (unsigned char)rand();
 		salsaKey[i] = (unsigned char)rand();
-		hmacKey[i] = (unsigned char)rand();
-	}
 
 
 	std::cout << "[packet] Testing Packet encoder/decoder... ";
 	std::cout << "[packet] Testing Packet encoder/decoder... ";
 
 

+ 2 - 0
service/ControlPlane.cpp

@@ -33,7 +33,9 @@
 
 
 #include "../ext/http-parser/http_parser.h"
 #include "../ext/http-parser/http_parser.h"
 
 
+#ifdef ZT_ENABLE_NETWORK_CONTROLLER
 #include "../controller/SqliteNetworkController.hpp"
 #include "../controller/SqliteNetworkController.hpp"
+#endif
 
 
 #include "../node/InetAddress.hpp"
 #include "../node/InetAddress.hpp"
 #include "../node/Node.hpp"
 #include "../node/Node.hpp"