Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4551480rwb; Mon, 8 Aug 2022 03:08:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR7t8nH6rHBOq3y8gmFNhzlvQMSipukD657+g8tpw66E+BUq7L0gH62JGmyA39kGUuEheH+Q X-Received: by 2002:aa7:d597:0:b0:43d:5bcf:f251 with SMTP id r23-20020aa7d597000000b0043d5bcff251mr17161151edq.15.1659953315042; Mon, 08 Aug 2022 03:08:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659953315; cv=none; d=google.com; s=arc-20160816; b=aB8DGj/8gXrCPBgMHT4l/OLM+QaNaBDXV1fGXHxHe8rIteI1eKxI32YPeI2pNQ0vRX mk7zkcKuGGVCtH3bDvAuIocSJN+R+/YS4rHXHryhu66M0FZZmdvBTTyISkortNqDpFyc 6TvCYjyZUg07+sAeoJp3kRzjxPpB6lwG/5sQ54yfrBP06va3SSdeLjXMLuDurqfff7hq tCOxFw4oy2SuCjb8bQo18tKmsWdAnSrzWGDqYnznapzr3i3jt4F8v63DxgY/Gu1naDtW FC/UvYIDfjYo8whyRvao6lKeH4MKZMww5olre493/DjLphyllT9//2KhEb7PL6IKAOYQ mj5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:sender:hmm_source_type :hmm_attache_num:hmm_source_ip; bh=dYHOfNRR1ztlLGGLgdTbayHLyuzLFgY2l6hYzYeuAMs=; b=YDwZnOtiPDM3D8VXKWUyCg/jY7rbKnH9fnqEqQiOBnayJYgT4RXI7xEf1t9VN8McRs 9/buGRjbZ14VzbsWeFH2p3BoZXXj3Exd1eqNmz77I+q0pezVXf1E+CqcWY78Hs7lgV/V 1LTH2Zo2xvZv9PXgvuldVaafSt3/l+MmcD+dgV4ymb9j7XcK/H2B8Rf8AzW5zZAQZFVd o0XRfa9xJkp/bZZM3z3bWUAAPN1+cg9JWLkI6ba7cM1wtbWVuV14QeJIrRwStj+1xjuJ qvbdtE7r2tvWWFDQ5paKP66/pp0iGxhWwY7nHQiPHsgkBPPqwkiMJ1gzm0W8wrZ4i/0f S0Aw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hu8-20020a170907a08800b007317d093e6esi743014ejc.822.2022.08.08.03.08.09; Mon, 08 Aug 2022 03:08:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242147AbiHHJnF (ORCPT + 99 others); Mon, 8 Aug 2022 05:43:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231496AbiHHJnD (ORCPT ); Mon, 8 Aug 2022 05:43:03 -0400 Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.228]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AEAE410FC; Mon, 8 Aug 2022 02:43:02 -0700 (PDT) HMM_SOURCE_IP: 172.18.0.48:36880.477778468 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-10.133.8.199 (unknown [172.18.0.48]) by chinatelecom.cn (HERMES) with SMTP id 057D32800ED; Mon, 8 Aug 2022 17:42:56 +0800 (CST) X-189-SAVE-TO-SEND: +sunshouxin@chinatelecom.cn Received: from ([172.18.0.48]) by app0024 with ESMTP id af902e6a6e614e7b83ddc61e3a362c7a for j.vosburgh@gmail.com; Mon, 08 Aug 2022 17:42:59 CST X-Transaction-ID: af902e6a6e614e7b83ddc61e3a362c7a X-Real-From: sunshouxin@chinatelecom.cn X-Receive-IP: 172.18.0.48 X-MEDUSA-Status: 0 Sender: sunshouxin@chinatelecom.cn From: Sun Shouxin To: j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, huyd12@chinatelecom.cn, sunshouxin@chinatelecom.cn Subject: [PATCH v1] net:bonding:support balance-alb interface with vlan to bridge Date: Mon, 8 Aug 2022 02:41:07 -0700 Message-Id: <20220808094107.6150-1-sunshouxin@chinatelecom.cn> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In my test, balance-alb bonding with two slaves eth0 and eth1, and then Bond0.150 is created with vlan id attached bond0. After adding bond0.150 into one linux bridge, I noted that Bond0, bond0.150 and bridge were assigned to the same MAC as eth0. Once bond0.150 receives a packet whose dest IP is bridge's and dest MAC is eth1's, the linux bridge cannot process it as expected. The patch fix the issue, and diagram as below: eth1(mac:eth1_mac)--bond0(balance-alb,mac:eth0_mac)--eth0(mac:eth0_mac) | bond0.150(mac:eth0_mac) | bridge(ip:br_ip, mac:eth0_mac)--other port Suggested-by: Hu Yadi Signed-off-by: Sun Shouxin --- drivers/net/bonding/bond_alb.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 007d43e46dcb..0dea04f00f12 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c @@ -654,6 +654,7 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) { struct slave *tx_slave = NULL; struct arp_pkt *arp; + struct net_device *dev; if (!pskb_network_may_pull(skb, sizeof(*arp))) return NULL; @@ -665,6 +666,13 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) if (!bond_slave_has_mac_rx(bond, arp->mac_src)) return NULL; + dev = ip_dev_find(dev_net(bond->dev), arp->ip_src); + if (dev) { + if (netif_is_bridge_master(dev)) { + return NULL; + } + } + if (arp->op_code == htons(ARPOP_REPLY)) { /* the arp must be sent on the selected rx channel */ tx_slave = rlb_choose_channel(skb, bond, arp); -- 2.27.0