All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <mleitner@redhat.com>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>,
	Stefano Brivio <sbrivio@redhat.com>,
	Jiri Pirko <jiri@resnulli.us>
Subject: Re: [PATCH net] team: set slave to promisc if team is already in promisc mode
Date: Thu, 4 Apr 2019 15:35:02 -0300	[thread overview]
Message-ID: <20190404183502.GL10232@localhost.localdomain> (raw)
In-Reply-To: <20190404124702.17041-1-liuhangbin@gmail.com>

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 <liuhangbin@gmail.com>

Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

> ---
>  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
> 

  reply	other threads:[~2019-04-04 18:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-04 12:47 [PATCH net] team: set slave to promisc if team is already in promisc mode Hangbin Liu
2019-04-04 18:35 ` Marcelo Ricardo Leitner [this message]
2019-04-08  8:45 ` [PATCHv2 " Hangbin Liu
2019-04-11  2:18   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190404183502.GL10232@localhost.localdomain \
    --to=mleitner@redhat.com \
    --cc=davem@davemloft.net \
    --cc=jiri@resnulli.us \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.