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: <3b275dda-39ac-282d-8a46-d3a95fdfc766@nbd.name>
Date:   Tue, 8 Nov 2022 07:08:46 +0100
From:   Felix Fietkau <nbd@....name>
To:     Vladimir Oltean <olteanv@...il.com>
Cc:     netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 08/14] net: vlan: remove invalid VLAN protocol warning

On 07.11.22 22:57, Vladimir Oltean wrote:
> On Mon, Nov 07, 2022 at 07:54:46PM +0100, Felix Fietkau wrote:
>> On MTK SoC ethernet, using NETIF_F_HW_VLAN_CTAG_RX in combination with hardware
>> special tag parsing can pass the special tag port metadata as VLAN protocol ID.
>> When the results is added as a skb hwaccel VLAN tag, it triggers a warning from
>> vlan_do_receive before calling the DSA tag receive function.
>> Remove this warning in order to properly pass the tag to the DSA receive function,
>> which will parse and clear it.
>> 
>> Signed-off-by: Felix Fietkau <nbd@....name>
>> ---
>>  net/8021q/vlan.h | 1 -
>>  1 file changed, 1 deletion(-)
>> 
>> diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
>> index 5eaf38875554..3f9c0406b266 100644
>> --- a/net/8021q/vlan.h
>> +++ b/net/8021q/vlan.h
>> @@ -44,7 +44,6 @@ static inline int vlan_proto_idx(__be16 proto)
>>  	case htons(ETH_P_8021AD):
>>  		return VLAN_PROTO_8021AD;
>>  	default:
>> -		WARN(1, "invalid VLAN protocol: 0x%04x\n", ntohs(proto));
> 
> Why would you ever want to remove a warning that's telling you you're
> doing something wrong?
> 
> Aren't you calling __vlan_hwaccel_put_tag() with the wrong thing (i.e.
> htons(RX_DMA_VPID()) as opposed to VPID translated to something
> digestible by the rest of the network stack.. ETH_P_8021Q, ETH_P_8021AD
> etc)?
The MTK ethernet hardware treats the DSA special tag as a VLAN tag and 
reports it as such. The ethernet driver passes this on as a hwaccel tag, 
and the MTK DSA tag parser consumes it. The only thing that's sitting in 
the middle looking at the tag is the VLAN device lookup with that warning.

Whenever DSA is not being used, the MTK ethernet device can also process 
regular VLAN tags. For those tags, htons(RX_DMA_VPID()) will contain the 
correct VPID.

- Felix

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ