|
@ -379,7 +379,7 @@ int load_allowed_sn_community (n2n_sn_t *sss) { |
|
|
if(comm != NULL) { |
|
|
if(comm != NULL) { |
|
|
comm_init(comm, cmn_str); |
|
|
comm_init(comm, cmn_str); |
|
|
/* loaded from file, this community is unpurgeable */ |
|
|
/* loaded from file, this community is unpurgeable */ |
|
|
comm->purgeable = UNPURGEABLE; |
|
|
comm->purgeable = false; |
|
|
/* we do not know if header encryption is used in this community,
|
|
|
/* we do not know if header encryption is used in this community,
|
|
|
* first packet will show. just in case, setup the key. */ |
|
|
* first packet will show. just in case, setup the key. */ |
|
|
comm->header_encryption = HEADER_ENCRYPTION_UNKNOWN; |
|
|
comm->header_encryption = HEADER_ENCRYPTION_UNKNOWN; |
|
@ -767,7 +767,7 @@ int sn_init_defaults (n2n_sn_t *sss) { |
|
|
sss->federation->community[N2N_COMMUNITY_SIZE - 1] = '\0'; |
|
|
sss->federation->community[N2N_COMMUNITY_SIZE - 1] = '\0'; |
|
|
/* enable the flag for federation */ |
|
|
/* enable the flag for federation */ |
|
|
sss->federation->is_federation = IS_FEDERATION; |
|
|
sss->federation->is_federation = IS_FEDERATION; |
|
|
sss->federation->purgeable = UNPURGEABLE; |
|
|
sss->federation->purgeable = false; |
|
|
/* header encryption enabled by default */ |
|
|
/* header encryption enabled by default */ |
|
|
sss->federation->header_encryption = HEADER_ENCRYPTION_ENABLED; |
|
|
sss->federation->header_encryption = HEADER_ENCRYPTION_ENABLED; |
|
|
/*setup the encryption key */ |
|
|
/*setup the encryption key */ |
|
@ -1075,6 +1075,7 @@ static int update_edge (n2n_sn_t *sss, |
|
|
if(handle_remote_auth(sss, &(reg->auth), answer_auth, comm) == 0) { |
|
|
if(handle_remote_auth(sss, &(reg->auth), answer_auth, comm) == 0) { |
|
|
if(skip_add == SN_ADD) { |
|
|
if(skip_add == SN_ADD) { |
|
|
scan = (struct peer_info *) calloc(1, sizeof(struct peer_info)); /* deallocated in purge_expired_nodes */ |
|
|
scan = (struct peer_info *) calloc(1, sizeof(struct peer_info)); /* deallocated in purge_expired_nodes */ |
|
|
|
|
|
scan->purgeable = true; |
|
|
memcpy(&(scan->mac_addr), reg->edgeMac, sizeof(n2n_mac_t)); |
|
|
memcpy(&(scan->mac_addr), reg->edgeMac, sizeof(n2n_mac_t)); |
|
|
scan->dev_addr.net_addr = reg->dev_addr.net_addr; |
|
|
scan->dev_addr.net_addr = reg->dev_addr.net_addr; |
|
|
scan->dev_addr.net_bitlen = reg->dev_addr.net_bitlen; |
|
|
scan->dev_addr.net_bitlen = reg->dev_addr.net_bitlen; |
|
@ -1446,7 +1447,7 @@ static int purge_expired_communities (n2n_sn_t *sss, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if((comm->edges == NULL) && (comm->purgeable == PURGEABLE)) { |
|
|
if((comm->edges == NULL) && (comm->purgeable == true)) { |
|
|
traceEvent(TRACE_INFO, "purging idle community %s", comm->community); |
|
|
traceEvent(TRACE_INFO, "purging idle community %s", comm->community); |
|
|
if(NULL != comm->header_encryption_ctx_static) { |
|
|
if(NULL != comm->header_encryption_ctx_static) { |
|
|
/* this should not happen as 'purgeable' and thus only communities w/o encrypted header here */ |
|
|
/* this should not happen as 'purgeable' and thus only communities w/o encrypted header here */ |
|
@ -1904,7 +1905,7 @@ static int process_udp (n2n_sn_t * sss, |
|
|
comm->header_encryption_ctx_static = NULL; |
|
|
comm->header_encryption_ctx_static = NULL; |
|
|
comm->header_encryption_ctx_dynamic = NULL; |
|
|
comm->header_encryption_ctx_dynamic = NULL; |
|
|
/* ... and also are purgeable during periodic purge */ |
|
|
/* ... and also are purgeable during periodic purge */ |
|
|
comm->purgeable = PURGEABLE; |
|
|
comm->purgeable = true; |
|
|
comm->number_enc_packets = 0; |
|
|
comm->number_enc_packets = 0; |
|
|
HASH_ADD_STR(sss->communities, community, comm); |
|
|
HASH_ADD_STR(sss->communities, community, comm); |
|
|
|
|
|
|
|
@ -2617,7 +2618,7 @@ int run_sn_loop (n2n_sn_t *sss) { |
|
|
#ifdef WIN32 |
|
|
#ifdef WIN32 |
|
|
traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError()); |
|
|
traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError()); |
|
|
#endif |
|
|
#endif |
|
|
*sss->keep_running = 0; |
|
|
*sss->keep_running = false; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2735,7 +2736,7 @@ int run_sn_loop (n2n_sn_t *sss) { |
|
|
// REVISIT: should we error out if ss_size returns bigger than before? can this ever happen?
|
|
|
// REVISIT: should we error out if ss_size returns bigger than before? can this ever happen?
|
|
|
if(bread <= 0) { |
|
|
if(bread <= 0) { |
|
|
traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno)); |
|
|
traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno)); |
|
|
*sss->keep_running = 0; |
|
|
*sss->keep_running = false; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|