[Bug 104] New: Bytes/packets counters sometimes give incorrect values

bugzilla-daemon@netfilter.org bugzilla-daemon@netfilter.org
Sun, 22 Jun 2003 14:50:38 +0200


https://bugzilla.netfilter.org/cgi-bin/bugzilla/show_bug.cgi?id=104

           Summary: Bytes/packets counters sometimes give incorrect values
           Product: iptables userspace
           Version: 1.2.8
          Platform: i386
        OS/Version: RedHat Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: iptables
        AssignedTo: laforge@netfilter.org
        ReportedBy: slava@maze.ambernet.kiev.ua
                CC: netfilter-
                    buglog@lists.netfilter.org,slava@maze.ambernet.kiev.ua


If command iptables -x -v -L using intensively, sometimes it is return incorrect
values for packets and bytes counter. It is make near impossible of use some
accounting systems, based at iptables command. In some calls iptables -x -v -L
return zero (or very small) counters, different to real counters value in the
kernel. It's bettr to see in real example:
------------------------------------------------------------------------
Jun 22 04:05:00 | /sbin/iptables -x -n -v -t mangle -L ambernet 2>&1
Jun 22 04:05:00 | pkts      bytes    target  prot opt in     out     source    
          destination
Jun 22 04:05:00 | 610      29096     RETURN  all  --  eth2   *      
213.186.203.0/24     0.0.0.0/0
Jun 22 04:05:00 | 353479   76188196  RETURN  all  --  *      eth2    0.0.0.0/0 
          213.186.203.0/24
Jun 22 04:05:00 | 14536227 8243486735        all  --  eth2   *       0.0.0.0/0 
          0.0.0.0/0          MARK match 0x0/0x1
Jun 22 04:05:00 | 15140086 2453732747        all  --  *      eth2    0.0.0.0/0 
          0.0.0.0/0          MARK match 0x0/0x1
Jun 22 04:05:00 | 12967451 11806213045       all  --  eth2   *       0.0.0.0/0 
          0.0.0.0/0          MARK match 0x1/0x1
Jun 22 04:05:00 | 10890481 2251716032        all  --  *      eth2    0.0.0.0/0 
          0.0.0.0/0          MARK match 0x1/0x1
Jun 22 04:05:00 | 12870179 8004664320        tcp  --  eth2   *       0.0.0.0/0 
          0.0.0.0/0          MARK match 0x0/0x1
Jun 22 04:05:00 | 12921914 2280044549        tcp  --  *      eth2    0.0.0.0/0 
          0.0.0.0/0          MARK match 0x0/0x1


================================================================================================
Jun 22 04:10:00	| /sbin/iptables -x -n -v -t mangle -L ambernet 2>&1
Jun 22 04:10:00	| pkts    bytes target   prot opt in     out     source        
      destination
Jun 22 04:10:00	|  0        0 RETURN     all  --  eth2   *      
213.186.203.0/24     0.0.0.0/0
Jun 22 04:10:00	|  0        0 RETURN     all  --  *      eth2    0.0.0.0/0     
      213.186.203.0/24
Jun 22 04:10:00	|  0        0            all  --  eth2   *       0.0.0.0/0     
      0.0.0.0/0          MARK match 0x0/0x1
Jun 22 04:10:00	|  1       60            all  --  *      eth2    0.0.0.0/0     
      0.0.0.0/0          MARK match 0x0/0x1
Jun 22 04:10:00	|  0        0            all  --  eth2   *       0.0.0.0/0     
      0.0.0.0/0          MARK match 0x1/0x1
Jun 22 04:10:00	|  0        0            all  --  *      eth2    0.0.0.0/0     
      0.0.0.0/0          MARK match 0x1/0x1
Jun 22 04:10:00	|  0        0            tcp  --  eth2   *       0.0.0.0/0     
      0.0.0.0/0          MARK match 0x0/0x1
Jun 22 04:10:00	|  1       60            tcp  --  *      eth2    0.0.0.0/0     
      0.0.0.0/0          MARK match 0x0/0x1


=================================================================================================
Jun 22 04:15:00 | /sbin/iptables -x -n -v -t mangle -L ambernet 2>&1
Jun 22 04:15:00 |  pkts      bytes   target     prot opt in     out     source 
             destination 
Jun 22 04:15:00 |  610     29096     RETURN     all  --  eth2   *      
213.186.203.0/24     0.0.0.0/0
Jun 22 04:15:00 | 353775   76218284  RETURN     all  --  *      eth2   
0.0.0.0/0            213.186.203.0/24
Jun 22 04:15:00 | 14542111 8246504002           all  --  eth2   *      
0.0.0.0/0            0.0.0.0/0          MARK match 0x0/0x1
Jun 22 04:15:00 | 15145668 2454310126           all  --  *      eth2   
0.0.0.0/0            0.0.0.0/0          MARK match 0x0/0x1
Jun 22 04:15:00 | 12970246 11807016897          all  --  eth2   *      
0.0.0.0/0            0.0.0.0/0          MARK match 0x1/0x1
Jun 22 04:15:00 | 10893370 2252029700           all  --  *      eth2   
0.0.0.0/0            0.0.0.0/0          MARK match 0x1/0x1
Jun 22 04:15:00 | 12875483 8007608072           tcp  --  eth2   *      
0.0.0.0/0            0.0.0.0/0          MARK match 0x0/0x1
Jun 22 04:15:00 | 12926610 2280558721           tcp  --  *      eth2   
0.0.0.0/0            0.0.0.0/0          MARK match 0x0/0x1

------------------------------------------------------------------------

You can see at 04:05 real correct values of counters, at 04:10 - counters is
have zero or
very sall values, and at 04:15 all OK again ! Counters is don't lose values -
whey is continue counting of real input packets, but at 04:10 you can see
incorrect values, which
was printed by iptables ! 

This problem more frequency appear then system is highly loaded. It can appear
also in other time, but vith much less frequency. In 04:05 is begin work of
logrotate by cron,
and becouse this trouble is mostly appear in this time. 
v1.2.8
I use kernel 2.4.20 and iptables v1.2.8.
Many instances of iptables is executing together in different threads. But any
iptables command is work with different chain.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.