From owner-freebsd-bugs@FreeBSD.ORG Sun Feb 19 17:50:01 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B982C1065670 for ; Sun, 19 Feb 2012 17:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8E7258FC08 for ; Sun, 19 Feb 2012 17:50:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q1JHo1XL066909 for ; Sun, 19 Feb 2012 17:50:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q1JHo1Nu066908; Sun, 19 Feb 2012 17:50:01 GMT (envelope-from gnats) Resent-Date: Sun, 19 Feb 2012 17:50:01 GMT Resent-Message-Id: <201202191750.q1JHo1Nu066908@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ivan Rozhuk Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9377106566C for ; Sun, 19 Feb 2012 17:43:57 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 9C1A98FC16 for ; Sun, 19 Feb 2012 17:43:57 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q1JHhvE5044041 for ; Sun, 19 Feb 2012 17:43:57 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q1JHhvBl044033; Sun, 19 Feb 2012 17:43:57 GMT (envelope-from nobody) Message-Id: <201202191743.q1JHhvBl044033@red.freebsd.org> Date: Sun, 19 Feb 2012 17:43:57 GMT From: Ivan Rozhuk To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/165296: Fix EVL_APPLY_VLID, update EVL_APPLY_PRI macro X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Feb 2012 17:50:01 -0000 >Number: 165296 >Category: kern >Synopsis: Fix EVL_APPLY_VLID, update EVL_APPLY_PRI macro >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Feb 19 17:50:01 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Ivan Rozhuk >Release: 9.0 >Organization: >Environment: FreeBSD firewall 9.0-STABLE FreeBSD 9.0-STABLE #0: Sat Jan 21 11:32:18 IRKT 2012 root@firewall:/tmp/obj/usr/src/sys/RIM i386 >Description: EVL_APPLY_VLID macro removes the flag Canonical Format Indicator (CFI) and the Priority Code Point (PCP) instead of removing VLAN Identifier (VID). The new VID is superimposed on the old one. (m) -> m_pkthdr.ether_vtag & = EVL_VLID_MASK; \ (m) -> m_pkthdr.ether_vtag | = (vlid); \ The correct version: (m) -> m_pkthdr.ether_vtag & = ~ EVL_VLID_MASK; \ (m) -> m_pkthdr.ether_vtag | = ((vlid) & EVL_VLID_MASK); \ >How-To-Repeat: >Fix: apply patch Patch attached with submission follows: --- ./if_vlan_var.h.orig 2011-09-23 09:51:37.000000000 +0900 +++ ./if_vlan_var.h 2012-02-20 02:28:50.000000000 +0900 @@ -52,27 +52,24 @@ #define EVL_APPLY_VLID(m, vlid) \ do { \ if ((m)->m_flags & M_VLANTAG) { \ - (m)->m_pkthdr.ether_vtag &= EVL_VLID_MASK; \ - (m)->m_pkthdr.ether_vtag |= (vlid); \ + (m)->m_pkthdr.ether_vtag &= ~EVL_VLID_MASK; \ } else { \ - (m)->m_pkthdr.ether_vtag = (vlid); \ + (m)->m_pkthdr.ether_vtag = 0; \ (m)->m_flags |= M_VLANTAG; \ } \ + (m)->m_pkthdr.ether_vtag |= ((vlid) & EVL_VLID_MASK); \ } while (0) /* Set the priority ID in an mbuf packet header non-destructively. */ #define EVL_APPLY_PRI(m, pri) \ do { \ if ((m)->m_flags & M_VLANTAG) { \ - uint16_t __vlantag = (m)->m_pkthdr.ether_vtag; \ - (m)->m_pkthdr.ether_vtag |= EVL_MAKETAG( \ - EVL_VLANOFTAG(__vlantag), (pri), \ - EVL_CFIOFTAG(__vlantag)); \ + (m)->m_pkthdr.ether_vtag &= ~EVL_PRI_MASK; \ } else { \ - (m)->m_pkthdr.ether_vtag = \ - EVL_MAKETAG(0, (pri), 0); \ + (m)->m_pkthdr.ether_vtag = 0; \ (m)->m_flags |= M_VLANTAG; \ } \ + (m)->m_pkthdr.ether_vtag |= (((pri) & 7) << 1); \ } while (0) /* sysctl(3) tags, for compatibility purposes */ >Release-Note: >Audit-Trail: >Unformatted: