netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] extensions: libip6t_LOG: Avoid to print the default log level in the translation
@ 2016-03-11 19:49 Roberto García
  2016-03-12 11:42 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Roberto García @ 2016-03-11 19:49 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Roberto García

Remove the log level when default is used

Before:
	$ sudo iptables-translate -I INPUT -j LOG
	nft add rule filter INPUT log level warning

After:
	$ sudo iptables-translate -I INPUT -j LOG
	nft add rule filter INPUT counter log
---
 extensions/libip6t_LOG.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/extensions/libip6t_LOG.c b/extensions/libip6t_LOG.c
index 7841e57..3c5075e 100644
--- a/extensions/libip6t_LOG.c
+++ b/extensions/libip6t_LOG.c
@@ -194,7 +194,8 @@ static int LOG_xlate(const void *ip, const struct xt_entry_target *target,
 		xt_xlate_add(xl, "prefix \\\"%s\\\" ", loginfo->prefix);
 
 	for (i = 0; i < ARRAY_SIZE(ip6t_log_xlate_names); ++i)
-		if (loginfo->level == ip6t_log_xlate_names[i].level) {
+		if (loginfo->level == ip6t_log_xlate_names[i].level &&
+		    loginfo->level != LOG_DEFAULT_LEVEL) {
 			xt_xlate_add(xl, "level %s",
 				   ip6t_log_xlate_names[i].name);
 			break;
-- 
2.7.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] extensions: libip6t_LOG: Avoid to print the default log level in the translation
  2016-03-11 19:49 [PATCH] extensions: libip6t_LOG: Avoid to print the default log level in the translation Roberto García
@ 2016-03-12 11:42 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2016-03-12 11:42 UTC (permalink / raw)
  To: Roberto García; +Cc: netfilter-devel

On Fri, Mar 11, 2016 at 08:49:32PM +0100, Roberto García wrote:
> Remove the log level when default is used
> 
> Before:
> 	$ sudo iptables-translate -I INPUT -j LOG
> 	nft add rule filter INPUT log level warning
> 
> After:
> 	$ sudo iptables-translate -I INPUT -j LOG
> 	nft add rule filter INPUT counter log

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-12 11:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-11 19:49 [PATCH] extensions: libip6t_LOG: Avoid to print the default log level in the translation Roberto García
2016-03-12 11:42 ` Pablo Neira Ayuso

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).