X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=parseiptables.c;h=cfd1add8018f5c711974c435df0b078e45bb11a0;hb=7d05bfc0742ea64ad5b1b5511a0c89a8da0badcc;hp=1f22d132226dcfefc637f6ba8cc02b890c81282f;hpb=fd3363912e0be224354fc22547b6b7f9174ee87d;p=svn%2FPrometheus-QoS%2F.git diff --git a/parseiptables.c b/parseiptables.c index 1f22d13..cfd1add 100644 --- a/parseiptables.c +++ b/parseiptables.c @@ -1,4 +1,4 @@ -/* Modified by: xChaos, 20130115 */ +/* Modified by: xChaos, 20131029 */ #include "cll1-0.6.2.h" #include "ipstruct.h" @@ -41,7 +41,7 @@ void get_traffic_statistics(const char *whichiptables, int ipv6) 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")) @@ -150,7 +150,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)"; @@ -173,22 +173,22 @@ void get_traffic_statistics(const char *whichiptables, int ipv6) { ip->traffic += traffic; } - ip->direct = ip->traffic-ip->upload-ip->proxy; - ip->pktsdown = pkts; + ip->direct += ip->traffic-ip->upload-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; } } }