From patchwork Thu Sep 30 12:16:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 66150 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id DAE31B6EF1 for ; Thu, 30 Sep 2010 22:17:02 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752482Ab0I3MQx (ORCPT ); Thu, 30 Sep 2010 08:16:53 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:49250 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751857Ab0I3MQx (ORCPT ); Thu, 30 Sep 2010 08:16:53 -0400 Received: by fxm4 with SMTP id 4so602532fxm.19 for ; Thu, 30 Sep 2010 05:16:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=NxLHWxPm9M6JNDfrMqbxflXW5AmmIfA/qZhmSyxX9jM=; b=amsTqQ9YYrDS2srVNEBbyw9+8yvLbY54p4oUMO4zUaOAv9UpDv+34mrcFV/XRbVTkv OLAvn0xY0Wz5PAM8WLlog5vqbzQ6vtxMv1enwViLJVVfhAQR0bdNqQ/d21Tl02T6Nfd0 vsrkR/QXEeCDDHKI/Xzs44QcBMF0vyzlLzsis= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=I7Ib0hREjyM9xd+7oNkWv1sOd5Fj2ByQdgjZKI0E3rNayBtauU/SyQ8+cpAjowMaqi CKglnXlhsu4HFUIRKSRoDcl1m8APaf2LZSt4l/BpnQCH/yU3uuY9x59g9zw4Onz7Vy21 hacEyPfe7qcH1sSQEvMz/Ad47N+KT6R8yfzvo= Received: by 10.223.106.8 with SMTP id v8mr3647159fao.42.1285849009863; Thu, 30 Sep 2010 05:16:49 -0700 (PDT) Received: from [10.150.51.210] (gw0.net.jmsp.net [212.23.165.14]) by mx.google.com with ESMTPS id k15sm4443767fai.40.2010.09.30.05.16.46 (version=SSLv3 cipher=RC4-MD5); Thu, 30 Sep 2010 05:16:48 -0700 (PDT) Subject: Re: VLAN packets silently dropped in promiscuous mode From: Eric Dumazet To: Patrick McHardy Cc: Roger Luethi , David Miller , Jesse Gross , netdev@vger.kernel.org In-Reply-To: <4CA46B72.2090100@trash.net> References: <20100929113757.GA23755@core.hellgate.ch> <20100930080703.GA10827@core.hellgate.ch> <1285838215.2615.126.camel@edumazet-laptop> <1285840532.2615.196.camel@edumazet-laptop> <1285843234.2615.278.camel@edumazet-laptop> <4CA46B72.2090100@trash.net> Date: Thu, 30 Sep 2010 14:16:44 +0200 Message-ID: <1285849004.2615.394.camel@edumazet-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Le jeudi 30 septembre 2010 à 12:50 +0200, Patrick McHardy a écrit : > This should be fine as long as the packets are properly marked > with PACKET_OTHERHOST. Ah thanks Patrick for the tip ! I tested following patch on tg3 and it is doing the right thing this time. [PATCH] vlan: dont drop packets from unknown vlans in promiscuous mode Roger Luethi noticed packets for unknown VLANs getting silently dropped even in promiscuous mode. Check for promiscuous mode in __vlan_hwaccel_rx() and vlan_gro_common() before drops. As suggested by Patrick, mark such packets to have skb->pkt_type set to PACKET_OTHERHOST to make sure they are dropped by IP stack. Reported-by: Roger Luethi Signed-off-by: Eric Dumazet CC: Patrick McHardy --- net/8021q/vlan_core.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 01ddb04..0eb96f7 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c @@ -24,8 +24,11 @@ int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, if (vlan_dev) skb->dev = vlan_dev; - else if (vlan_id) - goto drop; + else if (vlan_id) { + if (!(skb->dev->flags & IFF_PROMISC)) + goto drop; + skb->pkt_type = PACKET_OTHERHOST; + } return (polling ? netif_receive_skb(skb) : netif_rx(skb)); @@ -102,8 +105,11 @@ vlan_gro_common(struct napi_struct *napi, struct vlan_group *grp, if (vlan_dev) skb->dev = vlan_dev; - else if (vlan_id) - goto drop; + else if (vlan_id) { + if (!(skb->dev->flags & IFF_PROMISC)) + goto drop; + skb->pkt_type = PACKET_OTHERHOST; + } for (p = napi->gro_list; p; p = p->next) { NAPI_GRO_CB(p)->same_flow =