From owner-svn-src-head@freebsd.org Thu May 10 12:25:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E19BFC7C0F; Thu, 10 May 2018 12:25:02 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2760670A09; Thu, 10 May 2018 12:25:02 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 099BE205D2; Thu, 10 May 2018 12:25:02 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4ACP1Gx059202; Thu, 10 May 2018 12:25:01 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4ACP1ER059201; Thu, 10 May 2018 12:25:01 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201805101225.w4ACP1ER059201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 10 May 2018 12:25:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333458 - head/sbin/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sbin/ipfw X-SVN-Commit-Revision: 333458 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2018 12:25:03 -0000 Author: ae Date: Thu May 10 12:25:01 2018 New Revision: 333458 URL: https://svnweb.freebsd.org/changeset/base/333458 Log: Fix the printing of rule comments. Change uint8_t type of opcode argument to int in the print_opcode() function. Use negative value to print the rest of opcodes, because zero value is O_NOP, and it can't be uses for this purpose. Reported by: lev MFC after: 1 week Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Thu May 10 11:36:16 2018 (r333457) +++ head/sbin/ipfw/ipfw2.c Thu May 10 12:25:01 2018 (r333458) @@ -1708,7 +1708,7 @@ print_instruction(struct buf_pr *bp, const struct form static ipfw_insn * print_opcode(struct buf_pr *bp, struct format_opts *fo, - struct show_state *state, uint8_t opcode) + struct show_state *state, int opcode) { ipfw_insn *cmd; int l; @@ -1716,7 +1716,7 @@ print_opcode(struct buf_pr *bp, struct format_opts *fo for (l = state->rule->act_ofs, cmd = state->rule->cmd; l > 0; l -= F_LEN(cmd), cmd += F_LEN(cmd)) { /* We use zero opcode to print the rest of options */ - if (opcode != 0 && cmd->opcode != opcode) + if (opcode >= 0 && cmd->opcode != opcode) continue; /* * Skip O_NOP, when we printing the rest @@ -2192,7 +2192,7 @@ show_static_rule(struct cmdline_opts *co, struct forma O_IP_DSTPORT, HAVE_DSTIP); /* Print the rest of options */ - while (print_opcode(bp, fo, &state, 0)) + while (print_opcode(bp, fo, &state, -1)) ; end: /* Print comment at the end */