|
|
@ -202,6 +202,19 @@ static int try_broadcast(n2n_sn_t * sss, |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
/** Initialise some fields of the community structure **/ |
|
|
|
int comm_init(struct sn_community *comm, char *cmn){ |
|
|
|
|
|
|
|
comm = (struct sn_community*)malloc(sizeof(struct sn_community)); |
|
|
|
memset(comm, 0, sizeof(struct sn_community)); |
|
|
|
|
|
|
|
strncpy((char*)comm->community, cmn, N2N_COMMUNITY_SIZE-1); |
|
|
|
comm->community[N2N_COMMUNITY_SIZE-1] = '\0'; |
|
|
|
comm->is_federation = IS_NO_FEDERATION; |
|
|
|
|
|
|
|
return 0; /* OK */ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** Initialise the supernode structure */ |
|
|
|
int sn_init(n2n_sn_t *sss) { |
|
|
@ -969,11 +982,10 @@ static int process_udp(n2n_sn_t * sss, |
|
|
|
} |
|
|
|
|
|
|
|
if(!comm && (!sss->lock_communities || (match == 1))) { |
|
|
|
comm = calloc(1, sizeof(struct sn_community)); |
|
|
|
|
|
|
|
comm_init(comm,(char *)cmn.community); |
|
|
|
|
|
|
|
if(comm) { |
|
|
|
strncpy(comm->community, (char*)cmn.community, N2N_COMMUNITY_SIZE-1); |
|
|
|
comm->community[N2N_COMMUNITY_SIZE-1] = '\0'; |
|
|
|
/* new communities introduced by REGISTERs could not have had encrypted header... */ |
|
|
|
comm->header_encryption = HEADER_ENCRYPTION_NONE; |
|
|
|
comm->header_encryption_ctx = NULL; |
|
|
|