From: michael-dev <michael-dev@fami-braun.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [RFC] concat with dynamically sized fields like vlan id
Date: Tue, 05 May 2020 12:03:14 +0200 [thread overview]
Message-ID: <72c3232b343ae7c1f4191007b9cbbf5e@fami-braun.de> (raw)
In-Reply-To: <20200504124527.GA25213@salvia>
Am 04.05.2020 14:45, schrieb Pablo Neira Ayuso:
> 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).
When just changing the datatype definition of integer_type to .size =
32,
the resulting set elements are broken:
# ether type vlan @ll,112,16 & 4095 . ip daddr { 4095 . 1.0.0.1} accept
__set%d test-bridge 3 size 1
__set%d test-bridge 0
element ff0f0000 01000001 : 0 [end]
bridge
[ payload load 2b @ link header + 12 => reg 1 ]
[ cmp eq reg 1 0x00000081 ]
[ payload load 2b @ link header + 16 => reg 1 ]
[ cmp eq reg 1 0x00000008 ]
[ payload load 2b @ link header + 14 => reg 1 ]
[ bitwise reg 1 = (reg=1 & 0x0000ff0f ) ^ 0x00000000 ]
[ payload load 4b @ network header + 16 => reg 9 ]
[ lookup reg 1 set __set%d ]
[ immediate reg 0 accept ]
I also verified that such a rule really does not match
ether type vlan id . ip daddr { 501 . 141.24.44.2 } log
prefix "trace "
vlan id 501 ip daddr 141.24.44.2 log prefix "trace2
Results in dmesg entries only for trace2.
Whereas it worked with my last version.
I cannot really find the place to fix this. Any hint?
> 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.
That was already fixed with e10356a4 ("tests: dump generated use new nft
tool").
Regards,
M. Braun
next prev parent reply other threads:[~2020-05-05 10:03 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
2020-05-05 10:03 ` michael-dev [this message]
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=72c3232b343ae7c1f4191007b9cbbf5e@fami-braun.de \
--to=michael-dev@fami-braun.de \
--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).