diff options
Diffstat (limited to 'ot_stats.c')
| -rw-r--r-- | ot_stats.c | 15 |
1 files changed, 7 insertions, 8 deletions
| @@ -18,13 +18,12 @@ | |||
| 18 | 18 | ||
| 19 | /* Libowfat */ | 19 | /* Libowfat */ |
| 20 | #include "io.h" | 20 | #include "io.h" |
| 21 | #include "ip4.h" | ||
| 22 | #include "ip6.h" | ||
| 23 | 21 | ||
| 24 | /* Opentracker */ | 22 | /* Opentracker */ |
| 25 | #include "ot_accesslist.h" | 23 | #include "ot_accesslist.h" |
| 26 | #include "ot_hex.h" | 24 | #include "ot_hex.h" |
| 27 | #include "ot_iovec.h" | 25 | #include "ot_iovec.h" |
| 26 | #include "ot_ip.h" | ||
| 28 | #include "ot_mutex.h" | 27 | #include "ot_mutex.h" |
| 29 | #include "ot_stats.h" | 28 | #include "ot_stats.h" |
| 30 | #include "trackerlogic.h" | 29 | #include "trackerlogic.h" |
| @@ -206,7 +205,7 @@ static size_t stats_return_busy_networks(char *reply, stats_network_node *tree, | |||
| 206 | if (scores[i - 1]) { | 205 | if (scores[i - 1]) { |
| 207 | r += sprintf(r, "%08zd: ", scores[i - 1]); | 206 | r += sprintf(r, "%08zd: ", scores[i - 1]); |
| 208 | // #ifdef WANT_V6 | 207 | // #ifdef WANT_V6 |
| 209 | r += fmt_ip6c(r, networks[i - 1]); | 208 | r += ip_format(r, networks[i - 1]); |
| 210 | #if 0 | 209 | #if 0 |
| 211 | // XXX | 210 | // XXX |
| 212 | r += fmt_ip4( r, networks[i - 1]); | 211 | r += fmt_ip4( r, networks[i - 1]); |
| @@ -470,7 +469,7 @@ static void stats_return_fulllog(size_t *iovec_entries, struct iovec **iovector, | |||
| 470 | re = r + 32 * OT_STATS_TMPSIZE; | 469 | re = r + 32 * OT_STATS_TMPSIZE; |
| 471 | } | 470 | } |
| 472 | r += sprintf(r, "%08ld: ", loglist->time); | 471 | r += sprintf(r, "%08ld: ", loglist->time); |
| 473 | r += fmt_ip6c(r, loglist->ip); | 472 | r += ip_format(r, loglist->ip); |
| 474 | *r++ = '\n'; | 473 | *r++ = '\n'; |
| 475 | memcpy(r, loglist->data, loglist->size); | 474 | memcpy(r, loglist->data, loglist->size); |
| 476 | r += loglist->size; | 475 | r += loglist->size; |
| @@ -663,7 +662,7 @@ void stats_issue_event(ot_status_event event, PROTO_FLAG proto, uintptr_t event_ | |||
| 663 | *peerid_hex = 0; | 662 | *peerid_hex = 0; |
| 664 | } | 663 | } |
| 665 | 664 | ||
| 666 | ip_readable[fmt_ip6c(ip_readable, (char *)&ws->peer)] = 0; | 665 | ip_readable[ip_format(ip_readable, (char *)&ws->peer)] = 0; |
| 667 | #if 0 | 666 | #if 0 |
| 668 | /* XXX */ | 667 | /* XXX */ |
| 669 | ip_readable[ fmt_ip4( ip_readable, (char*)&ws->peer ) ] = 0; | 668 | ip_readable[ fmt_ip4( ip_readable, (char*)&ws->peer ) ] = 0; |
| @@ -687,7 +686,7 @@ void stats_issue_event(ot_status_event event, PROTO_FLAG proto, uintptr_t event_ | |||
| 687 | ot_ip6 *ip = (ot_ip6 *)event_data; /* ugly hack to transfer ip to stats */ | 686 | ot_ip6 *ip = (ot_ip6 *)event_data; /* ugly hack to transfer ip to stats */ |
| 688 | char _debug[512]; | 687 | char _debug[512]; |
| 689 | int off = snprintf(_debug, sizeof(_debug), "[%08d] scrp: ", (unsigned int)(g_now_seconds - ot_start_time) / 60); | 688 | int off = snprintf(_debug, sizeof(_debug), "[%08d] scrp: ", (unsigned int)(g_now_seconds - ot_start_time) / 60); |
| 690 | off += fmt_ip6c(_debug + off, *ip); | 689 | off += ip_format(_debug + off, *ip); |
| 691 | off += snprintf(_debug + off, sizeof(_debug) - off, " - FULL SCRAPE\n"); | 690 | off += snprintf(_debug + off, sizeof(_debug) - off, " - FULL SCRAPE\n"); |
| 692 | (void)write(2, _debug, off); | 691 | (void)write(2, _debug, off); |
| 693 | ot_full_scrape_request_count++; | 692 | ot_full_scrape_request_count++; |
| @@ -696,7 +695,7 @@ void stats_issue_event(ot_status_event event, PROTO_FLAG proto, uintptr_t event_ | |||
| 696 | ot_ip6 *ip = (ot_ip6 *)event_data; /* ugly hack to transfer ip to stats */ | 695 | ot_ip6 *ip = (ot_ip6 *)event_data; /* ugly hack to transfer ip to stats */ |
| 697 | char _debug[512]; | 696 | char _debug[512]; |
| 698 | int off = snprintf(_debug, sizeof(_debug), "[%08d] scrp: ", (unsigned int)(g_now_seconds - ot_start_time) / 60); | 697 | int off = snprintf(_debug, sizeof(_debug), "[%08d] scrp: ", (unsigned int)(g_now_seconds - ot_start_time) / 60); |
| 699 | off += fmt_ip6c(_debug + off, *ip); | 698 | off += ip_format(_debug + off, *ip); |
| 700 | off += snprintf(_debug + off, sizeof(_debug) - off, " - FULL SCRAPE\n"); | 699 | off += snprintf(_debug + off, sizeof(_debug) - off, " - FULL SCRAPE\n"); |
| 701 | (void)write(2, _debug, off); | 700 | (void)write(2, _debug, off); |
| 702 | ot_full_scrape_request_count++; | 701 | ot_full_scrape_request_count++; |
| @@ -751,7 +750,7 @@ static void *stats_worker(void *args) { | |||
| 751 | return NULL; | 750 | return NULL; |
| 752 | } | 751 | } |
| 753 | 752 | ||
| 754 | void stats_deliver(int64 sock, int tasktype) { mutex_workqueue_pushtask(sock, tasktype); } | 753 | void stats_deliver(int64_t sock, int tasktype) { mutex_workqueue_pushtask(sock, tasktype); } |
| 755 | 754 | ||
| 756 | static pthread_t thread_id; | 755 | static pthread_t thread_id; |
| 757 | void stats_init(void) { | 756 | void stats_init(void) { |
