summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2016-08-11 10:41:19 +0000
committerae <ae@FreeBSD.org>2016-08-11 10:41:19 +0000
commit2799407183ea1a78d82757540633ffb68a7ab9a4 (patch)
tree4c08c9898fa70d79e3f25d7dd101fbf4d50def80 /sbin
parent493f2f7fa067c0510b3050e4ac71d4fa6628b80d (diff)
downloadFreeBSD-src-2799407183ea1a78d82757540633ffb68a7ab9a4.zip
FreeBSD-src-2799407183ea1a78d82757540633ffb68a7ab9a4.tar.gz
MFC r303842:
Fix constructing of setdscp opcode with tablearg keyword. setdscp's argument can have zero value that conflicts with IP_FW_TARG value. Always set high-order bit if parser doesn't find tablearg keyword. MFC r303845: Fix formatting of setfib opcode. Zero fib is correct value and it conflicts with IP_FW_TARG. Use bprint_uint_arg() only when opcode contains IP_FW_TARG, otherwise just print numeric value with cleared high-order bit. Approved by: re (kib)
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ipfw/ipfw2.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index b2fbf35..f64c2be 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -1582,8 +1582,11 @@ show_static_rule(struct cmdline_opts *co, struct format_opts *fo,
break;
case O_SETFIB:
- bprint_uint_arg(bp, "setfib ", cmd->arg1 & 0x7FFF);
- break;
+ if (cmd->arg1 == IP_FW_TARG)
+ bprint_uint_arg(bp, "setfib ", cmd->arg1);
+ else
+ bprintf(bp, "setfib %u", cmd->arg1 & 0x7FFF);
+ break;
case O_EXTERNAL_ACTION: {
const char *ename;
@@ -3914,15 +3917,19 @@ chkarg:
NEED1("missing DSCP code");
if (_substrcmp(*av, "tablearg") == 0) {
action->arg1 = IP_FW_TARG;
- } else if (isalpha(*av[0])) {
- if ((code = match_token(f_ipdscp, *av)) == -1)
- errx(EX_DATAERR, "Unknown DSCP code");
- action->arg1 = code;
- } else
- action->arg1 = strtoul(*av, NULL, 10);
- /* Add high-order bit to DSCP to make room for tablearg */
- if (action->arg1 != IP_FW_TARG)
+ } else {
+ if (isalpha(*av[0])) {
+ if ((code = match_token(f_ipdscp, *av)) == -1)
+ errx(EX_DATAERR, "Unknown DSCP code");
+ action->arg1 = code;
+ } else
+ action->arg1 = strtoul(*av, NULL, 10);
+ /*
+ * Add high-order bit to DSCP to make room
+ * for tablearg
+ */
action->arg1 |= 0x8000;
+ }
av++;
break;
}
OpenPOWER on IntegriCloud