diff options
author | Moshe Shemesh <moshe@mellanox.com> | 2019-06-11 19:11:09 +0300 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2019-06-12 08:43:14 -0700 |
commit | c934da8aaacb015e08ac8abbbd0aa696a7ef19fd (patch) | |
tree | 77b5c841daaad98b12a94ede1949e060d32f215f /devlink/mnlg.c | |
parent | ba126dcad20e6d0e472586541d78bdd1ac4f1123 (diff) |
devlink: mnlg: Catch returned error value of dumpit commands
Devlink commands which implements the dumpit callback may return error.
The netlink function netlink_dump() sends the errno value as the payload
of the message, while answering user space with NLMSG_DONE.
To enable receiving errno value for dumpit commands we have to check for
it in the message. If it is a negative value then the dump returned an
error so we should set errno accordingly and check for ext_ack in case
it was set.
Fixes: 049c58539f5d ("devlink: mnlg: Add support for extended ack")
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Diffstat (limited to 'devlink/mnlg.c')
-rw-r--r-- | devlink/mnlg.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/devlink/mnlg.c b/devlink/mnlg.c index 37cc25dd..ee125df0 100644 --- a/devlink/mnlg.c +++ b/devlink/mnlg.c @@ -85,6 +85,13 @@ static int mnlg_cb_error(const struct nlmsghdr *nlh, void *data) static int mnlg_cb_stop(const struct nlmsghdr *nlh, void *data) { + int len = *(int *)NLMSG_DATA(nlh); + + if (len < 0) { + errno = -len; + nl_dump_ext_ack_done(nlh, len); + return MNL_CB_ERROR; + } return MNL_CB_STOP; } |