nifty hack - showing ip address instead of hostname for unregistered data transfers
[svn/Prometheus-QoS/.git] / prometheus.c
index e068b8ef5f9011a1ad913611fdbca9ea7569a752..9f22205729c76c6c7f7498d88ad12e0fe7d1a116 100644 (file)
@@ -2,12 +2,12 @@
  /*     Prometheus QoS - you can "steal fire" from your ISP     */\r
 /*      "fair-per-IP" quality of service (QoS) utility          */\r
 /*      requires Linux 2.4.x or 2.6.x with HTB support          */\r
-/*      Copyright(C) 2005-2012 Michael Polak, Arachne Labs      */\r
+/*      Copyright(C) 2005-2013 Michael Polak, Arachne Labs      */\r
 /*    iptables-restore support Copyright(C) 2007-2008 ludva     */\r
 /*  Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf  */\r
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */\r
 \r
-/* Modified by: xChaos, 20121011\r
+/* Modified by: xChaos, 20130107\r
                  ludva, 20080415\r
  \r
    Prometheus QoS is free software; you can redistribute it and/or\r
@@ -232,7 +232,10 @@ void get_config(char *config_filename)
    keyword->leaf_discipline="";\r
 \r
    push(keyword,keywords);\r
-   if(!defaultkeyword) defaultkeyword=keyword;\r
+   if(!defaultkeyword)\r
+   {\r
+    defaultkeyword=keyword;\r
+   }\r
    keywordcount++;\r
    \r
    kwd=NULL;\r
@@ -463,12 +466,16 @@ void get_traffic_statistics(void)
      else \r
      {\r
       TheIP();\r
-      ip->addr=ipaddr;\r
+      ip->addr = ipaddr;\r
       if(eq(ip->addr,"0.0.0.0/0"))\r
       {\r
-       ip->name="(unregistered)";\r
-       ip->min=free_min;\r
-       ip->max=ip->desired=free_max;\r
+       ip->name = "(unregistered)";\r
+       ip->min = free_min;\r
+       ip->max = ip->desired=free_max;\r
+      }\r
+      else\r
+      {\r
+       ip->name = ipaddr;\r
       }\r
      }\r
      \r
@@ -980,13 +987,14 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
     \r
     for_each(ip, ips) if(ip->min == group->min && ip->max > ip->min)\r
     {\r
-     if(    ip->keyword->data_limit && !ip->fixedprio \r
-         && (   ip->traffic>ip->credit\r
-              + (ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20))) )\r
+     ip->realquota=ip->credit+(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20));\r
+     if(     ip->keyword->data_limit \r
+         and not ip->fixedprio \r
+         and ip->traffic > ip->realquota )\r
      {\r
-      if(group_rate<ip->max)\r
+      if(group_rate < ip->max)\r
       {\r
-       ip->max=group_rate;\r
+       ip->max = group_rate;\r
       }\r
       group_rate+=magic_treshold;\r
       ip->prio=lowest_priority;\r
@@ -1085,7 +1093,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
  /*-----------------------------------------------------------------*/\r
  printf("Writing statistics into HTML page %s ...\n", html);\r
  /*-----------------------------------------------------------------*/\r
- write_htmlandlogs(json_traffic,d,total, just_preview);\r
+ write_htmlandlogs(html, d,total, just_preview);\r
 \r
  if(just_preview)\r
  {\r
This page took 0.114235 seconds and 4 git commands to generate.