Browse Source

fixed supernode's federation behavior (auth error) (#707)

pull/708/head
Logan oos Even 3 years ago
committed by GitHub
parent
commit
aac58a88ec
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      src/sn_utils.c

15
src/sn_utils.c

@ -1641,6 +1641,7 @@ static int process_udp (n2n_sn_t * sss,
if(comm->is_federation == IS_FEDERATION) { if(comm->is_federation == IS_FEDERATION) {
skip_add = SN_ADD; skip_add = SN_ADD;
p = add_sn_to_list_by_mac_or_sock(&(sss->federation->edges), &(ack.sock), reg.edgeMac, &skip_add); p = add_sn_to_list_by_mac_or_sock(&(sss->federation->edges), &(ack.sock), reg.edgeMac, &skip_add);
p->last_seen = now;
// communication with other supernodes happens via standard udp port // communication with other supernodes happens via standard udp port
p->socket_fd = sss->sock; p->socket_fd = sss->sock;
} }
@ -1676,11 +1677,13 @@ static int process_udp (n2n_sn_t * sss,
sock_to_cstr(sockbuf, &(ack.sock))); sock_to_cstr(sockbuf, &(ack.sock)));
ret_value = update_edge_no_change; ret_value = update_edge_no_change;
if(cmn.flags & N2N_FLAGS_SOCKET) { if(comm->is_federation != IS_FEDERATION) { /* REVISIT: auth among supernodes is not implemented yet */
ret_value = update_edge(sss, &reg, comm, &(ack.sock), socket_fd, &(ack.auth), SN_ADD_SKIP, now); if(cmn.flags & N2N_FLAGS_SOCKET) {
} else { ret_value = update_edge(sss, &reg, comm, &(ack.sock), socket_fd, &(ack.auth), SN_ADD_SKIP, now);
// do not add in case of null mac (edge asking for ip address) } else {
ret_value = update_edge(sss, &reg, comm, &(ack.sock), socket_fd, &(ack.auth), is_null_mac(reg.edgeMac) ? SN_ADD_SKIP : SN_ADD, now); // do not add in case of null mac (edge asking for ip address)
ret_value = update_edge(sss, &reg, comm, &(ack.sock), socket_fd, &(ack.auth), is_null_mac(reg.edgeMac) ? SN_ADD_SKIP : SN_ADD, now);
}
} }
if(ret_value == update_edge_auth_fail) { if(ret_value == update_edge_auth_fail) {
@ -2287,8 +2290,6 @@ int run_sn_loop (n2n_sn_t *sss, int *keep_running) {
// reset, await new prepended length // reset, await new prepended length
conn->expected = sizeof(uint16_t); conn->expected = sizeof(uint16_t);
conn->position = 0; conn->position = 0;
} }
} }
} }

Loading…
Cancel
Save