netfilter-devel.vger.kernel.org archive mirror
 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_mark: Add translation to nft
Date: Sat, 5 Dec 2015 20:14:09 +0100	[thread overview]
Message-ID: <20151205191409.GA2830@salvia> (raw)
In-Reply-To: <1449321576-20705-1-git-send-email-shivanib134@gmail.com>

Hi Shivani,

On Sat, Dec 05, 2015 at 06:49:36PM +0530, Shivani Bhardwaj wrote:
> Add translation of the metainformation mark to nft.
> 
> Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
> ---
>  extensions/libxt_mark.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 60 insertions(+)
> 
> diff --git a/extensions/libxt_mark.c b/extensions/libxt_mark.c
> index 7f8c995..5105bf9 100644
> --- a/extensions/libxt_mark.c
> +++ b/extensions/libxt_mark.c
> @@ -102,6 +102,64 @@ mark_save(const void *ip, const struct xt_entry_match *match)
>  	print_mark(info->mark, info->mask);
>  }
>  
> +static void
> +print_mark_xlate(struct xt_buf *buf,
> +		 unsigned int mark, unsigned int mask)
> +{
> +        if (mask != 0xffffffffU)
> +                xt_buf_add(buf, " 0x%x/0x%x", mark, mask);

In nftables this should be translated to &.

> +        else
> +                xt_buf_add(buf, " 0x%x", mark);
> +}
> +
> +static void
> +mark_mt_xlate_print(const struct xt_entry_match *match,
> +		    struct xt_buf *buf, int numeric)
> +{
> +	const struct xt_mark_mtinfo1 *info = (const void *)match->data;
> +
> +	if (info->invert)      
                         ^^^^^^
There is a tab that is not needed there. Update your editor
configuration to highlight unnecessary spaces before line break,

> +		xt_buf_add(buf, " !");
> +	print_mark_xlate(buf, info->mark, info->mask);
> +}
> +
> +static int
> +mark_mt_xlate(const struct xt_entry_match *match,
> +	      struct xt_buf *buf, int numeric)
> +{
> +	const struct xt_mark_mtinfo1 *info = (const void *)match->data;
> +
> +        xt_buf_add(buf, "ct mark %s", info->invert ? " !" : "");

Invert in nft is '!='.

Please, make sure that the suggested translation actually works in
nft.

But overall this looks good like a good start.

  reply	other threads:[~2015-12-05 19:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-05 13:19 [PATCH] extensions: libxt_mark: Add translation to nft Shivani Bhardwaj
2015-12-05 19:14 ` Pablo Neira Ayuso [this message]
2015-12-05 19:44   ` Shivani Bhardwaj
2015-12-05 23:14   ` Pablo Neira Ayuso
2015-12-06  2:48     ` Shivani Bhardwaj
  -- strict thread matches above, loose matches on Subject: below --
2015-12-23 15:33 [PATCH] extensions: libxt_MARK: " Shivani Bhardwaj
2015-12-23 15:38 ` Shivani Bhardwaj
2015-12-23 18:21   ` Florian Westphal
2015-12-23 16:15 ` Jan Engelhardt
2015-12-23 16:22   ` Shivani Bhardwaj
2015-12-25 12:14 ` Pablo Neira Ayuso

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=20151205191409.GA2830@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 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).