diff --git a/lib/debug_config.c b/lib/debug_config.c index 95e5a6e..af9dcd5 100644 --- a/lib/debug_config.c +++ b/lib/debug_config.c @@ -269,7 +269,7 @@ void debug_output(debug_level_t level, debug_category_t category, /* Add timestamp with microseconds: hh:mm:ss-xxx.yyy */ struct timeval tv; - gettimeofday(&tv, NULL); + utun_gettimeofday(&tv, NULL); time_t tv_sec = (time_t)tv.tv_sec; struct tm* tm_info = localtime(&tv_sec); char time_str[32]; diff --git a/lib/debug_config.h b/lib/debug_config.h index d5af2f6..8510fd2 100644 --- a/lib/debug_config.h +++ b/lib/debug_config.h @@ -53,7 +53,7 @@ typedef uint64_t debug_category_t; #define DEBUG_CATEGORY_CONTROL ((debug_category_t)1 << 14) // Control/monitoring server #define DEBUG_CATEGORY_DUMP ((debug_category_t)1 << 15) // Packet dump/logging #define DEBUG_CATEGORY_COUNT 16 // Total number of categories -#define DEBUG_CATEGORY_ALL ((debug_category_t)0xFFFFFFFFFFFFFFFFULL) +#define DEBUG_CATEGORY_ALL ((debug_category_t)0xFFFFFFFFUL) /* Debug configuration structure */ typedef struct { diff --git a/src/etcp.h b/src/etcp.h index 02870a1..fc40cc4 100644 --- a/src/etcp.h +++ b/src/etcp.h @@ -78,7 +78,7 @@ struct ETCP_CONN { // Crypto and state struct secure_channel crypto_ctx; - struct pn_pair* normalizer; + struct PKTNORM* normalizer; // Peer info uint64_t peer_node_id; // Peer node ID diff --git a/src/secure_channel.c b/src/secure_channel.c index d7cd2b8..ac31c63 100644 --- a/src/secure_channel.c +++ b/src/secure_channel.c @@ -4,6 +4,8 @@ #include #endif +#define OPENSSL_API_COMPAT 0x10100000L + #include "secure_channel.h" #include "../lib/debug_config.h" #include "../lib/platform_compat.h" @@ -141,7 +143,7 @@ static int sc_rng(uint8_t *dest, unsigned size) { pid_t pid = getpid(); #endif struct timeval tv; - gettimeofday(&tv, NULL); + utun_gettimeofday(&tv, NULL); for (unsigned i = 0; i < size; i++) { dest[i] ^= ((pid >> (i % (sizeof(pid) * 8))) & 0xFF); dest[i] ^= ((tv.tv_sec >> (i % (sizeof(tv.tv_sec) * 8))) & 0xFF); @@ -336,7 +338,7 @@ static void sc_build_nonce(uint64_t counter, uint8_t *nonce_out) { if (!sc_urandom_initialized) { sc_init_random_seed(); } - gettimeofday(&tv, NULL); + utun_gettimeofday(&tv, NULL); memcpy(data, sc_urandom_seed, 8); data[8] = (counter >> 0) & 0xFF; data[9] = (counter >> 8) & 0xFF; @@ -515,7 +517,7 @@ static int sc_rng(uint8_t *dest, unsigned size) pid_t pid = getpid(); #endif struct timeval tv; - gettimeofday(&tv, NULL); + utun_gettimeofday(&tv, NULL); for (unsigned i = 0; i < size; i++) { dest[i] ^= ((pid >> (i % (sizeof(pid) * 8))) & 0xFF); dest[i] ^= ((tv.tv_sec >> (i % (sizeof(tv.tv_sec) * 8))) & 0xFF); @@ -666,7 +668,7 @@ static void sc_build_nonce(uint64_t counter, uint8_t *nonce_out) sc_init_random_seed(); } - gettimeofday(&tv, NULL); + utun_gettimeofday(&tv, NULL); memcpy(data, sc_urandom_seed, 8); data[8] = (counter >> 0) & 0xFF; diff --git a/tests/test_pkt_normalizer_etcp.c b/tests/test_pkt_normalizer_etcp.c index eec4bec..adc4c7e 100644 --- a/tests/test_pkt_normalizer_etcp.c +++ b/tests/test_pkt_normalizer_etcp.c @@ -25,6 +25,8 @@ #include "../lib/debug_config.h" #include "../lib/mem.h" +extern int pn_packer_send(void* pn, const uint8_t* buffer, size_t size); + #define TEST_TIMEOUT_MS 3000 // 3 second timeout #define TOTAL_PACKETS 100 // Total packets to send //#define MAX_QUEUE_SIZE 5 // Max packets in input queue diff --git a/tests/test_pkt_normalizer_standalone.c b/tests/test_pkt_normalizer_standalone.c index 5e05bba..f324d2e 100644 --- a/tests/test_pkt_normalizer_standalone.c +++ b/tests/test_pkt_normalizer_standalone.c @@ -29,6 +29,8 @@ void etcp_conn_reinit(struct ETCP_CONN* etcp) { #include "../src/utun_instance.h" #include "../lib/mem.h" +extern int pn_packer_send(void* pn, const uint8_t* buffer, size_t size); + // Test state static struct UTUN_INSTANCE mock_instance; static struct ETCP_CONN mock_etcp; diff --git a/tests/test_u_async_performance.c b/tests/test_u_async_performance.c index 6f03673..79b85ad 100644 --- a/tests/test_u_async_performance.c +++ b/tests/test_u_async_performance.c @@ -21,7 +21,7 @@ /* Performance measurement */ static uint64_t get_time_us(void) { struct timeval tv; - gettimeofday(&tv, NULL); + utun_gettimeofday(&tv, NULL); return (uint64_t)tv.tv_sec * 1000000ULL + tv.tv_usec; }