git: e00fd2426294 - main - dtrace: allow NULL interface pointer for ifinfo_t translator

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Fri, 16 Feb 2024 11:33:25 UTC
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=e00fd24262945fdc7f16198c8abd977f743e66e4

commit e00fd24262945fdc7f16198c8abd977f743e66e4
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-02-16 11:28:48 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-02-16 11:28:48 +0000

    dtrace: allow NULL interface pointer for ifinfo_t translator
    
    This is similar to other translators and will be used in static
    probes where the interface is not known.
    
    Reviewed by:            markj
    MFC after:              1 week
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D43728
---
 cddl/lib/libdtrace/ip.d | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cddl/lib/libdtrace/ip.d b/cddl/lib/libdtrace/ip.d
index 172d7d54bc36..2fe98858efc2 100644
--- a/cddl/lib/libdtrace/ip.d
+++ b/cddl/lib/libdtrace/ip.d
@@ -262,8 +262,8 @@ inline int IFF_LOOPBACK =	0x8;
 
 #pragma D binding "1.5" translator
 translator ifinfo_t < struct ifnet *p > {
-	if_name =	p->if_xname;
-	if_local =	(p->if_flags & IFF_LOOPBACK) == 0 ? 0 : 1;
+	if_name =	p == NULL ? "<unknown>" : p->if_xname;
+	if_local =	p == NULL ? 0 : (p->if_flags & IFF_LOOPBACK) == 0 ? 0 : 1;
 	if_addr =	(uintptr_t)p;
 };