Documentation / netlink / specs / nlctrl.yaml


Based on kernel version 6.11. Page generated on 2024-09-24 08:21 EST.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)

name: nlctrl
protocol: genetlink-legacy
uapi-header: linux/genetlink.h

doc: |
  genetlink meta-family that exposes information about all genetlink
  families registered in the kernel (including itself).

definitions:
  -
    name: op-flags
    type: flags
    enum-name:
    entries:
      - admin-perm
      - cmd-cap-do
      - cmd-cap-dump
      - cmd-cap-haspol
      - uns-admin-perm
  -
    name: attr-type
    enum-name: netlink-attribute-type
    type: enum
    entries:
      - invalid
      - flag
      - u8
      - u16
      - u32
      - u64
      - s8
      - s16
      - s32
      - s64
      - binary
      - string
      - nul-string
      - nested
      - nested-array
      - bitfield32
      - sint
      - uint

attribute-sets:
  -
    name: ctrl-attrs
    name-prefix: ctrl-attr-
    attributes:
      -
        name: family-id
        type: u16
      -
        name: family-name
        type: string
      -
        name: version
        type: u32
      -
        name: hdrsize
        type: u32
      -
        name: maxattr
        type: u32
      -
        name: ops
        type: indexed-array
        sub-type: nest
        nested-attributes: op-attrs
      -
        name: mcast-groups
        type: indexed-array
        sub-type: nest
        nested-attributes: mcast-group-attrs
      -
        name: policy
        type: nest-type-value
        type-value: [ policy-id, attr-id ]
        nested-attributes: policy-attrs
      -
        name: op-policy
        type: nest-type-value
        type-value: [ op-id ]
        nested-attributes: op-policy-attrs
      -
        name: op
        type: u32
  -
    name: mcast-group-attrs
    name-prefix: ctrl-attr-mcast-grp-
    enum-name:
    attributes:
      -
        name: name
        type: string
      -
        name: id
        type: u32
  -
    name: op-attrs
    name-prefix: ctrl-attr-op-
    enum-name:
    attributes:
      -
        name: id
        type: u32
      -
        name: flags
        type: u32
        enum: op-flags
        enum-as-flags: true
  -
    name: policy-attrs
    name-prefix: nl-policy-type-attr-
    enum-name:
    attributes:
      -
        name: type
        type: u32
        enum: attr-type
      -
        name: min-value-s
        type: s64
      -
        name: max-value-s
        type: s64
      -
        name: min-value-u
        type: u64
      -
        name: max-value-u
        type: u64
      -
        name: min-length
        type: u32
      -
        name: max-length
        type: u32
      -
        name: policy-idx
        type: u32
      -
        name: policy-maxtype
        type: u32
      -
        name: bitfield32-mask
        type: u32
      -
        name: mask
        type: u64
      -
        name: pad
        type: pad
  -
    name: op-policy-attrs
    name-prefix: ctrl-attr-policy-
    enum-name:
    attributes:
      -
        name: do
        type: u32
      -
        name: dump
        type: u32

operations:
  enum-model: directional
  name-prefix: ctrl-cmd-
  list:
    -
      name: getfamily
      doc: Get / dump genetlink families
      attribute-set: ctrl-attrs
      do:
        request:
          value: 3
          attributes:
            - family-name
        reply: &all-attrs
          value: 1
          attributes:
            - family-id
            - family-name
            - hdrsize
            - maxattr
            - mcast-groups
            - ops
            - version
      dump:
        reply: *all-attrs
    -
      name: getpolicy
      doc: Get / dump genetlink policies
      attribute-set: ctrl-attrs
      dump:
        request:
          value: 10
          attributes:
            - family-name
            - family-id
            - op
        reply:
          value: 10
          attributes:
            - family-id
            - op-policy
            - policy