diff options
author | Jakub Kicinski <kuba@kernel.org> | 2023-12-02 13:13:10 -0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-12-05 20:08:13 -0800 |
commit | f2d4d9ad809a1c7173ce66c47cd45e11184a554c (patch) | |
tree | 4b3cba76ae42db42ec8077c86e0eade51ecb8e89 /tools/net | |
parent | e136735f0c263b8bb9572ff8d35d8d5bc9fd9b66 (diff) |
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: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Link: https://lore.kernel.org/r/20231202211310.342716-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/net')
-rw-r--r-- | tools/net/ynl/lib/ynl.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/net/ynl/lib/ynl.c b/tools/net/ynl/lib/ynl.c index 830d25097009..587286de10b5 100644 --- a/tools/net/ynl/lib/ynl.c +++ b/tools/net/ynl/lib/ynl.c @@ -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; } |