[PATCH v5] Print ip and port associated with descriptor with -yy

Zubin Mithra zubin.mithra at gmail.com
Mon Aug 11 08:55:06 UTC 2014


Hello all,

This is the latest patch for extended socket fd decoding. A few points :-


> +
> +#ifdef HAVE_LINUX_SOCK_DIAG_H
> +# include <linux/sock_diag.h>
> +#else
> +# define SOCK_DIAG_BY_FAMILY 20
> +  struct sock_diag_req {
> +         __u8    sdiag_family;
> +         __u8    sdiag_protocol;
> +  };
> +#endif
>

Unless I'm mistaken this header is present on all linux systems in
/usr/include even with the dev packages installed.


> +
> +#define SOCKET_BUFFER_SIZE (getpagesize() < 8192L ? getpagesize() : 8192L)
> +
> +#ifdef HAVE_LINUX_INET_DIAG_H
> +# include <linux/inet_diag.h>
> +#else
> +  struct inet_diag_sockid {
> +         __be16  idiag_sport;
> +         __be16  idiag_dport;
> +         __be32  idiag_src[4];
> +         __be32  idiag_dst[4];
> +         __u32   idiag_if;
> +         __u32   idiag_cookie[2];
> +  #define INET_DIAG_NOCOOKIE (~0U)
> +  };
> +#endif
> +
> +/* Not all linux/inet_diag.h have v2 */
> +#ifndef HAVE_STRUCT_INET_DIAG_REQ_V2
> +  struct inet_diag_req_v2 {
> +         __u8  sdiag_family;
> +         __u8  sdiag_protocol;
> +         __u8  idiag_ext;
> +         __u8  pad;
> +         __u32 idiag_states;
> +         struct inet_diag_sockid id;
> +  };
> +#endif
>
>
 inet_diag_req_v2 is not present on all Linux systems.


Thanks,
-- zm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20140811/c7be3d54/attachment.html>


More information about the Strace-devel mailing list