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 v3] extensions: libxt_connmark: Add translation to nft
Date: Fri, 25 Dec 2015 13:13:52 +0100	[thread overview]
Message-ID: <20151225121352.GA4822@salvia> (raw)
In-Reply-To: <20151223143333.GA16694@gmail.com>

On Wed, Dec 23, 2015 at 08:03:33PM +0530, Shivani Bhardwaj wrote:
>  static struct xtables_match connmark_mt_reg[] = {
>  	{
>  		.family        = NFPROTO_UNSPEC,
> @@ -135,6 +178,7 @@ static struct xtables_match connmark_mt_reg[] = {
>  		.save          = connmark_save,
>  		.x6_parse      = connmark_parse,
>  		.x6_options    = connmark_mt_opts,
> +		.xlate	       = connmark_xlate,
>  	},
>  	{
>  		.version       = XTABLES_VERSION,
> @@ -148,6 +192,7 @@ static struct xtables_match connmark_mt_reg[] = {
>  		.save          = connmark_mt_save,
>  		.x6_parse      = connmark_mt_parse,
>  		.x6_options    = connmark_mt_opts,
> +		.xlate	       = connmark_mt_xlate,

Careful.

The different revisions use different structure definitions, ie. the
structure binary layout is different, therefore you cannot reuse the
same connmark_mt_xlate() for the two different revision.

Let me make sure I clarify this, this is revision 0:

struct xt_connmark_info {
        unsigned long mark, mask;
        uint8_t invert;
};

This is revision 1:

struct xt_connmark_mtinfo1 {
        __u32 mark, mask;
        __u8 invert;
};

The size of unsigned long depends on the architecture, so this code
will not work correctly.

You have to add a connmark_mt_xlate_v0() and connmark_mt_xlate_v1(),
in each of these functions you have to cast data to the right
structure layout.

Thanks.

  reply	other threads:[~2015-12-25 12:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-23 14:33 [PATCH v3] extensions: libxt_connmark: Add translation to nft Shivani Bhardwaj
2015-12-25 12:13 ` Pablo Neira Ayuso [this message]
2015-12-25 14:39   ` Shivani Bhardwaj
2015-12-28 12:00     ` Pablo Neira Ayuso
  -- strict thread matches above, loose matches on Subject: below --
2015-12-22 21:06 Shivani Bhardwaj

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=20151225121352.GA4822@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).