summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@zerotier.com>2018-09-14 08:08:59 -0700
committerGitHub <noreply@github.com>2018-09-14 08:08:59 -0700
commitaf61ee6f3a35f8cdbb174676e2fe7efdaf9db11c (patch)
tree86f177cc4a6bcb192857fcdf063e05b3366a90ef /node
parent04d7a1df96cff63e985c5f8c683ed72696db40ad (diff)
parent88abd6ffc61b76fc244b9f7e885d6d9d64cb506e (diff)
downloadinfinitytier-af61ee6f3a35f8cdbb174676e2fe7efdaf9db11c.tar.gz
infinitytier-af61ee6f3a35f8cdbb174676e2fe7efdaf9db11c.zip
Merge pull request #836 from skunkwerks/feature/add-freebsd-debugs
add support for debug flags in FreeBSD
Diffstat (limited to 'node')
-rw-r--r--node/Trace.cpp1
-rw-r--r--node/Utils.hpp16
2 files changed, 15 insertions, 2 deletions
diff --git a/node/Trace.cpp b/node/Trace.cpp
index f47a029b..7b2fbbb7 100644
--- a/node/Trace.cpp
+++ b/node/Trace.cpp
@@ -40,6 +40,7 @@
#include "Tag.hpp"
#include "Capability.hpp"
#include "Revocation.hpp"
+#include "../include/ZeroTierDebug.h"
namespace ZeroTier {
diff --git a/node/Utils.hpp b/node/Utils.hpp
index 6ce67328..35493f01 100644
--- a/node/Utils.hpp
+++ b/node/Utils.hpp
@@ -38,6 +38,10 @@
#include <vector>
#include <map>
+#if defined(__FreeBSD__)
+#include <sys/endian.h>
+#endif
+
#include "Constants.hpp"
#ifdef __LINUX__
@@ -419,8 +423,12 @@ public:
static inline uint64_t hton(uint64_t n)
{
#if __BYTE_ORDER == __LITTLE_ENDIAN
-#if defined(__GNUC__) && (!defined(__OpenBSD__))
+#if defined(__GNUC__)
+#if defined(__FreeBSD__)
+ return bswap64(n);
+#elif (!defined(__OpenBSD__))
return __builtin_bswap64(n);
+#endif
#else
return (
((n & 0x00000000000000FFULL) << 56) |
@@ -448,8 +456,12 @@ public:
static inline uint64_t ntoh(uint64_t n)
{
#if __BYTE_ORDER == __LITTLE_ENDIAN
-#if defined(__GNUC__) && !defined(__OpenBSD__)
+#if defined(__GNUC__)
+#if defined(__FreeBSD__)
+ return bswap64(n);
+#elif (!defined(__OpenBSD__))
return __builtin_bswap64(n);
+#endif
#else
return (
((n & 0x00000000000000FFULL) << 56) |