From patchwork Fri Oct 20 11:24:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Sutter X-Patchwork-Id: 828558 X-Patchwork-Delegate: fw@strlen.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yJNk96vrcz9t5q for ; Fri, 20 Oct 2017 22:24:49 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752817AbdJTLYs (ORCPT ); Fri, 20 Oct 2017 07:24:48 -0400 Received: from orbyte.nwl.cc ([151.80.46.58]:52678 "EHLO orbyte.nwl.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752172AbdJTLYs (ORCPT ); Fri, 20 Oct 2017 07:24:48 -0400 Received: from localhost ([::1]:47220 helo=xsao) by orbyte.nwl.cc with esmtp (Exim 4.89) (envelope-from ) id 1e5VPy-0000VL-EV; Fri, 20 Oct 2017 13:24:46 +0200 From: Phil Sutter To: Pablo Neira Ayuso Cc: netfilter-devel@vger.kernel.org Subject: [iptables PATCH] libxt_recent: Remove ineffective checks for info->name Date: Fri, 20 Oct 2017 13:24:36 +0200 Message-Id: <20171020112436.17679-1-phil@nwl.cc> X-Mailer: git-send-email 2.13.1 Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org In struct xt_recent_mtinfo{,_v1}, field 'name' is an array, not a pointer. So there is no point in comparing it against NULL. Changing the check to make sure it's content is not an empty string is pointless either, since a non-empty default string is used and the argument parser will refuse empty strings as --name argument. So simply get rid of the checks altogether. Signed-off-by: Phil Sutter --- extensions/libxt_recent.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/libxt_recent.c b/extensions/libxt_recent.c index e1801f1c18952..055ae35080346 100644 --- a/extensions/libxt_recent.c +++ b/extensions/libxt_recent.c @@ -199,7 +199,7 @@ static void recent_print(const void *ip, const struct xt_entry_match *match, if(info->hit_count) printf(" hit_count: %d", info->hit_count); if (info->check_set & XT_RECENT_TTL) printf(" TTL-Match"); - if(info->name) printf(" name: %s", info->name); + printf(" name: %s", info->name); if (info->side == XT_RECENT_SOURCE) printf(" side: source"); if (info->side == XT_RECENT_DEST) @@ -239,7 +239,7 @@ static void recent_save(const void *ip, const struct xt_entry_match *match, if(info->hit_count) printf(" --hitcount %d", info->hit_count); if (info->check_set & XT_RECENT_TTL) printf(" --rttl"); - if(info->name) printf(" --name %s",info->name); + printf(" --name %s",info->name); switch(family) { case NFPROTO_IPV4: