From patchwork Wed Aug 7 08:31:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Bursztyka X-Patchwork-Id: 265400 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id CAB512C0222 for ; Wed, 7 Aug 2013 18:31:56 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756045Ab3HGIbz (ORCPT ); Wed, 7 Aug 2013 04:31:55 -0400 Received: from mga09.intel.com ([134.134.136.24]:36647 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756486Ab3HGIby (ORCPT ); Wed, 7 Aug 2013 04:31:54 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 07 Aug 2013 01:29:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,831,1367996400"; d="scan'208";a="358865463" Received: from unknown (HELO rd-180.ger.corp.intel.com) ([10.252.122.228]) by orsmga001.jf.intel.com with ESMTP; 07 Aug 2013 01:31:49 -0700 From: Tomasz Bursztyka To: netfilter-devel@vger.kernel.org Cc: Tomasz Bursztyka Subject: [iptables-nftables PATCH 3/3] nft: Print unknown target data only when relevant Date: Wed, 7 Aug 2013 11:31:37 +0300 Message-Id: <1375864297-9347-4-git-send-email-tomasz.bursztyka@linux.intel.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1375864297-9347-1-git-send-email-tomasz.bursztyka@linux.intel.com> References: <1375864297-9347-1-git-send-email-tomasz.bursztyka@linux.intel.com> Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Bug is: xtables -N test xtables -A FORWARD -j test xtables -L Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination test all -- anywhere anywhere [0 bytes of unknown target data] Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain test (1 references) target prot opt source destination "[0 bytes of unknown target data]" should not be printed in this case. Signed-off-by: Tomasz Bursztyka --- iptables/nft-shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iptables/nft-shared.c b/iptables/nft-shared.c index ad3e675..f5f905f 100644 --- a/iptables/nft-shared.c +++ b/iptables/nft-shared.c @@ -549,7 +549,7 @@ int print_target(const char *targname, const void *targinfo, if (target->print) /* FIXME missing first parameter */ target->print(NULL, t, format & FMT_NUMERIC); - } else + } else if (target_len > 0) printf("[%ld bytes of unknown target data] ", target_len); free(t);