]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
devlink: Fix error reporting
authorArkadi Sharshevsky <arkadis@mellanox.com>
Wed, 28 Feb 2018 09:24:22 +0000 (11:24 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 1 Mar 2018 00:10:32 +0000 (16:10 -0800)
The current code doesn't set errno in case of extended ack.

Fixes: 049c58539f5d ("devlink: mnlg: Add support for extended ack")
Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
devlink/mnlg.c

index 37c568735ff6133ec169c2ea85291d676ee5e0b7..3d28453a307b0ebb85b0fdd65aae712b57d75162 100644 (file)
@@ -71,15 +71,15 @@ static int mnlg_cb_error(const struct nlmsghdr *nlh, void *data)
 {
        const struct nlmsgerr *err = mnl_nlmsg_get_payload(nlh);
 
-       if (nl_dump_ext_ack(nlh, NULL))
-               return MNL_CB_STOP;
-
        /* Netlink subsystems returns the errno value with different signess */
        if (err->error < 0)
                errno = -err->error;
        else
                errno = err->error;
 
+       if (nl_dump_ext_ack(nlh, NULL))
+               return MNL_CB_ERROR;
+
        return err->error == 0 ? MNL_CB_STOP : MNL_CB_ERROR;
 }