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: <7fdfc76d-cf7d-47f3-afcf-c963c44f01b7@linux.alibaba.com>
Date: Wed, 25 Sep 2024 10:57:25 +0800
From: Philo Lu <lulie@...ux.alibaba.com>
To: Gur Stavi <gur.stavi@...wei.com>
Cc: antony.antony@...unet.com, davem@...emloft.net, dsahern@...nel.org,
 dust.li@...ux.alibaba.com, edumazet@...gle.com, fred.cc@...baba-inc.com,
 jakub@...udflare.com, kuba@...nel.org, linux-kernel@...r.kernel.org,
 netdev@...r.kernel.org, pabeni@...hat.com, steffen.klassert@...unet.com,
 willemdebruijn.kernel@...il.com, yubing.qiuyubing@...baba-inc.com
Subject: Re: [RFC PATCHv2 net-next 1/3] net/udp: Add a new struct for hash2
 slot


On 2024/9/24 20:51, Gur Stavi wrote:
>> @@ -224,13 +224,12 @@ struct sock *__udp6_lib_lookup(const struct net *net,
>>   			       struct sk_buff *skb)
>>   {
>>   	unsigned short hnum = ntohs(dport);
>> -	unsigned int hash2, slot2;
>>   	struct udp_hslot *hslot2;
>>   	struct sock *result, *sk;
>> +	unsigned int hash2;
>>
>>   	hash2 = ipv6_portaddr_hash(net, daddr, hnum);
>> -	slot2 = hash2 & udptable->mask;
>> -	hslot2 = &udptable->hash2[slot2];
>> +	hslot2 = udp_hashslot2(udptable, hash2);
>>
> 
> Why not minimize the code change by using udptable->hash2[slot2].hslot?
> Especially since later you do it in __udp6_lib_mcast_deliver.
> I think that many developers would find usage of C primitives more
> readable.

Yes I can use udptable->hash2[slot2].hslot. But I prefer the 
udp_hashslot2() helper, because I found I have to add ".hslot" at many 
places, while most of them look exactly what udp_hashslot2() does. I 
think replacing them may get the codes simpler and benefit future coding.

Some places like __udp6_lib_mcast_deliver() get hslot2 differently from 
udp_hashslot2(), so just appending ".hslot" to avoid functionality change.

Thanks.
-- 
Philo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ