X-Git-Url: https://git.harvie.cz/?p=svn%2FPrometheus-QoS%2F.git;a=blobdiff_plain;f=prometheus.c;h=a243c16242c3ad38625232e6110ea0d8e9c7dcd5;hp=313941946142eb2cba45a134ae20ae66c507bff6;hb=3335365b0903d2b1baf7331d17203490cdee65ea;hpb=dccb32271f7c04bfcfa0fd44ffff02a0f1b628de diff --git a/prometheus.c b/prometheus.c index 3139419..a243c16 100644 --- a/prometheus.c +++ b/prometheus.c @@ -7,7 +7,7 @@ /* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* Modified by: xChaos, 20150315 +/* Modified by: xChaos, 20151020 ludva, 20080415 Prometheus QoS is free software; you can redistribute it and/or @@ -29,10 +29,10 @@ #include "cll1-0.6.2.h" #include "ipstruct.h" -const char *version = "0.8.5-c"; +const char *version = "0.8.5-d"; /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -/* Versions: 0.8.3 is development release, 0.8.4 will be "stable" */ +/* Versions: 0.8.5 is development release, 0.8.6 will be "stable" */ /* Official Trac URL: https://dev.arachne.cz/svn/prometheus */ /* Official SVN URL: https://dev.arachne.cz/repos/prometheus */ /* BTC donations account: 19rriLx8vR19wGefPaMhakqnCYNYwjLvxq */ @@ -244,7 +244,6 @@ void get_config(char *config_filename) keyword->ip_count = 0; keyword->leaf_discipline = ""; keyword->allowed_avgmtu = 0; - keyword->download_aggregation = keyword->upload_aggregation = 1; push(keyword, keywords); if(!defaultkeyword) @@ -605,6 +604,8 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); for_each(sharedip, ips) if(eq(sharedip->name, ip->sharing)) { sharedip->traffic += ip->traffic; + sharedip->traffic_down += ip->direct; + sharedip->traffic_up += ip->upload; ip->traffic = 0; ip->mark = sharedip->mark; ip->lmsid = sharedip->lmsid; @@ -1050,24 +1051,25 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); ptr++; if_exists(ip,ips,eq(ip->addr,_)) { - int unshape_this_ip = stop_shaping; - long avg_mbps_down = ip->direct * 8 / how_much_seconds; - long avg_mbps_up = ip->upload * 8 / how_much_seconds; - int min_mbps = ip->min>>10; + int unshape_this_ip; + long avg_mbps_down = ip->traffic_down * 8 / how_much_seconds; + long avg_mbps_up = ip->traffic_up * 8 / how_much_seconds; int agreg = 1, print_stats = 1; - if(min_mbps < 1) - { - min_mbps = 1; - } - if(ip->keyword->download_aggregation) { + int min_mbps = (ip->min/ip->keyword->download_aggregation)>>10; + if(min_mbps < 1) + { + min_mbps = 1; + } + if(min_mbps <= avg_mbps_down) { unshape_this_ip = 0; - agreg = (avg_mbps_down+1)/min_mbps; + agreg = (int)((float)(avg_mbps_down+1)/min_mbps+.5); ip->max /= agreg; + ip->pps_limit /= agreg; printf("Download aggregation 1:%d for %s (min: %lu Mbps avg: %ld Mbps)\n", agreg, ip->name, min_mbps, avg_mbps_down); } else @@ -1077,10 +1079,16 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); } else if(ip->keyword->upload_aggregation) { + int min_mbps = (ip->min/ip->keyword->upload_aggregation)>>10; + if(min_mbps < 1) + { + min_mbps = 1; + } + if(min_mbps <= avg_mbps_up) { unshape_this_ip = 0; - agreg = (avg_mbps_up+1)/min_mbps; + agreg = (int)((float)(avg_mbps_up+1)/min_mbps+.5); ip->max /= agreg; printf("Upload aggregation 1:%d for %s: (min: %lu Mbps avg: %ld Mbps)\n", agreg, ip->name, min_mbps, avg_mbps_up); } @@ -1089,7 +1097,12 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); unshape_this_ip = 1; } } - ip->mark=atoi(ptr); + if(stop_shaping) + { + unshape_this_ip = 1; + } + ip->aggregated = agreg; + ip->mark = atoi(ptr); if(ip->max < ip->desired || unshape_this_ip || reduce_ceil) /* apply or disable FUP limit immediately.... */ { if(unshape_this_ip)