X-Git-Url: http://git.harvie.cz/?p=svn%2FPrometheus-QoS%2F.git;a=blobdiff_plain;f=parseiptables.c;h=eca2ced6221c4af51d98be83b5a9c0adf9376c86;hp=1f22d132226dcfefc637f6ba8cc02b890c81282f;hb=bb5e73853e892f8bce70e03344a81b192c2b84ff;hpb=fd3363912e0be224354fc22547b6b7f9174ee87d diff --git a/parseiptables.c b/parseiptables.c index 1f22d13..eca2ced 100644 --- a/parseiptables.c +++ b/parseiptables.c @@ -1,4 +1,4 @@ -/* Modified by: xChaos, 20130115 */ +/* Modified by: xChaos, 20131208 */ #include "cll1-0.6.2.h" #include "ipstruct.h" @@ -8,7 +8,7 @@ /* globals declared in prometheus.c */ extern struct IP *ips, *ip, *sharedip; extern char *mark; -extern char *proxy_ip; +/* extern char *proxy_ip; */ extern int free_min; extern int free_max; extern int include_upload; @@ -36,12 +36,12 @@ void get_traffic_statistics(const char *whichiptables, int ipv6) for_each(line,lines) { - int col, accept = 0, proxyflag = 0, valid = 1, setchainname = 0, commonflag = 0; + int col, accept = 0, /*proxyflag = 0, */valid = 1, setchainname = 0, commonflag = 0; unsigned long long traffic = 0; unsigned long pkts = 0; char *ipaddr = NULL,*ptr; - valid_columns(ptr, line->str, ' ', col) + valid_columns(ptr, line->str, ' ', col) if(valid) switch(col) { case 1: if(eq(ptr,"Chain")) @@ -98,14 +98,17 @@ void get_traffic_statistics(const char *whichiptables, int ipv6) } else if(!ipv6) { - if(downloadflag) +/* if(downloadflag) { if(strstr(proxy_ip,ptr)) { proxyflag = 1; } - } - else + + } + else + { */ + if(!downloadflag) { ipaddr = ptr; } @@ -131,12 +134,14 @@ void get_traffic_statistics(const char *whichiptables, int ipv6) { printf("(IPv4) "); } - +/* if(proxyflag) { printf("(proxy) "); } - else if(!downloadflag) + else +*/ + if(!downloadflag) { printf("(up) "); } @@ -150,7 +155,7 @@ void get_traffic_statistics(const char *whichiptables, int ipv6) if_exists(ip, ips, eqi(ip->addr,ipaddr)); else { - TheIP(ipaddr); + TheIP(ipaddr, FALSE); if(eq(ip->addr,"0.0.0.0/0")) { ip->name = "(unregistered)"; @@ -165,30 +170,31 @@ void get_traffic_statistics(const char *whichiptables, int ipv6) if(downloadflag) { +/* if(proxyflag) { ip->proxy = traffic; } else - { - ip->traffic += traffic; - } - ip->direct = ip->traffic-ip->upload-ip->proxy; - ip->pktsdown = pkts; + {*/ + ip->traffic += traffic; +/* } */ + ip->direct += traffic; /*-ip->proxy;*/ + ip->pktsdown += pkts; } else { - ip->upload = traffic; - ip->pktsup = pkts; + ip->upload += traffic; + ip->pktsup += pkts; if(include_upload) { ip->traffic += traffic; } else { - if(traffic > ip->traffic) + if(ip->upload > ip->traffic) { - ip->traffic = traffic; + ip->traffic = ip->upload; } } }