All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Shivani Bhardwaj <shivanib134@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] extensions: libxt_NFLOG: Add translation to nft
Date: Tue, 22 Dec 2015 17:43:58 +0100	[thread overview]
Message-ID: <20151222164358.GA18134@salvia> (raw)
In-Reply-To: <20151221173559.GA8787@gmail.com>

On Mon, Dec 21, 2015 at 11:05:59PM +0530, Shivani Bhardwaj wrote:
> Add translation for NF Logging to nftables.
> 
> Examples:
> 
> $ sudo iptables-translate -A OUTPUT -j NFLOG --nflog-group 30
> nft add rule ip filter OUTPUT counter log group 30
> 
> $ sudo iptables-translate -A FORWARD -j NFLOG --nflog-group 32 --nflog-prefix "Prefix 1.0"
> nft add rule ip filter FORWARD counter log prefix \"Prefix 1.0\" log group 32
> 
> $ sudo iptables-translate -I INPUT -j NFLOG --nflog-range 256
> nft insert rule ip filter INPUT counter log snaplen 256
> 
> $ sudo iptables-translate -I INPUT -j NFLOG --nflog-threshold 25
> nft insert rule ip filter INPUT counter log queue-threshold 25

Applied with changes.

> Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
> ---
>  extensions/libxt_NFLOG.c | 28 +++++++++++++++++++++++++++-
>  1 file changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/extensions/libxt_NFLOG.c b/extensions/libxt_NFLOG.c
> index 448576a..3d05ce0 100644
> --- a/extensions/libxt_NFLOG.c
> +++ b/extensions/libxt_NFLOG.c
> @@ -72,7 +72,7 @@ static void nflog_print(const struct xt_nflog_info *info, char *prefix)
>  }
>  
>  static void NFLOG_print(const void *ip, const struct xt_entry_target *target,
> -                        int numeric)
> +			int numeric)
>  {
>  	const struct xt_nflog_info *info = (struct xt_nflog_info *)target->data;
>  
> @@ -86,6 +86,31 @@ static void NFLOG_save(const void *ip, const struct xt_entry_target *target)
>  	nflog_print(info, "--");
>  }
>  
> +static void nflog_print_xlate(const struct xt_nflog_info *info,
> +			      char *prefix, struct xt_buf *buf)
> +{
> +	if (info->prefix[0] != '\0')
> +		xt_buf_add(buf, "%slog prefix \\\"%s\\\" ",
> +			   prefix, info->prefix);
> +	if (info->group)
> +		xt_buf_add(buf, "%slog group %u ", prefix, info->group);
> +	if (info->len)
> +		xt_buf_add(buf, "%slog snaplen %u ", prefix, info->len);
> +	if (info->threshold != XT_NFLOG_DEFAULT_THRESHOLD)
> +		xt_buf_add(buf, "%slog queue-threshold %u ",
> +			   prefix, info->threshold);
> +}
> +
> +static int NFLOG_xlate(const struct xt_entry_target *target,
> +		       struct xt_buf *buf, int numeric)
> +{
> +	const struct xt_nflog_info *info = (struct xt_nflog_info *)target->data;
> +
> +	nflog_print_xlate(info, "", buf);
                                ^^

This is always "", so we can get rid of this extra parameter.

I have fixed this here, no need to send v2.

Thanks.

      parent reply	other threads:[~2015-12-22 16:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-21 17:35 [PATCH] extensions: libxt_NFLOG: Add translation to nft Shivani Bhardwaj
2015-12-22 12:40 ` Arturo Borrero Gonzalez
2015-12-22 12:47 ` Arturo Borrero Gonzalez
2015-12-22 17:01   ` Pablo Neira Ayuso
2015-12-22 16:43 ` Pablo Neira Ayuso [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151222164358.GA18134@salvia \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=shivanib134@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.