The branch main has been updated by cy:

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

commit 93c1048a1360c3a0f1a6a9248916ef06c52b4504
Author:     Cy Schubert <c...@freebsd.org>
AuthorDate: 2022-03-03 06:43:48 +0000
Commit:     Cy Schubert <c...@freebsd.org>
CommitDate: 2022-03-03 14:43:12 +0000

    ipfilter: Reliably print the interface name
    
    When printing the interface name from the ipstate_t struct the interface
    name in is_ifp may not always be avaiable when reading it from kmem
    (tested on FreeBSD and NetBSD). However the is_ifname (the interface
    name character string) is almost always available -- it is not available
    when the source of the packet is a process running on the firewall
    itself. Rather than print both interface name strings, print only the
    one.
    
    MFC after:      1 week
---
 sbin/ipf/libipf/printstate.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/sbin/ipf/libipf/printstate.c b/sbin/ipf/libipf/printstate.c
index 8832a723e9f1..1f135231ff58 100644
--- a/sbin/ipf/libipf/printstate.c
+++ b/sbin/ipf/libipf/printstate.c
@@ -184,23 +184,19 @@ printstate(ipstate_t *sp, int opts, u_long now)
                PRINTF("\tis_flx %#x %#x %#x %#x\n", sp->is_flx[0][0],
                        sp->is_flx[0][1], sp->is_flx[1][0], sp->is_flx[1][1]);
        }
-       PRINTF("\tinterfaces: in %s[%s", getifname(sp->is_ifp[0]),
-               sp->is_ifname[0]);
+       PRINTF("\tinterfaces: in %s", FORMAT_IF(sp->is_ifname[0]));
        if (opts & OPT_DEBUG)
                PRINTF("/%p", sp->is_ifp[0]);
-       putchar(']');
-       PRINTF(",%s[%s", getifname(sp->is_ifp[1]), sp->is_ifname[1]);
+       PRINTF(",%s", FORMAT_IF(sp->is_ifname[1]));
        if (opts & OPT_DEBUG)
                PRINTF("/%p", sp->is_ifp[1]);
-       putchar(']');
-       PRINTF(" out %s[%s", getifname(sp->is_ifp[2]), sp->is_ifname[2]);
+       PRINTF(" out %s", FORMAT_IF(sp->is_ifname[2]));
        if (opts & OPT_DEBUG)
                PRINTF("/%p", sp->is_ifp[2]);
-       putchar(']');
-       PRINTF(",%s[%s", getifname(sp->is_ifp[3]), sp->is_ifname[3]);
+       PRINTF(",%s", FORMAT_IF(sp->is_ifname[3]));
        if (opts & OPT_DEBUG)
                PRINTF("/%p", sp->is_ifp[3]);
-       PRINTF("]\n");
+       PRINTF("\n");
 
        PRINTF("\tSync status: ");
        if (sp->is_sync != NULL) {

Reply via email to