b2c04a8fab
Prior to this commit, the Ansible bootstrap procedure on StarlingX would fail with drbd-related errors when a v5.10-based kernel was in use. The error reported by the kernel was "invalid argument". Upon further debugging, it was discovered that generic-netlink (genl) messages generated by drbdsetup would be rejected by the v5.10 kernel. After looking at the git history of the drbd-utils repository, the following two commits were found: $ git log -2 --pretty=ref 859151b228d3b3aacefb09d06d515a2589c22e35 859151b228d3 (netlink: Add NLA_F_NESTED flag to nested attribute, 2019-07-12) 92ade5989027 (netlink: prepare for kernel v5.2, 2019-07-12) This issue appears to be caused by kernel versions >= 5.2 being more strict with the validation of nested netlink attributes. The patches required very minor context adjustments and enable the Ansible bootstrap procedure to succeed. Story: 2008921 Task: 42787 Change-Id: I573d0caafc741c7668be8ee8e494fde826437a98 Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
50 lines
1.5 KiB
Diff
50 lines
1.5 KiB
Diff
From 062ec873e733d278c9024be3783f59c532333b75 Mon Sep 17 00:00:00 2001
|
|
From: He Zhe <zhe.he@windriver.com>
|
|
Date: Fri, 12 Jul 2019 15:07:27 +0800
|
|
Subject: [PATCH] netlink: Add NLA_F_NESTED flag to nested attribute
|
|
|
|
The mainline kernel v5.2 commit b424e432e770
|
|
("netlink: add validation of NLA_F_NESTED flag") imposes strict validation
|
|
against nested attribute as follow.
|
|
|
|
"
|
|
Add new validation flag NL_VALIDATE_NESTED which adds three consistency
|
|
checks of NLA_F_NESTED_FLAG:
|
|
|
|
- the flag is set on attributes with NLA_NESTED{,_ARRAY} policy
|
|
- the flag is not set on attributes with other policies except NLA_UNSPEC
|
|
- the flag is set on attribute passed to nla_parse_nested()
|
|
"
|
|
|
|
Sending messages with nested attribute without NLA_F_NESTED would cause failed
|
|
validation. For example,
|
|
|
|
$ drbdsetup new-resource r0
|
|
Invalid argument
|
|
|
|
This patch adds NLA_F_NESTED flag to all nested attributes.
|
|
|
|
Signed-off-by: He Zhe <zhe.he@windriver.com>
|
|
[mvb: Adapted to drbd-utils 8.4.3.]
|
|
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
|
|
---
|
|
user/libgenl.h | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/user/libgenl.h b/user/libgenl.h
|
|
index b1c3eab345ec..3b1146109772 100644
|
|
--- a/user/libgenl.h
|
|
+++ b/user/libgenl.h
|
|
@@ -851,7 +851,7 @@ static inline struct nlattr *nla_nest_start(struct msg_buff *msg, int attrtype)
|
|
{
|
|
struct nlattr *start = (struct nlattr *)msg->tail;
|
|
|
|
- if (nla_put(msg, attrtype, 0, NULL) < 0)
|
|
+ if (nla_put(msg, attrtype | NLA_F_NESTED, 0, NULL) < 0)
|
|
return NULL;
|
|
|
|
return start;
|
|
--
|
|
2.29.2
|
|
|