mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-23 12:44:09 +01:00
monitor: Provide a helper function
Provide a helper function to convert NLMSG type to string.
This commit is contained in:
parent
275d067123
commit
0922ce9817
@ -1920,22 +1920,11 @@ static void genl_ctrl(struct nlmon *nlmon, const void *data, uint32_t len)
|
||||
nlmon->id = id;
|
||||
}
|
||||
|
||||
void nlmon_print_rtnl(struct nlmon *nlmon, const struct timeval *tv,
|
||||
const void *data, uint32_t size)
|
||||
static const char *nlmsg_type_to_str(uint32_t msg_type)
|
||||
{
|
||||
uint32_t aligned_size = NLMSG_ALIGN(size);
|
||||
const struct nlmsghdr *nlmsg;
|
||||
const char *str = NULL;
|
||||
|
||||
update_time_offset(tv);
|
||||
|
||||
for (nlmsg = data; NLMSG_OK(nlmsg, aligned_size);
|
||||
nlmsg = NLMSG_NEXT(nlmsg, aligned_size)) {
|
||||
const struct ifinfomsg *ifi;
|
||||
char extra_str[32];
|
||||
const char *str;
|
||||
bool out;
|
||||
|
||||
switch (nlmsg->nlmsg_type) {
|
||||
switch (msg_type) {
|
||||
case NLMSG_NOOP:
|
||||
str = "Noop";
|
||||
break;
|
||||
@ -1983,6 +1972,25 @@ void nlmon_print_rtnl(struct nlmon *nlmon, const struct timeval *tv,
|
||||
break;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void nlmon_print_rtnl(struct nlmon *nlmon, const struct timeval *tv,
|
||||
const void *data, uint32_t size)
|
||||
{
|
||||
uint32_t aligned_size = NLMSG_ALIGN(size);
|
||||
const struct nlmsghdr *nlmsg;
|
||||
|
||||
update_time_offset(tv);
|
||||
|
||||
for (nlmsg = data; NLMSG_OK(nlmsg, aligned_size);
|
||||
nlmsg = NLMSG_NEXT(nlmsg, aligned_size)) {
|
||||
const struct ifinfomsg *ifi;
|
||||
char extra_str[32];
|
||||
const char *str;
|
||||
bool out;
|
||||
|
||||
str = nlmsg_type_to_str(nlmsg->nlmsg_type);
|
||||
out = !!(nlmsg->nlmsg_flags & NLM_F_REQUEST);
|
||||
|
||||
netlink_str(extra_str, sizeof(extra_str),
|
||||
|
Loading…
Reference in New Issue
Block a user