From owner-dev-commits-src-branches@freebsd.org Sun Jan 3 13:28:56 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 997944D2002; Sun, 3 Jan 2021 13:28:56 +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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D802w3xTnz4vBp; Sun, 3 Jan 2021 13:28:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7A0F4527; Sun, 3 Jan 2021 13:28:56 +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 103DSuaW033041; Sun, 3 Jan 2021 13:28:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 103DSuVp033039; Sun, 3 Jan 2021 13:28:56 GMT (envelope-from git) Date: Sun, 3 Jan 2021 13:28:56 GMT Message-Id: <202101031328.103DSuVp033039@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 796d9b45c7c9 - stable/12 - MFC r365628 by ae: Fix compatibility regression after r364117. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 796d9b45c7c917f0fd09e7c578e8189932debae5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jan 2021 13:28:56 -0000 The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=796d9b45c7c917f0fd09e7c578e8189932debae5 commit 796d9b45c7c917f0fd09e7c578e8189932debae5 Author: Andrey V. Elsukov AuthorDate: 2020-09-11 10:07:09 +0000 Commit: Gordon Bergling CommitDate: 2021-01-03 13:27:50 +0000 MFC r365628 by ae: Fix compatibility regression after r364117. Properly handle the case, when some opcode keywords follow after the `frag` opcode without additional options. Reported by: Evgeniy Khramtsov Approved by: glebius (cherry picked from commit b876085f5589f4e6d531d97ad902c5730ec55339) --- sbin/ipfw/ipfw2.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index e0b5371adb91..85347b1add03 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -4560,17 +4560,24 @@ read_options: fill_cmd(cmd, O_DIVERTED, 0, 2); break; - case TOK_FRAG: - fill_flags_cmd(cmd, O_FRAG, f_ipoff, *av); - /* - * Compatibility: no argument after "frag" - * keyword equals to "frag offset". - */ - if (cmd->arg1 == 0) - cmd->arg1 = 0x1; - else + case TOK_FRAG: { + uint32_t set = 0, clear = 0; + + if (*av != NULL && fill_flags(f_ipoff, *av, NULL, + &set, &clear) == 0) av++; + else { + /* + * Compatibility: no argument after "frag" + * keyword equals to "frag offset". + */ + set = 0x01; + clear = 0; + } + fill_cmd(cmd, O_FRAG, 0, + (set & 0xff) | ( (clear & 0xff) << 8)); break; + } case TOK_LAYER2: fill_cmd(cmd, O_LAYER2, 0, 0);