aboutsummaryrefslogtreecommitdiff
path: root/sbin/ipfw
diff options
context:
space:
mode:
authorAndrey V. Elsukov <ae@FreeBSD.org>2019-06-25 09:08:24 +0000
committerAndrey V. Elsukov <ae@FreeBSD.org>2019-06-25 09:08:24 +0000
commit55507128b93b01c76f7446bdd5e7f38bed4d4652 (patch)
treebd01d26829473b0476aa6af9ebd947f886a11c44 /sbin/ipfw
parent18cd8bb80011a5f1053007d1a641d510d0f3a5bd (diff)
downloadsrc-55507128b93b01c76f7446bdd5e7f38bed4d4652.tar.gz
src-55507128b93b01c76f7446bdd5e7f38bed4d4652.zip
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
Notes
Notes: svn path=/head/; revision=349364
Diffstat (limited to 'sbin/ipfw')
-rw-r--r--sbin/ipfw/ipfw2.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index 4fd977edb91f..c2d89fcbf72f 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -2223,6 +2223,8 @@ show_static_rule(struct cmdline_opts *co, struct format_opts *fo,
}
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;