Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 May 2018 10:01:47 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r333705 - stable/11/sbin/ipfw
Message-ID:  <201805171001.w4HA1lxw030306@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Thu May 17 10:01:47 2018
New Revision: 333705
URL: https://svnweb.freebsd.org/changeset/base/333705

Log:
  MFC r333458:
    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
  Approved by:	re (gjb)

Modified:
  stable/11/sbin/ipfw/ipfw2.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ipfw/ipfw2.c
==============================================================================
--- stable/11/sbin/ipfw/ipfw2.c	Thu May 17 06:04:50 2018	(r333704)
+++ stable/11/sbin/ipfw/ipfw2.c	Thu May 17 10:01:47 2018	(r333705)
@@ -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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805171001.w4HA1lxw030306>