aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/uapi/linux/netlink.h
diff options
context:
space:
mode:
authorJamal Hadi Salim <jhs@mojatatu.com>2017-07-30 13:24:49 -0400
committerDavid S. Miller <davem@davemloft.net>2017-07-30 19:28:08 -0700
commit64c83d837329531252a1a0f0dfdd4fd607e1d8e9 (patch)
treea764214643c24db912ab942efd1aa47365d179c9 /include/uapi/linux/netlink.h
parentnet: fec: Allow reception of frames bigger than 1522 bytes (diff)
downloadwireguard-linux-64c83d837329531252a1a0f0dfdd4fd607e1d8e9.tar.xz
wireguard-linux-64c83d837329531252a1a0f0dfdd4fd607e1d8e9.zip
net netlink: Add new type NLA_BITFIELD32
Generic bitflags attribute content sent to the kernel by user. With this netlink attr type the user can either set or unset a flag in the kernel. The value is a bitmap that defines the bit values being set The selector is a bitmask that defines which value bit is to be considered. A check is made to ensure the rules that a kernel subsystem always conforms to bitflags the kernel already knows about. i.e if the user tries to set a bit flag that is not understood then the _it will be rejected_. In the most basic form, the user specifies the attribute policy as: [ATTR_GOO] = { .type = NLA_BITFIELD32, .validation_data = &myvalidflags }, where myvalidflags is the bit mask of the flags the kernel understands. If the user _does not_ provide myvalidflags then the attribute will also be rejected. Examples: value = 0x0, and selector = 0x1 implies we are selecting bit 1 and we want to set its value to 0. value = 0x2, and selector = 0x2 implies we are selecting bit 2 and we want to set its value to 1. Suggested-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/uapi/linux/netlink.h')
-rw-r--r--include/uapi/linux/netlink.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h
index f86127a46cfc..f4fc9c9e123d 100644
--- a/include/uapi/linux/netlink.h
+++ b/include/uapi/linux/netlink.h
@@ -226,5 +226,22 @@ struct nlattr {
#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
+/* Generic 32 bitflags attribute content sent to the kernel.
+ *
+ * The value is a bitmap that defines the values being set
+ * The selector is a bitmask that defines which value is legit
+ *
+ * Examples:
+ * value = 0x0, and selector = 0x1
+ * implies we are selecting bit 1 and we want to set its value to 0.
+ *
+ * value = 0x2, and selector = 0x2
+ * implies we are selecting bit 2 and we want to set its value to 1.
+ *
+ */
+struct nla_bitfield32 {
+ __u32 value;
+ __u32 selector;
+};
#endif /* _UAPI__LINUX_NETLINK_H */