Skip to contentSkip to conversation

tools: ynl: use strerror() if no extack of note provided

PATCH Applied Jakub Kicinski 3 participants 3 messages Dec 2, 2023 – Dec 6, 2023

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 tools: ynl: use strerror() if no extack of note provided

If kernel didn't give use any meaningful error - print a strerror() to the ynl error message.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 tools/net/ynl/lib/ynl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/net/ynl/lib/ynl.c +5 -1
index 830d25097009..587286de10b5 100644
@@ -145,8 +145,10 @@ ynl_ext_ack_check(struct ynl_sock *ys, const struct nlmsghdr *nlh,
 	const struct nlattr *attr;
 	const char *str = NULL;
 
-	if (!(nlh->nlmsg_flags & NLM_F_ACK_TLVS))
+	if (!(nlh->nlmsg_flags & NLM_F_ACK_TLVS)) {
+		yerr_msg(ys, "%s", strerror(ys->err.code));
 		return MNL_CB_OK;
+	}
 
 	mnl_attr_for_each(attr, nlh, hlen) {
 		unsigned int len, type;
@@ -249,6 +251,8 @@ ynl_ext_ack_check(struct ynl_sock *ys, const struct nlmsghdr *nlh,
 		yerr_msg(ys, "Kernel %s: %s%s",
 			 ys->err.code ? "error" : "warning",
 			 bad_attr, miss_attr);
+	else
+		yerr_msg(ys, "%s", strerror(ys->err.code));
 
 	return MNL_CB_OK;
 }
Signature · 1 line
2.43.0
#2 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Sat, 2 Dec 2023 13:13:10 -0800 you wrote:

If kernel didn't give use any meaningful error - print a strerror() to the ynl error message.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

[...]

Here is the summary with links:
- [net-next] tools: ynl: use strerror() if no extack of note provided

    https://git.kernel.org/netdev/net-next/c/f2d4d9ad809a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html