aboutsummaryrefslogtreecommitdiff
path: root/cddl/lib
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2018-06-18 18:35:29 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2018-06-18 18:35:29 +0000
commit7575d3df5b3dd239d39381efebc9e6e80bac62db (patch)
tree731995c1b154a5ddd16606d37a1dc439699cd8fc /cddl/lib
parentc4db0baa34b97e88f2e7cd2b2c2711828ffc89a7 (diff)
downloadsrc-7575d3df5b3dd239d39381efebc9e6e80bac62db.tar.gz
src-7575d3df5b3dd239d39381efebc9e6e80bac62db.zip
The IP, TCP, and UDP provider report IP addresses as strings.
In some cases, the required information is not available and the UDP provider reported an empty string in this case and the IP and TCP provider reported a NULL pointer. This patch changes the value provided in this case to the string "<unknown>". This make the behaviour consistent and in-line with the behaviour of Solaris. Reviewed by: markj@, dteske@, gnn@ Differential Revision: https://reviews.freebsd.org/D15855
Notes
Notes: svn path=/head/; revision=335325
Diffstat (limited to 'cddl/lib')
-rw-r--r--cddl/lib/libdtrace/ip.d8
-rw-r--r--cddl/lib/libdtrace/tcp.d4
-rw-r--r--cddl/lib/libdtrace/udp.d4
3 files changed, 8 insertions, 8 deletions
diff --git a/cddl/lib/libdtrace/ip.d b/cddl/lib/libdtrace/ip.d
index 2c7bde161aa8..d413a300284c 100644
--- a/cddl/lib/libdtrace/ip.d
+++ b/cddl/lib/libdtrace/ip.d
@@ -228,11 +228,11 @@ translator ipinfo_t < uint8_t *p > {
((struct ip *)p)->ip_v == 4 ?
ntohs(((struct ip *)p)->ip_len) - (((struct ip *)p)->ip_hl << 2):
ntohs(((struct ip6_hdr *)p)->ip6_ctlun.ip6_un1.ip6_un1_plen);
- ip_saddr = p == NULL ? 0 :
+ ip_saddr = p == NULL ? "<unknown>" :
((struct ip *)p)->ip_v == 4 ?
inet_ntoa(&((struct ip *)p)->ip_src.s_addr) :
inet_ntoa6(&((struct ip6_hdr *)p)->ip6_src);
- ip_daddr = p == NULL ? 0 :
+ ip_daddr = p == NULL ? "<unknown>" :
((struct ip *)p)->ip_v == 4 ?
inet_ntoa(&((struct ip *)p)->ip_dst.s_addr) :
inet_ntoa6(&((struct ip6_hdr *)p)->ip6_dst);
@@ -246,11 +246,11 @@ translator ipinfo_t < struct mbuf *m > {
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 :
+ ip_saddr = m == NULL ? "<unknown>" :
((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 :
+ ip_daddr = m == NULL ? "<unknown>" :
((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);
diff --git a/cddl/lib/libdtrace/tcp.d b/cddl/lib/libdtrace/tcp.d
index 383d284821b5..bf7788c88f04 100644
--- a/cddl/lib/libdtrace/tcp.d
+++ b/cddl/lib/libdtrace/tcp.d
@@ -190,11 +190,11 @@ translator tcpsinfo_t < struct tcpcb *p > {
tcps_active = -1; /* XXX */
tcps_lport = p == NULL ? 0 : ntohs(p->t_inpcb->inp_inc.inc_ie.ie_lport);
tcps_rport = p == NULL ? 0 : ntohs(p->t_inpcb->inp_inc.inc_ie.ie_fport);
- tcps_laddr = p == NULL ? 0 :
+ tcps_laddr = p == NULL ? "<unknown>" :
p->t_inpcb->inp_vflag == INP_IPV4 ?
inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.id46_addr.ia46_addr4.s_addr) :
inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.id6_addr);
- tcps_raddr = p == NULL ? 0 :
+ tcps_raddr = p == NULL ? "<unknown>" :
p->t_inpcb->inp_vflag == INP_IPV4 ?
inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id46_addr.ia46_addr4.s_addr) :
inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.id6_addr);
diff --git a/cddl/lib/libdtrace/udp.d b/cddl/lib/libdtrace/udp.d
index 917baa663c71..603bbbd29617 100644
--- a/cddl/lib/libdtrace/udp.d
+++ b/cddl/lib/libdtrace/udp.d
@@ -56,11 +56,11 @@ translator udpsinfo_t < struct inpcb *p > {
udps_addr = (uintptr_t)p;
udps_lport = p == NULL ? 0 : ntohs(p->inp_inc.inc_ie.ie_lport);
udps_rport = p == NULL ? 0 : ntohs(p->inp_inc.inc_ie.ie_fport);
- udps_laddr = p == NULL ? "" :
+ udps_laddr = p == NULL ? "<unknown>" :
p->inp_vflag == INP_IPV4 ?
inet_ntoa(&p->inp_inc.inc_ie.ie_dependladdr.id46_addr.ia46_addr4.s_addr) :
inet_ntoa6(&p->inp_inc.inc_ie.ie_dependladdr.id6_addr);
- udps_raddr = p == NULL ? "" :
+ udps_raddr = p == NULL ? "<unknown>" :
p->inp_vflag == INP_IPV4 ?
inet_ntoa(&p->inp_inc.inc_ie.ie_dependfaddr.id46_addr.ia46_addr4.s_addr) :
inet_ntoa6(&p->inp_inc.inc_ie.ie_dependfaddr.id6_addr);