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: <20240216132117.ajxg3vyds4ffpbaj@skbuf>
Date: Fri, 16 Feb 2024 15:21:17 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: Pawel Dembicki <paweldembicki@...il.com>
Cc: netdev@...r.kernel.org, linus.walleij@...aro.org,
	Andrew Lunn <andrew@...n.ch>,
	Florian Fainelli <f.fainelli@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Claudiu Manoil <claudiu.manoil@....com>,
	Alexandre Belloni <alexandre.belloni@...tlin.com>,
	UNGLinuxDriver@...rochip.com, Russell King <linux@...linux.org.uk>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v4 07/15] net: dsa: vsc73xx: Add vlan filtering

On Tue, Feb 13, 2024 at 11:03:20PM +0100, Pawel Dembicki wrote:
> +static int
> +vsc73xx_port_vlan_filtering(struct dsa_switch *ds, int port,
> +			    bool vlan_filtering, struct netlink_ext_ack *extack)
> +{
> +	enum vsc73xx_port_vlan_conf port_vlan_conf = VSC73XX_VLAN_IGNORE;
> +	struct vsc73xx *vsc = ds->priv;
> +	bool store_untagged  = false;
> +	bool store_pvid = false;
> +	u16 vlan_no, vlan_untagged;
> +
> +	/* The swap processed bellow is required because vsc73xx is using tag8021q.
> +	 * When vlan_filtering is disabled, tag8021q use pvid/untagged vlans for
> +	 * port recognition. The values configured for vlans < 3072 are stored
> +	 * in storage table. When vlan_filtering is enabled, we need to restore
> +	 * pvid/untagged from storage and keep values used for tag8021q.
> +	 */
> +
> +	if (vlan_filtering) {
> +		/* Use VLAN_N_VID to count all vlans */
> +		u16 num_untagged = vsc73xx_bridge_vlan_num_untagged(vsc, port, VLAN_N_VID);
> +
> +		port_vlan_conf = (num_untagged > 1) ?
> +				 VSC73XX_VLAN_FILTER_UNTAG_ALL : VSC73XX_VLAN_FILTER;
> +
> +		vlan_untagged = vsc73xx_find_first_vlan_untagged(vsc, port);
> +		if (vlan_no < VLAN_N_VID) {

One more that I've missed. There's a bug here. You don't mean "vlan_no"
(which at this stage is uninitialized), but "vlan_untagged".

> +			store_untagged  = vsc73xx_port_get_untagged(vsc, port, &vlan_no, false);
> +			vsc73xx_vlan_change_untagged(vsc, port, vlan_untagged,
> +						     vlan_untagged < VLAN_N_VID, false);
> +			vsc->untagged_storage[port] = store_untagged ? vlan_no : VLAN_N_VID;
> +		}
> +	} else {
> +		vsc73xx_vlan_change_untagged(vsc, port, vsc->untagged_storage[port],
> +					     vsc->untagged_storage[port] < VLAN_N_VID, false);
> +	}
> +
> +	vsc73xx_set_vlan_conf(vsc, port, port_vlan_conf);
> +
> +	store_pvid = vsc73xx_port_get_pvid(vsc, port, &vlan_no, false);
> +	vsc73xx_vlan_change_pvid(vsc, port, vsc->pvid_storage[port],
> +				 vsc->pvid_storage[port] < VLAN_N_VID, false);
> +	vsc->pvid_storage[port] = store_pvid ? vlan_no : VLAN_N_VID;
> +
> +	return 0;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ