monitor: Print netlink core control messages

Decode core control messages (NLMSG_ERROR and NLMSG_DONE).
This commit is contained in:
Ravi kumar Veeramally 2015-01-19 13:55:20 +02:00 committed by Denis Kenzior
parent 4d7ff64f38
commit fa40340d68
1 changed files with 22 additions and 0 deletions

View File

@ -1997,6 +1997,8 @@ void nlmon_print_rtnl(struct nlmon *nlmon, const struct timeval *tv,
char extra_str[32];
const char *str;
bool out;
int status;
struct nlmsgerr *err;
str = nlmsg_type_to_str(nlmsg->nlmsg_type);
out = !!(nlmsg->nlmsg_flags & NLM_F_REQUEST);
@ -2020,6 +2022,26 @@ void nlmon_print_rtnl(struct nlmon *nlmon, const struct timeval *tv,
NLMSG_ALIGN(sizeof(*ifi)),
NLMSG_PAYLOAD(nlmsg, sizeof(*ifi)));
break;
case NLMSG_NOOP:
case NLMSG_OVERRUN:
break;
case NLMSG_ERROR:
err = NLMSG_DATA(nlmsg);
status = -err->error;
if (status < 0)
print_field("Error: %d (%s)", status,
strerror(status));
else
print_field("ACK: %d", status);
break;
case NLMSG_DONE:
status = *((int *) NLMSG_DATA(nlmsg));
print_field("Status: %d", status);
break;
}
}
}