From patchwork Fri Jul 21 04:03:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 13321307 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 790377F for ; Fri, 21 Jul 2023 04:04:15 +0000 (UTC) Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51E5C1BFC for ; Thu, 20 Jul 2023 21:04:14 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-2632336f75fso879182a91.3 for ; Thu, 20 Jul 2023 21:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689912253; x=1690517053; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Bu40FYf4l16wl+LuNHGFQ31ZyL4l6RFv71xxNKtpWTg=; b=gDG2UQ3Y5GmywxAfp4w8pbCQSI4sK7NkUE/eftLIlP6Dc5XpUXW061VnILiTwrR8VV TSzGHpMgoRw0ofZLpWwC3REYKDk6YSVctPyvIZAD0SODYiDHVZHxqCIRz0lVa+8piKWu zPhnzvqdxtsFEIvY+WhlBL40b5WnXRL0P/5sKLwBl4A4MP3EYpATUXf6Htf4M96DDiC2 lBxzUwjAbwEz8Rf9soHDs2H0jf8WVKM+YiHNCkjFRRqTHSpiG9JGtYCcVWmkUEKfQmLq iK4I254cBfIFr5hqvQ7fqZbeVpBGnURkJ1ivBDfVZaXFAgHwZuvri+k4UrPhKny/YIyC fU6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689912253; x=1690517053; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Bu40FYf4l16wl+LuNHGFQ31ZyL4l6RFv71xxNKtpWTg=; b=gPgHgDPnSaFJmtGLcybewt3LKJ1f+hkfwmiGnUgx6ZQJ3OxrjQRdwOH9sNc/fYUHme v4dJrtaxE/ph8i4gbWXZAKpSc7WxHef7+T+3c1XSZ/0o/tm7tTZ6ric+odShbi+/ywr9 3ji2tdwCJEYpI3L/tzTXAlXLXNgNdgTaWop/sTWHj2zaQgfM6hspRIxYWxiC9+6+Rdcp 7+Y2uAuE4JetnSZ3OR3RaH4lEWJBNlKUJ+7zOVQBl+SDs2+Y1eU/dMRugKw2ZDDklESl Hu1rjUDHW85FgmLbZHsZcmN8gL3FZzZKK1edQFm2EKwFz+tbhI324nCxE4irnn3MJw1a 1X8w== X-Gm-Message-State: ABy/qLamkMXI3Ma4n6Kb+Z2WVs0F511FgH+98jJ5wCHfT1Y8ecPUpdu+ 78T0qVJms+3BTALznSx8IJHAry1G4MtxQQ== X-Google-Smtp-Source: APBJJlGK4wk540ps49SvUpFF/ivrSxuDDXWJPxpzPCPyQABrPoHdMHHbByE0Huh0cHD+MH0rKur6vQ== X-Received: by 2002:a17:90a:b283:b0:262:e3aa:fd73 with SMTP id c3-20020a17090ab28300b00262e3aafd73mr608705pjr.17.1689912252934; Thu, 20 Jul 2023 21:04:12 -0700 (PDT) Received: from Laptop-X1.redhat.com ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id bt21-20020a17090af01500b00263f6687690sm1640480pjb.18.2023.07.20.21.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 21:04:12 -0700 (PDT) From: Hangbin Liu To: netdev@vger.kernel.org Cc: Jay Vosburgh , "David S . Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , Liang Li , Jiri Pirko , Nikolay Aleksandrov , Hangbin Liu Subject: [PATCHv4 net 1/2] bonding: reset bond's flags when down link is P2P device Date: Fri, 21 Jul 2023 12:03:55 +0800 Message-Id: <20230721040356.3591174-2-liuhangbin@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230721040356.3591174-1-liuhangbin@gmail.com> References: <20230721040356.3591174-1-liuhangbin@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 X-Patchwork-Delegate: kuba@kernel.org When adding a point to point downlink to the bond, we neglected to reset the bond's flags, which were still using flags like BROADCAST and MULTICAST. Consequently, this would initiate ARP/DAD for P2P downlink interfaces, such as when adding a GRE device to the bonding. To address this issue, let's reset the bond's flags for P2P interfaces. Before fix: 7: gre0@NONE: mtu 1500 qdisc noqueue master bond0 state UNKNOWN group default qlen 1000 link/gre6 2006:70:10::1 peer 2006:70:10::2 permaddr 167f:18:f188:: 8: bond0: mtu 1500 qdisc noqueue state UP group default qlen 1000 link/gre6 2006:70:10::1 brd 2006:70:10::2 inet6 fe80::200:ff:fe00:0/64 scope link valid_lft forever preferred_lft forever After fix: 7: gre0@NONE: mtu 1500 qdisc noqueue master bond2 state UNKNOWN group default qlen 1000 link/gre6 2006:70:10::1 peer 2006:70:10::2 permaddr c29e:557a:e9d9:: 8: bond0: mtu 1500 qdisc noqueue state UP group default qlen 1000 link/gre6 2006:70:10::1 peer 2006:70:10::2 inet6 fe80::1/64 scope link valid_lft forever preferred_lft forever Reported-by: Liang Li Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2221438 Fixes: 872254dd6b1f ("net/bonding: Enable bonding to enslave non ARPHRD_ETHER") Signed-off-by: Hangbin Liu --- v4: no change. v3: no change. v2: Add the missed {} after if checking. --- drivers/net/bonding/bond_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 7a0f25301f7e..484c9e3e5e82 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1508,6 +1508,11 @@ static void bond_setup_by_slave(struct net_device *bond_dev, memcpy(bond_dev->broadcast, slave_dev->broadcast, slave_dev->addr_len); + + if (slave_dev->flags & IFF_POINTOPOINT) { + bond_dev->flags &= ~(IFF_BROADCAST | IFF_MULTICAST); + bond_dev->flags |= (IFF_POINTOPOINT | IFF_NOARP); + } } /* On bonding slaves other than the currently active slave, suppress From patchwork Fri Jul 21 04:03:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 13321308 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E598C7F for ; Fri, 21 Jul 2023 04:04:18 +0000 (UTC) Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 919721BC1 for ; Thu, 20 Jul 2023 21:04:17 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-262f7b67da8so820805a91.0 for ; Thu, 20 Jul 2023 21:04:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689912256; x=1690517056; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=a/tMk6LKzIoo6vJXJHVG64sPPKUXgW1KwB7m/idCZTo=; b=DsOdmCCWiZvPphh3SE707GETF9JuJIx4D1VEoUi6xU3yFUjtAo6cdhbeOBF2fmTi0Z AB4nhGTf9nRdmWdlnI5+WKpiyPRvGYnqnwS0T0ykbrYyiomswyWJbaOgYUMRb3TAN9Gy 3Z2bprauOGdVcLXK1ivpGWJgPiZ9Xmqv/8jvPbUUWrZdYz9/7HGHAGFCupVeuEebE9J9 69ZJdbFVldVpuLpd96xmD/43WPYWB+ZuzCEMFpbqWJbxslKD8D5a8nlZQL38jGYFJ6mp sonB2tZV3SsPpQqLJG+iNGAGUjAIxrVNOzZrPiX0uo084J+0I4+qq7CBXN6yRndKHg8p rjaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689912256; x=1690517056; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a/tMk6LKzIoo6vJXJHVG64sPPKUXgW1KwB7m/idCZTo=; b=is4aS4GIx4s8WBodglW38E13+mGJevneuKMe0kAcJi5yn6aL29aHWNxVXSIQakv5/d Y3/ANKxXBfTQ7098EB8Nx6dKzXlKz9FSUK3xLh0P74IN1PlHo4YthcvcGUKWFUgCkpI4 zPVve2OI5C3dNukXJFpA/8LVuflxNmoVVKwbndUDWu9y4eW/l9EC19mjZ0f6c75QTLy/ HJUBI4THvgZzieGy3BU7UPzrdRSBJid8Sd7UZOYIl0iUPaxT39vcuRhXP1q45gQ+Uzjv XoM9WB0GMB/pvG2tSfsZ97wxbMQWHip9+wj9yOdKzrFt00cqBYagilqDiN6DC2IM1Sv/ UpMw== X-Gm-Message-State: ABy/qLZKocDIILA1M+7HnjSHvqV7jWXsf09+v4f9wzrKlPovLDjeh1d9 TwEHZI0Txj36R0cTlRplm53TUcaBX9pPTg== X-Google-Smtp-Source: APBJJlHneyifNhW1esLF1BZX2fUAeet+bn2B2Syb2RQqfojinbT+UwOCPErcIyNZR29LoLnL2l/wvA== X-Received: by 2002:a17:90b:fc9:b0:263:cdc4:5e89 with SMTP id gd9-20020a17090b0fc900b00263cdc45e89mr497631pjb.8.1689912256562; Thu, 20 Jul 2023 21:04:16 -0700 (PDT) Received: from Laptop-X1.redhat.com ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id bt21-20020a17090af01500b00263f6687690sm1640480pjb.18.2023.07.20.21.04.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 21:04:15 -0700 (PDT) From: Hangbin Liu To: netdev@vger.kernel.org Cc: Jay Vosburgh , "David S . Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , Liang Li , Jiri Pirko , Nikolay Aleksandrov , Hangbin Liu Subject: [PATCHv4 net 2/2] team: reset team's flags when down link is P2P device Date: Fri, 21 Jul 2023 12:03:56 +0800 Message-Id: <20230721040356.3591174-3-liuhangbin@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230721040356.3591174-1-liuhangbin@gmail.com> References: <20230721040356.3591174-1-liuhangbin@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 X-Patchwork-Delegate: kuba@kernel.org When adding a point to point downlink to team device, we neglected to reset the team's flags, which were still using flags like BROADCAST and MULTICAST. Consequently, this would initiate ARP/DAD for P2P downlink interfaces, such as when adding a GRE device to team device. Fix this by remove multicast/broadcast flags and add p2p and noarp flags. After removing the none ethernet interface and adding an ethernet interface to team, we need to reset team interface flags. Unlike bonding interface, team do not need restore IFF_MASTER, IFF_SLAVE flags. Reported-by: Liang Li Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2221438 Fixes: 1d76efe1577b ("team: add support for non-ethernet devices") Signed-off-by: Hangbin Liu --- v4: just reset the flags, no need to do ether_setup(), as Paolo pointed. v3: add function team_ether_setup to reset team back to ethernet. v2: Add the missed {} after if checking. --- drivers/net/team/team.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 555b0b1e9a78..d3dc22509ea5 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -2135,6 +2135,15 @@ static void team_setup_by_port(struct net_device *dev, dev->mtu = port_dev->mtu; memcpy(dev->broadcast, port_dev->broadcast, port_dev->addr_len); eth_hw_addr_inherit(dev, port_dev); + + if (port_dev->flags & IFF_POINTOPOINT) { + dev->flags &= ~(IFF_BROADCAST | IFF_MULTICAST); + dev->flags |= (IFF_POINTOPOINT | IFF_NOARP); + } else if ((port_dev->flags & (IFF_BROADCAST | IFF_MULTICAST)) == + (IFF_BROADCAST | IFF_MULTICAST)) { + dev->flags |= (IFF_BROADCAST | IFF_MULTICAST); + dev->flags &= ~(IFF_POINTOPOINT | IFF_NOARP); + } } static int team_dev_type_check_change(struct net_device *dev,