netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy Sowden <jeremy@azazel.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Netfilter Devel <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH nf-next v2 09/10] netfilter: bitwise: add NFTA_BITWISE_DATA attribute.
Date: Wed, 15 Jan 2020 09:30:38 +0000	[thread overview]
Message-ID: <20200115093038.GE999973@azazel.net> (raw)
In-Reply-To: <20200115092907.subrj56hcjgtywze@salvia>

[-- Attachment #1: Type: text/plain, Size: 2183 bytes --]

On 2020-01-15, at 10:29:07 +0100, Pablo Neira Ayuso wrote:
> On Tue, Jan 14, 2020 at 09:29:17PM +0000, Jeremy Sowden wrote:
> > Add a new bitwise netlink attribute that will be used by shift
> > operations to store the size of the shift.  It is not used by
> > boolean operations.
> >
> > Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
> > ---
> >  include/uapi/linux/netfilter/nf_tables.h | 2 ++
> >  net/netfilter/nft_bitwise.c              | 5 +++++
> >  2 files changed, 7 insertions(+)
> >
> > diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
> > index cfda75725455..7cb85fd0d38e 100644
> > --- a/include/uapi/linux/netfilter/nf_tables.h
> > +++ b/include/uapi/linux/netfilter/nf_tables.h
> > @@ -503,6 +503,7 @@ enum nft_bitwise_ops {
> >   * @NFTA_BITWISE_MASK: mask value (NLA_NESTED: nft_data_attributes)
> >   * @NFTA_BITWISE_XOR: xor value (NLA_NESTED: nft_data_attributes)
> >   * @NFTA_BITWISE_OP: type of operation (NLA_U32: nft_bitwise_ops)
> > + * @NFTA_BITWISE_DATA: argument for non-boolean operations (NLA_U32)
> >   *
> >   * The bitwise expression performs the following operation:
> >   *
> > @@ -524,6 +525,7 @@ enum nft_bitwise_attributes {
> >  	NFTA_BITWISE_MASK,
> >  	NFTA_BITWISE_XOR,
> >  	NFTA_BITWISE_OP,
> > +	NFTA_BITWISE_DATA,
> >  	__NFTA_BITWISE_MAX
> >  };
> >  #define NFTA_BITWISE_MAX	(__NFTA_BITWISE_MAX - 1)
> > diff --git a/net/netfilter/nft_bitwise.c b/net/netfilter/nft_bitwise.c
> > index 1d9079ba2102..72abaa83a8ca 100644
> > --- a/net/netfilter/nft_bitwise.c
> > +++ b/net/netfilter/nft_bitwise.c
> > @@ -22,6 +22,7 @@ struct nft_bitwise {
> >  	u8			len;
> >  	struct nft_data		mask;
> >  	struct nft_data		xor;
> > +	u32			data;
>
> Could you make this struct nft_data?
>
> We can extend later on nft_bitwise to more operations. I was
> considering to (ab)use bitwise to implement increment and decrement. I
> think u32 should be enough in most cases, but I'd prefer to stick to
> one 128 bit word in this case. For shift this is obviously too much,
> but this would be leaving room for new operations requiring something
> larger than u32.

I did wonder about that. :) Will do.

J.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2020-01-15  9:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14 21:29 [PATCH nf-next v2 00/10] netfilter: nft_bitwise: shift support Jeremy Sowden
2020-01-14 21:29 ` [PATCH nf-next v2 01/10] netfilter: nf_tables: white-space fixes Jeremy Sowden
2020-01-14 21:29 ` [PATCH nf-next v2 02/10] netfilter: bitwise: remove NULL comparisons from attribute checks Jeremy Sowden
2020-01-14 21:29 ` [PATCH nf-next v2 03/10] netfilter: bitwise: replace gotos with returns Jeremy Sowden
2020-01-14 21:29 ` [PATCH nf-next v2 04/10] netfilter: bitwise: add NFTA_BITWISE_OP netlink attribute Jeremy Sowden
2020-01-14 21:29 ` [PATCH nf-next v2 05/10] netfilter: bitwise: add helper for initializing boolean operations Jeremy Sowden
2020-01-14 21:29 ` [PATCH nf-next v2 06/10] netfilter: bitwise: add helper for evaluating " Jeremy Sowden
2020-01-14 21:29 ` [PATCH nf-next v2 07/10] netfilter: bitwise: add helper for dumping " Jeremy Sowden
2020-01-14 21:29 ` [PATCH nf-next v2 08/10] netfilter: bitwise: only offload " Jeremy Sowden
2020-01-14 21:29 ` [PATCH nf-next v2 09/10] netfilter: bitwise: add NFTA_BITWISE_DATA attribute Jeremy Sowden
2020-01-15  9:29   ` Pablo Neira Ayuso
2020-01-15  9:30     ` Jeremy Sowden [this message]
2020-01-14 21:29 ` [PATCH nf-next v2 10/10] netfilter: bitwise: add support for shifts Jeremy Sowden
2020-01-15  9:29 ` [PATCH nf-next v2 00/10] netfilter: nft_bitwise: shift support 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=20200115093038.GE999973@azazel.net \
    --to=jeremy@azazel.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 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).