[Patch] Re: Line numbering broken since bb34082d

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On fre, 2008-06-13 at 11:14 +0200, Jan Engelhardt wrote:

> `iptables -nvL --lin`, starting with bb34082de, gives a wrong count:
> 
> Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
> num   pkts bytes target     prot opt in     out     source               
> destination         
> 2        0     0 LOG        all  --  *      *       0.0.0.0/0            
> 0.0.0.0/0           LOG flags 0 level 4 

Sorry about that. Never tested --line-numbers.

I think the best fix is to drop the +1 from print_firewall(). Patch attached.

Regards
Henrik
Index: iptables.c
===================================================================
--- iptables.c	(revision 7543)
+++ iptables.c	(working copy)
@@ -737,7 +737,7 @@
 	flags = fw->ip.flags;
 
 	if (format & FMT_LINENUMBERS)
-		printf(FMT("%-4u ", "%u "), num+1);
+		printf(FMT("%-4u ", "%u "), num);
 
 	if (!(format & FMT_NOCOUNTS)) {
 		print_num(fw->counters.pcnt, format);
Index: ip6tables.c
===================================================================
--- ip6tables.c	(revision 7543)
+++ ip6tables.c	(working copy)
@@ -737,7 +737,7 @@
 	flags = fw->ipv6.flags;
 
 	if (format & FMT_LINENUMBERS)
-		printf(FMT("%-4u ", "%u "), num+1);
+		printf(FMT("%-4u ", "%u "), num);
 
 	if (!(format & FMT_NOCOUNTS)) {
 		print_num(fw->counters.pcnt, format);

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux