From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30E4CC4360F for ; Thu, 4 Apr 2019 18:35:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0ED0320820 for ; Thu, 4 Apr 2019 18:35:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729839AbfDDSfI (ORCPT ); Thu, 4 Apr 2019 14:35:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33930 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729534AbfDDSfI (ORCPT ); Thu, 4 Apr 2019 14:35:08 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1561DC066814; Thu, 4 Apr 2019 18:35:08 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-45.gru2.redhat.com [10.97.116.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A3261F8; Thu, 4 Apr 2019 18:35:05 +0000 (UTC) Received: by localhost.localdomain (Postfix, from userid 1000) id D07B8180B78; Thu, 4 Apr 2019 15:35:02 -0300 (-03) Date: Thu, 4 Apr 2019 15:35:02 -0300 From: Marcelo Ricardo Leitner To: Hangbin Liu Cc: netdev@vger.kernel.org, David Miller , Stefano Brivio , Jiri Pirko Subject: Re: [PATCH net] team: set slave to promisc if team is already in promisc mode Message-ID: <20190404183502.GL10232@localhost.localdomain> References: <20190404124702.17041-1-liuhangbin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190404124702.17041-1-liuhangbin@gmail.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 04 Apr 2019 18:35:08 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Apr 04, 2019 at 08:47:02PM +0800, Hangbin Liu wrote: > After adding a team interface to bridge, the team interface will enter > promisc mode. Then if we add a new slave to team0, the slave will keep > promisc off. Fix it by setting slave to promisc on if team master is > already in promisc mode, also do the same for allmulti. > > Fixes: 3d249d4ca7d0 ("net: introduce ethernet teaming device") > Signed-off-by: Hangbin Liu Reviewed-by: Marcelo Ricardo Leitner > --- > drivers/net/team/team.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c > index 6ed96fdfd96d..bbaa198d0960 100644 > --- a/drivers/net/team/team.c > +++ b/drivers/net/team/team.c > @@ -1246,6 +1246,23 @@ static int team_port_add(struct team *team, struct net_device *port_dev, > goto err_option_port_add; > } > > + /* set promiscuity level to new slave */ > + if (team->dev->flags & IFF_PROMISC) { > + err = dev_set_promiscuity(port_dev, 1); > + if (err) > + goto err_set_slave_promisc; > + } > + > + /* set allmulti level to new slave */ > + if (team->dev->flags & IFF_ALLMULTI) { > + err = dev_set_allmulti(port_dev, 1); > + if (err) { > + if (team->dev->flags & IFF_PROMISC) > + dev_set_promiscuity(port_dev, -1); > + goto err_set_slave_promisc; > + } > + } > + > netif_addr_lock_bh(dev); > dev_uc_sync_multiple(port_dev, dev); > dev_mc_sync_multiple(port_dev, dev); > @@ -1262,6 +1279,9 @@ static int team_port_add(struct team *team, struct net_device *port_dev, > > return 0; > > +err_set_slave_promisc: > + __team_option_inst_del_port(team, port); > + > err_option_port_add: > team_upper_dev_unlink(team, port); > > -- > 2.19.2 >