On Sun, Jun 04, 2017 at 03:57:08PM +0800, JingPiao Chen wrote: > On Fri, Jun 02, 2017 at 06:25:28PM +0300, Dmitry V. Levin wrote: > > On Fri, May 05, 2017 at 06:21:17PM +0800, JingPiao Chen wrote: > > > * netlink.c (decode_payload): Decode NLMSG_DONE message. > > > * tests/netlink_protocol.c: Add check for decoding > > > of NLMSG_DONE message. > > > > Unlike NLMSG_ERROR, there are no universal NLMSG_DONE messages. While > > many NLMSG_DONE messages indeed have payload containing just one integer, > > there are exceptions. For example, > > > > net/netfilter/nfnetlink_log.c:__nfulnl_send() sends struct nfgenmsg, > > drivers/connector/connector.c:cn_netlink_send_mult() sends struct cn_msg, > > drivers/scsi/scsi_transport_iscsi.c:iscsi_if_send_reply() sends struct > iscsi_uevent, > > kernel/auditfilter.c:audit_list_rules() sends struct audit_rule_data, > > kernel/audit.c:audit_get_feature() sends struct audit_features, > > kernel/audit.c:audit_receive_msg() sends struct audit_status, > audit_sig_info, > > audit_tty_status, and so on. > > I am decoding audit, I understand kernel/auditfilter.c: audit_list_rules() > sends struct audit_rule_data, but I do not understand > kernel/audit.c: audit_get_feature() sends struct audit_features > > static int audit_get_feature(struct sk_buff *skb) > { > ... > audit_send_reply(skb, seq, AUDIT_GET_FEATURE, 0, 0, &af, sizeof(af)); > ... > } > > done = 0, why is it send NLMSG_DONE messages? > Can you help me understand this? Thank you.
I must have missed this case, apparently, audit_get_feature does not send NLMSG_DONE messages. > > I suggest implementing a default decoder of NLMSG_DONE messages that > > would print the integer in case of len == sizeof(int) and fall back > > to printstrn for other lengths. > > I updated the patch. default decoder[1]: Thanks. > diff --git a/netlink.c b/netlink.c > index 678343c..104a65f 100644 > --- a/netlink.c > +++ b/netlink.c > @@ -120,6 +120,12 @@ decode_payload(struct tcb *const tcp, > if (nlmsghdr->nlmsg_type == NLMSG_ERROR) { > decode_nlmsgerr(tcp, addr, len); > return; > + } else if (nlmsghdr->nlmsg_type == NLMSG_DONE && len == sizeof(int)) { > + int total_len; btw, why do you call it total_len? This integer can contain anything. -- ldv
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel