From nobody Thu Mar 10 00:33:41 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DBD7519F34A2; Thu, 10 Mar 2022 00:33:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KDVRV3lr1z4kqr; Thu, 10 Mar 2022 00:33:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646872422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=za1SdBuHlE45FTSMWjfNEUIliC5Glm+YYMuGyxyDtqA=; b=sytbVZhLUpozBEcvi8xYFLKHGu+HQ7jHIBLqXNvYiZFwNJ/EAHcNnBvXiWuhJdL7Hg1wFT RFQD2UqE6w20mOVoHnG0VsjcJv3eiAe3tyAzfu22cGdBpca1OgVPlZw+zGWG3p6uOPPrO+ aGzz6r4hj2Kl0YCuQDvYkH74cwpZYX011vmTFa9jmb5ewlamun0UBTbELuGliCOxQG2l77 cFDAc39TZ3E3VdZiKRrNtqjMJY+VQutVp3B7Axmegr8hRsdn+jhg3S9WMNpUvuMpCtnXf9 tDwnC1NlKbSz+/3fu2kxgZYtij2HcJV5oU4Ow062Mu7ld/ZKLh1EY2m+2Gb3gQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CFD51B30B; Thu, 10 Mar 2022 00:33:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22A0XfEf059788; Thu, 10 Mar 2022 00:33:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22A0XfMS059787; Thu, 10 Mar 2022 00:33:41 GMT (envelope-from git) Date: Thu, 10 Mar 2022 00:33:41 GMT Message-Id: <202203100033.22A0XfMS059787@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 88fdbc9a0680 - stable/12 - ipfilter: Reliably print the interface name List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 88fdbc9a0680bb656bc9d7bff8fb2203990380fb Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646872422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=za1SdBuHlE45FTSMWjfNEUIliC5Glm+YYMuGyxyDtqA=; b=Y0hHsKbbnSvoD9vxXjnu2duZ54eOj+CbC+IgPe5Epqm14LZbmh0Qr0XgCoYXIK9akD+MJR jJwAFlNZp3LK1aip0frQHDb3d4D5ViPM85Wm1MTvlLwLEJOQIJIb4iahaFzFS23DZuPEqY 0fVi4VJVW1MiZrrrsmTCRJDkFqZdtfzAcr2eDABia94K8pkIwNnMUVgD2hdVIh6qCLpo1s nKeMGp0dOGC2Rf7uviaXT4J2DFNJr2KFM1QKWii+r40e6sM8DiO+oH8yFzxCrYq2cgMbne GFAXVecs6tSXyClauwn69m2L3QaT8QLJN9U67vVIant9Dj8utvH8LyzXj2J5uQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646872422; a=rsa-sha256; cv=none; b=MPrzC02uCK0NjUmIV5QGNZXASyJV3QJDWO/Gvqu75KtQW/cyL0zorZvMrEioipIbLTAy81 8tkrydnTo/rdnRWZqLUKK04uOTB52K1HgO7XhF0+iBAKsO2x4IhNdixQubX3Up7nmjmVBn cnEJ0MnHmiWW/ZGawf12Agw6wdCarfoQtlj+lhtmT/De4wNLeIwre/F6lOeEMWrInDsIf+ easvZw50bmUxyuxvop2Jp3qTKCJ9KX6bGleQRshmqhL7G4y6nynatlu7Mf568IKPJ4LYag kbH9RXceRpV+EFOz3pkOUFxwMQIOqpz0CeHazNN6w5bJ08vQ8Xu+x4bgQnhl6Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=88fdbc9a0680bb656bc9d7bff8fb2203990380fb commit 88fdbc9a0680bb656bc9d7bff8fb2203990380fb Author: Cy Schubert AuthorDate: 2022-03-03 06:43:48 +0000 Commit: Cy Schubert CommitDate: 2022-03-10 00:33:20 +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. (cherry picked from commit 93c1048a1360c3a0f1a6a9248916ef06c52b4504) --- 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) {