Date: Fri, 11 Sep 2020 10:07:10 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365628 - head/sbin/ipfw Message-ID: <202009111007.08BA7AbB038702@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Fri Sep 11 10:07:09 2020 New Revision: 365628 URL: https://svnweb.freebsd.org/changeset/base/365628 Log: 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 <evgeniy at khramtsov org> Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Fri Sep 11 10:05:44 2020 (r365627) +++ head/sbin/ipfw/ipfw2.c Fri Sep 11 10:07:09 2020 (r365628) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009111007.08BA7AbB038702>