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