X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;ds=sidebyside;f=prometheus.c;h=094008789cd56e3029e1e57641805463d2fb09bd;hb=3bf40f9b7d9850a43a3a53374dac3cde20adf587;hp=e068b8ef5f9011a1ad913611fdbca9ea7569a752;hpb=9a56ab25128074e581fa5f69bac8afa2fb939c82;p=svn%2FPrometheus-QoS%2F.git
diff --git a/prometheus.c b/prometheus.c
index e068b8e..0940087 100644
--- a/prometheus.c
+++ b/prometheus.c
@@ -2,12 +2,12 @@
/* Prometheus QoS - you can "steal fire" from your ISP */
/* "fair-per-IP" quality of service (QoS) utility */
/* requires Linux 2.4.x or 2.6.x with HTB support */
-/* Copyright(C) 2005-2012 Michael Polak, Arachne Labs */
+/* Copyright(C) 2005-2013 Michael Polak, Arachne Labs */
/* iptables-restore support Copyright(C) 2007-2008 ludva */
/* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-/* Modified by: xChaos, 20121011
+/* Modified by: xChaos, 20130107
ludva, 20080415
Prometheus QoS is free software; you can redistribute it and/or
@@ -39,7 +39,7 @@ const char *version = "0.8.3-g";
/* C source code development versions ("beta"): 0.7.9-a, 0.8.1-b, etc. */
/* C source code release versions: 0.8.0, 0.8.2, 0.8.4, etc. */
-const char *stats_html_signature = "Statistics generated by Prometheus QoS version %s
GPL+Copyright(C)2005-2012 Michael Polak, Arachne Labs\n";
+const char *stats_html_signature = "Statistics generated by Prometheus QoS version %s
GPL+Copyright(C)2005-2013 Michael Polak, Arachne Labs\n";
/* ======= Help screen is hopefuly self-documenting part of code :-) ======= */
@@ -232,7 +232,10 @@ void get_config(char *config_filename)
keyword->leaf_discipline="";
push(keyword,keywords);
- if(!defaultkeyword) defaultkeyword=keyword;
+ if(!defaultkeyword)
+ {
+ defaultkeyword=keyword;
+ }
keywordcount++;
kwd=NULL;
@@ -463,12 +466,16 @@ void get_traffic_statistics(void)
else
{
TheIP();
- ip->addr=ipaddr;
+ ip->addr = ipaddr;
if(eq(ip->addr,"0.0.0.0/0"))
{
- ip->name="(unregistered)";
- ip->min=free_min;
- ip->max=ip->desired=free_max;
+ ip->name = "(unregistered)";
+ ip->min = free_min;
+ ip->max = ip->desired=free_max;
+ }
+ else
+ {
+ ip->name = ipaddr;
}
}
@@ -980,13 +987,14 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
for_each(ip, ips) if(ip->min == group->min && ip->max > ip->min)
{
- if( ip->keyword->data_limit && !ip->fixedprio
- && ( ip->traffic>ip->credit
- + (ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20))) )
+ ip->realquota=ip->credit+(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20));
+ if( ip->keyword->data_limit
+ and not ip->fixedprio
+ and ip->traffic > ip->realquota )
{
- if(group_ratemax)
+ if(group_rate < ip->max)
{
- ip->max=group_rate;
+ ip->max = group_rate;
}
group_rate+=magic_treshold;
ip->prio=lowest_priority;
@@ -1085,7 +1093,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
/*-----------------------------------------------------------------*/
printf("Writing statistics into HTML page %s ...\n", html);
/*-----------------------------------------------------------------*/
- write_htmlandlogs(json_traffic,d,total, just_preview);
+ write_htmlandlogs(html, d,total, just_preview);
if(just_preview)
{