On Thu, Jun 15, 2017 at 12:30:51PM +0800, JingPiao Chen wrote: > * defs.h (inet_protocols): New xlat prototype. > * linux/inet_diag.h (inet_diag_req): New structure. > (INET_DIAG_*): New enum. > * netlink_sock_diag.c: Include <arpa/inet.h>, <linux/inet_diag.h> > and "xlat/inet_diag_extended_flags.h". > (print_inet_diag_sockid, decode_inet_diag_req_compat) > (decode_inet_diag_req_v2, decode_inet_diag_req) > (decode_inet_diag_msg): New functions. > (diag_decoders): Add AF_INET and AF_INET6; > * xlat/inet_diag_extended_flags.in: New file.
Thanks, applied with the following changes: > +static void > +print_inet_diag_sockid(const struct inet_diag_sockid *id, const uint8_t > family) > +{ > + tprintf("{idiag_sport=htons(%u), idiag_dport=htons(%u)", > + ntohs(id->idiag_sport), ntohs(id->idiag_dport)); > + > + int text_size; > + const char *name; > + > + if (family == AF_INET) { > + text_size = INET_ADDRSTRLEN; > + name = "AF_INET"; > + } > + else if (family == AF_INET6) { > + text_size = INET6_ADDRSTRLEN; > + name = "AF_INET6"; > + } > + else > + text_size = 0; > + > + char buf[text_size]; > + > + > + tprints(", "); > + if (text_size > + && inet_ntop(family, id->idiag_src, buf, text_size)) > + tprintf("inet_pton(%s, \"%s\", idiag_src)", name, buf); > + else > + print_quoted_string((char *) id->idiag_src, > + sizeof(id->idiag_src), 0); > + > + tprints(", "); > + if (text_size > + && inet_ntop(family, id->idiag_dst, buf, text_size)) > + tprintf("inet_pton(%s, \"%s\", idiag_dst)", name, buf); > + else > + print_quoted_string((char *) id->idiag_dst, > + sizeof(id->idiag_dst), 0); > + > + tprintf(", idiag_if=%" PRIu32 ", idiag_cookie=[%" PRIu32 > + ", %" PRIu32 "]}", > + id->idiag_if, id->idiag_cookie[0], id->idiag_cookie[1]); > +} Rewritten using the recently added print_inet_addr function. > + printflags(inet_diag_extended_flags, req.idiag_ext, > + "1<<(INET_DIAG_\?\?\?-1)"); Changed "1<<(INET_DIAG_\?\?\?-1)" to "1<<INET_DIAG_???-1". > + printflags(inet_diag_extended_flags, req.idiag_ext, > + "1<<(INET_DIAG_\?\?\?-1)"); Likewise. > diff --git a/xlat/inet_diag_extended_flags.in > b/xlat/inet_diag_extended_flags.in > new file mode 100644 > index 0000000..2466696 > --- /dev/null > +++ b/xlat/inet_diag_extended_flags.in > @@ -0,0 +1,16 @@ > +{ 1<<(INET_DIAG_MEMINFO-1) , "(1<<(INET_DIAG_MEMINFO-1))" }, > +{ 1<<(INET_DIAG_INFO-1) , "(1<<(INET_DIAG_INFO-1))" > }, > +{ 1<<(INET_DIAG_VEGASINFO-1) , "(1<<(INET_DIAG_VEGASINFO-1))" }, > +{ 1<<(INET_DIAG_CONG-1) , "(1<<(INET_DIAG_CONG-1))" > }, > +{ 1<<(INET_DIAG_TOS-1) , "(1<<(INET_DIAG_TOS-1))" > }, > +{ 1<<(INET_DIAG_TCLASS-1) , "(1<<(INET_DIAG_TCLASS-1))" }, > +{ 1<<(INET_DIAG_SKMEMINFO-1) , "(1<<(INET_DIAG_SKMEMINFO-1))" }, > +{ 1<<(INET_DIAG_SHUTDOWN-1) , "(1<<(INET_DIAG_SHUTDOWN-1))" }, > +{ 1<<(INET_DIAG_DCTCPINFO-1) , "(1<<(INET_DIAG_DCTCPINFO-1))" }, > +{ 1<<(INET_DIAG_PROTOCOL-1) , "(1<<(INET_DIAG_PROTOCOL-1))" }, > +{ 1<<(INET_DIAG_SKV6ONLY-1) , "(1<<(INET_DIAG_SKV6ONLY-1))" }, > +{ 1<<(INET_DIAG_LOCALS-1) , "(1<<(INET_DIAG_LOCALS-1))" }, > +{ 1<<(INET_DIAG_PEERS-1) , "(1<<(INET_DIAG_PEERS-1))" }, > +{ 1<<(INET_DIAG_PAD-1) , "(1<<(INET_DIAG_PAD-1))" > }, > +{ 1<<(INET_DIAG_MARK-1) , "(1<<(INET_DIAG_MARK-1))" > }, > +{ 1<<(INET_DIAG_BBRINFO-1) , "(1<<(INET_DIAG_BBRINFO-1))" }, Rewritten using a simpler syntax. -- 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