1 # SPDX-License-Identifier: ((GPL-2.0 WITH Linu 1 # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 2 %YAML 1.2 2 %YAML 1.2 3 --- 3 --- 4 $id: http://kernel.org/schemas/netlink/netlink 4 $id: http://kernel.org/schemas/netlink/netlink-raw.yaml# 5 $schema: https://json-schema.org/draft-07/sche 5 $schema: https://json-schema.org/draft-07/schema 6 6 7 # Common defines 7 # Common defines 8 $defs: 8 $defs: 9 uint: 9 uint: 10 type: integer 10 type: integer 11 minimum: 0 11 minimum: 0 12 len-or-define: 12 len-or-define: 13 type: [ string, integer ] 13 type: [ string, integer ] 14 pattern: ^[0-9A-Za-z_-]+( - 1)?$ !! 14 pattern: ^[0-9A-Za-z_]+( - 1)?$ 15 minimum: 0 15 minimum: 0 16 16 17 # Schema for specs 17 # Schema for specs 18 title: Protocol 18 title: Protocol 19 description: Specification of a raw netlink pr 19 description: Specification of a raw netlink protocol 20 type: object 20 type: object 21 required: [ name, doc, attribute-sets, operati 21 required: [ name, doc, attribute-sets, operations ] 22 additionalProperties: False 22 additionalProperties: False 23 properties: 23 properties: 24 name: 24 name: 25 description: Name of the netlink family. 25 description: Name of the netlink family. 26 type: string 26 type: string 27 doc: 27 doc: 28 type: string 28 type: string 29 protocol: 29 protocol: 30 description: Schema compatibility level. 30 description: Schema compatibility level. 31 enum: [ netlink-raw ] # Trim 31 enum: [ netlink-raw ] # Trim 32 # Start netlink-raw 32 # Start netlink-raw 33 protonum: 33 protonum: 34 description: Protocol number to use for ne 34 description: Protocol number to use for netlink-raw 35 type: integer 35 type: integer 36 # End netlink-raw 36 # End netlink-raw 37 uapi-header: 37 uapi-header: 38 description: Path to the uAPI header, defa 38 description: Path to the uAPI header, default is linux/${family-name}.h 39 type: string 39 type: string 40 # Start genetlink-c 40 # Start genetlink-c 41 c-family-name: 41 c-family-name: 42 description: Name of the define for the fa 42 description: Name of the define for the family name. 43 type: string 43 type: string 44 c-version-name: 44 c-version-name: 45 description: Name of the define for the ve 45 description: Name of the define for the version of the family. 46 type: string 46 type: string 47 max-by-define: 47 max-by-define: 48 description: Makes the number of attribute 48 description: Makes the number of attributes and commands be specified by a define, not an enum value. 49 type: boolean 49 type: boolean 50 cmd-max-name: << 51 description: Name of the define for the la << 52 type: string << 53 cmd-cnt-name: << 54 description: The explicit name for constan << 55 type: string << 56 # End genetlink-c 50 # End genetlink-c 57 # Start genetlink-legacy 51 # Start genetlink-legacy 58 kernel-policy: 52 kernel-policy: 59 description: | 53 description: | 60 Defines if the input policy in the kerne 54 Defines if the input policy in the kernel is global, per-operation, or split per operation type. 61 Default is split. 55 Default is split. 62 enum: [ split, per-op, global ] 56 enum: [ split, per-op, global ] 63 # End genetlink-legacy 57 # End genetlink-legacy 64 58 65 definitions: 59 definitions: 66 description: List of type and constant def 60 description: List of type and constant definitions (enums, flags, defines). 67 type: array 61 type: array 68 items: 62 items: 69 type: object 63 type: object 70 required: [ type, name ] 64 required: [ type, name ] 71 additionalProperties: False 65 additionalProperties: False 72 properties: 66 properties: 73 name: 67 name: 74 type: string 68 type: string 75 header: 69 header: 76 description: For C-compatible langua 70 description: For C-compatible languages, header which already defines this value. 77 type: string 71 type: string 78 type: 72 type: 79 enum: [ const, enum, flags, struct ] 73 enum: [ const, enum, flags, struct ] # Trim 80 doc: 74 doc: 81 type: string 75 type: string 82 # For const 76 # For const 83 value: 77 value: 84 description: For const - the value. 78 description: For const - the value. 85 type: [ string, integer ] 79 type: [ string, integer ] 86 # For enum and flags 80 # For enum and flags 87 value-start: 81 value-start: 88 description: For enum or flags the l 82 description: For enum or flags the literal initializer for the first value. 89 type: [ string, integer ] 83 type: [ string, integer ] 90 entries: 84 entries: 91 description: For enum or flags array 85 description: For enum or flags array of values. 92 type: array 86 type: array 93 items: 87 items: 94 oneOf: 88 oneOf: 95 - type: string 89 - type: string 96 - type: object 90 - type: object 97 required: [ name ] 91 required: [ name ] 98 additionalProperties: False 92 additionalProperties: False 99 properties: 93 properties: 100 name: 94 name: 101 type: string 95 type: string 102 value: 96 value: 103 type: integer 97 type: integer 104 doc: 98 doc: 105 type: string 99 type: string 106 render-max: 100 render-max: 107 description: Render the max members 101 description: Render the max members for this enum. 108 type: boolean 102 type: boolean 109 # Start genetlink-c 103 # Start genetlink-c 110 enum-name: 104 enum-name: 111 description: Name for enum, if empty 105 description: Name for enum, if empty no name will be used. 112 type: [ string, "null" ] 106 type: [ string, "null" ] 113 name-prefix: 107 name-prefix: 114 description: For enum the prefix of 108 description: For enum the prefix of the values, optional. 115 type: string 109 type: string 116 # End genetlink-c 110 # End genetlink-c 117 # Start genetlink-legacy 111 # Start genetlink-legacy 118 members: 112 members: 119 description: List of struct members. 113 description: List of struct members. Only scalars and strings members allowed. 120 type: array 114 type: array 121 items: 115 items: 122 type: object 116 type: object 123 required: [ name, type ] 117 required: [ name, type ] 124 additionalProperties: False 118 additionalProperties: False 125 properties: 119 properties: 126 name: 120 name: 127 type: string 121 type: string 128 type: 122 type: 129 description: | !! 123 description: The netlink attribute type 130 The netlink attribute type. !! 124 enum: [ u8, u16, u32, u64, s8, s16, s32, s64, string, binary ] 131 must also have the 'len' pro << 132 enum: [ u8, u16, u32, u64, s8, << 133 len: 125 len: 134 $ref: '#/$defs/len-or-define' 126 $ref: '#/$defs/len-or-define' 135 byte-order: 127 byte-order: 136 enum: [ little-endian, big-end 128 enum: [ little-endian, big-endian ] 137 doc: 129 doc: 138 description: Documentation for 130 description: Documentation for the struct member attribute. 139 type: string 131 type: string 140 enum: 132 enum: 141 description: Name of the enum 133 description: Name of the enum type used for the attribute. 142 type: string 134 type: string 143 enum-as-flags: 135 enum-as-flags: 144 description: | 136 description: | 145 Treat the enum as flags. In 137 Treat the enum as flags. In most cases enum is either used as flags or as values. 146 Sometimes, however, both for 138 Sometimes, however, both forms are necessary, in which case header contains the enum 147 form while specific attribut 139 form while specific attributes may request to convert the values into a bitfield. 148 type: boolean 140 type: boolean 149 display-hint: &display-hint 141 display-hint: &display-hint 150 description: | 142 description: | 151 Optional format indicator th 143 Optional format indicator that is intended only for choosing 152 the right formatting mechani 144 the right formatting mechanism when displaying values of this 153 type. 145 type. 154 enum: [ hex, mac, fddi, ipv4, 146 enum: [ hex, mac, fddi, ipv4, ipv6, uuid ] 155 struct: << 156 description: Name of the neste << 157 type: string << 158 if: << 159 properties: << 160 type: << 161 const: pad << 162 then: << 163 required: [ len ] << 164 if: << 165 properties: << 166 type: << 167 const: binary << 168 then: << 169 oneOf: << 170 - required: [ len ] << 171 - required: [ struct ] << 172 # End genetlink-legacy 147 # End genetlink-legacy 173 148 174 attribute-sets: 149 attribute-sets: 175 description: Definition of attribute space 150 description: Definition of attribute spaces for this family. 176 type: array 151 type: array 177 items: 152 items: 178 description: Definition of a single attr 153 description: Definition of a single attribute space. 179 type: object 154 type: object 180 required: [ name, attributes ] 155 required: [ name, attributes ] 181 additionalProperties: False 156 additionalProperties: False 182 properties: 157 properties: 183 name: 158 name: 184 description: | 159 description: | 185 Name used when referring to this s 160 Name used when referring to this space in other definitions, not used outside of the spec. 186 type: string 161 type: string 187 name-prefix: 162 name-prefix: 188 description: | 163 description: | 189 Prefix for the C enum name of the 164 Prefix for the C enum name of the attributes. Default family[name]-set[name]-a- 190 type: string 165 type: string 191 enum-name: 166 enum-name: 192 description: | !! 167 description: Name for the enum type of the attribute. 193 Name for the enum type of the attr !! 168 type: string 194 type: [ string, "null" ] << 195 doc: 169 doc: 196 description: Documentation of the sp 170 description: Documentation of the space. 197 type: string 171 type: string 198 subset-of: 172 subset-of: 199 description: | 173 description: | 200 Name of another space which this i 174 Name of another space which this is a logical part of. Sub-spaces can be used to define 201 a limited group of attributes whic 175 a limited group of attributes which are used in a nest. 202 type: string 176 type: string 203 # Start genetlink-c 177 # Start genetlink-c 204 attr-cnt-name: 178 attr-cnt-name: 205 description: The explicit name for c 179 description: The explicit name for constant holding the count of attributes (last attr + 1). 206 type: string 180 type: string 207 attr-max-name: 181 attr-max-name: 208 description: The explicit name for l 182 description: The explicit name for last member of attribute enum. 209 type: string 183 type: string 210 # End genetlink-c 184 # End genetlink-c 211 attributes: 185 attributes: 212 description: List of attributes in t 186 description: List of attributes in the space. 213 type: array 187 type: array 214 items: 188 items: 215 type: object 189 type: object 216 required: [ name ] !! 190 required: [ name, type ] 217 additionalProperties: False 191 additionalProperties: False 218 properties: 192 properties: 219 name: 193 name: 220 type: string 194 type: string 221 type: &attr-type 195 type: &attr-type 222 description: The netlink attri 196 description: The netlink attribute type 223 enum: [ unused, pad, flag, bin !! 197 enum: [ unused, pad, flag, binary, u8, u16, u32, u64, s32, s64, 224 u8, u16, u32, u64, s8, !! 198 string, nest, array-nest, nest-type-value ] 225 string, nest, indexed- << 226 sub-message ] << 227 doc: 199 doc: 228 description: Documentation of 200 description: Documentation of the attribute. 229 type: string 201 type: string 230 value: 202 value: 231 description: Value for the enu 203 description: Value for the enum item representing this attribute in the uAPI. 232 $ref: '#/$defs/uint' 204 $ref: '#/$defs/uint' 233 type-value: 205 type-value: 234 description: Name of the value 206 description: Name of the value extracted from the type of a nest-type-value attribute. 235 type: array 207 type: array 236 items: 208 items: 237 type: string 209 type: string 238 byte-order: 210 byte-order: 239 enum: [ little-endian, big-end 211 enum: [ little-endian, big-endian ] 240 multi-attr: 212 multi-attr: 241 type: boolean 213 type: boolean 242 nested-attributes: 214 nested-attributes: 243 description: Name of the space 215 description: Name of the space (sub-space) used inside the attribute. 244 type: string 216 type: string 245 enum: 217 enum: 246 description: Name of the enum 218 description: Name of the enum type used for the attribute. 247 type: string 219 type: string 248 enum-as-flags: 220 enum-as-flags: 249 description: | 221 description: | 250 Treat the enum as flags. In 222 Treat the enum as flags. In most cases enum is either used as flags or as values. 251 Sometimes, however, both for 223 Sometimes, however, both forms are necessary, in which case header contains the enum 252 form while specific attribut 224 form while specific attributes may request to convert the values into a bitfield. 253 type: boolean 225 type: boolean 254 checks: 226 checks: 255 description: Kernel input vali 227 description: Kernel input validation. 256 type: object 228 type: object 257 additionalProperties: False 229 additionalProperties: False 258 properties: 230 properties: 259 flags-mask: 231 flags-mask: 260 description: Name of the f 232 description: Name of the flags constant on which to base mask (unsigned scalar types only). 261 type: string 233 type: string 262 min: 234 min: 263 description: Min value for 235 description: Min value for an integer attribute. 264 type: integer 236 type: integer 265 min-len: 237 min-len: 266 description: Min length fo 238 description: Min length for a binary attribute. 267 $ref: '#/$defs/len-or-defi 239 $ref: '#/$defs/len-or-define' 268 max-len: 240 max-len: 269 description: Max length fo 241 description: Max length for a string or a binary attribute. 270 $ref: '#/$defs/len-or-defi 242 $ref: '#/$defs/len-or-define' 271 exact-len: << 272 description: Exact length << 273 $ref: '#/$defs/len-or-defi << 274 unterminated-ok: << 275 description: | << 276 For string attributes, d << 277 contains the terminating << 278 type: boolean << 279 sub-type: *attr-type 243 sub-type: *attr-type 280 display-hint: *display-hint 244 display-hint: *display-hint 281 # Start genetlink-c 245 # Start genetlink-c 282 name-prefix: 246 name-prefix: 283 type: string 247 type: string 284 # End genetlink-c 248 # End genetlink-c 285 # Start genetlink-legacy 249 # Start genetlink-legacy 286 struct: 250 struct: 287 description: Name of the struc 251 description: Name of the struct type used for the attribute. 288 type: string 252 type: string 289 # End genetlink-legacy 253 # End genetlink-legacy 290 # Start netlink-raw << 291 sub-message: << 292 description: | << 293 Name of the sub-message defi << 294 type: string << 295 selector: << 296 description: | << 297 Name of the attribute to use << 298 format specifier. << 299 type: string << 300 # End netlink-raw << 301 254 302 # Make sure name-prefix does not appear 255 # Make sure name-prefix does not appear in subsets (subsets inherit naming) 303 dependencies: 256 dependencies: 304 name-prefix: 257 name-prefix: 305 not: 258 not: 306 required: [ subset-of ] 259 required: [ subset-of ] 307 subset-of: 260 subset-of: 308 not: 261 not: 309 required: [ name-prefix ] 262 required: [ name-prefix ] 310 263 311 # type property is only required if not << 312 if: << 313 properties: << 314 subset-of: << 315 not: << 316 type: string << 317 then: << 318 properties: << 319 attributes: << 320 items: << 321 required: [ type ] << 322 << 323 # Start netlink-raw << 324 sub-messages: << 325 description: Definition of sub message att << 326 type: array << 327 items: << 328 type: object << 329 additionalProperties: False << 330 required: [ name, formats ] << 331 properties: << 332 name: << 333 description: Name of the sub-message << 334 type: string << 335 formats: << 336 description: Dynamically selected fo << 337 type: array << 338 items: << 339 type: object << 340 additionalProperties: False << 341 required: [ value ] << 342 properties: << 343 value: << 344 description: | << 345 Value to match for dynamic s << 346 specifier. << 347 type: string << 348 fixed-header: << 349 description: | << 350 Name of the struct definitio << 351 for the sub message. << 352 type: string << 353 attribute-set: << 354 description: | << 355 Name of the attribute space << 356 in the sub message. << 357 type: string << 358 # End netlink-raw << 359 << 360 operations: 264 operations: 361 description: Operations supported by the p 265 description: Operations supported by the protocol. 362 type: object 266 type: object 363 required: [ list ] 267 required: [ list ] 364 additionalProperties: False 268 additionalProperties: False 365 properties: 269 properties: 366 enum-model: 270 enum-model: 367 description: | 271 description: | 368 The model of assigning values to the 272 The model of assigning values to the operations. 369 "unified" is the recommended model w 273 "unified" is the recommended model where all message types belong 370 to a single enum. 274 to a single enum. 371 "directional" has the messages sent 275 "directional" has the messages sent to the kernel and from the kernel 372 enumerated separately. 276 enumerated separately. 373 enum: [ unified, directional ] # Trim 277 enum: [ unified, directional ] # Trim 374 name-prefix: 278 name-prefix: 375 description: | 279 description: | 376 Prefix for the C enum name of the co 280 Prefix for the C enum name of the command. The name is formed by concatenating 377 the prefix with the upper case name 281 the prefix with the upper case name of the command, with dashes replaced by underscores. 378 type: string 282 type: string 379 enum-name: 283 enum-name: 380 description: | !! 284 description: Name for the enum type with commands. 381 Name for the enum type with commands !! 285 type: string 382 type: [ string, "null" ] << 383 async-prefix: 286 async-prefix: 384 description: Same as name-prefix but u 287 description: Same as name-prefix but used to render notifications and events to separate enum. 385 type: string 288 type: string 386 async-enum: 289 async-enum: 387 description: | !! 290 description: Name for the enum type with notifications/events. 388 Name for the enum type with commands !! 291 type: string 389 type: [ string, "null" ] << 390 # Start genetlink-legacy 292 # Start genetlink-legacy 391 fixed-header: &fixed-header 293 fixed-header: &fixed-header 392 description: | 294 description: | 393 Name of the structure defining the o 295 Name of the structure defining the optional fixed-length protocol 394 header. This header is placed in a m 296 header. This header is placed in a message after the netlink and 395 genetlink headers and before any att 297 genetlink headers and before any attributes. 396 type: string 298 type: string 397 # End genetlink-legacy 299 # End genetlink-legacy 398 list: 300 list: 399 description: List of commands 301 description: List of commands 400 type: array 302 type: array 401 items: 303 items: 402 type: object 304 type: object 403 additionalProperties: False 305 additionalProperties: False 404 required: [ name, doc ] 306 required: [ name, doc ] 405 properties: 307 properties: 406 name: 308 name: 407 description: Name of the operati 309 description: Name of the operation, also defining its C enum value in uAPI. 408 type: string 310 type: string 409 doc: 311 doc: 410 description: Documentation for t 312 description: Documentation for the command. 411 type: string 313 type: string 412 value: 314 value: 413 description: Value for the enum 315 description: Value for the enum in the uAPI. 414 $ref: '#/$defs/uint' 316 $ref: '#/$defs/uint' 415 attribute-set: 317 attribute-set: 416 description: | 318 description: | 417 Attribute space from which att 319 Attribute space from which attributes directly in the requests and replies 418 to this command are defined. 320 to this command are defined. 419 type: string 321 type: string 420 flags: &cmd_flags 322 flags: &cmd_flags 421 description: Command flags. 323 description: Command flags. 422 type: array 324 type: array 423 items: 325 items: 424 enum: [ admin-perm ] 326 enum: [ admin-perm ] 425 dont-validate: 327 dont-validate: 426 description: Kernel attribute va 328 description: Kernel attribute validation flags. 427 type: array 329 type: array 428 items: 330 items: 429 enum: [ strict, dump ] 331 enum: [ strict, dump ] 430 # Start genetlink-legacy 332 # Start genetlink-legacy 431 fixed-header: *fixed-header 333 fixed-header: *fixed-header 432 # End genetlink-legacy 334 # End genetlink-legacy 433 do: &subop-type 335 do: &subop-type 434 description: Main command handle 336 description: Main command handler. 435 type: object 337 type: object 436 additionalProperties: False 338 additionalProperties: False 437 properties: 339 properties: 438 request: &subop-attr-list 340 request: &subop-attr-list 439 description: Definition of t 341 description: Definition of the request message for a given command. 440 type: object 342 type: object 441 additionalProperties: False 343 additionalProperties: False 442 properties: 344 properties: 443 attributes: 345 attributes: 444 description: | 346 description: | 445 Names of attributes fr 347 Names of attributes from the attribute-set (not full attribute 446 definitions, just name 348 definitions, just names). 447 type: array 349 type: array 448 items: 350 items: 449 type: string 351 type: string 450 # Start genetlink-legacy 352 # Start genetlink-legacy 451 value: 353 value: 452 description: | 354 description: | 453 ID of this message if 355 ID of this message if value for request and response differ, 454 i.e. requests and resp 356 i.e. requests and responses have different message enums. 455 $ref: '#/$defs/uint' 357 $ref: '#/$defs/uint' 456 # End genetlink-legacy 358 # End genetlink-legacy 457 reply: *subop-attr-list 359 reply: *subop-attr-list 458 pre: 360 pre: 459 description: Hook for a func 361 description: Hook for a function to run before the main callback (pre_doit or start). 460 type: string 362 type: string 461 post: 363 post: 462 description: Hook for a func 364 description: Hook for a function to run after the main callback (post_doit or done). 463 type: string 365 type: string 464 dump: *subop-type 366 dump: *subop-type 465 notify: 367 notify: 466 description: Name of the command 368 description: Name of the command sharing the reply type with this notification. 467 type: string 369 type: string 468 event: 370 event: 469 type: object 371 type: object 470 additionalProperties: False 372 additionalProperties: False 471 properties: 373 properties: 472 attributes: 374 attributes: 473 description: Explicit list o 375 description: Explicit list of the attributes for the notification. 474 type: array 376 type: array 475 items: 377 items: 476 type: string 378 type: string 477 mcgrp: 379 mcgrp: 478 description: Name of the multica 380 description: Name of the multicast group generating given notification. 479 type: string 381 type: string 480 mcast-groups: 382 mcast-groups: 481 description: List of multicast groups. 383 description: List of multicast groups. 482 type: object 384 type: object 483 required: [ list ] 385 required: [ list ] 484 additionalProperties: False 386 additionalProperties: False 485 properties: 387 properties: 486 list: 388 list: 487 description: List of groups. 389 description: List of groups. 488 type: array 390 type: array 489 items: 391 items: 490 type: object 392 type: object 491 required: [ name ] 393 required: [ name ] 492 additionalProperties: False 394 additionalProperties: False 493 properties: 395 properties: 494 name: 396 name: 495 description: | 397 description: | 496 The name for the group, used t 398 The name for the group, used to form the define and the value of the define. 497 type: string 399 type: string 498 # Start genetlink-c 400 # Start genetlink-c 499 c-define-name: 401 c-define-name: 500 description: Override for the na 402 description: Override for the name of the define in C uAPI. 501 type: string 403 type: string 502 # End genetlink-c 404 # End genetlink-c 503 flags: *cmd_flags 405 flags: *cmd_flags 504 # Start netlink-raw 406 # Start netlink-raw 505 value: 407 value: 506 description: Value of the netlin 408 description: Value of the netlink multicast group in the uAPI. 507 type: integer 409 type: integer 508 # End netlink-raw 410 # End netlink-raw
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.