netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] extensions: libipt_LOG: Avoid to print the default log level in the translation
@ 2016-03-10 18:15 Laura Garcia Liebana
  2016-03-10 18:32 ` Shivani Bhardwaj
  2016-03-10 18:36 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 4+ messages in thread
From: Laura Garcia Liebana @ 2016-03-10 18:15 UTC (permalink / raw)
  To: netfilter-devel; +Cc: shivanib134, pablo, outreachy-kernel

Avoid to print the log level in the translation when the level is the
default value.

Example:

$ sudo iptables-translate -t filter -A INPUT -m icmp ! --icmp-type 10 -j LOG
nft add rule ip filter INPUT icmp type != router-solicitation counter log

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
---
 extensions/libipt_LOG.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/extensions/libipt_LOG.c b/extensions/libipt_LOG.c
index f3875b6..216b1ca 100644
--- a/extensions/libipt_LOG.c
+++ b/extensions/libipt_LOG.c
@@ -194,7 +194,8 @@ static int LOG_xlate(const struct xt_entry_target *target,
 		xt_xlate_add(xl, "prefix \\\"%s\\\" ", loginfo->prefix);
 
 	for (i = 0; i < ARRAY_SIZE(ipt_log_xlate_names); ++i)
-		if (loginfo->level == ipt_log_xlate_names[i].level) {
+		if (loginfo->level != LOG_DEFAULT_LEVEL &&
+		    loginfo->level == ipt_log_xlate_names[i].level) {
 			xt_xlate_add(xl, "level %s ",
 				   ipt_log_xlate_names[i].name);
 			break;
-- 
2.7.0


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

end of thread, other threads:[~2016-03-10 18:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-10 18:15 [PATCH] extensions: libipt_LOG: Avoid to print the default log level in the translation Laura Garcia Liebana
2016-03-10 18:32 ` Shivani Bhardwaj
2016-03-10 18:37   ` Pablo Neira Ayuso
2016-03-10 18:36 ` 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).