Documentation / netlink / specs / ovpn.yaml


Based on kernel version 6.16. Page generated on 2025-08-06 08:57 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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508
# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
#
# Author: Antonio Quartulli <antonio@openvpn.net>
#
# Copyright (c) 2024-2025, OpenVPN Inc.
#

name: ovpn

protocol: genetlink

doc: Netlink protocol to control OpenVPN network devices

definitions:
  -
    type: const
    name: nonce-tail-size
    value: 8
  -
    type: enum
    name: cipher-alg
    entries: [ none, aes-gcm, chacha20-poly1305 ]
  -
    type: enum
    name: del-peer-reason
    entries:
      - teardown
      - userspace
      - expired
      - transport-error
      - transport-disconnect
  -
    type: enum
    name: key-slot
    entries: [ primary, secondary ]

attribute-sets:
  -
    name: peer
    attributes:
      -
        name: id
        type: u32
        doc: >-
          The unique ID of the peer in the device context. To be used to identify
          peers during operations for a specific device
        checks:
          max: 0xFFFFFF
      -
        name: remote-ipv4
        type: u32
        doc: The remote IPv4 address of the peer
        byte-order: big-endian
        display-hint: ipv4
      -
        name: remote-ipv6
        type: binary
        doc: The remote IPv6 address of the peer
        display-hint: ipv6
        checks:
          exact-len: 16
      -
        name: remote-ipv6-scope-id
        type: u32
        doc: The scope id of the remote IPv6 address of the peer (RFC2553)
      -
        name: remote-port
        type: u16
        doc: The remote port of the peer
        byte-order: big-endian
        checks:
          min: 1
      -
        name: socket
        type: u32
        doc: The socket to be used to communicate with the peer
      -
        name: socket-netnsid
        type: s32
        doc: The ID of the netns the socket assigned to this peer lives in
      -
        name: vpn-ipv4
        type: u32
        doc: The IPv4 address assigned to the peer by the server
        byte-order: big-endian
        display-hint: ipv4
      -
        name: vpn-ipv6
        type: binary
        doc: The IPv6 address assigned to the peer by the server
        display-hint: ipv6
        checks:
          exact-len: 16
      -
        name: local-ipv4
        type: u32
        doc: The local IPv4 to be used to send packets to the peer (UDP only)
        byte-order: big-endian
        display-hint: ipv4
      -
        name: local-ipv6
        type: binary
        doc: The local IPv6 to be used to send packets to the peer (UDP only)
        display-hint: ipv6
        checks:
          exact-len: 16
      -
        name: local-port
        type: u16
        doc: The local port to be used to send packets to the peer (UDP only)
        byte-order: big-endian
        checks:
          min: 1
      -
        name: keepalive-interval
        type: u32
        doc: >-
          The number of seconds after which a keep alive message is sent to the
          peer
      -
        name: keepalive-timeout
        type: u32
        doc: >-
          The number of seconds from the last activity after which the peer is
          assumed dead
      -
        name: del-reason
        type: u32
        doc: The reason why a peer was deleted
        enum: del-peer-reason
      -
        name: vpn-rx-bytes
        type: uint
        doc: Number of bytes received over the tunnel
      -
        name: vpn-tx-bytes
        type: uint
        doc: Number of bytes transmitted over the tunnel
      -
        name: vpn-rx-packets
        type: uint
        doc: Number of packets received over the tunnel
      -
        name: vpn-tx-packets
        type: uint
        doc: Number of packets transmitted over the tunnel
      -
        name: link-rx-bytes
        type: uint
        doc: Number of bytes received at the transport level
      -
        name: link-tx-bytes
        type: uint
        doc: Number of bytes transmitted at the transport level
      -
        name: link-rx-packets
        type: uint
        doc: Number of packets received at the transport level
      -
        name: link-tx-packets
        type: uint
        doc: Number of packets transmitted at the transport level
  -
    name: peer-new-input
    subset-of: peer
    attributes:
      -
        name: id
      -
        name: remote-ipv4
      -
        name: remote-ipv6
      -
        name: remote-ipv6-scope-id
      -
        name: remote-port
      -
        name: socket
      -
        name: vpn-ipv4
      -
        name: vpn-ipv6
      -
        name: local-ipv4
      -
        name: local-ipv6
      -
        name: keepalive-interval
      -
        name: keepalive-timeout
  -
    name: peer-set-input
    subset-of: peer
    attributes:
      -
        name: id
      -
        name: remote-ipv4
      -
        name: remote-ipv6
      -
        name: remote-ipv6-scope-id
      -
        name: remote-port
      -
        name: vpn-ipv4
      -
        name: vpn-ipv6
      -
        name: local-ipv4
      -
        name: local-ipv6
      -
        name: keepalive-interval
      -
        name: keepalive-timeout
  -
    name: peer-del-input
    subset-of: peer
    attributes:
      -
        name: id
  -
    name: keyconf
    attributes:
      -
        name: peer-id
        type: u32
        doc: >-
          The unique ID of the peer in the device context. To be used to
          identify peers during key operations
        checks:
          max: 0xFFFFFF
      -
        name: slot
        type: u32
        doc: The slot where the key should be stored
        enum: key-slot
      -
        name: key-id
        doc: >-
          The unique ID of the key in the peer context. Used to fetch the
          correct key upon decryption
        type: u32
        checks:
          max: 7
      -
        name: cipher-alg
        type: u32
        doc: The cipher to be used when communicating with the peer
        enum: cipher-alg
      -
        name: encrypt-dir
        type: nest
        doc: Key material for encrypt direction
        nested-attributes: keydir
      -
        name: decrypt-dir
        type: nest
        doc: Key material for decrypt direction
        nested-attributes: keydir
  -
    name: keydir
    attributes:
      -
        name: cipher-key
        type: binary
        doc: The actual key to be used by the cipher
        checks:
          max-len: 256
      -
        name: nonce-tail
        type: binary
        doc: >-
          Random nonce to be concatenated to the packet ID, in order to
          obtain the actual cipher IV
        checks:
          exact-len: nonce-tail-size
 
  -
    name: keyconf-get
    subset-of: keyconf
    attributes:
      -
        name: peer-id
      -
        name: slot
      -
        name: key-id
      -
        name: cipher-alg
  -
    name: keyconf-swap-input
    subset-of: keyconf
    attributes:
      -
        name: peer-id
  -
    name: keyconf-del-input
    subset-of: keyconf
    attributes:
      -
        name: peer-id
      -
        name: slot
  -
    name: ovpn
    attributes:
      -
        name: ifindex
        type: u32
        doc: Index of the ovpn interface to operate on
      -
        name: peer
        type: nest
        doc: >-
          The peer object containing the attributed of interest for the specific
          operation
        nested-attributes: peer
      -
        name: keyconf
        type: nest
        doc: Peer specific cipher configuration
        nested-attributes: keyconf
  -
    name: ovpn-peer-new-input
    subset-of: ovpn
    attributes:
      -
        name: ifindex
      -
        name: peer
        nested-attributes: peer-new-input
  -
    name: ovpn-peer-set-input
    subset-of: ovpn
    attributes:
      -
        name: ifindex
      -
        name: peer
        nested-attributes: peer-set-input
  -
    name: ovpn-peer-del-input
    subset-of: ovpn
    attributes:
      -
        name: ifindex
      -
        name: peer
        nested-attributes: peer-del-input
  -
    name: ovpn-keyconf-get
    subset-of: ovpn
    attributes:
      -
        name: ifindex
      -
        name: keyconf
        nested-attributes: keyconf-get
  -
    name: ovpn-keyconf-swap-input
    subset-of: ovpn
    attributes:
      -
        name: ifindex
      -
        name: keyconf
        nested-attributes: keyconf-swap-input
  -
    name: ovpn-keyconf-del-input
    subset-of: ovpn
    attributes:
      -
        name: ifindex
      -
        name: keyconf
        nested-attributes: keyconf-del-input

operations:
  list:
    -
      name: peer-new
      attribute-set: ovpn-peer-new-input
      flags: [ admin-perm ]
      doc: Add a remote peer
      do:
        pre: ovpn-nl-pre-doit
        post: ovpn-nl-post-doit
        request:
          attributes:
            - ifindex
            - peer
    -
      name: peer-set
      attribute-set: ovpn-peer-set-input
      flags: [ admin-perm ]
      doc: modify a remote peer
      do:
        pre: ovpn-nl-pre-doit
        post: ovpn-nl-post-doit
        request:
          attributes:
            - ifindex
            - peer
    -
      name: peer-get
      attribute-set: ovpn
      flags: [ admin-perm ]
      doc: Retrieve data about existing remote peers (or a specific one)
      do:
        pre: ovpn-nl-pre-doit
        post: ovpn-nl-post-doit
        request:
          attributes:
            - ifindex
            - peer
        reply:
          attributes:
            - peer
      dump:
        request:
          attributes:
            - ifindex
        reply:
          attributes:
            - peer
    -
      name: peer-del
      attribute-set: ovpn-peer-del-input
      flags: [ admin-perm ]
      doc: Delete existing remote peer
      do:
        pre: ovpn-nl-pre-doit
        post: ovpn-nl-post-doit
        request:
          attributes:
            - ifindex
            - peer
    -
      name: peer-del-ntf
      doc: Notification about a peer being deleted
      notify: peer-get
      mcgrp: peers
 
    -
      name: key-new
      attribute-set: ovpn
      flags: [ admin-perm ]
      doc: Add a cipher key for a specific peer
      do:
        pre: ovpn-nl-pre-doit
        post: ovpn-nl-post-doit
        request:
          attributes:
            - ifindex
            - keyconf
    -
      name: key-get
      attribute-set: ovpn-keyconf-get
      flags: [ admin-perm ]
      doc: Retrieve non-sensitive data about peer key and cipher
      do:
        pre: ovpn-nl-pre-doit
        post: ovpn-nl-post-doit
        request:
          attributes:
            - ifindex
            - keyconf
        reply:
          attributes:
            - keyconf
    -
      name: key-swap
      attribute-set: ovpn-keyconf-swap-input
      flags: [ admin-perm ]
      doc: Swap primary and secondary session keys for a specific peer
      do:
        pre: ovpn-nl-pre-doit
        post: ovpn-nl-post-doit
        request:
          attributes:
            - ifindex
            - keyconf
    -
      name: key-swap-ntf
      notify: key-get
      doc: >-
        Notification about key having exhausted its IV space and requiring
        renegotiation
      mcgrp: peers
    -
      name: key-del
      attribute-set: ovpn-keyconf-del-input
      flags: [ admin-perm ]
      doc: Delete cipher key for a specific peer
      do:
        pre: ovpn-nl-pre-doit
        post: ovpn-nl-post-doit
        request:
          attributes:
            - ifindex
            - keyconf

mcast-groups:
  list:
    -
      name: peers