hc
2024-05-10 10ebd8556b7990499c896a550e3d416b444211e6
kernel/include/uapi/linux/netlink.h
....@@ -20,7 +20,7 @@
2020 #define NETLINK_CONNECTOR 11
2121 #define NETLINK_NETFILTER 12 /* netfilter subsystem */
2222 #define NETLINK_IP6_FW 13
23
-#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
23
+#define NETLINK_DNRTMSG 14 /* DECnet routing messages (obsolete) */
2424 #define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
2525 #define NETLINK_GENERIC 16
2626 /* leave room for NETLINK_DM (DM Events) */
....@@ -129,6 +129,7 @@
129129 * @NLMSGERR_ATTR_COOKIE: arbitrary subsystem specific cookie to
130130 * be used - in the success case - to identify a created
131131 * object or operation or similar (binary)
132
+ * @NLMSGERR_ATTR_POLICY: policy for a rejected attribute
132133 * @__NLMSGERR_ATTR_MAX: number of attributes
133134 * @NLMSGERR_ATTR_MAX: highest attribute number
134135 */
....@@ -137,6 +138,7 @@
137138 NLMSGERR_ATTR_MSG,
138139 NLMSGERR_ATTR_OFFS,
139140 NLMSGERR_ATTR_COOKIE,
141
+ NLMSGERR_ATTR_POLICY,
140142
141143 __NLMSGERR_ATTR_MAX,
142144 NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1
....@@ -155,6 +157,7 @@
155157 #define NETLINK_LIST_MEMBERSHIPS 9
156158 #define NETLINK_CAP_ACK 10
157159 #define NETLINK_EXT_ACK 11
160
+#define NETLINK_GET_STRICT_CHK 12
158161
159162 struct nl_pktinfo {
160163 __u32 group;
....@@ -248,4 +251,109 @@
248251 __u32 selector;
249252 };
250253
254
+/*
255
+ * policy descriptions - it's specific to each family how this is used
256
+ * Normally, it should be retrieved via a dump inside another attribute
257
+ * specifying where it applies.
258
+ */
259
+
260
+/**
261
+ * enum netlink_attribute_type - type of an attribute
262
+ * @NL_ATTR_TYPE_INVALID: unused
263
+ * @NL_ATTR_TYPE_FLAG: flag attribute (present/not present)
264
+ * @NL_ATTR_TYPE_U8: 8-bit unsigned attribute
265
+ * @NL_ATTR_TYPE_U16: 16-bit unsigned attribute
266
+ * @NL_ATTR_TYPE_U32: 32-bit unsigned attribute
267
+ * @NL_ATTR_TYPE_U64: 64-bit unsigned attribute
268
+ * @NL_ATTR_TYPE_S8: 8-bit signed attribute
269
+ * @NL_ATTR_TYPE_S16: 16-bit signed attribute
270
+ * @NL_ATTR_TYPE_S32: 32-bit signed attribute
271
+ * @NL_ATTR_TYPE_S64: 64-bit signed attribute
272
+ * @NL_ATTR_TYPE_BINARY: binary data, min/max length may be specified
273
+ * @NL_ATTR_TYPE_STRING: string, min/max length may be specified
274
+ * @NL_ATTR_TYPE_NUL_STRING: NUL-terminated string,
275
+ * min/max length may be specified
276
+ * @NL_ATTR_TYPE_NESTED: nested, i.e. the content of this attribute
277
+ * consists of sub-attributes. The nested policy and maxtype
278
+ * inside may be specified.
279
+ * @NL_ATTR_TYPE_NESTED_ARRAY: nested array, i.e. the content of this
280
+ * attribute contains sub-attributes whose type is irrelevant
281
+ * (just used to separate the array entries) and each such array
282
+ * entry has attributes again, the policy for those inner ones
283
+ * and the corresponding maxtype may be specified.
284
+ * @NL_ATTR_TYPE_BITFIELD32: &struct nla_bitfield32 attribute
285
+ */
286
+enum netlink_attribute_type {
287
+ NL_ATTR_TYPE_INVALID,
288
+
289
+ NL_ATTR_TYPE_FLAG,
290
+
291
+ NL_ATTR_TYPE_U8,
292
+ NL_ATTR_TYPE_U16,
293
+ NL_ATTR_TYPE_U32,
294
+ NL_ATTR_TYPE_U64,
295
+
296
+ NL_ATTR_TYPE_S8,
297
+ NL_ATTR_TYPE_S16,
298
+ NL_ATTR_TYPE_S32,
299
+ NL_ATTR_TYPE_S64,
300
+
301
+ NL_ATTR_TYPE_BINARY,
302
+ NL_ATTR_TYPE_STRING,
303
+ NL_ATTR_TYPE_NUL_STRING,
304
+
305
+ NL_ATTR_TYPE_NESTED,
306
+ NL_ATTR_TYPE_NESTED_ARRAY,
307
+
308
+ NL_ATTR_TYPE_BITFIELD32,
309
+};
310
+
311
+/**
312
+ * enum netlink_policy_type_attr - policy type attributes
313
+ * @NL_POLICY_TYPE_ATTR_UNSPEC: unused
314
+ * @NL_POLICY_TYPE_ATTR_TYPE: type of the attribute,
315
+ * &enum netlink_attribute_type (U32)
316
+ * @NL_POLICY_TYPE_ATTR_MIN_VALUE_S: minimum value for signed
317
+ * integers (S64)
318
+ * @NL_POLICY_TYPE_ATTR_MAX_VALUE_S: maximum value for signed
319
+ * integers (S64)
320
+ * @NL_POLICY_TYPE_ATTR_MIN_VALUE_U: minimum value for unsigned
321
+ * integers (U64)
322
+ * @NL_POLICY_TYPE_ATTR_MAX_VALUE_U: maximum value for unsigned
323
+ * integers (U64)
324
+ * @NL_POLICY_TYPE_ATTR_MIN_LENGTH: minimum length for binary
325
+ * attributes, no minimum if not given (U32)
326
+ * @NL_POLICY_TYPE_ATTR_MAX_LENGTH: maximum length for binary
327
+ * attributes, no maximum if not given (U32)
328
+ * @NL_POLICY_TYPE_ATTR_POLICY_IDX: sub policy for nested and
329
+ * nested array types (U32)
330
+ * @NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE: maximum sub policy
331
+ * attribute for nested and nested array types, this can
332
+ * in theory be < the size of the policy pointed to by
333
+ * the index, if limited inside the nesting (U32)
334
+ * @NL_POLICY_TYPE_ATTR_BITFIELD32_MASK: valid mask for the
335
+ * bitfield32 type (U32)
336
+ * @NL_POLICY_TYPE_ATTR_MASK: mask of valid bits for unsigned integers (U64)
337
+ * @NL_POLICY_TYPE_ATTR_PAD: pad attribute for 64-bit alignment
338
+ */
339
+enum netlink_policy_type_attr {
340
+ NL_POLICY_TYPE_ATTR_UNSPEC,
341
+ NL_POLICY_TYPE_ATTR_TYPE,
342
+ NL_POLICY_TYPE_ATTR_MIN_VALUE_S,
343
+ NL_POLICY_TYPE_ATTR_MAX_VALUE_S,
344
+ NL_POLICY_TYPE_ATTR_MIN_VALUE_U,
345
+ NL_POLICY_TYPE_ATTR_MAX_VALUE_U,
346
+ NL_POLICY_TYPE_ATTR_MIN_LENGTH,
347
+ NL_POLICY_TYPE_ATTR_MAX_LENGTH,
348
+ NL_POLICY_TYPE_ATTR_POLICY_IDX,
349
+ NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE,
350
+ NL_POLICY_TYPE_ATTR_BITFIELD32_MASK,
351
+ NL_POLICY_TYPE_ATTR_PAD,
352
+ NL_POLICY_TYPE_ATTR_MASK,
353
+
354
+ /* keep last */
355
+ __NL_POLICY_TYPE_ATTR_MAX,
356
+ NL_POLICY_TYPE_ATTR_MAX = __NL_POLICY_TYPE_ATTR_MAX - 1
357
+};
358
+
251359 #endif /* _UAPI__LINUX_NETLINK_H */