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: <f0b22f81-2de1-47f0-8cc9-f89c7a055867@intel.com>
Date: Tue, 9 Apr 2024 13:00:33 +0200
From: Alexander Lobakin <aleksander.lobakin@...el.com>
To: Diogo Ivo <diogo.ivo@...mens.com>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
	<pabeni@...hat.com>, <netdev@...r.kernel.org>, <andrew@...n.ch>,
	<danishanwar@...com>, <rogerq@...nel.org>, <vigneshr@...com>,
	<jan.kiszka@...mens.com>
Subject: Re: [PATCH net-next v6 02/10] eth: Move IPv4/IPv6 multicast address
 bases to their own symbols

From: Diogo Ivo <diogo.ivo@...mens.com>
Date: Tue, 9 Apr 2024 11:20:21 +0100

> On 4/9/24 10:07 AM, Alexander Lobakin wrote:
>> From: Diogo Ivo <diogo.ivo@...mens.com>
>> Date: Wed,  3 Apr 2024 11:48:12 +0100
>>
>>> As these addresses can be useful outside of checking if an address
>>> is a multicast address (for example in device drivers) make them
>>> accessible to users of etherdevice.h to avoid code duplication.
>>>
>>> Signed-off-by: Diogo Ivo <diogo.ivo@...mens.com>
>>> Reviewed-by: MD Danish Anwar <danishanwar@...com>
>>> ---
>>> Changes in v5:
>>>   - Added Reviewed-by tag from Danish
>>>
>>>   include/linux/etherdevice.h | 12 ++++++++----
>>>   1 file changed, 8 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
>>> index 224645f17c33..8d6daf828427 100644
>>> --- a/include/linux/etherdevice.h
>>> +++ b/include/linux/etherdevice.h
>>> @@ -71,6 +71,12 @@ static const u8 eth_reserved_addr_base[ETH_ALEN]
>>> __aligned(2) =
>>>   { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 };
>>>   #define eth_stp_addr eth_reserved_addr_base
>>>   +static const u8 eth_ipv4_mcast_addr_base[ETH_ALEN] __aligned(2) =
>>> +{ 0x01, 0x00, 0x5e, 0x00, 0x00, 0x00 };
>>> +
>>> +static const u8 eth_ipv6_mcast_addr_base[ETH_ALEN] __aligned(2) =
>>> +{ 0x33, 0x33, 0x00, 0x00, 0x00, 0x00 };
>>
>> I see this is applied already, but I don't like static symbols in header
>> files. This will make a local copy of every used symbol each time it's
>> referenced.
>> We usually make such symbols global consts and export them. Could you
>> please send a follow-up?
> 
> I forgot to ask, should this exporting happen in
> include/linux/etherdevice.h?

In etherdevice.h, you do

const u8 eth_ipv4_mcast_addr_base[ETH_ALEN];
const u8 eth_ipv6_mcast_addr_base[ETH_ALEN];

Then, somewhere in, I guess, net/ethernet/eth.c, you do

const u8 eth_ipv4_mcast_addr_base[ETH_ALEN] __aligned(2) = {
	0x01, 0x00, 0x5e, 0x00, 0x00, 0x00
};
EXPORT_SYMBOL(eth_ipv4_mcast_addr_base);

const u8 eth_ipv6_mcast_addr_base[ETH_ALEN] __aligned(2) = {
	0x33, 0x33, 0x00, 0x00, 0x00, 0x00
};
EXPORT_SYMBOL(eth_ipv6_mcast_addr_base);

> 
> Best regards,
> Diogo
> 

Thanks,
Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ