* net.c (printcmsghdr): add IP_PKTINFO decoding
* xlat/sol_ip_vals.in: new file

Signed-off-by: Gabriel Laskar <gabr...@lse.epita.fr>
Suggested-by: Orion Poplawski <or...@cora.nwra.com>
---
 net.c               | 11 +++++++++++
 xlat/sol_ip_vals.in |  1 +
 2 files changed, 12 insertions(+)
 create mode 100644 xlat/sol_ip_vals.in

diff --git a/net.c b/net.c
index 7e8586a..85e5536 100644
--- a/net.c
+++ b/net.c
@@ -294,6 +294,7 @@ printsock(struct tcb *tcp, long addr, int addrlen)
 #  define SCM_SECURITY 0x03
 # endif
 # include "xlat/scmvals.h"
+# include "xlat/sol_ip_vals.h"
 
 #if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
 struct cmsghdr32 {
@@ -423,6 +424,16 @@ printcmsghdr(struct tcb *tcp, unsigned long addr, size_t 
len)
                                        goto next_cmsg;
                                break;
                        }
+               } else if (cmsg_level == SOL_IP) {
+                       printxval(sol_ip_vals, cmsg_type, "IP_???");
+                       if (cmsg_size + sizeof(struct in_pktinfo) > cmsg_len)
+                               break;
+                       struct in_pktinfo *pktinfo = (void*)(u.ptr + cmsg_size);
+                       tprintf(", {ipi_ifindex=%u, ipi_spec_dst=inet_addr(%s), 
ipi_addr=inet_addr(%s)}",
+                                       pktinfo->ipi_ifindex,
+                                       inet_ntoa(pktinfo->ipi_spec_dst),
+                                       inet_ntoa(pktinfo->ipi_addr));
+                       goto next_cmsg;
                } else {
                        tprintf("%u", cmsg_type);
                }
diff --git a/xlat/sol_ip_vals.in b/xlat/sol_ip_vals.in
new file mode 100644
index 0000000..4f8304b
--- /dev/null
+++ b/xlat/sol_ip_vals.in
@@ -0,0 +1 @@
+IP_PKTINFO
-- 
Gabriel Laskar


------------------------------------------------------------------------------
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to