extern int found_lmsid;\r
extern char *lms_url;\r
extern char *log_dir;\r
+extern char *ip6prefix;\r
\r
const char *tr_odd_even(void);\r
/* implemented in prometheus.c, shared with parselogs.c */\r
\r
for_each(keyword, keywords) if(keyword->ip_count)\r
{\r
- fprintf(f,"<td style=\"text-align: right\"><span style=\"color:#%s\">%d MB</span></td>",\r
- keyword->html_color, group->min*keyword->data_limit);\r
+ fprintf(f, "<td style=\"text-align: right\"><span style=\"color:#%s\">%d MB</span></td>",\r
+ keyword->html_color, group->min*keyword->data_limit);\r
} \r
i += group->desired; \r
total += group->count;\r
i++;\r
\r
if(ip->max < ip->desired) \r
- { \r
- f1 = "<span style=\"color:red\">"; \r
+ {\r
+ f1 = "<span style=\"color:red\">";\r
f2 = "</span>"; \r
limit_count++; \r
- } \r
- else if(ip->prio > highest_priority+1) \r
- { \r
- f1 = "<span style=\"color:brown\">"; \r
- f2 = "</span>"; \r
+ }\r
+ else if(ip->prio > highest_priority+1)\r
+ {\r
+ f1 = "<span style=\"color:brown\">";\r
+ f2 = "</span>";\r
prio_count++; \r
} \r
\r
\r
if(use_jquery_popups)\r
{\r
- fprintf(f,"<span id=\"sharing_%d\" style=\"display:none\">",i);\r
+ fprintf(f, "<span id=\"sharing_%d\" style=\"display:none\">",i);\r
popup_button=0;\r
+\r
for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && !sharedip->v6) /* IPv4 only */\r
{\r
- fprintf(f,"<br /><a class=\"blue\" target=\"_blank\" href=\"%s%s.log\">%s</a>\n", log_url, sharedip->name, sharedip->name);\r
+ fprintf(f, "<br /><a class=\"blue\" target=\"_blank\" href=\"%s%s.log\">%s</a>\n", \r
+ log_url, sharedip->name, sharedip->name);\r
popup_button++;\r
}\r
+\r
for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && sharedip->v6) /* IPv6 only */\r
{\r
- fprintf(f,"<br /><a class=\"blue\" target=\"_blank\" href=\"%s%s.log\">%s/64</a>\n", log_url, sharedip->addr, sharedip->addr);\r
+ fprintf(f, "<br /><a class=\"blue\" target=\"_blank\" href=\"%s%s.log\">%s/64</a>\n", \r
+ log_url, sharedip->addr, sharedip->addr);\r
popup_button++;\r
}\r
+\r
fputs("</span>\n",f);\r
if(popup_button)\r
{\r
- fprintf(f,"<span>[<a class=\"blue\" href=\"#\" onClick=\"$(this).parent().hide();$(\'#sharing_%d\').show();$(\'#download_%d\').show();$(\'#upload_%d\').show();return(false);\" style=\"cursor: pointer;\">+%d</a>]</span>",\r
- i, i, i, popup_button);\r
+ fprintf(f, "<span>[<a class=\"blue\" href=\"#\" onClick=\"$(this).parent().hide();$(\'#sharing_%d\').show();$(\'#download_%d\').show();$(\'#upload_%d\').show();return(false);\" style=\"cursor: pointer;\">+%d</a>]</span>",\r
+ i, i, i, popup_button);\r
}\r
}\r
fputs("</td>\n",f);\r
fprintf(f,"</td><td style=\"text-align: right\">%Lu", ip->direct);\r
if(use_jquery_popups)\r
{\r
- fprintf(f,"<span id=\"download_%d\" style=\"display:none\">",i);\r
+ fprintf(f,"<span id=\"download_%d\" style=\"display:none\">", i);\r
for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing) && !sharedip->v6) /* IPv4 only */\r
{\r
fprintf(f,"<br />%Lu", sharedip->direct);\r
fprintf(f,"<td style=\"text-align: right\">%Lu", ip->upload);\r
if(use_jquery_popups)\r
{\r
- fprintf(f,"<span id=\"upload_%d\" style=\"display:none\">",i);\r
+ fprintf(f,"<span id=\"upload_%d\" style=\"display:none\">", i);\r
for_each(sharedip,ips) if(eq(ip->name, sharedip->sharing) && !sharedip->v6) /* IPv4 only */\r
{\r
fprintf(f,"<br />%Lu", sharedip->upload);\r
fprintf(f,"<th style=\"text-align: right\">%Lu</th>", total_upload);\r
fprintf(f,"<th colspan=\"4\"><span style=\"color:red\">LIMIT %dx</span> <span style=\"color:brown\">LOW-PRIO %dx</span></th></tr>\n</thead></table>\n",limit_count,prio_count);\r
\r
+ if(ip6prefix)\r
+ {\r
+ unsigned long long pkts4 =0, pkts6 = 0, bytes4 = 0, bytes6 = 0;\r
+ for_each(ip, ips)\r
+ { \r
+ if(ip->v6)\r
+ {\r
+ bytes6 += ip->traffic;\r
+ pkts6 += ip->pktsdown+ip->pktsup;\r
+ }\r
+ else\r
+ {\r
+ bytes4 += ip->traffic;\r
+ pkts4 += ip->pktsdown+ip->pktsup;\r
+ }\r
+ }\r
+\r
+ fputs("<p><table class=\"decorated last\"><caption>IP protocols usage</caption>\n",f);\r
+ fprintf(f, "%s<td>Total IPv4</td><td style=\"text-align: right\">%Lu MB (%.2f %%)</td><td style=\"text-align: right\">%Lu packets (%d %%)</td></tr>\n",\r
+ tr_odd_even(), bytes4, (float)(100*bytes4)/(bytes4+bytes6), pkts4, (float)(100*pkts4)/(pkts4+pkts6));\r
+ fprintf(f, "%s<td>Total IPv6</td><td style=\"text-align: right\">%Lu MB (%.2f %%)</td><td style=\"text-align: right\">%Lu packets (%d %%)</td></tr>\n",\r
+ tr_odd_even(), bytes6, (float)(100*bytes6)/(bytes4+bytes6), pkts6, (float)(100*pkts6)/(pkts4+pkts6));\r
+ fputs("</table>\n", f);\r
+ }\r
+\r
row_odd_even = 0;\r
if(active_classes>10)\r
{\r