From 88abd6ffc61b76fc244b9f7e885d6d9d64cb506e Mon Sep 17 00:00:00 2001 From: Dave Cottlehuber Date: Fri, 22 Jun 2018 21:05:53 +0000 Subject: add support for debug flags in FreeBSD --- node/Trace.cpp | 1 + node/Utils.hpp | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'node') diff --git a/node/Trace.cpp b/node/Trace.cpp index 386edaac..451f5806 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 a24f2c9a..cb107391 100644 --- a/node/Utils.hpp +++ b/node/Utils.hpp @@ -38,6 +38,10 @@ #include #include +#if defined(__FreeBSD__) +#include +#endif + #include "Constants.hpp" #ifdef __LINUX__ @@ -411,8 +415,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) | @@ -440,8 +448,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) | -- cgit v1.2.3