Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Feb 2017 19:33:00 +0000 (UTC)
From:      "George V. Neville-Neil" <gnn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r313045 - in head: cddl/lib/libdtrace sys/netinet
Message-ID:  <201702011933.v11JX0rA044409@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gnn
Date: Wed Feb  1 19:33:00 2017
New Revision: 313045
URL: https://svnweb.freebsd.org/changeset/base/313045

Log:
  Add an mbuf to ipinfo_t translator to finish cleanup of mbuf passing to TCP probes.
  
  Reviewed by:	markj
  MFC after:	2 weeks
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D9401

Modified:
  head/cddl/lib/libdtrace/ip.d
  head/sys/netinet/in_kdtrace.c

Modified: head/cddl/lib/libdtrace/ip.d
==============================================================================
--- head/cddl/lib/libdtrace/ip.d	Wed Feb  1 16:15:23 2017	(r313044)
+++ head/cddl/lib/libdtrace/ip.d	Wed Feb  1 19:33:00 2017	(r313045)
@@ -238,6 +238,24 @@ translator ipinfo_t < uint8_t *p > {
 	    inet_ntoa6(&((struct ip6_hdr *)p)->ip6_dst);
 };
 
+#pragma D binding "1.13" translator
+translator ipinfo_t < struct mbuf *m > {
+	ip_ver =	m == NULL ? 0 : ((struct ip *)m->m_data)->ip_v;
+	ip_plength =	m == NULL ? 0 :
+	    ((struct ip *)m->m_data)->ip_v == 4 ?
+	    ntohs(((struct ip *)m->m_data)->ip_len) - 
+			(((struct ip *)m->m_data)->ip_hl << 2):
+	    ntohs(((struct ip6_hdr *)m->m_data)->ip6_ctlun.ip6_un1.ip6_un1_plen);
+	ip_saddr =	m == NULL ? 0 :
+	    ((struct ip *)m->m_data)->ip_v == 4 ?
+	    inet_ntoa(&((struct ip *)m->m_data)->ip_src.s_addr) :
+	    inet_ntoa6(&((struct ip6_hdr *)m->m_data)->ip6_src);
+	ip_daddr =	m == NULL ? 0 :
+	    ((struct ip *)m->m_data)->ip_v == 4 ?
+	    inet_ntoa(&((struct ip *)m->m_data)->ip_dst.s_addr) :
+	    inet_ntoa6(&((struct ip6_hdr *)m->m_data)->ip6_dst);
+};
+
 #pragma D binding "1.5" IFF_LOOPBACK
 inline int IFF_LOOPBACK =	0x8;
 

Modified: head/sys/netinet/in_kdtrace.c
==============================================================================
--- head/sys/netinet/in_kdtrace.c	Wed Feb  1 16:15:23 2017	(r313044)
+++ head/sys/netinet/in_kdtrace.c	Wed Feb  1 19:33:00 2017	(r313045)
@@ -56,28 +56,28 @@ SDT_PROBE_DEFINE6_XLATE(ip, , , send,
 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established,
     "void *", "pktinfo_t *",
     "struct tcpcb *", "csinfo_t *",
-    "uint8_t *", "ipinfo_t *",
+    "struct mbuf *", "ipinfo_t *",
     "struct tcpcb *", "tcpsinfo_t *" ,
     "struct tcphdr *", "tcpinfoh_t *");
 
 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__refused,
     "void *", "pktinfo_t *",
     "struct tcpcb *", "csinfo_t *",
-    "uint8_t *", "ipinfo_t *",
+    "struct mbuf *", "ipinfo_t *",
     "struct tcpcb *", "tcpsinfo_t *" ,
     "struct tcphdr *", "tcpinfo_t *");
 
 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__established,
     "void *", "pktinfo_t *",
     "struct tcpcb *", "csinfo_t *",
-    "uint8_t *", "ipinfo_t *",
+    "struct mbuf *", "ipinfo_t *",
     "struct tcpcb *", "tcpsinfo_t *" ,
     "struct tcphdr *", "tcpinfoh_t *");
 
 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__refused,
     "void *", "pktinfo_t *",
     "struct tcpcb *", "csinfo_t *",
-    "uint8_t *", "ipinfo_t *",
+    "struct mbuf *", "ipinfo_t *",
     "struct tcpcb *", "tcpsinfo_t *" ,
     "struct tcphdr *", "tcpinfoh_t *");
 
@@ -91,7 +91,7 @@ SDT_PROBE_DEFINE5_XLATE(tcp, , , connect
 SDT_PROBE_DEFINE5_XLATE(tcp, , , receive,
     "void *", "pktinfo_t *",
     "struct tcpcb *", "csinfo_t *",
-    "uint8_t *", "ipinfo_t *",
+    "struct mbuf *", "ipinfo_t *",
     "struct tcpcb *", "tcpsinfo_t *" ,
     "struct tcphdr *", "tcpinfoh_t *");
 
@@ -113,7 +113,7 @@ SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__
 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__output,
     "struct tcpcb *", "tcpsinfo_t *" ,
     "struct tcphdr *", "tcpinfo_t *",
-    "uint8_t *", "ipinfo_t *");
+    "struct mbuf *", "ipinfo_t *");
 
 SDT_PROBE_DEFINE2_XLATE(tcp, , , debug__user,
     "struct tcpcb *", "tcpsinfo_t *" ,
@@ -122,7 +122,7 @@ SDT_PROBE_DEFINE2_XLATE(tcp, , , debug__
 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__drop,
     "struct tcpcb *", "tcpsinfo_t *" ,
     "struct tcphdr *", "tcpinfo_t *",
-    "uint8_t *", "ipinfo_t *");
+    "struct mbuf *", "ipinfo_t *");
 
 SDT_PROBE_DEFINE6_XLATE(tcp, , , state__change,
     "void *", "void *",



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702011933.v11JX0rA044409>