* [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
* Re: [PATCH] extensions: libipt_LOG: Avoid to print the default log level in the translation
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
1 sibling, 1 reply; 4+ messages in thread
From: Shivani Bhardwaj @ 2016-03-10 18:32 UTC (permalink / raw)
To: Laura Garcia Liebana
Cc: Netfilter Development Mailing list, Pablo Neira Ayuso,
outreachy-kernel
On Thu, Mar 10, 2016 at 11:45 PM, Laura Garcia Liebana <nevola@gmail.com> wrote:
> 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
>
Looks good. Don't forget to send a patch for libip6t_LOG too.
Same is the case with reject as well. When I did the translations, I
left its default nature intact.
$ sudo ip6tables-translate -A FORWARD -p TCP --dport 22 -j REJECT
nft add rule ip6 filter FORWARD tcp dport 22 counter reject with
icmpv6 type port-unreachable
Pablo, should this be corrected too?
Laura, may be you can send more patches depending on his response.
Thanks.
> 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 [flat|nested] 4+ messages in thread
* Re: [PATCH] extensions: libipt_LOG: Avoid to print the default log level in the translation
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:36 ` Pablo Neira Ayuso
1 sibling, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2016-03-10 18:36 UTC (permalink / raw)
To: Laura Garcia Liebana; +Cc: netfilter-devel, shivanib134, outreachy-kernel
On Thu, Mar 10, 2016 at 07:15:40PM +0100, Laura Garcia Liebana wrote:
> 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
Applied, thanks Laura.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] extensions: libipt_LOG: Avoid to print the default log level in the translation
2016-03-10 18:32 ` Shivani Bhardwaj
@ 2016-03-10 18:37 ` Pablo Neira Ayuso
0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2016-03-10 18:37 UTC (permalink / raw)
To: Shivani Bhardwaj
Cc: Laura Garcia Liebana, Netfilter Development Mailing list,
outreachy-kernel
On Fri, Mar 11, 2016 at 12:02:25AM +0530, Shivani Bhardwaj wrote:
> On Thu, Mar 10, 2016 at 11:45 PM, Laura Garcia Liebana <nevola@gmail.com> wrote:
> > 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
> >
>
> Looks good. Don't forget to send a patch for libip6t_LOG too.
Yes please, send a patch for libip6t_LOG too.
> Same is the case with reject as well. When I did the translations, I
> left its default nature intact.
> $ sudo ip6tables-translate -A FORWARD -p TCP --dport 22 -j REJECT
> nft add rule ip6 filter FORWARD tcp dport 22 counter reject with
> icmpv6 type port-unreachable
>
> Pablo, should this be corrected too?
It would be good to translate this to the more compact syntax, if
possible.
> Laura, may be you can send more patches depending on his response.
Yes please. Thanks for commenting on this Shivani.
^ permalink raw reply [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).