* [iptables PATCH] libxt_recent: Remove ineffective checks for info->name
@ 2017-10-20 11:24 Phil Sutter
2017-10-20 11:54 ` Florian Westphal
0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2017-10-20 11:24 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
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>
---
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:
--
2.13.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-20 11:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-20 11:24 [iptables PATCH] libxt_recent: Remove ineffective checks for info->name Phil Sutter
2017-10-20 11:54 ` Florian Westphal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).