svn commit: r303957 - stable/11/sbin/ipfw
Andrey V. Elsukov
ae at FreeBSD.org
Thu Aug 11 10:41:20 UTC 2016
Author: ae
Date: Thu Aug 11 10:41:19 2016
New Revision: 303957
URL: https://svnweb.freebsd.org/changeset/base/303957
Log:
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)
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 Aug 11 10:14:03 2016 (r303956)
+++ stable/11/sbin/ipfw/ipfw2.c Thu Aug 11 10:41:19 2016 (r303957)
@@ -1582,8 +1582,11 @@ show_static_rule(struct cmdline_opts *co
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;
}
More information about the svn-src-stable-11
mailing list