]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
datatype: use DTYPE_F_PREFIX only for IP address datatype
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 21 Mar 2024 11:40:53 +0000 (12:40 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 21 Mar 2024 12:28:18 +0000 (13:28 +0100)
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 <pablo@netfilter.org>
src/datatype.c
src/meta.c
src/rt.c
tests/py/any/meta.t
tests/py/any/meta.t.json

index 3205b214197fc94e76053c971feb8abe5aa00784..b368ea9125fcddfea356d96283024f55ca1d98ff 100644 (file)
@@ -1015,7 +1015,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 = {
index eca8dac72098a9939e89da56edf188a583b665a5..a17bacf07d0e79c06053b0152e58cb0706da782a 100644 (file)
@@ -363,7 +363,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 = {
index d8f3352f4b4a72c86097c1420e11546a8b3acc5f..9320b8322456bf8506065a8250acd6dc8bb99fc0 100644 (file)
--- a/src/rt.c
+++ b/src/rt.c
@@ -61,7 +61,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[] = {
index 718c7ad96186743889c5e7cfe8e1625b03e289b9..bd10c56dfe5f60ff5cb7453ffdf1a75372430c9e 100644 (file)
@@ -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
index d50272de55a5b59e8283e7f2584648cc69801329..2af3f623e1e4a28d36b962782a8bc30e46bd1449 100644 (file)
     {
         "match": {
             "left": {
-                "meta": {
-                    "key": "mark"
-                }
+                "&": [
+                    {
+                        "meta": {
+                            "key": "mark"
+                        }
+                    },
+                    4294967040
+                ]
             },
             "op": "==",
-            "right": {
-                "prefix": {
-                    "addr": 4294967040,
-                    "len": 24
-                }
-            }
+            "right": 4294967040
         }
     }
 ]