nl-linux 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,169 @@
1
+ # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2
+ ---
3
+ name: tcp_metrics
4
+
5
+ protocol: genetlink-legacy
6
+
7
+ doc: |
8
+ Management interface for TCP metrics.
9
+
10
+ c-family-name: tcp-metrics-genl-name
11
+ c-version-name: tcp-metrics-genl-version
12
+ max-by-define: true
13
+ kernel-policy: global
14
+
15
+ definitions:
16
+ -
17
+ name: tcp-fastopen-cookie-max
18
+ type: const
19
+ value: 16
20
+
21
+ attribute-sets:
22
+ -
23
+ name: tcp-metrics
24
+ name-prefix: tcp-metrics-attr-
25
+ attributes:
26
+ -
27
+ name: addr-ipv4
28
+ type: u32
29
+ byte-order: big-endian
30
+ display-hint: ipv4
31
+ -
32
+ name: addr-ipv6
33
+ type: binary
34
+ checks:
35
+ min-len: 16
36
+ byte-order: big-endian
37
+ display-hint: ipv6
38
+ -
39
+ name: age
40
+ type: u64
41
+ -
42
+ name: tw-tsval
43
+ type: u32
44
+ doc: unused
45
+ -
46
+ name: tw-ts-stamp
47
+ type: s32
48
+ doc: unused
49
+ -
50
+ name: vals
51
+ type: nest
52
+ nested-attributes: metrics
53
+ -
54
+ name: fopen-mss
55
+ type: u16
56
+ -
57
+ name: fopen-syn-drops
58
+ type: u16
59
+ -
60
+ name: fopen-syn-drop-ts
61
+ type: u64
62
+ -
63
+ name: fopen-cookie
64
+ type: binary
65
+ checks:
66
+ min-len: tcp-fastopen-cookie-max
67
+ -
68
+ name: saddr-ipv4
69
+ type: u32
70
+ byte-order: big-endian
71
+ display-hint: ipv4
72
+ -
73
+ name: saddr-ipv6
74
+ type: binary
75
+ checks:
76
+ min-len: 16
77
+ byte-order: big-endian
78
+ display-hint: ipv6
79
+ -
80
+ name: pad
81
+ type: pad
82
+
83
+ -
84
+ name: metrics
85
+ # Intentionally don't define the name-prefix, see below.
86
+ doc: |
87
+ Attributes with metrics. Note that the values here do not match
88
+ the TCP_METRIC_* defines in the kernel, because kernel defines
89
+ are off-by one (e.g. rtt is defined as enum 0, while netlink carries
90
+ attribute type 1).
91
+ attributes:
92
+ -
93
+ name: rtt
94
+ type: u32
95
+ doc: |
96
+ Round Trip Time (RTT), in msecs with 3 bits fractional
97
+ (left-shift by 3 to get the msec value).
98
+ -
99
+ name: rttvar
100
+ type: u32
101
+ doc: |
102
+ Round Trip Time VARiance (RTT), in msecs with 2 bits fractional
103
+ (left-shift by 2 to get the msec value).
104
+ -
105
+ name: ssthresh
106
+ type: u32
107
+ doc: Slow Start THRESHold.
108
+ -
109
+ name: cwnd
110
+ type: u32
111
+ doc: Congestion Window.
112
+ -
113
+ name: reodering
114
+ type: u32
115
+ doc: Reodering metric.
116
+ -
117
+ name: rtt-us
118
+ type: u32
119
+ doc: |
120
+ Round Trip Time (RTT), in usecs, with 3 bits fractional
121
+ (left-shift by 3 to get the msec value).
122
+ -
123
+ name: rttvar-us
124
+ type: u32
125
+ doc: |
126
+ Round Trip Time (RTT), in usecs, with 2 bits fractional
127
+ (left-shift by 3 to get the msec value).
128
+
129
+ operations:
130
+ list:
131
+ -
132
+ name: get
133
+ doc: Retrieve metrics.
134
+ attribute-set: tcp-metrics
135
+
136
+ dont-validate: [strict, dump]
137
+
138
+ do:
139
+ request: &sel_attrs
140
+ attributes:
141
+ - addr-ipv4
142
+ - addr-ipv6
143
+ - saddr-ipv4
144
+ - saddr-ipv6
145
+ reply: &all_attrs
146
+ attributes:
147
+ - addr-ipv4
148
+ - addr-ipv6
149
+ - saddr-ipv4
150
+ - saddr-ipv6
151
+ - age
152
+ - vals
153
+ - fopen-mss
154
+ - fopen-syn-drops
155
+ - fopen-syn-drop-ts
156
+ - fopen-cookie
157
+ dump:
158
+ reply: *all_attrs
159
+
160
+ -
161
+ name: del
162
+ doc: Delete metrics.
163
+ attribute-set: tcp-metrics
164
+
165
+ dont-validate: [strict, dump]
166
+ flags: [admin-perm]
167
+
168
+ do:
169
+ request: *sel_attrs
data/linux/team.yaml ADDED
@@ -0,0 +1,206 @@
1
+ # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2
+ ---
3
+ name: team
4
+
5
+ protocol: genetlink-legacy
6
+
7
+ doc: |
8
+ Network team device driver.
9
+
10
+ c-family-name: team-genl-name
11
+ c-version-name: team-genl-version
12
+ kernel-policy: global
13
+ uapi-header: linux/if_team.h
14
+
15
+ definitions:
16
+ -
17
+ name: string-max-len
18
+ type: const
19
+ value: 32
20
+ -
21
+ name: genl-change-event-mc-grp-name
22
+ type: const
23
+ value: change_event
24
+
25
+ attribute-sets:
26
+ -
27
+ name: team
28
+ doc: |
29
+ The team nested layout of get/set msg looks like::
30
+
31
+ [TEAM_ATTR_LIST_OPTION]
32
+ [TEAM_ATTR_ITEM_OPTION]
33
+ [TEAM_ATTR_OPTION_*], ...
34
+ [TEAM_ATTR_ITEM_OPTION]
35
+ [TEAM_ATTR_OPTION_*], ...
36
+ ...
37
+ [TEAM_ATTR_LIST_PORT]
38
+ [TEAM_ATTR_ITEM_PORT]
39
+ [TEAM_ATTR_PORT_*], ...
40
+ [TEAM_ATTR_ITEM_PORT]
41
+ [TEAM_ATTR_PORT_*], ...
42
+ ...
43
+
44
+ name-prefix: team-attr-
45
+ attributes:
46
+ -
47
+ name: unspec
48
+ type: unused
49
+ value: 0
50
+ -
51
+ name: team-ifindex
52
+ type: u32
53
+ -
54
+ name: list-option
55
+ type: nest
56
+ nested-attributes: item-option
57
+ -
58
+ name: list-port
59
+ type: nest
60
+ nested-attributes: item-port
61
+ -
62
+ name: item-option
63
+ name-prefix: team-attr-item-
64
+ attr-cnt-name: __team-attr-item-option-max
65
+ attr-max-name: team-attr-item-option-max
66
+ attributes:
67
+ -
68
+ name: option-unspec
69
+ type: unused
70
+ value: 0
71
+ -
72
+ name: option
73
+ type: nest
74
+ nested-attributes: attr-option
75
+ -
76
+ name: attr-option
77
+ name-prefix: team-attr-option-
78
+ attributes:
79
+ -
80
+ name: unspec
81
+ type: unused
82
+ value: 0
83
+ -
84
+ name: name
85
+ type: string
86
+ checks:
87
+ max-len: string-max-len
88
+ unterminated-ok: true
89
+ -
90
+ name: changed
91
+ type: flag
92
+ -
93
+ name: type
94
+ type: u8
95
+ -
96
+ name: data
97
+ type: binary
98
+ -
99
+ name: removed
100
+ type: flag
101
+ -
102
+ name: port-ifindex
103
+ type: u32
104
+ doc: for per-port options
105
+ -
106
+ name: array-index
107
+ type: u32
108
+ doc: for array options
109
+ -
110
+ name: item-port
111
+ name-prefix: team-attr-item-
112
+ attr-cnt-name: __team-attr-item-port-max
113
+ attr-max-name: team-attr-item-port-max
114
+ attributes:
115
+ -
116
+ name: port-unspec
117
+ type: unused
118
+ value: 0
119
+ -
120
+ name: port
121
+ type: nest
122
+ nested-attributes: attr-port
123
+ -
124
+ name: attr-port
125
+ name-prefix: team-attr-port-
126
+ attributes:
127
+ -
128
+ name: unspec
129
+ type: unused
130
+ value: 0
131
+ -
132
+ name: ifindex
133
+ type: u32
134
+ -
135
+ name: changed
136
+ type: flag
137
+ -
138
+ name: linkup
139
+ type: flag
140
+ -
141
+ name: speed
142
+ type: u32
143
+ -
144
+ name: duplex
145
+ type: u8
146
+ -
147
+ name: removed
148
+ type: flag
149
+
150
+ operations:
151
+ list:
152
+ -
153
+ name: noop
154
+ doc: No operation
155
+ value: 0
156
+ attribute-set: team
157
+ dont-validate: [strict]
158
+
159
+ do:
160
+ # Actually it only reply the team netlink family
161
+ reply:
162
+ attributes:
163
+ - team-ifindex
164
+
165
+ -
166
+ name: options-set
167
+ doc: Set team options
168
+ attribute-set: team
169
+ dont-validate: [strict]
170
+ flags: [admin-perm]
171
+
172
+ do:
173
+ request: &option_attrs
174
+ attributes:
175
+ - team-ifindex
176
+ - list-option
177
+ reply: *option_attrs
178
+
179
+ -
180
+ name: options-get
181
+ doc: Get team options info
182
+ attribute-set: team
183
+ dont-validate: [strict]
184
+ flags: [admin-perm]
185
+
186
+ do:
187
+ request:
188
+ attributes:
189
+ - team-ifindex
190
+ reply: *option_attrs
191
+
192
+ -
193
+ name: port-list-get
194
+ doc: Get team ports info
195
+ attribute-set: team
196
+ dont-validate: [strict]
197
+ flags: [admin-perm]
198
+
199
+ do:
200
+ request:
201
+ attributes:
202
+ - team-ifindex
203
+ reply: &port_attrs
204
+ attributes:
205
+ - team-ifindex
206
+ - list-port
@@ -0,0 +1,298 @@
1
+ # SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2
+ ---
3
+ name: wireguard
4
+ protocol: genetlink-legacy
5
+
6
+ doc: |
7
+ **Netlink protocol to control WireGuard network devices.**
8
+
9
+ The below enums and macros are for interfacing with WireGuard, using generic
10
+ netlink, with family ``WG_GENL_NAME`` and version ``WG_GENL_VERSION``. It
11
+ defines two commands: get and set. Note that while they share many common
12
+ attributes, these two commands actually accept a slightly different set of
13
+ inputs and outputs. These differences are noted under the individual
14
+ attributes.
15
+ c-family-name: wg-genl-name
16
+ c-version-name: wg-genl-version
17
+ max-by-define: true
18
+
19
+ definitions:
20
+ -
21
+ name-prefix: wg-
22
+ name: key-len
23
+ type: const
24
+ value: 32
25
+ -
26
+ name: --kernel-timespec
27
+ type: struct
28
+ header: linux/time_types.h
29
+ members:
30
+ -
31
+ name: sec
32
+ type: u64
33
+ doc: Number of seconds, since UNIX epoch.
34
+ -
35
+ name: nsec
36
+ type: u64
37
+ doc: Number of nanoseconds, after the second began.
38
+ -
39
+ name: wgdevice-flags
40
+ name-prefix: wgdevice-f-
41
+ enum-name: wgdevice-flag
42
+ type: flags
43
+ entries:
44
+ - replace-peers
45
+ -
46
+ name: wgpeer-flags
47
+ name-prefix: wgpeer-f-
48
+ enum-name: wgpeer-flag
49
+ type: flags
50
+ entries:
51
+ - remove-me
52
+ - replace-allowedips
53
+ - update-only
54
+ -
55
+ name: wgallowedip-flags
56
+ name-prefix: wgallowedip-f-
57
+ enum-name: wgallowedip-flag
58
+ type: flags
59
+ entries:
60
+ - remove-me
61
+
62
+ attribute-sets:
63
+ -
64
+ name: wgdevice
65
+ enum-name: wgdevice-attribute
66
+ name-prefix: wgdevice-a-
67
+ attr-cnt-name: --wgdevice-a-last
68
+ attributes:
69
+ -
70
+ name: unspec
71
+ type: unused
72
+ value: 0
73
+ -
74
+ name: ifindex
75
+ type: u32
76
+ -
77
+ name: ifname
78
+ type: string
79
+ checks:
80
+ max-len: 15
81
+ -
82
+ name: private-key
83
+ type: binary
84
+ doc: Set to all zeros to remove.
85
+ display-hint: hex
86
+ checks:
87
+ exact-len: wg-key-len
88
+ -
89
+ name: public-key
90
+ type: binary
91
+ display-hint: hex
92
+ checks:
93
+ exact-len: wg-key-len
94
+ -
95
+ name: flags
96
+ type: u32
97
+ doc: |
98
+ ``0`` or ``WGDEVICE_F_REPLACE_PEERS`` if all current peers should be
99
+ removed prior to adding the list below.
100
+ enum: wgdevice-flags
101
+ -
102
+ name: listen-port
103
+ type: u16
104
+ doc: Set as ``0`` to choose randomly.
105
+ -
106
+ name: fwmark
107
+ type: u32
108
+ doc: Set as ``0`` to disable.
109
+ -
110
+ name: peers
111
+ type: indexed-array
112
+ sub-type: nest
113
+ nested-attributes: wgpeer
114
+ doc: |
115
+ The index/type parameter is unused on ``SET_DEVICE`` operations and is
116
+ zero on ``GET_DEVICE`` operations.
117
+ -
118
+ name: wgpeer
119
+ enum-name: wgpeer-attribute
120
+ name-prefix: wgpeer-a-
121
+ attr-cnt-name: --wgpeer-a-last
122
+ attributes:
123
+ -
124
+ name: unspec
125
+ type: unused
126
+ value: 0
127
+ -
128
+ name: public-key
129
+ type: binary
130
+ display-hint: hex
131
+ checks:
132
+ exact-len: wg-key-len
133
+ -
134
+ name: preshared-key
135
+ type: binary
136
+ doc: Set as all zeros to remove.
137
+ display-hint: hex
138
+ checks:
139
+ exact-len: wg-key-len
140
+ -
141
+ name: flags
142
+ type: u32
143
+ doc: |
144
+ ``0`` and/or ``WGPEER_F_REMOVE_ME`` if the specified peer should not
145
+ exist at the end of the operation, rather than added/updated and/or
146
+ ``WGPEER_F_REPLACE_ALLOWEDIPS`` if all current allowed IPs of this
147
+ peer should be removed prior to adding the list below and/or
148
+ ``WGPEER_F_UPDATE_ONLY`` if the peer should only be set if it already
149
+ exists.
150
+ enum: wgpeer-flags
151
+ -
152
+ name: endpoint
153
+ type: binary
154
+ doc: struct sockaddr_in or struct sockaddr_in6
155
+ checks:
156
+ min-len: 16
157
+ -
158
+ name: persistent-keepalive-interval
159
+ type: u16
160
+ doc: Set as ``0`` to disable.
161
+ -
162
+ name: last-handshake-time
163
+ type: binary
164
+ struct: --kernel-timespec
165
+ checks:
166
+ exact-len: 16
167
+ -
168
+ name: rx-bytes
169
+ type: u64
170
+ -
171
+ name: tx-bytes
172
+ type: u64
173
+ -
174
+ name: allowedips
175
+ type: indexed-array
176
+ sub-type: nest
177
+ nested-attributes: wgallowedip
178
+ doc: |
179
+ The index/type parameter is unused on ``SET_DEVICE`` operations and is
180
+ zero on ``GET_DEVICE`` operations.
181
+ -
182
+ name: protocol-version
183
+ type: u32
184
+ doc: |
185
+ Should not be set or used at all by most users of this API, as the
186
+ most recent protocol will be used when this is unset. Otherwise,
187
+ must be set to ``1``.
188
+ -
189
+ name: wgallowedip
190
+ enum-name: wgallowedip-attribute
191
+ name-prefix: wgallowedip-a-
192
+ attr-cnt-name: --wgallowedip-a-last
193
+ attributes:
194
+ -
195
+ name: unspec
196
+ type: unused
197
+ value: 0
198
+ -
199
+ name: family
200
+ type: u16
201
+ doc: IP family, either ``AF_INET`` or ``AF_INET6``.
202
+ -
203
+ name: ipaddr
204
+ type: binary
205
+ doc: Either ``struct in_addr`` or ``struct in6_addr``.
206
+ display-hint: ipv4-or-v6
207
+ checks:
208
+ min-len: 4
209
+ -
210
+ name: cidr-mask
211
+ type: u8
212
+ -
213
+ name: flags
214
+ type: u32
215
+ doc: |
216
+ ``WGALLOWEDIP_F_REMOVE_ME`` if the specified IP should be removed;
217
+ otherwise, this IP will be added if it is not already present.
218
+ enum: wgallowedip-flags
219
+
220
+ operations:
221
+ enum-name: wg-cmd
222
+ name-prefix: wg-cmd-
223
+ list:
224
+ -
225
+ name: get-device
226
+ value: 0
227
+ doc: |
228
+ Retrieve WireGuard device
229
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
230
+
231
+ The command should be called with one but not both of:
232
+
233
+ - ``WGDEVICE_A_IFINDEX``
234
+ - ``WGDEVICE_A_IFNAME``
235
+
236
+ The kernel will then return several messages (``NLM_F_MULTI``). It is
237
+ possible that all of the allowed IPs of a single peer will not fit
238
+ within a single netlink message. In that case, the same peer will be
239
+ written in the following message, except it will only contain
240
+ ``WGPEER_A_PUBLIC_KEY`` and ``WGPEER_A_ALLOWEDIPS``. This may occur
241
+ several times in a row for the same peer. It is then up to the receiver
242
+ to coalesce adjacent peers. Likewise, it is possible that all peers will
243
+ not fit within a single message. So, subsequent peers will be sent in
244
+ following messages, except those will only contain ``WGDEVICE_A_IFNAME``
245
+ and ``WGDEVICE_A_PEERS``. It is then up to the receiver to coalesce
246
+ these messages to form the complete list of peers.
247
+
248
+ Since this is an ``NLA_F_DUMP`` command, the final message will always
249
+ be ``NLMSG_DONE``, even if an error occurs. However, this ``NLMSG_DONE``
250
+ message contains an integer error code. It is either zero or a negative
251
+ error code corresponding to the errno.
252
+ attribute-set: wgdevice
253
+ flags: [uns-admin-perm]
254
+
255
+ dump:
256
+ pre: wg-get-device-start
257
+ post: wg-get-device-done
258
+ request:
259
+ attributes:
260
+ - ifindex
261
+ - ifname
262
+ reply: &all-attrs
263
+ attributes:
264
+ - ifindex
265
+ - ifname
266
+ - private-key
267
+ - public-key
268
+ - flags
269
+ - listen-port
270
+ - fwmark
271
+ - peers
272
+ -
273
+ name: set-device
274
+ value: 1
275
+ doc: |
276
+ Set WireGuard device
277
+ ~~~~~~~~~~~~~~~~~~~~
278
+
279
+ This command should be called with a wgdevice set, containing one but
280
+ not both of ``WGDEVICE_A_IFINDEX`` and ``WGDEVICE_A_IFNAME``.
281
+
282
+ It is possible that the amount of configuration data exceeds that of the
283
+ maximum message length accepted by the kernel. In that case, several
284
+ messages should be sent one after another, with each successive one
285
+ filling in information not contained in the prior. Note that if
286
+ ``WGDEVICE_F_REPLACE_PEERS`` is specified in the first message, it
287
+ probably should not be specified in fragments that come after, so that
288
+ the list of peers is only cleared the first time but appended after.
289
+ Likewise for peers, if ``WGPEER_F_REPLACE_ALLOWEDIPS`` is specified in
290
+ the first message of a peer, it likely should not be specified in
291
+ subsequent fragments.
292
+
293
+ If an error occurs, ``NLMSG_ERROR`` will reply containing an errno.
294
+ attribute-set: wgdevice
295
+ flags: [uns-admin-perm]
296
+
297
+ do:
298
+ request: *all-attrs