Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5574074rwb; Mon, 8 Aug 2022 23:36:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR42tamySI+50WgnCKaC/5CjsPBm9gUeCkQIIG/MGqk5Wud8Wn+3cStGi0E1+0hyM/ivtRtv X-Received: by 2002:a17:907:209c:b0:731:27bb:da8c with SMTP id pv28-20020a170907209c00b0073127bbda8cmr9265290ejb.555.1660026992145; Mon, 08 Aug 2022 23:36:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660026992; cv=none; d=google.com; s=arc-20160816; b=JMxbqMRlP1KuA9rNxaz+U1JfI+tHPyJmSHMY+Nr8ZHYoMR8lprYQu0FYvSynBFXtNz WJ+/m31ZLr/cgKNADwshIBA2KBWKBGf4eUilODAqvzW6Guq1jXYz/vH60UFaYnPJliCC siTkeKZm7M/Qmdx/6M7hjLI8SYzG9+nupOTIHxFzaB7jATLA7HV0DDAuZrKOrHASxzyn Q2LaTGLMmBOUJqrEGV36LTR8o1F0BaBxS0xqYPhw8VpkO0yuK3m7ePG4cF96oKpaVW/n SiTjk1Z7JwTRP/A5G1figPJs+NHN/iGm5Glg5EA2kJEB7v3QvggDYQAnNI7HyGeeoHIQ nkZA== 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=kdOiyh/YbpiNo5nAwoZcU5DAsxffdZsNJA7wwaxduAk=; b=cm+Cw9L8iD3GTd2t0Ak5+jhiggyeR94FTJB6ysNtTQfZ67oKCrM6o7FpEyTF2vqz4n mPCyw8//y811JX91iv/bNcavimfRTC60JJeniQbiwQPMaXW1eR8LqvILiJNZ5/SYFvpL PaWHmsHDCEB/ZFlInUagsdLTLH7WLva5wZJaDCJ4k82ZypKsEP25tvKttyxCruoeFQJq vXl6WASuKdwkfWZT1ZBP1PcRKCFbSpRZw8Q3AZOiywJwFeQFRsyNnZgB775uI7kdkw1x VhRhm5y7zvMnfFRMwB02NpCEEGNfxMZ/hf7gmTTTPJQh1oNufpK6k0hOXFaOmKAgZpxA TByQ== 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 gt6-20020a1709072d8600b0073155c0e7cesi1671437ejc.677.2022.08.08.23.36.03; Mon, 08 Aug 2022 23:36:32 -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 S236944AbiHIGXX (ORCPT + 99 others); Tue, 9 Aug 2022 02:23:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236251AbiHIGXV (ORCPT ); Tue, 9 Aug 2022 02:23:21 -0400 Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.222]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 721801FCC8; Mon, 8 Aug 2022 23:23:19 -0700 (PDT) HMM_SOURCE_IP: 172.18.0.48:50634.2011200144 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 1F5EF2800B9; Tue, 9 Aug 2022 14:23:09 +0800 (CST) X-189-SAVE-TO-SEND: +sunshouxin@chinatelecom.cn Received: from ([172.18.0.48]) by app0024 with ESMTP id 1e91304342df415f95cdfdc294bf4188 for j.vosburgh@gmail.com; Tue, 09 Aug 2022 14:23:15 CST X-Transaction-ID: 1e91304342df415f95cdfdc294bf4188 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, razor@blackwall.org, huyd12@chinatelecom.cn, sunshouxin@chinatelecom.cn Subject: [PATCH v2] net:bonding:support balance-alb interface with vlan to bridge Date: Mon, 8 Aug 2022 23:21:03 -0700 Message-Id: <20220809062103.31213-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 will not match eth1's MAC entry in FDB, and not handle 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 --- changelog: v1->v2: -declare variabls in reverse xmas tree order -delete {} -add explanation in commit message --- drivers/net/bonding/bond_alb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 007d43e46dcb..60cb9a0225aa 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c @@ -653,6 +653,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) { struct slave *tx_slave = NULL; + struct net_device *dev; struct arp_pkt *arp; if (!pskb_network_may_pull(skb, sizeof(*arp))) @@ -665,6 +666,12 @@ 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