git: a98f745dbb18 - stable/12 - ipfilter: Introduce the new FORMAT_IF macro

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Thu, 10 Mar 2022 00:33:39 UTC
The branch stable/12 has been updated by cy:

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

commit a98f745dbb1808f89855c85e524209a65aa29550
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-03-03 06:21:59 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-03-10 00:33:20 +0000

    ipfilter: Introduce the new FORMAT_IF macro
    
    Interface names stored in the ipstate_t and ipnat_t structures can be
    NULL. This occurs when an application, such as named, is running on the
    firewall machine itself. For example an application, i.e. named, running
    on the firewall itself will cause a state table display and NAT mapping
    display to show a null ingress interface and its egress interface. This
    is perfectly valid but confusing to human eyes. Rather than print
    nothing, print "(null)".
    
    (cherry picked from commit 915395a2800a09a64ae41ca96eabcb5e16b44309)
---
 sbin/ipf/common/ipf.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sbin/ipf/common/ipf.h b/sbin/ipf/common/ipf.h
index e178cfc1676e..b278d8ec5d6c 100644
--- a/sbin/ipf/common/ipf.h
+++ b/sbin/ipf/common/ipf.h
@@ -103,6 +103,7 @@ typedef unsigned int	u_32_t;
 
 #define	PRINTF	(void)printf
 #define	FPRINTF	(void)fprintf
+#define FORMAT_IF(_a)	(_a != NULL ? _a : "(null)")
 
 
 struct	ipopt_names	{