git: 915395a2800a - main - ipfilter: Introduce the new FORMAT_IF macro

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Thu, 03 Mar 2022 15:27:18 UTC
The branch main has been updated by cy:

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

commit 915395a2800a09a64ae41ca96eabcb5e16b44309
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-03-03 06:21:59 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-03-03 14:43:11 +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)".
    
    MFC after:      1 week
---
 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	{