Commit 88a52c2b authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Andrei Vagin

net: libnetlink -- Call error handler instead of unconditional error message

To be able to zap error messages when needed. Without error
handler we will continue printing error. This will placate
diag modules probing since they are not mandatory features.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@gmail.com>
parent 8a90bc83
...@@ -21,13 +21,8 @@ static int nlmsg_receive(char *buf, int len, ...@@ -21,13 +21,8 @@ static int nlmsg_receive(char *buf, int len,
continue; continue;
if (hdr->nlmsg_type == NLMSG_DONE) { if (hdr->nlmsg_type == NLMSG_DONE) {
int *len = (int *)NLMSG_DATA(hdr); int *len = (int *)NLMSG_DATA(hdr);
if (*len < 0)
if (*len < 0) { return err_cb(*len, arg);
pr_err("ERROR %d reported by netlink (%s)\n",
*len, strerror(-*len));
return *len;
}
return 0; return 0;
} }
if (hdr->nlmsg_type == NLMSG_ERROR) { if (hdr->nlmsg_type == NLMSG_ERROR) {
...@@ -52,7 +47,8 @@ static int nlmsg_receive(char *buf, int len, ...@@ -52,7 +47,8 @@ static int nlmsg_receive(char *buf, int len,
static int rtnl_return_err(int err, void *arg) static int rtnl_return_err(int err, void *arg)
{ {
pr_warn("ERROR %d reported by netlink\n", err); errno = -err;
pr_perror("ERROR %d reported by netlink", err);
return err; return err;
} }
......
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