lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231129101159.99197-3-donald.hunter@gmail.com>
Date: Wed, 29 Nov 2023 10:11:55 +0000
From: Donald Hunter <donald.hunter@...il.com>
To: netdev@...r.kernel.org,
	Jakub Kicinski <kuba@...nel.org>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Paolo Abeni <pabeni@...hat.com>,
	Jonathan Corbet <corbet@....net>,
	linux-doc@...r.kernel.org
Cc: donald.hunter@...hat.com,
	Donald Hunter <donald.hunter@...il.com>
Subject: [RFC PATCH net-next v1 2/6] doc/netlink: Add a nest selector to netlink-raw schema

Add a 'dynamic' attribute type with a selector that declares how to
choose the attribute-space for nested attributes. Use the value of
another attribute as the selector key. For example if the following
attribute has already been decoded:

  { "kind": "gre" }

then the following selector:

  selector:
    attribute: kind
    list:
      -
        value: bridge
        type: nest
        nested-attributes: linkinfo-bridge-attrs
      -
        value: gre
        type: nest
        nested-attributes: linkinfo-gre-attrs
      -
        value: geneve
        type: nest
        nested-attributes: linkinfo-geneve-attrs

would decode the value as nested attributes, using the
'linkinfo-gre-attrs' attribute space.

This approach was chosen so that different value types can be handled by
the same selector, allowing a mix of e.g. nest, struct and binary.

Signed-off-by: Donald Hunter <donald.hunter@...il.com>
---
 Documentation/netlink/netlink-raw.yaml | 38 +++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/Documentation/netlink/netlink-raw.yaml b/Documentation/netlink/netlink-raw.yaml
index ad5395040765..62061e180f8f 100644
--- a/Documentation/netlink/netlink-raw.yaml
+++ b/Documentation/netlink/netlink-raw.yaml
@@ -202,7 +202,7 @@ properties:
                 description: The netlink attribute type
                 enum: [ unused, pad, flag, binary, bitfield32,
                         u8, u16, u32, u64, s8, s16, s32, s64,
-                        string, nest, array-nest, nest-type-value ]
+                        string, nest, array-nest, nest-type-value, dynamic ]
               doc:
                 description: Documentation of the attribute.
                 type: string
@@ -261,6 +261,42 @@ properties:
                 description: Name of the struct type used for the attribute.
                 type: string
               # End genetlink-legacy
+              # Start netlink-raw
+              selector:
+                description:
+                  Map of attribute definitions for dynamic selection of type
+                  specific attribute spaces.
+                type: object
+                required: [ attribute, list ]
+                additionalProperties: false
+                properties:
+                  attribute:
+                    description:
+                      Name of the attribute that contains the type identifier
+                      string.
+                    type: string
+                  list:
+                    type: array
+                    items:
+                      type: object
+                      required: [ value, type ]
+                      additionalProperties: false
+                      properties:
+                        value:
+                          description: Type identifier string to match.
+                          type: string
+                        type:
+                          description: The netlink attribute type.
+                          enum: [ binary, nest ]
+                        nested-attributes:
+                          description:
+                            Name of the sub-space used inside the attribute.
+                          type: string
+                        struct:
+                          description:
+                            Name of the struct type used for the attribute.
+                          type: string
+              # End netlink-raw
 
       # Make sure name-prefix does not appear in subsets (subsets inherit naming)
       dependencies:
-- 
2.42.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ