lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9a87a847-05e9-0de8-bdf1-d56eab15f2a9@gmail.com>
Date:   Mon, 6 Jul 2020 14:23:11 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Linus Walleij <linus.walleij@...aro.org>,
        Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>
Cc:     DENG Qingfang <dqfext@...il.com>,
        Mauri Sandberg <sandberg@...lfence.com>
Subject: Re: [net-next PATCH 4/5 v4] net: dsa: rtl8366: VLAN 0 as disable
 tagging



On 7/6/2020 1:52 PM, Linus Walleij wrote:
> The code in net/8021q/vlan.c, vlan_device_event() sets
> VLAN 0 for a VLAN-capable ethernet device when it
> comes up.
> 
> Since the RTL8366 DSA switches must have a VLAN and
> PVID set up for any packets to come through we have
> already set up default VLAN for each port as part of
> bringing the switch online.
> 
> Make sure that setting VLAN 0 has the same effect
> and does not try to actually tell the hardware to use
> VLAN 0 on the port because that will not work.
> 
> Cc: DENG Qingfang <dqfext@...il.com>
> Cc: Mauri Sandberg <sandberg@...lfence.com>
> Reviewed-by: Andrew Lunn <andrew@...n.ch>
> Signed-off-by: Linus Walleij <linus.walleij@...aro.org>
> ---
> ChangeLog v3->v4:
> - Resend with the rest
> ChangeLog v2->v3:
> - Collected Andrew's review tag.
> ChangeLog v1->v2:
> - Rebased on v5.8-rc1 and other changes.
> ---
>  drivers/net/dsa/rtl8366.c | 65 +++++++++++++++++++++++++++++++--------
>  1 file changed, 52 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c
> index b907c0ed9697..a000d458d121 100644
> --- a/drivers/net/dsa/rtl8366.c
> +++ b/drivers/net/dsa/rtl8366.c
> @@ -355,15 +355,25 @@ int rtl8366_vlan_prepare(struct dsa_switch *ds, int port,
>  			 const struct switchdev_obj_port_vlan *vlan)
>  {
>  	struct realtek_smi *smi = ds->priv;
> +	u16 vid_begin = vlan->vid_begin;
> +	u16 vid_end = vlan->vid_end;
>  	u16 vid;
>  	int ret;
>  
> -	for (vid = vlan->vid_begin; vid < vlan->vid_end; vid++)
> +	if (vid_begin == 0) {
> +		dev_info(smi->dev, "prepare VLAN 0 - ignored\n");
> +		if (vid_end == 0)
> +			return 0;
> +		/* Skip VLAN 0 and start with VLAN 1 */
> +		vid_begin = 1;
> +	}

Humm I still don't understand why you are doing that. Upon DSA network
device creation, VID 0 will be pushed because we advertise support for
NETIF_F_HW_VLAN_CTAG_FILTER, so if nothing else, we will be getting the
"prepare VLAN 0 -ignored" message which is not relevant nor a good idea
to print.

You can force this VLAN to be programmed as untagged, in fact you should
be doing that per the 802.1Q specification.

There are no other cases other than the initial network device creation
that will lead to programming this VLAN ID. The bridge will always
specify a VID range within 1 through 4094 and the VLAN RX filter offload
will not add or remove VID 0 other than at creation/destruction.

As mentioned before, if you need VLAN awareness into the switch from the
get go, you need to set configure_vlan_while_not_filtering and that
would ensure that all ports belong to a VID at startup. Later on, when
the bridge gets set-up, it will be requesting the ports added as bridge
ports to be programmed into VID 1 as PVID untagged. And this should
still be fine.
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ