Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752544Ab1CEKgU (ORCPT ); Sat, 5 Mar 2011 05:36:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:20729 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751983Ab1CEKgT (ORCPT ); Sat, 5 Mar 2011 05:36:19 -0500 Date: Sat, 5 Mar 2011 11:36:14 +0100 From: Jiri Pirko To: Xiaotian Feng Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Tom Herbert Subject: Re: [RFC PATCH] net/core: fix skb handling on netif serves for both bridge and vlan Message-ID: <20110305103613.GB7799@psychotron.redhat.com> References: <1299149713-18740-1-git-send-email-dfeng@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1299149713-18740-1-git-send-email-dfeng@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2426 Lines: 83 Thu, Mar 03, 2011 at 11:55:13AM CET, dfeng@redhat.com wrote: >Consider network topology as follows: > >eth0 eth1 > |_____| > | > bond0 --- br0 > | > vlan0 --- br1 > >bond0 serves for both br0 and vlan0, if a vlan tagged packet was sent >to br1 through bond0, bridge handling code is seeing the packet on bond0 >and handing it off to my "legacy" bridge before vlan_tx_tag_present >and vlan_hwaccel_do_receive even haven't a chance to look at it. > >Moving the vlan_tx_tag_present before bridge/macvlan handling code could >cure this. Wouldn't this break "eth0 - br0 - br0.5"? > >Signed-off-by: Xiaotian Feng >Cc: "David S. Miller" >Cc: Eric Dumazet >Cc: Tom Herbert >--- > net/core/dev.c | 20 ++++++++++---------- > 1 files changed, 10 insertions(+), 10 deletions(-) > >diff --git a/net/core/dev.c b/net/core/dev.c >index 8ae6631..d2d12c2 100644 >--- a/net/core/dev.c >+++ b/net/core/dev.c >@@ -3079,27 +3079,27 @@ static int __netif_receive_skb(struct sk_buff *skb) > ncls: > #endif > >- /* Handle special case of bridge or macvlan */ >- rx_handler = rcu_dereference(skb->dev->rx_handler); >- if (rx_handler) { >+ if (vlan_tx_tag_present(skb)) { > if (pt_prev) { > ret = deliver_skb(skb, pt_prev, orig_dev); > pt_prev = NULL; > } >- skb = rx_handler(skb); >- if (!skb) >+ if (vlan_hwaccel_do_receive(&skb)) { >+ ret = __netif_receive_skb(skb); >+ goto out; >+ } else if (unlikely(!skb)) > goto out; > } > >- if (vlan_tx_tag_present(skb)) { >+ /* Handle special case of bridge or macvlan */ >+ rx_handler = rcu_dereference(skb->dev->rx_handler); >+ if (rx_handler) { > if (pt_prev) { > ret = deliver_skb(skb, pt_prev, orig_dev); > pt_prev = NULL; > } >- if (vlan_hwaccel_do_receive(&skb)) { >- ret = __netif_receive_skb(skb); >- goto out; >- } else if (unlikely(!skb)) >+ skb = rx_handler(skb); >+ if (!skb) > goto out; > } > >-- >1.7.1 > >-- >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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/