From: Pablo Neira Ayuso Date: Thu, 21 Mar 2024 11:40:53 +0000 (+0100) Subject: datatype: use DTYPE_F_PREFIX only for IP address datatype X-Git-Tag: v1.0.6.1~217 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=158fda72a49c4ba34b28599f9ab1bce98720223e;p=thirdparty%2Fnftables.git datatype: use DTYPE_F_PREFIX only for IP address datatype commit a2a7fbdfdd7f8dc5baa4cc8a23753b96bbc8a433 upstream. DTYPE_F_PREFIX flag provides a hint to the netlink delinearize path to use prefix notation. It seems use of prefix notation in meta mark causes confusion, users expect to see prefix in the listing only in IP address datatypes. Untoggle this flag so (more lengthy) binop output such as: meta mark & 0xffffff00 == 0xffffff00 is used instead. Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1739 Signed-off-by: Pablo Neira Ayuso --- diff --git a/src/datatype.c b/src/datatype.c index ac0221a8..e5df3d3d 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -843,7 +843,6 @@ const struct datatype mark_type = { .print = mark_type_print, .json = mark_type_json, .parse = mark_type_parse, - .flags = DTYPE_F_PREFIX, }; static const struct symbol_table icmp_code_tbl = { diff --git a/src/meta.c b/src/meta.c index 62546397..71ed1033 100644 --- a/src/meta.c +++ b/src/meta.c @@ -371,7 +371,6 @@ const struct datatype devgroup_type = { .print = devgroup_type_print, .json = devgroup_type_json, .parse = devgroup_type_parse, - .flags = DTYPE_F_PREFIX, }; const struct datatype ifname_type = { diff --git a/src/rt.c b/src/rt.c index d7aa5edd..48cc5fe6 100644 --- a/src/rt.c +++ b/src/rt.c @@ -55,7 +55,6 @@ const struct datatype realm_type = { .basetype = &integer_type, .print = realm_type_print, .parse = realm_type_parse, - .flags = DTYPE_F_PREFIX, }; const struct rt_template rt_templates[] = { diff --git a/tests/py/any/meta.t b/tests/py/any/meta.t index 12fabb79..05eb44d3 100644 --- a/tests/py/any/meta.t +++ b/tests/py/any/meta.t @@ -56,7 +56,7 @@ meta mark and 0x03 == 0x01;ok;meta mark & 0x00000003 == 0x00000001 meta mark and 0x03 != 0x01;ok;meta mark & 0x00000003 != 0x00000001 meta mark 0x10;ok;meta mark 0x00000010 meta mark != 0x10;ok;meta mark != 0x00000010 -meta mark 0xffffff00/24;ok +meta mark 0xffffff00/24;ok;meta mark & 0xffffff00 == 0xffffff00 meta mark or 0x03 == 0x01;ok;meta mark | 0x00000003 == 0x00000001 meta mark or 0x03 != 0x01;ok;meta mark | 0x00000003 != 0x00000001 diff --git a/tests/py/any/meta.t.json b/tests/py/any/meta.t.json index 4734bbf9..f3717f26 100644 --- a/tests/py/any/meta.t.json +++ b/tests/py/any/meta.t.json @@ -667,17 +667,17 @@ { "match": { "left": { - "meta": { - "key": "mark" - } + "&": [ + { + "meta": { + "key": "mark" + } + }, + 4294967040 + ] }, "op": "==", - "right": { - "prefix": { - "addr": 4294967040, - "len": 24 - } - } + "right": 4294967040 } } ]