X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=parseiptables.c;h=5a2043f714f55025d92cc300b937f830baee59f8;hb=139fc8a0a7c49580783fb3c4b8050761e8bf021a;hp=f34e5f976cc6386e93582148dd856b6d64071347;hpb=39a89851f15ae468a2c764454b18248b07da9a30;p=svn%2FPrometheus-QoS%2F.git diff --git a/parseiptables.c b/parseiptables.c index f34e5f9..5a2043f 100644 --- a/parseiptables.c +++ b/parseiptables.c @@ -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); @@ -78,6 +81,10 @@ void get_traffic_statistics(const char *whichiptables, int ipv6) else { sscanf(ptr,"%Lu",&traffic); + if(traffic) + { + traffic_detected = 1; + } traffic += (1<<19); traffic >>= 20; } @@ -98,7 +105,6 @@ void get_traffic_statistics(const char *whichiptables, int ipv6) } else if(!ipv6) { - /* if(downloadflag) { if(strstr(proxy_ip,ptr)) @@ -108,8 +114,7 @@ void get_traffic_statistics(const char *whichiptables, int ipv6) } else - { -*/ + { */ if(!downloadflag) { ipaddr = ptr; @@ -179,14 +184,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) {