From f281fb40bb2be36ab77f94d308a19fdb70ddca4d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 23 Jul 2019 10:32:07 +0200 Subject: platform/netlink: mark nested netlink attribute with NLA_F_NESTED Kernel 5.2 is starting to add more strict checking for the netlink message. In particular, for certain API it checks now that NLA_F_NESTED flag is set for nested attributes ([1]). Note that libnl3 does not ever set this flag, and since our netlink implementation is copied from there, certain netlink messages are now rejected as invalid. On the other hand, libmnl always adds this flag ([2]). So we should do that as well. In particular, this affects the WireGuard netlink API ([3]). [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b424e432e770d6dd572765459d5b6a96a19c5286 [2] https://git.netfilter.org/libmnl/tree/src/attr.c?id=5937dfcb0185f5cb9cf275992ea701ec4e619d9c#n535 [3] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/212 --- src/platform/nm-netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/nm-netlink.c b/src/platform/nm-netlink.c index fae62fec35..da009d01c1 100644 --- a/src/platform/nm-netlink.c +++ b/src/platform/nm-netlink.c @@ -509,7 +509,7 @@ 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, NLA_F_NESTED | attrtype, 0, NULL) < 0) return NULL; return start; -- cgit v1.2.1