From 3549936b481fb60f1970d142f15f0673f25baafe Mon Sep 17 00:00:00 2001 From: Logan007 Date: Wed, 29 Jul 2020 15:32:04 +0545 Subject: [PATCH] moved some #DEFs to n2n_define.h --- include/n2n_define.h | 8 ++++++++ src/n2n.c | 6 ------ src/random_numbers.c | 3 --- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/n2n_define.h b/include/n2n_define.h index 4372372..4d3c48b 100644 --- a/include/n2n_define.h +++ b/include/n2n_define.h @@ -46,6 +46,14 @@ #define IP4_MIN_SIZE 20 #define UDP_SIZE 8 +/* parameters for replay protection */ +#define TIME_STAMP_FRAME 0x0000001000000000LL /* clocks of different computers are allowed +/- 16 seconds to be off */ +#define TIME_STAMP_JITTER 0x0000000027100000LL /* we allow a packet to arrive 160 ms (== 0x27100 us) before another + * set to 0x0000000000000000LL if increasing (or equal) time stamps allowed only */ + +/* parameter for random number generation */ +#define RND_RETRIES 1000 /* syscall and inquiring random number from hardware generators might fail, so we will retry */ + /* N2N compression indicators. */ /* Compression is disabled by default for outgoing packets if no cli * option is given. All edges are built with decompression support so diff --git a/src/n2n.c b/src/n2n.c index 8ec3223..7c8109e 100644 --- a/src/n2n.c +++ b/src/n2n.c @@ -23,12 +23,6 @@ #include -#define PURGE_REGISTRATION_FREQUENCY 30 -#define REGISTRATION_TIMEOUT 60 - -#define TIME_STAMP_FRAME 0x0000001000000000LL /* clocks of different computers are allowed +/- 16 seconds to be off */ -#define TIME_STAMP_JITTER 0x0000000027100000LL /* we allow a packet to arrive 160 ms (== 0x27100 us) before another - * set to 0x0000000000000000LL if increasing (or equal) time stamps allowed only */ static const uint8_t broadcast_addr[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; static const uint8_t multicast_addr[6] = { 0x01, 0x00, 0x5E, 0x00, 0x00, 0x00 }; /* First 3 bytes are meaningful */ static const uint8_t ipv6_multicast_addr[6] = { 0x33, 0x33, 0x00, 0x00, 0x00, 0x00 }; /* First 2 bytes are meaningful */ diff --git a/src/random_numbers.c b/src/random_numbers.c index 111f984..ed734cc 100644 --- a/src/random_numbers.c +++ b/src/random_numbers.c @@ -22,9 +22,6 @@ #include "n2n.h" -// syscall and inquiring random number from hardware generators might fail, so we will retry -#define RND_RETRIES 1000 - /* The following code offers an alterate pseudo random number generator namely XORSHIFT128+ to use instead of C's rand(). Its performance is