3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 14:49:24 +01:00

monitor: Print netlink command complete error messages

This commit is contained in:
Marcel Holtmann 2014-08-09 16:34:39 -07:00
parent 1219658f7d
commit 7689d2202f

View File

@ -908,7 +908,7 @@ static void print_message(const struct nlmsghdr *nlmsg)
str = "Noop";
break;
case NLMSG_ERROR:
str = "Error";
str = "Complete";
break;
case NLMSG_DONE:
str = "Done";
@ -926,6 +926,17 @@ static void print_message(const struct nlmsghdr *nlmsg)
nlmsg->nlmsg_type,
nlmsg->nlmsg_flags,
NLMSG_PAYLOAD(nlmsg, 0));
if (nlmsg->nlmsg_type == NLMSG_ERROR) {
uint32_t status = *((uint32_t *) NLMSG_DATA(nlmsg));
printf("%*cStatus: %s (%u)\n", 4, ' ',
strerror(status), status);
print_hexdump(NLMSG_DATA(nlmsg) + 4,
NLMSG_PAYLOAD(nlmsg, 4));
} else
print_hexdump(NLMSG_DATA(nlmsg),
NLMSG_PAYLOAD(nlmsg, 0));
return;
}