]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
nft: Print unknown target data only when relevant
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Wed, 7 Aug 2013 08:31:37 +0000 (11:31 +0300)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 30 Dec 2013 22:50:43 +0000 (23:50 +0100)
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 <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/nft-shared.c

index 4a0317bc9d44f12a962b1d70644c0bff1bf1f627..dd4766b0abb0171b980211557100b4aab56ae993 100644 (file)
@@ -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);