From c2237b8a65286bff65d5bd81e48cb88fb7d2562e Mon Sep 17 00:00:00 2001 From: xchaos Date: Thu, 24 Jan 2013 16:46:22 +0000 Subject: [PATCH] should be completely fixed now git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@219 251d49ef-1d17-4917-a970-b30cf55b089b --- htmlandlogs.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/htmlandlogs.c b/htmlandlogs.c index 0443c7b..291871e 100644 --- a/htmlandlogs.c +++ b/htmlandlogs.c @@ -327,28 +327,27 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview) limit_count, prio_count); if(ip6prefix) - { - + { for_each(ip, ips) { if(ip->v6) { - bytes6 += ip->traffic; - pkts6 += ip->pktsdown+ip->pktsup; + bytes6 += ip->upload + ip->direct; + pkts6 += ip->pktsdown + ip->pktsup; count6++; } else { - bytes4 += ip->traffic; - pkts4 += ip->pktsdown+ip->pktsup; + bytes4 += ip->upload + ip->direct; + pkts4 += ip->pktsdown + ip->pktsup; count4++; } } - perc6=(double)(100*bytes6)/(bytes4+bytes6); + perc6=(double)(bytes6)/(bytes4+bytes6)*100; fputs("

\n",f); fprintf(f, "%s\n", - tr_odd_even(), count4, bytes4, (double)(100*bytes4)/(bytes4+bytes6), pkts4, (float)(100*pkts4)/(pkts4+pkts6)); + tr_odd_even(), count4, bytes4, (double)(bytes4)/(bytes4+bytes6)*100, pkts4, (float)(100*pkts4)/(pkts4+pkts6)); fprintf(f, "%s\n", tr_odd_even(), count6, bytes6, perc6, pkts6, (float)(100*pkts6)/(pkts4+pkts6)); fputs("
IP protocols usage
Total %d IPv4 (addreses)%Lu MB (%.2f %%)%Lu packets (%.2f %%)
Total %d IPv6 (/64 ranges)%Lu MB (%.2f %%)%Lu packets (%.2f %%)

\n", f); -- 2.30.2