Merge pull request #372 from Logan007/aIp

let auto ip feature handle several sub-networks
This commit is contained in:
Luca Deri
2020-08-23 14:13:05 +02:00
committed by GitHub
7 changed files with 215 additions and 49 deletions
+4 -1
View File
@@ -370,6 +370,7 @@ struct sn_community
he_context_t *header_iv_ctx; /* Header IV ecnryption cipher context, REMOVE as soon as seperate fields for checksum and replay protection available */
struct peer_info *edges; /* Link list of registered edges. */
int64_t number_enc_packets; /* Number of encrypted packets handled so far, required for sorting from time to time */
n2n_ip_subnet_t auto_ip_net; /* Address range of auto ip address service. */
UT_hash_handle hh; /* makes this structure hashable */
};
@@ -390,7 +391,8 @@ typedef struct n2n_sn
uint16_t mport; /* Management UDP port to bind to. */
int sock; /* Main socket for UDP traffic with edges. */
int mgmt_sock; /* management socket. */
n2n_ip_subnet_t dhcp_addr; /* Address range of dhcp service. */
n2n_ip_subnet_t min_auto_ip_net; /* Address range of auto_ip service. */
n2n_ip_subnet_t max_auto_ip_net; /* Address range of auto_ip service. */
#ifndef WIN32
uid_t userid;
gid_t groupid;
@@ -502,6 +504,7 @@ int quick_edge_init(char *device_name, char *community_name,
int sn_init(n2n_sn_t *sss);
void sn_term(n2n_sn_t *sss);
int run_sn_loop(n2n_sn_t *sss, int *keep_running);
int assign_one_ip_subnet(n2n_sn_t *sss, struct sn_community *comm);
const char* compression_str(uint8_t cmpr);
const char* transop_str(enum n2n_transform tr);
+4 -3
View File
@@ -101,9 +101,10 @@
#define TUNTAP_IP_MODE_STATIC 1
#define TUNTAP_IP_MODE_DHCP 2
/* Default network segment of the dhcp service provided by sn. */
#define N2N_SN_DHCP_NET_ADDR_DEFAULT "172.17.12.0"
#define N2N_SN_DHCP_NET_BIT_DEFAULT 24
/* Default network segment of the auto ip address service provided by sn. */
#define N2N_SN_MIN_AUTO_IP_NET_DEFAULT "10.128.0.0"
#define N2N_SN_MAX_AUTO_IP_NET_DEFAULT "10.255.255.0"
#define N2N_SN_AUTO_IP_NET_BIT_DEFAULT 24
/* ************************************** */
+2
View File
@@ -20,6 +20,8 @@ void pearson_hash_256 (uint8_t *out, const uint8_t *in, size_t len);
void pearson_hash_128 (uint8_t *out, const uint8_t *in, size_t len);
uint32_t pearson_hash_32 (const uint8_t *in, size_t len);
uint16_t pearson_hash_16 (const uint8_t *in, size_t len);
void pearson_hash_init();