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
This commit is contained in:
George V. Neville-Neil 2017-02-01 19:33:00 +00:00
parent accb19a8bc
commit 82988b50a1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=313045
2 changed files with 25 additions and 7 deletions

View File

@ -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;

View File

@ -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__request,
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__input,
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__user,
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 *",