diff options
author | George V. Neville-Neil <gnn@FreeBSD.org> | 2017-02-01 19:33:00 +0000 |
---|---|---|
committer | George V. Neville-Neil <gnn@FreeBSD.org> | 2017-02-01 19:33:00 +0000 |
commit | 82988b50a17ccd6a39d9bb49f15f42b11fc6a052 (patch) | |
tree | 35bd18bcee641e445b21b55935b36d32eea35f56 /cddl/lib/libdtrace/ip.d | |
parent | accb19a8bc6abc0fd810a093cdefa21872bc35dd (diff) | |
download | src-82988b50a17ccd6a39d9bb49f15f42b11fc6a052.tar.gz src-82988b50a17ccd6a39d9bb49f15f42b11fc6a052.zip |
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
Notes
Notes:
svn path=/head/; revision=313045
Diffstat (limited to 'cddl/lib/libdtrace/ip.d')
-rw-r--r-- | cddl/lib/libdtrace/ip.d | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cddl/lib/libdtrace/ip.d b/cddl/lib/libdtrace/ip.d index e3fc23dbf744..bf487e62f938 100644 --- a/cddl/lib/libdtrace/ip.d +++ b/cddl/lib/libdtrace/ip.d @@ -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; |