git: c5e78e553c66 - stable/14 - dtrace: allow NULL interface pointer for ifinfo_t translator

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Wed, 17 Apr 2024 13:46:10 UTC
The branch stable/14 has been updated by tuexen:

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

commit c5e78e553c6638fb24e7186690056fac9d78b2c9
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-02-16 11:28:48 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-04-17 13:45:40 +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
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D43728
    
    (cherry picked from commit e00fd24262945fdc7f16198c8abd977f743e66e4)
---
 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;
 };