Author: ae
Date: Tue Jun 25 09:08:24 2019
New Revision: 349364
URL: https://svnweb.freebsd.org/changeset/base/349364

Log:
  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>
  MFC after:    1 week

Modified:
  head/sbin/ipfw/ipfw2.c

Modified: head/sbin/ipfw/ipfw2.c
==============================================================================
--- head/sbin/ipfw/ipfw2.c      Tue Jun 25 07:44:37 2019        (r349363)
+++ head/sbin/ipfw/ipfw2.c      Tue Jun 25 09:08:24 2019        (r349364)
@@ -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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to