On Mon, Jun 19, 2017 at 12:45:51PM +0900, Masatake YAMATO wrote: > GENERIC is a protocol stacked on Netlink protocol. Via GENERIC > protocol, a process can communicate with a kernel subsystem. > > An integer named "family" is assigned to each subsystem that can be > communicated via GENERIC protocol. A process sets the integer to the > type field of Netlink packet. > > A subsystem registers its name to the kernel at run-time, and gets an > integer for family. So even strace can know the integer that the > target process uses in the communication, a user of strace cannot know > the subsystem which the target process communicates with. > > This change decodes the integer for family which is stored to the > type field by accessing kernel at run-time. > > Example session: > > $ ./strace -yy -e 'sendto' ip tcp_metrics > /dev/null > sendto(4<NETLINK:[GENERIC:7939]>, {{len=20, type=tcp_metrics, ... > +++ exited with 0 +++ > > type= that specifies a family in Netlink GENERIC protocol > is decoded well. > > * netlink.c (nlmsg_types): Remove const modifiers to allow to > install a xlat table for decoding the field made at run-time. > Add an element for NETLINK_GENERIC. > (decode_nlmsg_type): Install the xlat table to the NETLINK_GENERIC > element of nlmsg_types.
I've reworded this commit message, hope it's OK. > Changes in v4: > > * Update this log to clear the relationship between an integer > for "family" and "type" field. > > Signed-off-by: Masatake YAMATO <yam...@redhat.com> > --- > netlink.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/netlink.c b/netlink.c > index 4bef949..ff837f4 100644 > --- a/netlink.c > +++ b/netlink.c > @@ -109,6 +109,15 @@ decode_nlmsg_type_default(const struct xlat *const xlat, > } > > static void > +decode_nlmsg_type_generic(const struct xlat *const xlat, > + const uint16_t type, > + const char *const dflt) > +{ > + const struct xlat *const my_xlat = genl_families_xlat(); > + printxval(my_xlat, type, dflt); I've replaced these two lines with a single line: printxval(genl_families_xlat(), type, dflt); > +} > + > +static void > decode_nlmsg_type_netfilter(const struct xlat *const xlat, > const uint16_t type, > const char *const dflt) > @@ -146,6 +155,11 @@ static const struct { > const char *const dflt; > } nlmsg_types[] = { > [NETLINK_AUDIT] = { NULL, nl_audit_types, "AUDIT_???" }, > + [NETLINK_GENERIC] = { > + decode_nlmsg_type_generic, > + NULL, > + "GENERIC_FAMILY_???" > + }, > [NETLINK_NETFILTER] = { > decode_nlmsg_type_netfilter, > nl_netfilter_subsys_ids, Applied, thanks! -- 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