int active_classes = 0;\r
// int colspan = 14;\r
struct Sum {unsigned long long l; int i; list(Sum);} *sum,*sums = NULL;\r
- int limit_count = 0, prio_count = 0;\r
+ int agreg_count = 0, limit_count = 0, prio_count = 0;\r
int popup_button = 0;\r
/* IPv6 vs. IPv4 stats */\r
unsigned long long pkts4 =0, pkts6 = 0, bytes4 = 0, bytes6 = 0;\r
char *f1="", *f2="";\r
i++;\r
\r
- if(ip->max < ip->desired) \r
+ if(ip->aggregated > 1)\r
+ {\r
+ f1 = "<span style=\"color:green\">";\r
+ f2 = "</span>"; \r
+ agreg_count++;\r
+ }\r
+ else if(ip->max < ip->desired) \r
{\r
f1 = "<span style=\"color:red\">";\r
f2 = "</span>"; \r
*/\r
fprintf(f, "<th style=\"text-align: right\">%Lu</th><th style=\"text-align: right\">%d</th>",\r
total_direct, total_pktdown/i);\r
- fprintf(f, "<th colspan=\"6\"><span style=\"color:red\">LIMIT %dx</span> \\r
-<span style=\"color:brown\">LOW-PRIO %dx</span></th></tr>\n</thead></table>\n",\r
- limit_count, prio_count);\r
+ fprintf(f, "<th colspan=\"6\">\\r
+<span style=\"color:green\">AGR %dx</span> \\r
+<span style=\"color:red\">FUP %dx</span> \\r
+<span style=\"color:brown\">PRIO %dx</span></th></tr>\n</thead></table>\n",\r
+ agreg_count, limit_count, prio_count);\r
\r
if(ip6prefix)\r
{ \r
int max;\r
int mark;\r
int prio;\r
+ int aggregated;\r
int fixedprio;\r
int group;\r
int lmsid;\r
int pps_limit;\r
unsigned long long direct;\r
unsigned long long proxy;\r
+ unsigned long long traffic_down;\r
+ unsigned long long traffic_up;\r
unsigned long long upload;\r
unsigned long long traffic;\r
unsigned long long credit;\r
void TheIP(char *ipaddr, int is_network)\r
{\r
create(ip,IP);\r
- ip->name = "";\r
- ip->addr = ipaddr;\r
- ip->sharing = NULL;\r
- ip->prio = highest_priority+1;\r
- ip->lmsid = -1;\r
- ip->fixedprio = \\r
- ip->mark = \\r
- ip->min = \\r
- ip->max = \\r
- ip->desired = \\r
- ip->credit = \\r
- ip->upload = \\r
- ip->proxy = \\r
- ip->direct = \\r
- ip->traffic = \\r
- ip->pktsup = \\r
- ip->pps_limit = \\r
- ip->pktsdown = 0;\r
- ip->keyword = keywords;\r
- ip->v6 = (strchr(ip->addr,':')!=NULL);\r
- ip->mask = ((ip->v6)?64:32);\r
+ ip->name = "";\r
+ ip->addr = ipaddr;\r
+ ip->sharing = NULL;\r
+ ip->prio = highest_priority+1;\r
+ ip->lmsid = -1;\r
+ ip->fixedprio = \\r
+ ip->aggregated = \\r
+ ip->mark = \\r
+ ip->min = \\r
+ ip->max = \\r
+ ip->desired = \\r
+ ip->credit = \\r
+ ip->upload = \\r
+ ip->proxy = \\r
+ ip->direct = \\r
+ ip->traffic = \\r
+ ip->traffic_down = \\r
+ ip->traffic_up = \\r
+ ip->pktsup = \\r
+ ip->pps_limit = \\r
+ ip->pktsdown = 0;\r
+ ip->keyword = keywords;\r
+ ip->v6 = (strchr(ip->addr,':')!=NULL);\r
+ ip->mask = ((ip->v6)?64:32);\r
if(is_network)\r
{\r
push(ip, networks);\r
else\r
{*/\r
ip->traffic += traffic;\r
+ ip->traffic_down += traffic;\r
/* } */\r
ip->direct += traffic; /*-ip->proxy;*/\r
ip->pktsdown += pkts;\r
else\r
{\r
ip->upload += traffic;\r
+ ip->traffic_up += traffic;\r
ip->pktsup += pkts;\r
if(include_upload)\r
{\r
/* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf */\r
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\r
\r
-/* Modified by: xChaos, 20150315\r
+/* Modified by: xChaos, 20150331\r
ludva, 20080415\r
\r
Prometheus QoS is free software; you can redistribute it and/or\r
for_each(sharedip, ips) if(eq(sharedip->name, ip->sharing))\r
{\r
sharedip->traffic += ip->traffic;\r
+ sharedip->traffic_down += ip->direct;\r
+ sharedip->traffic_up += ip->upload;\r
ip->traffic = 0;\r
ip->mark = sharedip->mark; \r
ip->lmsid = sharedip->lmsid;\r
if_exists(ip,ips,eq(ip->addr,_))\r
{\r
int unshape_this_ip = stop_shaping;\r
- long avg_mbps_down = ip->direct * 8 / how_much_seconds;\r
- long avg_mbps_up = ip->upload * 8 / how_much_seconds;\r
+ long avg_mbps_down = ip->traffic_down * 8 / how_much_seconds; \r
+ long avg_mbps_up = ip->traffic_up * 8 / how_much_seconds;\r
int min_mbps = ip->min>>10;\r
int agreg = 1, print_stats = 1;\r
\r
if(min_mbps <= avg_mbps_down)\r
{\r
unshape_this_ip = 0;\r
- agreg = (avg_mbps_down+1)/min_mbps;\r
+ agreg = (int)((float)(avg_mbps_down+1)/min_mbps+.5);\r
ip->max /= agreg;\r
printf("Download aggregation 1:%d for %s (min: %lu Mbps avg: %ld Mbps)\n", agreg, ip->name, min_mbps, avg_mbps_down);\r
}\r
if(min_mbps <= avg_mbps_up)\r
{\r
unshape_this_ip = 0;\r
- agreg = (avg_mbps_up+1)/min_mbps;\r
+ agreg = (int)((float)(avg_mbps_up+1)/min_mbps+.5);\r
ip->max /= agreg;\r
printf("Upload aggregation 1:%d for %s: (min: %lu Mbps avg: %ld Mbps)\n", agreg, ip->name, min_mbps, avg_mbps_up);\r
}\r
unshape_this_ip = 1;\r
}\r
}\r
- ip->mark=atoi(ptr);\r
+ ip->aggregated = agreg; \r
+ ip->mark = atoi(ptr);\r
if(ip->max < ip->desired || unshape_this_ip || reduce_ceil) /* apply or disable FUP limit immediately.... */\r
{\r
if(unshape_this_ip)\r