All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Michael Braun <michael-dev@fami-braun.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [RFC] concat with dynamically sized fields like vlan id
Date: Mon, 4 May 2020 14:45:27 +0200	[thread overview]
Message-ID: <20200504124527.GA25213@salvia> (raw)
In-Reply-To: <20200501205915.24682-1-michael-dev@fami-braun.de>

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

On Fri, May 01, 2020 at 10:59:15PM +0200, Michael Braun wrote:
> This enables commands like
> 
>  nft set bridge t s4 '{typeof vlan id . ip daddr; elements = { 3567 .
> 1.2.3.4 }; }'
> 
> Which would previously fail with
>   Error: can not use variable sized data types (integer) in concat
>   expressions

Now that typeof is in place, the integer_type can be set to 32-bits
(word size).

I would prefer to not expose the integer type definition to sets:

> +	set s4 {
> +		type integer . ipv4_addr
> +		elements = { 0 . 13.239.0.0 }
> +	}
> +

Users do not need to know that an 8-bit payload field is actually
aligned to 32-bits. Or that osf name is actually and 32-bit id number.

[-- Attachment #2: x.patch --]
[-- Type: text/x-diff, Size: 379 bytes --]

diff --git a/src/datatype.c b/src/datatype.c
index 723ac649ea42..6a9b0239d37c 100644
--- a/src/datatype.c
+++ b/src/datatype.c
@@ -397,6 +397,7 @@ const struct datatype integer_type = {
 	.type		= TYPE_INTEGER,
 	.name		= "integer",
 	.desc		= "integer",
+	.size		= 4 * BITS_PER_BYTE,
 	.print		= integer_type_print,
 	.json		= integer_type_json,
 	.parse		= integer_type_parse,

  reply	other threads:[~2020-05-04 12:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 20:59 [RFC] concat with dynamically sized fields like vlan id Michael Braun
2020-05-04 12:45 ` Pablo Neira Ayuso [this message]
2020-05-05 10:03   ` michael-dev
2022-08-11  6:05 ` Florian Westphal

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=20200504124527.GA25213@salvia \
    --to=pablo@netfilter.org \
    --cc=michael-dev@fami-braun.de \
    --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.