All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Phil Sutter <phil@nwl.cc>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [iptables PATCH 11/14] nft: Bore up nft_parse_payload()
Date: Tue, 27 Aug 2019 12:38:52 +0200	[thread overview]
Message-ID: <20190827103852.5gef3xhk4nrql7jb@salvia> (raw)
In-Reply-To: <20190821092602.16292-12-phil@nwl.cc>

On Wed, Aug 21, 2019 at 11:25:59AM +0200, Phil Sutter wrote:
> Allow for closer inspection by storing payload expression's base and
> length values. Also facilitate for two consecutive payload expressions
> as LHS of a (cmp/lookup) statement as used with concatenations.
> 
> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
>  iptables/nft-shared.c | 8 ++++++++
>  iptables/nft-shared.h | 4 +++-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/iptables/nft-shared.c b/iptables/nft-shared.c
> index d5984d0577ed1..0f8cabf9abcc7 100644
> --- a/iptables/nft-shared.c
> +++ b/iptables/nft-shared.c
> @@ -445,8 +445,16 @@ static void nft_parse_meta(struct nft_xt_ctx *ctx, struct nftnl_expr *e)
>  
>  static void nft_parse_payload(struct nft_xt_ctx *ctx, struct nftnl_expr *e)
>  {
> +	if (ctx->flags & NFT_XT_CTX_PAYLOAD) {
> +		memcpy(&ctx->prev_payload, &ctx->payload,
> +		       sizeof(ctx->prev_payload));
> +		ctx->flags |= NFT_XT_CTX_PREV_PAYLOAD;
> +	}
>
>  	ctx->reg = nftnl_expr_get_u32(e, NFTNL_EXPR_META_DREG);
> +	ctx->payload.base = nftnl_expr_get_u32(e, NFTNL_EXPR_PAYLOAD_BASE);
>  	ctx->payload.offset = nftnl_expr_get_u32(e, NFTNL_EXPR_PAYLOAD_OFFSET);
> +	ctx->payload.len = nftnl_expr_get_u32(e, NFTNL_EXPR_PAYLOAD_LEN);
>  	ctx->flags |= NFT_XT_CTX_PAYLOAD;
>  }
>  
> diff --git a/iptables/nft-shared.h b/iptables/nft-shared.h
> index ff3beef1af0de..cb7eea6208cd2 100644
> --- a/iptables/nft-shared.h
> +++ b/iptables/nft-shared.h
> @@ -43,6 +43,7 @@ enum {
>  	NFT_XT_CTX_META		= (1 << 1),
>  	NFT_XT_CTX_BITWISE	= (1 << 2),
>  	NFT_XT_CTX_IMMEDIATE	= (1 << 3),
> +	NFT_XT_CTX_PREV_PAYLOAD	= (1 << 4),

Why does ebt among needs this?

  reply	other threads:[~2019-08-27 10:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21  9:25 [iptables PATCH 00/14] Implement among match support Phil Sutter
2019-08-21  9:25 ` [iptables PATCH 01/14] nft: Fix typo in nft_parse_limit() error message Phil Sutter
2019-08-24 16:40   ` Pablo Neira Ayuso
2019-08-21  9:25 ` [iptables PATCH 02/14] nft: Get rid of NFT_COMPAT_EXPR_MAX define Phil Sutter
2019-08-24 16:40   ` Pablo Neira Ayuso
2019-08-21  9:25 ` [iptables PATCH 03/14] nft: Keep nft_handle pointer in nft_xt_ctx Phil Sutter
2019-08-24 16:41   ` Pablo Neira Ayuso
2019-09-26  8:29     ` Phil Sutter
2019-08-21  9:25 ` [iptables PATCH 04/14] nft: Eliminate pointless calls to nft_family_ops_lookup() Phil Sutter
2019-08-24 16:41   ` Pablo Neira Ayuso
2019-08-21  9:25 ` [iptables PATCH 05/14] nft: Fetch sets when updating rule cache Phil Sutter
2019-08-27 10:37   ` Pablo Neira Ayuso
2019-08-21  9:25 ` [iptables PATCH 06/14] nft: Support NFT_COMPAT_SET_ADD Phil Sutter
2019-08-21  9:25 ` [iptables PATCH 07/14] nft: family_ops: Pass nft_handle to 'add' callback Phil Sutter
2019-08-21  9:25 ` [iptables PATCH 08/14] nft: family_ops: Pass nft_handle to 'rule_find' callback Phil Sutter
2019-08-21  9:25 ` [iptables PATCH 09/14] nft: family_ops: Pass nft_handle to 'print_rule' callback Phil Sutter
2019-08-21  9:25 ` [iptables PATCH 10/14] nft: family_ops: Pass nft_handle to 'rule_to_cs' callback Phil Sutter
2019-08-21  9:25 ` [iptables PATCH 11/14] nft: Bore up nft_parse_payload() Phil Sutter
2019-08-27 10:38   ` Pablo Neira Ayuso [this message]
2019-08-27 10:50     ` Pablo Neira Ayuso
2019-08-21  9:26 ` [iptables PATCH 12/14] nft: Embed rule's table name in nft_xt_ctx Phil Sutter
2019-08-21  9:26 ` [iptables PATCH 13/14] nft: Support parsing lookup expression Phil Sutter
2019-08-21  9:26 ` [iptables PATCH 14/14] nft: bridge: Rudimental among extension support Phil Sutter
2019-08-24 16:53   ` Pablo Neira Ayuso
2019-08-26 15:40     ` Phil Sutter
2019-08-27 10:39       ` Pablo Neira Ayuso
2019-08-27 10:49   ` Pablo Neira Ayuso
2019-08-27 11:35     ` Phil Sutter
2019-08-27 12:21       ` Pablo Neira Ayuso
2019-08-27 12:47         ` 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=20190827103852.5gef3xhk4nrql7jb@salvia \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /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.