netlink: NLMSG_DONE never enter specific family decoder

JingPiao Chen chenjingpiao at gmail.com
Sat Jun 24 01:06:06 UTC 2017


static int
print_nlmsghdr(struct tcb *tcp,
      const int fd,
      int family,
      const struct nlmsghdr *const nlmsghdr)
{
...
const int hdr_family = (nlmsghdr->nlmsg_type < NLMSG_MIN_TYPE)
      ? NL_FAMILY_DEFAULT
      : (family != NL_FAMILY_DEFAULT
 ? family : get_fd_nl_family(tcp, fd));
...
}

Get family is in this function,
if type = NLMSG_DONE (NLMSG_DONE < NLMSG_MIN_TYPE),
family = NL_FAMILY_DEFAULT. So in the decode_payload
(unsigned int) family < ARRAY_SIZE(netlink_decoders) is false.

static void
decode_payload(struct tcb *const tcp,
      const int fd,
      const int family,
      const struct nlmsghdr *const nlmsghdr,
      const kernel_ulong_t addr,
      const kernel_ulong_t len)
{
...
if ((unsigned int) family < ARRAY_SIZE(netlink_decoders)
   && netlink_decoders[family]
   && netlink_decoders[family](tcp, nlmsghdr, addr, len)) {
return;
}
...
}

If enter decode_netlink_sock_diag, it only return true, following code
never execute.

static void
decode_payload(struct tcb *const tcp,
      const int fd,
      const int family,
      const struct nlmsghdr *const nlmsghdr,
      const kernel_ulong_t addr,
      const kernel_ulong_t len)
{
...
if (nlmsghdr->nlmsg_type == NLMSG_DONE && len == sizeof(int)) {
int num;

if (!umove_or_printaddr(tcp, addr, &num))
tprintf("%d", num);
return;
}
...
}

--
JingPiao Chen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170624/f82feca9/attachment.html>


More information about the Strace-devel mailing list