X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=parseiptables.c;h=b44c7ad133008b5275d3e128449a0ff40d752deb;hb=421c0c00daa7f89134ffdd703f86712a571a42cd;hp=f34e5f976cc6386e93582148dd856b6d64071347;hpb=39a89851f15ae468a2c764454b18248b07da9a30;p=svn%2FPrometheus-QoS%2F.git diff --git a/parseiptables.c b/parseiptables.c index f34e5f9..b44c7ad 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); @@ -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) {