X-Git-Url: https://git.harvie.cz/?p=svn%2FPrometheus-QoS%2F.git;a=blobdiff_plain;f=htmlandlogs.c;h=f16580adbb597adf97499255bc9280316255ce89;hp=c0d564894684a645e37372c6b44ab3c93e850797;hb=ca6f7e80f4ce05259df01ec965beb7a4907b8540;hpb=fd3363912e0be224354fc22547b6b7f9174ee87d
diff --git a/htmlandlogs.c b/htmlandlogs.c
index c0d5648..f16580a 100644
--- a/htmlandlogs.c
+++ b/htmlandlogs.c
@@ -20,6 +20,7 @@ extern char *log_url;
extern int found_lmsid;
extern char *lms_url;
extern char *log_dir;
+extern char *ip6prefix;
const char *tr_odd_even(void);
/* implemented in prometheus.c, shared with parselogs.c */
@@ -89,8 +90,8 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
for_each(keyword, keywords) if(keyword->ip_count)
{
- fprintf(f,"
%d MB | ",
- keyword->html_color, group->min*keyword->data_limit);
+ fprintf(f, "%d MB | ",
+ keyword->html_color, group->min*keyword->data_limit);
}
i += group->desired;
total += group->count;
@@ -172,15 +173,15 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
i++;
if(ip->max < ip->desired)
- {
- f1 = "";
+ {
+ f1 = "";
f2 = "";
limit_count++;
- }
- else if(ip->prio > highest_priority+1)
- {
- f1 = "";
- f2 = "";
+ }
+ else if(ip->prio > highest_priority+1)
+ {
+ f1 = "";
+ f2 = "";
prio_count++;
}
@@ -193,23 +194,28 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
if(use_jquery_popups)
{
- fprintf(f,"",i);
+ fprintf(f, "",i);
popup_button=0;
+
for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && !sharedip->v6) /* IPv4 only */
{
- fprintf(f,"
%s\n", log_url, sharedip->name, sharedip->name);
+ fprintf(f, "
%s\n",
+ log_url, sharedip->name, sharedip->name);
popup_button++;
}
+
for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && sharedip->v6) /* IPv6 only */
{
- fprintf(f,"
%s/64\n", log_url, sharedip->addr, sharedip->addr);
+ fprintf(f, "
%s/64\n",
+ log_url, sharedip->addr, sharedip->addr);
popup_button++;
}
+
fputs("\n",f);
if(popup_button)
{
- fprintf(f,"[+%d]",
- i, i, i, popup_button);
+ fprintf(f, "[+%d]",
+ i, i, i, popup_button);
}
}
fputs("\n",f);
@@ -237,7 +243,7 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
fprintf(f,"%Lu", ip->direct);
if(use_jquery_popups)
{
- fprintf(f,"",i);
+ fprintf(f,"", i);
for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && !sharedip->v6) /* IPv4 only */
{
fprintf(f," %Lu", sharedip->direct);
@@ -259,7 +265,7 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
fprintf(f," | %Lu", ip->upload);
if(use_jquery_popups)
{
- fprintf(f,"",i);
+ fprintf(f,"", i);
for_each(sharedip,ips) if(eq(ip->name, sharedip->sharing) && !sharedip->v6) /* IPv4 only */
{
fprintf(f," %Lu", sharedip->upload);
@@ -314,6 +320,31 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview)
fprintf(f," | %Lu | ", total_upload);
fprintf(f,"LIMIT %dx LOW-PRIO %dx | \n\n",limit_count,prio_count);
+ if(ip6prefix)
+ {
+ unsigned long long pkts4 =0, pkts6 = 0, bytes4 = 0, bytes6 = 0;
+ for_each(ip, ips)
+ {
+ if(ip->v6)
+ {
+ bytes6 += ip->traffic;
+ pkts6 += ip->pktsdown+ip->pktsup;
+ }
+ else
+ {
+ bytes4 += ip->traffic;
+ pkts4 += ip->pktsdown+ip->pktsup;
+ }
+ }
+
+ fputs("IP protocols usage\n",f);
+ fprintf(f, "%sTotal IPv4 | %Lu MB (%.2f %%) | %Lu packets (%d %%) | \n",
+ tr_odd_even(), bytes4, (float)(100*bytes4)/(bytes4+bytes6), pkts4, (float)(100*pkts4)/(pkts4+pkts6));
+ fprintf(f, "%sTotal IPv6 | %Lu MB (%.2f %%) | %Lu packets (%d %%) | \n",
+ tr_odd_even(), bytes6, (float)(100*bytes6)/(bytes4+bytes6), pkts6, (float)(100*pkts6)/(pkts4+pkts6));
+ fputs("
\n", f);
+ }
+
row_odd_even = 0;
if(active_classes>10)
{