Fix segfault in issue #463 (#464)

This commit is contained in:
Francesco Carli 2020-10-19 09:45:00 +02:00 committed by GitHub
parent ed25ff8d01
commit 0c3fdc4df3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1068,11 +1068,6 @@ static int process_udp(n2n_sn_t * sss,
n2n_sock_t *tmp_sock; n2n_sock_t *tmp_sock;
n2n_mac_t *tmp_mac; n2n_mac_t *tmp_mac;
if(from_supernode != comm->is_federation) {
traceEvent(TRACE_DEBUG, "process_udp dropped REGISTER_SUPER: from_supernode value doesn't correspond to the internal federation marking");
return -1;
}
memset(&ack, 0, sizeof(n2n_REGISTER_SUPER_ACK_t)); memset(&ack, 0, sizeof(n2n_REGISTER_SUPER_ACK_t));
/* Edge/supernode requesting registration with us. */ /* Edge/supernode requesting registration with us. */
@ -1154,6 +1149,11 @@ static int process_udp(n2n_sn_t * sss,
ack.sock.port = ntohs(sender_sock->sin_port); ack.sock.port = ntohs(sender_sock->sin_port);
memcpy(ack.sock.addr.v4, &(sender_sock->sin_addr.s_addr), IPV4_SIZE); memcpy(ack.sock.addr.v4, &(sender_sock->sin_addr.s_addr), IPV4_SIZE);
if(from_supernode != comm->is_federation) {
traceEvent(TRACE_DEBUG, "process_udp dropped REGISTER_SUPER: from_supernode value doesn't correspond to the internal federation marking");
return -1;
}
/* Add sender's data to federation (or update it) */ /* Add sender's data to federation (or update it) */
if(comm->is_federation == IS_FEDERATION) { if(comm->is_federation == IS_FEDERATION) {
p = add_sn_to_federation_by_mac_or_sock(sss,&(ack.sock),&(reg.edgeMac)); p = add_sn_to_federation_by_mac_or_sock(sss,&(ack.sock),&(reg.edgeMac));