|
@ -302,10 +302,10 @@ static int process_mgmt(n2n_sn_t *sss, |
|
|
|
|
|
|
|
|
traceEvent(TRACE_DEBUG, "process_mgmt"); |
|
|
traceEvent(TRACE_DEBUG, "process_mgmt"); |
|
|
|
|
|
|
|
|
ressize += SAFE_SNPRINTF(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
"----------------\n"); |
|
|
"----------------\n"); |
|
|
|
|
|
|
|
|
ressize += SAFE_SNPRINTF(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
"uptime %lu\n", (now - sss->start_time)); |
|
|
"uptime %lu\n", (now - sss->start_time)); |
|
|
|
|
|
|
|
|
HASH_ITER(hh, sss->communities, community, tmp) |
|
|
HASH_ITER(hh, sss->communities, community, tmp) |
|
@ -313,54 +313,54 @@ static int process_mgmt(n2n_sn_t *sss, |
|
|
num_edges += HASH_COUNT(community->edges); |
|
|
num_edges += HASH_COUNT(community->edges); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ressize += SAFE_SNPRINTF(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
"edges %u\n", |
|
|
"edges %u\n", |
|
|
num_edges); |
|
|
num_edges); |
|
|
|
|
|
|
|
|
ressize += SAFE_SNPRINTF(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
"errors %u\n", |
|
|
"errors %u\n", |
|
|
(unsigned int)sss->stats.errors); |
|
|
(unsigned int)sss->stats.errors); |
|
|
|
|
|
|
|
|
ressize += SAFE_SNPRINTF(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
"reg_sup %u\n", |
|
|
"reg_sup %u\n", |
|
|
(unsigned int)sss->stats.reg_super); |
|
|
(unsigned int)sss->stats.reg_super); |
|
|
|
|
|
|
|
|
ressize += SAFE_SNPRINTF(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
"reg_nak %u\n", |
|
|
"reg_nak %u\n", |
|
|
(unsigned int)sss->stats.reg_super_nak); |
|
|
(unsigned int)sss->stats.reg_super_nak); |
|
|
|
|
|
|
|
|
ressize += SAFE_SNPRINTF(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
"fwd %u\n", |
|
|
"fwd %u\n", |
|
|
(unsigned int)sss->stats.fwd); |
|
|
(unsigned int)sss->stats.fwd); |
|
|
|
|
|
|
|
|
ressize += SAFE_SNPRINTF(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
"broadcast %u\n", |
|
|
"broadcast %u\n", |
|
|
(unsigned int)sss->stats.broadcast); |
|
|
(unsigned int)sss->stats.broadcast); |
|
|
|
|
|
|
|
|
ressize += SAFE_SNPRINTF(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
"last fwd %lu sec ago\n", |
|
|
"last fwd %lu sec ago\n", |
|
|
(long unsigned int)(now - sss->stats.last_fwd)); |
|
|
(long unsigned int)(now - sss->stats.last_fwd)); |
|
|
|
|
|
|
|
|
ressize += SAFE_SNPRINTF(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, |
|
|
"last reg %lu sec ago\n", |
|
|
"last reg %lu sec ago\n", |
|
|
(long unsigned int)(now - sss->stats.last_reg_super)); |
|
|
(long unsigned int)(now - sss->stats.last_reg_super)); |
|
|
|
|
|
|
|
|
ressize += SAFE_SNPRINTF(resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, |
|
|
ressize += snprintf(resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, |
|
|
"cur_cmnts"); |
|
|
"cur_cmnts"); |
|
|
HASH_ITER(hh, sss->communities, community, tmp) { |
|
|
HASH_ITER(hh, sss->communities, community, tmp) { |
|
|
ressize += SAFE_SNPRINTF(resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, |
|
|
ressize += snprintf(resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, |
|
|
" [%s]", |
|
|
" [%s]", |
|
|
community->community); |
|
|
community->community); |
|
|
HASH_ITER(hh, community->edges, peer, tmpPeer) { |
|
|
HASH_ITER(hh, community->edges, peer, tmpPeer) { |
|
|
ressize += SAFE_SNPRINTF(resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, |
|
|
ressize += snprintf(resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, |
|
|
" {%s}", |
|
|
" {%s}", |
|
|
macaddr_str(mac_buf, peer->mac_addr)); |
|
|
macaddr_str(mac_buf, peer->mac_addr)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
ressize += SAFE_SNPRINTF(resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, |
|
|
ressize += snprintf(resbuf+ressize, N2N_SN_PKTBUF_SIZE-ressize, |
|
|
"\n"); |
|
|
"\n"); |
|
|
|
|
|
|
|
|
r = sendto(sss->mgmt_sock, resbuf, MIN(ressize, N2N_SN_PKTBUF_SIZE), 0 /*flags*/, |
|
|
r = sendto(sss->mgmt_sock, resbuf, ressize, 0 /*flags*/, |
|
|
(struct sockaddr *)sender_sock, sizeof(struct sockaddr_in)); |
|
|
(struct sockaddr *)sender_sock, sizeof(struct sockaddr_in)); |
|
|
|
|
|
|
|
|
if (r <= 0) |
|
|
if (r <= 0) |
|
|