Re: [PATCH net] net: bridge: keep ports without IFF_UNICAST_FLT in BR_PROMISC mode

Vladimir Oltean
2023-07-03T16:08:37Z

On Mon, Jul 03, 2023 at 11:00:14AM +0300, Ido Schimmel wrote:
> On Fri, Jun 30, 2023 at 07:41:18PM +0300, Vladimir Oltean wrote:
> > diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
> > index 3f04b40f6056..2450690f98cf 100644
> > --- a/net/bridge/br_if.c
> > +++ b/net/bridge/br_if.c
> > @@ -166,8 +166,9 @@ void br_manage_promisc(struct net_bridge *br)
> > * This lets us disable promiscuous mode and write
> > * this config to hw.
> > */
> > - if (br->auto_cnt == 0 ||
> > - (br->auto_cnt == 1 && br_auto_port(p)))
> > + if ((p->dev->priv_flags & IFF_UNICAST_FLT) &&
> > + (br->auto_cnt == 0 ||
> > + (br->auto_cnt == 1 && br_auto_port(p))))
> > br_port_clear_promisc(p);
> > else
> > br_port_set_promisc(p);
>
> IIUC, you are basically saying "If the port does not support unicast
> filtering, then set it to promiscuous mode right away instead of waiting
> for the addition of the first FDB entry to trigger it."

Correct.

> If so, LGTM.
>
> Reviewed-by: Ido Schimmel <idosch@nvidia.com>
>
> Tested using [1].
>
> Before:
>
> # ~/tmp/promisc_repo.sh
> 0
>
> After:
>
> # ~/tmp/promisc_repo.sh
> 1
>
> [1]
> #!/bin/bash
>
> ip link add name swp1 type dummy
> ip link add name br1 type bridge vlan_filtering 1
> ip link set dev swp1 master br1
> ip -d -j -p link show dev swp1 | jq '.[]["promiscuity"]'

Thanks for testing.