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: <ffd2326c-5b66-87d8-ad42-6dea37e290d6@gmail.com>
Date:   Tue, 25 Jan 2022 20:02:53 -0800
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Ansuel Smith <ansuelsmth@...il.com>
Cc:     Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org,
        netdev@...r.kernel.org
Subject: Re: [RFC PATCH v7 06/16] net: dsa: tag_qca: add define for handling
 mgmt Ethernet packet



On 1/25/2022 8:01 PM, Ansuel Smith wrote:
> On Tue, Jan 25, 2022 at 07:54:15PM -0800, Florian Fainelli wrote:
>>
>>
>> On 1/22/2022 5:33 PM, Ansuel Smith wrote:
>>> Add all the required define to prepare support for mgmt read/write in
>>> Ethernet packet. Any packet of this type has to be dropped as the only
>>> use of these special packet is receive ack for an mgmt write request or
>>> receive data for an mgmt read request.
>>> A struct is used that emulates the Ethernet header but is used for a
>>> different purpose.
>>>
>>> Signed-off-by: Ansuel Smith <ansuelsmth@...il.com>
>>> ---
>>
>> [snip]
>>
>>> +/* Special struct emulating a Ethernet header */
>>> +struct mgmt_ethhdr {
>>> +	u32 command;		/* command bit 31:0 */
>>> +	u32 seq;		/* seq 63:32 */
>>> +	u32 mdio_data;		/* first 4byte mdio */
>>> +	__be16 hdr;		/* qca hdr */
>>> +} __packed;
>>
>> Might be worth adding a BUILD_BUG_ON(sizeof(struct mgmt_ethhdr) !=
>> QCA_HDR_MGMT_PKG_LEN) when you start making use of that structure?
> 
> Where should I put this check? Right after the struct definition,
> correct? (I just checked definition of the macro)

It would have to be in a call site where you use the structure, I have 
not checked whether putting it in a static inline function in .h file 
actually works if the inline function is not used at all.
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ