Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Jul 2019 09:48:22 +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: r349646 - stable/11/sbin/ipfw
Message-ID:  <201907030948.x639mMUK055942@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Wed Jul  3 09:48:22 2019
New Revision: 349646
URL: https://svnweb.freebsd.org/changeset/base/349646

Log:
  MFC r349364:
    Restore ipfw(8)'s compact output support broken after r331668.
  
    Also modify it a bit. Now -c option omits only 'from any to any' part
    and works for different protocols (not just for ip).
  
    Reported by:  Dmitry Selivanov <dseliv at gmail>

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	Wed Jul  3 09:48:20 2019	(r349645)
+++ stable/11/sbin/ipfw/ipfw2.c	Wed Jul  3 09:48:22 2019	(r349646)
@@ -2223,6 +2223,8 @@ show_static_rule(struct cmdline_opts *co, struct forma
 	}
 
 	print_proto(bp, fo, &state);
+	if (co->do_compact != 0 && (rule->flags & IPFW_RULE_NOOPT))
+		goto justopts;
 
 	/* Print source */
 	bprintf(bp, " from");
@@ -4395,6 +4397,8 @@ chkarg:
 	}
     OR_BLOCK(get_proto);
 
+	first_cmd = cmd; /* update pointer to use in compact form */
+
 	/*
 	 * "from", mandatory
 	 */
@@ -4466,6 +4470,8 @@ chkarg:
 				cmd = next_cmd(cmd, &cblen);
 		}
 	}
+	if (first_cmd == cmd)
+		rule->flags |= IPFW_RULE_NOOPT;
 
 read_options:
 	prev = NULL;



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