bugfix - no data were logged if no IPV6 traffic detected, by mistake
[svn/Prometheus-QoS/.git] / parseiptables.c
index cad83642137ca3e86e8c266452b1120f5d634bc3..db984fa923035a878541da78ac597c17f2f11ff4 100644 (file)
@@ -1,4 +1,4 @@
-/* Modified by: xChaos, 20131029 */\r
+/* Modified by: xChaos, 20131208 */\r
 \r
 #include "cll1-0.6.2.h"\r
 #include "ipstruct.h"\r
@@ -13,12 +13,14 @@ extern int free_min;
 extern int free_max;\r
 extern int include_upload;\r
 \r
+int traffic_detected = 0;\r
+\r
 /* ===================== traffic analyser - uses iptables  ================ */ \r
 \r
 void get_traffic_statistics(const char *whichiptables, int ipv6)\r
 {\r
  char *str,*cmd;\r
- int downloadflag=0;\r
+ int downloadflag = 0;\r
 \r
  textfile(Pipe,str) *line,*lines=NULL;\r
  string(str,STRLEN);\r
@@ -98,7 +100,6 @@ void get_traffic_statistics(const char *whichiptables, int ipv6)
            }\r
            else if(!ipv6)\r
            {\r
-\r
 /*          if(downloadflag)\r
             { \r
              if(strstr(proxy_ip,ptr))\r
@@ -108,8 +109,7 @@ void get_traffic_statistics(const char *whichiptables, int ipv6)
 \r
             } \r
             else \r
-            { \r
-*/\r
+            {  */\r
             if(!downloadflag)\r
             {\r
              ipaddr = ptr;\r
@@ -152,6 +152,7 @@ void get_traffic_statistics(const char *whichiptables, int ipv6)
     printf("(down) ");\r
    }\r
    \r
+   traffic_detected = 1;\r
    printf("%s %Lu MB (%ld pkts)\n", ipaddr, traffic, pkts);\r
 \r
    if_exists(ip, ips, eqi(ip->addr,ipaddr)); \r
@@ -179,14 +180,16 @@ void get_traffic_statistics(const char *whichiptables, int ipv6)
     }\r
     else\r
     {*/\r
-     ip->traffic += traffic;\r
+    ip->traffic += traffic;\r
+    ip->traffic_down += traffic;\r
 /*    } */\r
-/*    ip->direct += ip->traffic-ip->upload; /*-ip->proxy;*/\r
+    ip->direct += traffic; /*-ip->proxy;*/\r
     ip->pktsdown += pkts;\r
    }\r
    else\r
    {\r
     ip->upload += traffic;\r
+    ip->traffic_up += traffic;\r
     ip->pktsup += pkts;\r
     if(include_upload)\r
     {\r
This page took 0.152822 seconds and 4 git commands to generate.