[iptables-nftables PATCH 3/3] nft: Print unknown target data only when relevant

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
---
 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);
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux