From 46f0acba8141c8d49a8b2358f6436779e486d150 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 17 May 2022 20:15:57 +0200 Subject: netlink: add NLA_F_NESTED to all nested attributes Newer generic netlink APIs (e.g. wireguard) require this to be able to parse nested attributes Signed-off-by: Felix Fietkau --- include/netlink/attr.h | 2 +- include/netlink/netlink-kernel.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/netlink/attr.h b/include/netlink/attr.h index bcfbf07..3e3047f 100644 --- a/include/netlink/attr.h +++ b/include/netlink/attr.h @@ -495,7 +495,7 @@ static inline struct nlattr *nla_nest_start(struct nl_msg *msg, int attrtype) { struct nlattr *start = (struct nlattr *) nlmsg_tail(msg->nm_nlh); - if (nla_put(msg, attrtype, 0, NULL) < 0) + if (nla_put(msg, attrtype | NLA_F_NESTED, 0, NULL) < 0) return NULL; return start; diff --git a/include/netlink/netlink-kernel.h b/include/netlink/netlink-kernel.h index a0f5535..026a914 100644 --- a/include/netlink/netlink-kernel.h +++ b/include/netlink/netlink-kernel.h @@ -175,6 +175,8 @@ struct nlmsghdr /** @} */ +#define NLA_F_NESTED (1 << 15) + /** * Netlink error message * @ingroup msg -- cgit v1.2.1