|
@ -72,7 +72,7 @@ static int process_udp(n2n_sn_t *sss, |
|
|
size_t udp_size, |
|
|
size_t udp_size, |
|
|
time_t now); |
|
|
time_t now); |
|
|
|
|
|
|
|
|
static const n2n_mac_t null_mac = {0, 0, 0, 0, 0, 0}; |
|
|
static const n2n_mac_t null_mac = {0, 0, 0, 0, 0, 0}; /* 00:00:00:00:00:00 */ |
|
|
|
|
|
|
|
|
/* ************************************** */ |
|
|
/* ************************************** */ |
|
|
|
|
|
|
|
@ -669,6 +669,7 @@ static int process_mgmt(n2n_sn_t *sss, |
|
|
" id tun_tap MAC edge hint last_seen\n"); |
|
|
" id tun_tap MAC edge hint last_seen\n"); |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
"-------------------------------------------------------------------------------------------------\n"); |
|
|
"-------------------------------------------------------------------------------------------------\n"); |
|
|
|
|
|
|
|
|
HASH_ITER(hh, sss->communities, community, tmp) { |
|
|
HASH_ITER(hh, sss->communities, community, tmp) { |
|
|
num_edges += HASH_COUNT(community->edges); |
|
|
num_edges += HASH_COUNT(community->edges); |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
@ -691,7 +692,7 @@ static int process_mgmt(n2n_sn_t *sss, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
"---------------------------------------------------------------------------------\n"); |
|
|
"--------------------------------------------------------------------------------------------------\n"); |
|
|
|
|
|
|
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
"uptime %lu | ", (now - sss->start_time)); |
|
|
"uptime %lu | ", (now - sss->start_time)); |
|
@ -773,7 +774,6 @@ static int process_udp(n2n_sn_t * sss, |
|
|
char buf[32]; |
|
|
char buf[32]; |
|
|
struct sn_community *comm, *tmp; |
|
|
struct sn_community *comm, *tmp; |
|
|
uint64_t stamp; |
|
|
uint64_t stamp; |
|
|
const n2n_mac_t null_mac = {0, 0, 0, 0, 0, 0}; /* 00:00:00:00:00:00 */ |
|
|
|
|
|
|
|
|
|
|
|
traceEvent(TRACE_DEBUG, "Processing incoming UDP packet [len: %lu][sender: %s:%u]", |
|
|
traceEvent(TRACE_DEBUG, "Processing incoming UDP packet [len: %lu][sender: %s:%u]", |
|
|
udp_size, intoa(ntohl(sender_sock->sin_addr.s_addr), buf, sizeof(buf)), |
|
|
udp_size, intoa(ntohl(sender_sock->sin_addr.s_addr), buf, sizeof(buf)), |
|
@ -1194,19 +1194,20 @@ static int process_udp(n2n_sn_t * sss, |
|
|
n2n_REGISTER_SUPER_ACK_t ack; |
|
|
n2n_REGISTER_SUPER_ACK_t ack; |
|
|
size_t encx=0; |
|
|
size_t encx=0; |
|
|
struct sn_community *fed; |
|
|
struct sn_community *fed; |
|
|
struct peer_info *scan, *tmp; |
|
|
struct peer_info *scan, *tmp_peer; |
|
|
n2n_sock_str_t sockbuf1; |
|
|
n2n_sock_str_t sockbuf1; |
|
|
n2n_sock_str_t sockbuf2; |
|
|
n2n_sock_str_t sockbuf2; |
|
|
macstr_t mac_buf1; |
|
|
macstr_t mac_buf1; |
|
|
n2n_sock_t sender; |
|
|
n2n_sock_t sender; |
|
|
n2n_sock_t *orig_sender; |
|
|
n2n_sock_t *orig_sender; |
|
|
n2n_sock_t *tmp_sock; |
|
|
n2n_sock_t *tmp_sock; |
|
|
n2n_mac_t *tmp_mac; |
|
|
n2n_mac_t *tmp_mac; |
|
|
int i; |
|
|
int i; |
|
|
uint8_t dec_tmpbuf[MAX_AVAILABLE_SPACE_FOR_ENTRIES]; |
|
|
uint8_t dec_tmpbuf[MAX_AVAILABLE_SPACE_FOR_ENTRIES]; |
|
|
int skip_add; |
|
|
int skip_add; |
|
|
|
|
|
|
|
|
memset(&sender, 0, sizeof(n2n_sock_t)); |
|
|
memset(&sender, 0, sizeof(n2n_sock_t)); |
|
|
|
|
|
|
|
|
sender.family = AF_INET; |
|
|
sender.family = AF_INET; |
|
|
sender.port = ntohs(sender_sock->sin_port); |
|
|
sender.port = ntohs(sender_sock->sin_port); |
|
|
memcpy(&(sender.addr.v4), &(sender_sock->sin_addr.s_addr), IPV4_SIZE); |
|
|
memcpy(&(sender.addr.v4), &(sender_sock->sin_addr.s_addr), IPV4_SIZE); |
|
@ -1256,11 +1257,11 @@ static int process_udp(n2n_sn_t * sss, |
|
|
tmp_mac = (void*)dec_tmpbuf + sizeof(n2n_sock_t); |
|
|
tmp_mac = (void*)dec_tmpbuf + sizeof(n2n_sock_t); |
|
|
|
|
|
|
|
|
for(i=0; i<ack.num_sn; i++) { |
|
|
for(i=0; i<ack.num_sn; i++) { |
|
|
skip_add = NO_SKIP; |
|
|
skip_add = NO_SKIP; |
|
|
tmp = add_sn_to_list_by_mac_or_sock(&(sss->federation->edges), tmp_sock, tmp_mac, &skip_add); |
|
|
tmp_peer = add_sn_to_list_by_mac_or_sock(&(sss->federation->edges), tmp_sock, tmp_mac, &skip_add); |
|
|
|
|
|
|
|
|
if(skip_add == ADDED) { |
|
|
if(skip_add == ADDED) { |
|
|
tmp->last_seen = now - TEST_TIME; |
|
|
tmp_peer->last_seen = now - TEST_TIME; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* REVISIT: find a more elegant expression to increase following pointers. */ |
|
|
/* REVISIT: find a more elegant expression to increase following pointers. */ |
|
|