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] [day] [month] [year] [list]
Message-ID: <60a01fb2-422b-54e4-3353-3766b1a10059@gmail.com>
Date:   Wed, 23 Sep 2020 10:06:52 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Vladimir Oltean <vladimir.oltean@....com>
Cc:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        open list <linux-kernel@...r.kernel.org>,
        "olteanv@...il.com" <olteanv@...il.com>,
        "nikolay@...dia.com" <nikolay@...dia.com>
Subject: Re: [PATCH net-next 1/2] net: dsa: untag the bridge pvid from rx skbs

On 9/23/20 1:14 AM, Vladimir Oltean wrote:
> On Tue, Sep 22, 2020 at 08:11:54PM -0700, Florian Fainelli wrote:
>> diff --git a/include/net/dsa.h b/include/net/dsa.h
>> index d16057c5987a..b539241a7533 100644
>> --- a/include/net/dsa.h
>> +++ b/include/net/dsa.h
>> @@ -301,6 +301,14 @@ struct dsa_switch {
>>  	 */
>>  	bool			configure_vlan_while_not_filtering;
>>  
>> +	/* If the switch driver always programs the CPU port as egress tagged
>> +	 * despite the VLAN configuration indicating otherwise, then setting
>> +	 * @untag_bridge_pvid will force the DSA receive path to pop the bridge's
>> +	 * default_pvid VLAN tagged frames to offer a consistent behavior
>> +	 * between a vlan_filtering=0 and vlan_filtering=1 bridge device.
>> +	 */
>> +	bool			untag_bridge_pvid;
>> +
>>  	/* In case vlan_filtering_is_global is set, the VLAN awareness state
>>  	 * should be retrieved from here and not from the per-port settings.
>>  	 */
>> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
>> index 5c18c0214aac..dec4ab59b7c4 100644
>> --- a/net/dsa/dsa.c
>> +++ b/net/dsa/dsa.c
>> @@ -225,6 +225,15 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
>>  	skb->pkt_type = PACKET_HOST;
>>  	skb->protocol = eth_type_trans(skb, skb->dev);
>>  
>> +	if (unlikely(cpu_dp->ds->untag_bridge_pvid)) {
>> +		nskb = dsa_untag_bridge_pvid(skb);
>> +		if (!nskb) {
>> +			kfree_skb(skb);
>> +			return 0;
>> +		}
>> +		skb = nskb;
>> +	}
>> +
>>  	s = this_cpu_ptr(p->stats64);
>>  	u64_stats_update_begin(&s->syncp);
>>  	s->rx_packets++;
> 
> I was thinking a lot simpler. Maybe you could just tail-call
> dsa_untag_bridge_pvid(skb) at the end of your .rcv function instead of
> putting it in the common receive path. I specifically wrote it to look
> at hdr->h_vlan_proto instead of skb->protocol, so it wouldn't depend on
> eth_type_trans().

Yes, good point, there is no point in promoting this to the main receive
path until we have a second user of that facility, v2 coming shortly.
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ