summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-07-23 10:32:07 +0200
committerThomas Haller <thaller@redhat.com>2019-07-23 10:32:08 +0200
commitf281fb40bb2be36ab77f94d308a19fdb70ddca4d (patch)
tree6a96af2fd46a69ee924f1840a1139a3f2d9c30af
parent8f8a1990ce1955226ac51d8bb1927caad4561b4d (diff)
downloadNetworkManager-th/platform-netlink-nested-flag.tar.gz
platform/netlink: mark nested netlink attribute with NLA_F_NESTEDth/platform-netlink-nested-flag
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
-rw-r--r--src/platform/nm-netlink.c2
1 files changed, 1 insertions, 1 deletions
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;