From owner-svn-src-head@freebsd.org Mon Aug 8 18:10:31 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A746BB3E9E; Mon, 8 Aug 2016 18:10:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B8B614EA; Mon, 8 Aug 2016 18:10:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u78IAUPH096095; Mon, 8 Aug 2016 18:10:30 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u78IAUQ4096094; Mon, 8 Aug 2016 18:10:30 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201608081810.u78IAUQ4096094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 8 Aug 2016 18:10:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303842 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2016 18:10:31 -0000 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; }