Date: Mon, 8 Aug 2016 18:10:30 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303842 - head/sbin/ipfw Message-ID: <201608081810.u78IAUQ4096094@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Mon Aug 8 18:10:30 2016 New Revision: 303842 URL: https://svnweb.freebsd.org/changeset/base/303842 Log: 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 after: 3 days Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon Aug 8 17:59:59 2016 (r303841) +++ head/sbin/ipfw/ipfw2.c Mon Aug 8 18:10:30 2016 (r303842) @@ -3957,15 +3957,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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608081810.u78IAUQ4096094>