From nobody Thu Mar 03 15:27:20 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 CCBC219F58EF; Thu, 3 Mar 2022 15:27:21 +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 4K8Zbs2VBjz3nyH; Thu, 3 Mar 2022 15:27:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646321241; 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=i55jAFAwSGny7lskPDFslBKho+XRE2fAE1EAZEKPzf0=; b=KwFmD1aO0KEaTS3CqBqwH12PLgR2ZFYupx3GaXYQPLf+OeXxcAF2avgAoD5dCv024SmCOx P8QYKT6IjlNrGDrFAkvGVvbmfobF+09JT/zv90plFH35mVpJ3hGDNptT8ajyHgDcqmNJ2e wdcBWWUJNS1mRGKSReVDj7sL70IjzF5gjg0dOojKGpUPNd3dQLqaZcMI94Kem8dWdpHyzC ke0tqsGStMMk5/zpbAZL7g7Cw84btiHsjU2+Mr8we8gQd/cSPfBkv7DJ+6+R39WC70eQX9 n3vgqYDEpw8pNtl/cY4KRHJ6G7C4EVFHc/so7E1kGg7B+ibVOwQbdPRgdAWbmQ== 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 0C2521A5E0; Thu, 3 Mar 2022 15:27:21 +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 223FRK0s077937; Thu, 3 Mar 2022 15:27:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 223FRKhj077936; Thu, 3 Mar 2022 15:27:20 GMT (envelope-from git) Date: Thu, 3 Mar 2022 15:27:20 GMT Message-Id: <202203031527.223FRKhj077936@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 93c1048a1360 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 93c1048a1360c3a0f1a6a9248916ef06c52b4504 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646321241; 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=i55jAFAwSGny7lskPDFslBKho+XRE2fAE1EAZEKPzf0=; b=sZ1gMQQRQdWxMjaowj2t3QzP1+Rv2urjRd1NVOtcNbOkQYKDtV3ccIR/7cmi7ZTRe+qM+z hX4MxyrpsxsQjX+a66Ujw2pVK0dXzgZs/+1om7kOcpyXnEYCHbqxYhN1DDoYIUVntomjkj UZo/1ZZZytz1OqCSksW9omCZ2NaOBSXJMNc/MU450Rg56abz9xFLoMZ8iWWzjDgQB/nsjc ZFYxMaKLF6dVbsPJOdFHGCdg3FEz1mVp6k4/rIt7Hlj4yuli26pEqvjOHLbRzKgsP/IYN6 VVV1w7rZbKXcVrxoh9hC09xTCW4cLni9jnOGjfleizC1ZgMyzd43fiNPqNbtCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646321241; a=rsa-sha256; cv=none; b=CZ6ZOG8xdzxmGtohSYPM6Ky1EKu+5pIW9Kj8rJO4zeJJxAP+tEQCDgjIAOVAS4isfTa/y5 Yb6cVZWR6trxbSSvmEJOqJhu4tvNZFBM+/IL56Z9AagrTCzu1ISw8zY9al4raIMBzRuasE 1ySUE0Wdc4f+AtESmVUA58mz9ZhW3Fh4VSVTDvgdgkQfiszHZvJc1VmM8tgSeFEjX9HiPT 70i5Uo6yOkSYFA34fa9rW+8S6xZcXXoAgZKRE4C1APVkUxfD+yqFSOxjMDbU8CY+isAgOT bRCcYZfsXaS7dTksXLW1WHkgA4GPz/a9UDFGR8Csy+8yWg9oMs+j+h0RUaKaUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=93c1048a1360c3a0f1a6a9248916ef06c52b4504 commit 93c1048a1360c3a0f1a6a9248916ef06c52b4504 Author: Cy Schubert AuthorDate: 2022-03-03 06:43:48 +0000 Commit: Cy Schubert 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) {