From nobody Fri Feb 21 11:19:54 2025 X-Original-To: dev-commits-src-branches@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 4Yznj717pkz5pdcD; Fri, 21 Feb 2025 11:19:55 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yznj70Lyjz3mrg; Fri, 21 Feb 2025 11:19:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740136795; 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=7aSMadKsSHdxz/At2qLihppbzzCOHMIj1WObPL0xIaM=; b=DEGs0o7YavjqEDN+799Biidn7zQWHLQw+ByGFk8QAOP66XlALt3R2nqQVFiERePc7XPRVP SocNmyMJ0lAAorGfco3Aib8EtjdGagPEheUT60Ax85+9Lz1XncnidVNjXNeEIqRhEt2V/C 9/GXepZpUvvcNWJh7vLdGFtsN5mzeN50VNwC795O9z+DhHK1SI+80dR0OVp2bg4AwpDWkl iHqZP4CncdfoGKsLg+u70s9/woH0H/TNVqN8D2gImdCjw12qmgqvxb8qr/0R2V5jMT5TQU NN+ALZn0P7+RbsAKq+DTUAYmj3fEUfBWDoNWI/DcW11OYhI2LLdzzTw3WWIFFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740136795; a=rsa-sha256; cv=none; b=S7dhAhPcQm1/Iajks5nUF5LSf3bT6xeCAUUz3a2uRNQlwP8TZWzGwTeHCqqfR0Gxq/b5T2 KC6VUD5tc56pEIN4xw9GTKQ6JnOLLRdkw7Whf9yu/7kdmS46ZtA8Q+rlkL604hnzEe4mhP qB9BuHzXvNjbCBPx1eZ+Gy7jN3H7j5aMTGBEkw8IqIyvOF5Xn0cl0QTwT1jbOl+G7mwLBA AKbAj7G/YwlsldWAhGwX9/cR6AVQhLXl+R6/Ieuxwr2jZjP9ulxytUKZeO2zo86hx41I/K yJbOsWBZN68ciQJZzSEDdBA8NK4BM+wOoPEagnjPSuHN35ICuGAALeD/qIx6BA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740136795; 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=7aSMadKsSHdxz/At2qLihppbzzCOHMIj1WObPL0xIaM=; b=TV3tX+Bp7VzYoOBUVNHoWDPMOP1ukuvTGxbdtryXITvGJON/6Nfqho+J/OmrGBPeTYAkgs T4PMyZzz13XYpqaK36feNhw/QmCXL/N0NK/gHQdJnxwyjtwye2PVDwyJUs89se3ptMdd0+ qNwFX3C3UVor1PgIKRq6G3eb0OZPSVx8eGnfx9NzNOmocZC55YgnoAg2yh+M0dTIHhQKGD PXkgiKkxNb8uhnWTxgTtHe3qTvVE0fUBUZxYnGLS6V5POqVRnVSlwUgwJWppFVCs+f92xb Rg0QOLkCMl+nV97qU7u6q/L88k1KIV9r1TDszLf3e0HV67ybuIJbo/o2QMa6lw== 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 4Yznj66lNjz4Lx; Fri, 21 Feb 2025 11:19:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51LBJsjT016777; Fri, 21 Feb 2025 11:19:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51LBJst4016774; Fri, 21 Feb 2025 11:19:54 GMT (envelope-from git) Date: Fri, 21 Feb 2025 11:19:54 GMT Message-Id: <202502211119.51LBJst4016774@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: 63422982e074 - stable/13 - ipfw: make 'ipfw show' output compatible with 'ipfw add' command List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 63422982e074a144cfb420408be06e6dc154f9fe Auto-Submitted: auto-generated The branch stable/13 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=63422982e074a144cfb420408be06e6dc154f9fe commit 63422982e074a144cfb420408be06e6dc154f9fe Author: Andrey V. Elsukov AuthorDate: 2025-02-11 09:48:17 +0000 Commit: Andrey V. Elsukov CommitDate: 2025-02-21 11:18:44 +0000 ipfw: make 'ipfw show' output compatible with 'ipfw add' command If rule was added in compact form and rule body is empty, print 'proto ip' opcode to be compatible with ipfw(8) syntax parser. Before: $ ipfw add allow proto ip 000700 allow After: $ ipfw add allow proto ip 000700 allow proto ip (cherry picked from commit 706a03f61bbb6e0cf10e6c3727966495b30d763e) --- sbin/ipfw/ipfw2.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 46c51081ded4..7a084249c4eb 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -2276,6 +2276,13 @@ show_static_rule(struct cmdline_opts *co, struct format_opts *fo, if (rule->flags & IPFW_RULE_JUSTOPTS) { state.flags |= HAVE_PROTO | HAVE_SRCIP | HAVE_DSTIP; + /* + * Print `proto ip` if all opcodes has been already printed. + */ + if (memchr(state.printed, 0, rule->act_ofs) == NULL) { + bprintf(bp, " proto ip"); + goto end; + } goto justopts; }