Commit f2d4d9ad authored by Jakub Kicinski's avatar Jakub Kicinski

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.
Reviewed-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Link: https://lore.kernel.org/r/20231202211310.342716-1-kuba@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent e136735f
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment