From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pablo Neira Ayuso Subject: Re: [iptables-compat PATCH] save: fix the printing of the counters Date: Tue, 10 Jun 2014 13:48:53 +0200 Message-ID: <20140610114853.GA11663@localhost> References: <1401781652-3538-1-git-send-email-giuseppelng@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netfilter-devel@vger.kernel.org To: Giuseppe Longo Return-path: Received: from mail.us.es ([193.147.175.20]:47117 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751241AbaFJLs6 (ORCPT ); Tue, 10 Jun 2014 07:48:58 -0400 Content-Disposition: inline In-Reply-To: <1401781652-3538-1-git-send-email-giuseppelng@gmail.com> Sender: netfilter-devel-owner@vger.kernel.org List-ID: On Tue, Jun 03, 2014 at 09:47:32AM +0200, Giuseppe Longo wrote: > This patch prints the counters of a rule before the details, > like iptables-save syntax. The output after your patch: shell# iptables-compat-save -c # Generated by xtables-save v1.4.21 on Tue Jun 10 13:37:11 2014 *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] :test - [0:0] [ 0 : 0 ] -A INPUT -s 1.1.1.1/32 COMMIT # Completed on Tue Jun 10 13:37:11 2014 And the original iptables-save output: shell# iptables-save -c # Generated by iptables-save v1.4.21 on Tue Jun 10 13:33:06 2014 *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] :test - [0:0] [0:0] -A INPUT -s 1.1.1.1/32 COMMIT I think you have to use: +void save_counters(uint64_t pcnt, uint64_t bcnt, unsigned int format) +{ + printf("[%llu:%llu] ", pcnt, bcnt); +} to make it look similar to what we have. The format parameter, I think you don't need it if this is only used for saving. Can you fix you and resend? Thanks.