]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libxt_recent: Remove ineffective checks for info->name
authorPhil Sutter <phil@nwl.cc>
Fri, 20 Oct 2017 11:24:36 +0000 (13:24 +0200)
committerFlorian Westphal <fw@strlen.de>
Fri, 20 Oct 2017 11:52:40 +0000 (13:52 +0200)
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 <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
extensions/libxt_recent.c

index e1801f1c18952fc3894fda0deb05378f89f4b2bd..055ae3508034684a321b051a6866c13122118543 100644 (file)
@@ -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: