1# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2
3name: nlctrl
4protocol: genetlink-legacy
5uapi-header: linux/genetlink.h
6
7doc: |
8  genetlink meta-family that exposes information about all genetlink
9  families registered in the kernel (including itself).
10
11definitions:
12  -
13    name: op-flags
14    type: flags
15    enum-name:
16    entries:
17      - admin-perm
18      - cmd-cap-do
19      - cmd-cap-dump
20      - cmd-cap-haspol
21      - uns-admin-perm
22  -
23    name: attr-type
24    enum-name: netlink-attribute-type
25    type: enum
26    entries:
27      - invalid
28      - flag
29      - u8
30      - u16
31      - u32
32      - u64
33      - s8
34      - s16
35      - s32
36      - s64
37      - binary
38      - string
39      - nul-string
40      - nested
41      - nested-array
42      - bitfield32
43      - sint
44      - uint
45
46attribute-sets:
47  -
48    name: ctrl-attrs
49    name-prefix: ctrl-attr-
50    attributes:
51      -
52        name: family-id
53        type: u16
54      -
55        name: family-name
56        type: string
57      -
58        name: version
59        type: u32
60      -
61        name: hdrsize
62        type: u32
63      -
64        name: maxattr
65        type: u32
66      -
67        name: ops
68        type: indexed-array
69        sub-type: nest
70        nested-attributes: op-attrs
71      -
72        name: mcast-groups
73        type: indexed-array
74        sub-type: nest
75        nested-attributes: mcast-group-attrs
76      -
77        name: policy
78        type: nest-type-value
79        type-value: [ policy-id, attr-id ]
80        nested-attributes: policy-attrs
81      -
82        name: op-policy
83        type: nest-type-value
84        type-value: [ op-id ]
85        nested-attributes: op-policy-attrs
86      -
87        name: op
88        type: u32
89  -
90    name: mcast-group-attrs
91    name-prefix: ctrl-attr-mcast-grp-
92    enum-name:
93    attributes:
94      -
95        name: name
96        type: string
97      -
98        name: id
99        type: u32
100  -
101    name: op-attrs
102    name-prefix: ctrl-attr-op-
103    enum-name:
104    attributes:
105      -
106        name: id
107        type: u32
108      -
109        name: flags
110        type: u32
111        enum: op-flags
112        enum-as-flags: true
113  -
114    name: policy-attrs
115    name-prefix: nl-policy-type-attr-
116    enum-name:
117    attributes:
118      -
119        name: type
120        type: u32
121        enum: attr-type
122      -
123        name: min-value-s
124        type: s64
125      -
126        name: max-value-s
127        type: s64
128      -
129        name: min-value-u
130        type: u64
131      -
132        name: max-value-u
133        type: u64
134      -
135        name: min-length
136        type: u32
137      -
138        name: max-length
139        type: u32
140      -
141        name: policy-idx
142        type: u32
143      -
144        name: policy-maxtype
145        type: u32
146      -
147        name: bitfield32-mask
148        type: u32
149      -
150        name: mask
151        type: u64
152      -
153        name: pad
154        type: pad
155  -
156    name: op-policy-attrs
157    name-prefix: ctrl-attr-policy-
158    enum-name:
159    attributes:
160      -
161        name: do
162        type: u32
163      -
164        name: dump
165        type: u32
166
167operations:
168  enum-model: directional
169  name-prefix: ctrl-cmd-
170  list:
171    -
172      name: getfamily
173      doc: Get / dump genetlink families
174      attribute-set: ctrl-attrs
175      do:
176        request:
177          value: 3
178          attributes:
179            - family-name
180        reply: &all-attrs
181          value: 1
182          attributes:
183            - family-id
184            - family-name
185            - hdrsize
186            - maxattr
187            - mcast-groups
188            - ops
189            - version
190      dump:
191        reply: *all-attrs
192    -
193      name: getpolicy
194      doc: Get / dump genetlink policies
195      attribute-set: ctrl-attrs
196      dump:
197        request:
198          value: 10
199          attributes:
200            - family-name
201            - family-id
202            - op
203        reply:
204          value: 10
205          attributes:
206            - family-id
207            - op-policy
208            - policy
209