From owner-freebsd-net@FreeBSD.ORG Tue Oct 18 23:38:14 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5ABA71065672 for ; Tue, 18 Oct 2011 23:38:14 +0000 (UTC) (envelope-from rozhuk.im@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id D8D6E8FC13 for ; Tue, 18 Oct 2011 23:38:13 +0000 (UTC) Received: by bkbzu17 with SMTP id zu17so1813296bkb.13 for ; Tue, 18 Oct 2011 16:38:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=reply-to:from:to:references:in-reply-to:subject:date:message-id :mime-version:content-type:content-transfer-encoding:x-mailer :thread-index:content-language; bh=5ZfQHrWgVA4t4nWMik3Q16GTz9JOWvMTUmaJED9uh98=; b=GZdDjNQTyw72UlhL3F0C0CCAsHtwe9K0TnfRyAWt6+5MqWWZIJ0MWH4KGe4lBMGXuU JIpOOq2aXtybZckRcukkC2wRJFZn0MwaS44LzAwx4DL1Y8cSX1zksdqIcCy9oqgMJZ2q CIMMn9kIfi2uDXd43mAMs0ppKwbrufu4zPF44= Received: by 10.204.140.22 with SMTP id g22mr3212084bku.69.1318981092684; Tue, 18 Oct 2011 16:38:12 -0700 (PDT) Received: from rimwks1x64 ([92.124.38.98]) by mx.google.com with ESMTPS id x3sm3893709bkn.1.2011.10.18.16.38.10 (version=SSLv3 cipher=OTHER); Tue, 18 Oct 2011 16:38:11 -0700 (PDT) From: rozhuk.im@gmail.com To: "'Ryan Stone'" , "'freebsd-net'" References: In-Reply-To: Date: Wed, 19 Oct 2011 08:38:07 +0900 Message-ID: <4e9e0de3.4364cc0a.38b5.ffffc94f@mx.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1251" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcyNtXR/2l2GbRq1QrOBFYJhsbV7zQAOXGRQ Content-Language: ru Cc: Subject: RE: ether_demux does not handle frames with embedded vlan tags X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Rozhuk.IM@gmail.com List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2011 23:38:14 -0000 > ether_demux currently assumes that all vlan-tagged packets that it > sees have had the vlan stripped out and the M_VLAN tag is set, so it > never checks the ether type for a vlan. However ng_ether_rcv_upper > currently does not guarantee that this is the case(and there may be > other code paths where this is also true). Does anybody have any > strong feelings as to where the fix should go? Making ether_demux > handle it is guaranteed to catch all cases but it does add a bit more > overhead to check for a vlan tag at each stage. In what cases vlan-tagged packet can be received by ng_ether_rcv_upper ? Another side of vlan and netgraph implementation problem is in: PR = 152141 http://lists.freebsd.org/pipermail/freebsd-net/2011-February/027964.html Tagget packet -> ether_input --> (M_VLANTAG set) --> ng_ether.lower --> ng_bridge --> ng_ether.lower --> ether_output_frame --> ifp->if_transmit Untagged packet may be transmitted. ng_ether.lower and ether_output_frame does not check: is M_VLANTAG = handled by iface driver IMHO ether_output_frame should do this check. /* * If underlying interface can not do VLAN tag insertion itself * then attach a packet tag that holds it. */ if ((m->m_flags & M_VLANTAG) && (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) =3D=3D 0) { m =3D ether_vlanencap(m, m->m_pkthdr.ether_vtag); if (m =3D=3D NULL) { ifp->if_oerrors++; return (ENOBUFS); } m->m_flags &=3D ~M_VLANTAG; } (from if_bridge.c) =A0 -- Rozhuk Ivan