All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft 2/3] netlink_delinearize: fix listing of set members in host byteorder using integer_type
Date: Tue, 9 Dec 2014 15:19:22 +0100	[thread overview]
Message-ID: <20141209141922.GA3721@salvia> (raw)
In-Reply-To: <20141209075320.GA15583@acer.localdomain>

On Tue, Dec 09, 2014 at 07:53:21AM +0000, Patrick McHardy wrote:
> On 08.12, Pablo Neira Ayuso wrote:
> >  nft list table filter
> >  ...
> >         cpu { 50331648, 33554432, 0, 16777216} counter packets 8 bytes 344
> 
> I'm certain this used to work for mark values, so I'm wondering
> what broke it. We might have a more fundamental bug somewhere.

mark values don't use the integer_type, they use mark_type which has
an specific byteorder. So they work fine.

The problem is integer_type, it has no specific byteorder. Actually,
it is left unset so it is BYTEORDER_INVALID, which is handled when
importing/exporting as BYTEORDER_BIG_ENDIAN.

Solutions that I can see are:

1) Add specific integer_types, ie. be_integer_type (subtype of
   integer) that uses BYTEORDER_BIG_ENDIAN so the datatype tells us
   the endianness, but this doesn't seem convenient:
   http://marc.info/?l=netfilter-devel&m=141806352422510&w=2

2) From the postprocess step as you suggested. In this case, if we see
   an integer_type, we use the left-hand side expr->byteorder. Note that
   integer_type is also used in several header fields (where this
   should be a big endian integer). That case currently works because
   BYTEORDER_INVALID defaults on BYTEORDER_BIG_ENDIAN when
   importing/exporting. This new integer_postprocess() function should
   be also called. This is what this patch does.

Let me know, thanks.

  reply	other threads:[~2014-12-09 14:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-08 22:24 [PATCH nft 1/3] src: generate set members using integer_type in the appropriate byteorder Pablo Neira Ayuso
2014-12-08 22:24 ` [PATCH nft 2/3] netlink_delinearize: fix listing of set members in host byteorder using integer_type Pablo Neira Ayuso
2014-12-09  7:53   ` Patrick McHardy
2014-12-09 14:19     ` Pablo Neira Ayuso [this message]
2014-12-09 14:25       ` Patrick McHardy
2014-12-08 22:24 ` [PATCH nft 3/3] netlink: fix listing of range set elements in host byteorder 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=20141209141922.GA3721@salvia \
    --to=pablo@netfilter.org \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    /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.