X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=parseiptables.c;h=b44c7ad133008b5275d3e128449a0ff40d752deb;hb=c5a58cd49c2e0be45739384880a1a172d79e2756;hp=cad83642137ca3e86e8c266452b1120f5d634bc3;hpb=7ae5a5939e4328ed4a1d8c025ea6769265574260;p=svn%2FPrometheus-QoS%2F.git diff --git a/parseiptables.c b/parseiptables.c index cad8364..b44c7ad 100644 --- a/parseiptables.c +++ b/parseiptables.c @@ -1,4 +1,4 @@ -/* Modified by: xChaos, 20131029 */ +/* Modified by: xChaos, 20131208 */ #include "cll1-0.6.2.h" #include "ipstruct.h" @@ -13,12 +13,15 @@ extern int free_min; extern int free_max; extern int include_upload; +int traffic_detected = 0; + /* ===================== traffic analyser - uses iptables ================ */ void get_traffic_statistics(const char *whichiptables, int ipv6) { char *str,*cmd; - int downloadflag=0; + int downloadflag = 0; + traffic_detected = 0; textfile(Pipe,str) *line,*lines=NULL; string(str,STRLEN); @@ -98,7 +101,6 @@ void get_traffic_statistics(const char *whichiptables, int ipv6) } else if(!ipv6) { - /* if(downloadflag) { if(strstr(proxy_ip,ptr)) @@ -108,8 +110,7 @@ void get_traffic_statistics(const char *whichiptables, int ipv6) } else - { -*/ + { */ if(!downloadflag) { ipaddr = ptr; @@ -152,6 +153,7 @@ void get_traffic_statistics(const char *whichiptables, int ipv6) printf("(down) "); } + traffic_detected = 1; printf("%s %Lu MB (%ld pkts)\n", ipaddr, traffic, pkts); if_exists(ip, ips, eqi(ip->addr,ipaddr)); @@ -179,14 +181,16 @@ void get_traffic_statistics(const char *whichiptables, int ipv6) } else {*/ - ip->traffic += traffic; + ip->traffic += traffic; + ip->traffic_down += traffic; /* } */ -/* ip->direct += ip->traffic-ip->upload; /*-ip->proxy;*/ + ip->direct += traffic; /*-ip->proxy;*/ ip->pktsdown += pkts; } else { ip->upload += traffic; + ip->traffic_up += traffic; ip->pktsup += pkts; if(include_upload) {