From owner-svn-src-head@freebsd.org Mon Jun 18 18:35:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 860C71018B47; Mon, 18 Jun 2018 18:35:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 343546B9A8; Mon, 18 Jun 2018 18:35:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB3B127DFE; Mon, 18 Jun 2018 18:35:29 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5IIZThY001243; Mon, 18 Jun 2018 18:35:29 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5IIZTID001240; Mon, 18 Jun 2018 18:35:29 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201806181835.w5IIZTID001240@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 18 Jun 2018 18:35:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335325 - head/cddl/lib/libdtrace X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/cddl/lib/libdtrace X-SVN-Commit-Revision: 335325 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2018 18:35:30 -0000 Author: tuexen Date: Mon Jun 18 18:35:29 2018 New Revision: 335325 URL: https://svnweb.freebsd.org/changeset/base/335325 Log: 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 "". 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 Modified: head/cddl/lib/libdtrace/ip.d head/cddl/lib/libdtrace/tcp.d head/cddl/lib/libdtrace/udp.d Modified: head/cddl/lib/libdtrace/ip.d ============================================================================== --- head/cddl/lib/libdtrace/ip.d Mon Jun 18 18:10:11 2018 (r335324) +++ head/cddl/lib/libdtrace/ip.d Mon Jun 18 18:35:29 2018 (r335325) @@ -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 ? "" : ((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 ? "" : ((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 ? "" : ((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 ? "" : ((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); Modified: head/cddl/lib/libdtrace/tcp.d ============================================================================== --- head/cddl/lib/libdtrace/tcp.d Mon Jun 18 18:10:11 2018 (r335324) +++ head/cddl/lib/libdtrace/tcp.d Mon Jun 18 18:35:29 2018 (r335325) @@ -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 ? "" : 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 ? "" : 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); Modified: head/cddl/lib/libdtrace/udp.d ============================================================================== --- head/cddl/lib/libdtrace/udp.d Mon Jun 18 18:10:11 2018 (r335324) +++ head/cddl/lib/libdtrace/udp.d Mon Jun 18 18:35:29 2018 (r335325) @@ -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 ? "" : 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 ? "" : 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);