> +static int > +netlink_parse_response(const char *proto_name, const void *data, > + const int data_len, const unsigned long inode) > +{ > + const struct netlink_diag_msg *const diag_msg = data; > + const char *netlink_proto; > + char *details; > + > + if (data_len < (int) NLMSG_LENGTH(sizeof(*diag_msg))) > + return -1; > + if (diag_msg->ndiag_ino != inode) > + return 0; > + > + if (diag_msg->ndiag_family != AF_NETLINK) > + return -1; > + > + netlink_proto = xlookup(netlink_protocols, > + diag_msg->ndiag_protocol); > + > + if (netlink_proto) { > + if (asprintf(&details, "%s:[%s]", proto_name, > + netlink_proto) < 0) > + return -1; > + } else { > + if (asprintf(&details, "%s:[%u]", proto_name, > + (unsigned) diag_msg->ndiag_protocol) < 0) > + return -1; > + }
Looks good for me. Just a question. Your code records ndiag_protocol. How about other fields? struct netlink_diag_msg { __u8 ndiag_family; __u8 ndiag_type; __u8 ndiag_protocol; __u8 ndiag_state; __u32 ndiag_portid; __u32 ndiag_dst_portid; __u32 ndiag_dst_group; __u32 ndiag_ino; __u32 ndiag_cookie[2]; }; At a glance, ndiag_portid, ndiag_dst_portid and ndiag_dst_group are meaningful in strace for me though I don't know well. (If this topic has been discussed alrady , ignore me.) Masatake YAMATO ------------------------------------------------------------------------------ Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j _______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel