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]
Date:	Mon, 31 Mar 2014 15:01:57 -0700
From:	Mahesh Bandewar <maheshb@...gle.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	Jay Vosburgh <fubar@...ibm.com>,
	Veaceslav Falico <vfalico@...hat.com>,
	Andy Gospodarek <andy@...yhouse.net>,
	David Miller <davem@...emloft.net>,
	netdev <netdev@...r.kernel.org>,
	Eric Dumazet <edumazet@...gle.com>,
	Maciej Zenczykowski <maze@...gle.com>
Subject: Re: [PATCH 1/5] bonding: Changed hashing function to just provide hash

On Mon, Mar 31, 2014 at 8:44 AM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> On Fri, 2014-03-28 at 22:28 -0700, Mahesh Bandewar wrote:
>> Modified the hash function to return just hash separating from the
>> modulo operation that can be performed by the caller. This is to
>> make way for the tlb mode to use the same hashing policies that
>> are used in the 802.3ad and Xor mode.
>>
>> Signed-off-by: Mahesh Bandewar <maheshb@...gle.com>
>> ---
>
>
>> -int bond_xmit_hash(struct bonding *bond, struct sk_buff *skb, int count)
>> +int bond_xmit_hash(struct bonding *bond, struct sk_buff *skb)
>>  {
>>       struct flow_keys flow;
>>       u32 hash;
>>
>>       if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER2 ||
>>           !bond_flow_dissect(bond, skb, &flow))
>> -             return bond_eth_hash(skb) % count;
>> +             return bond_eth_hash(skb);
>>
>>       if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER23 ||
>>           bond->params.xmit_policy == BOND_XMIT_POLICY_ENCAP23)
>> @@ -3039,7 +3037,7 @@ int bond_xmit_hash(struct bonding *bond, struct sk_buff *skb, int count)
>>       hash ^= (hash >> 16);
>>       hash ^= (hash >> 8);
>>
>> -     return hash % count;
>> +     return hash;
>>  }
>
>
> Sounds good, but I would change  bond_xmit_hash() to return an u32
> instead of 'int'
>
> There is an interesting mix of u32 and int in this bonding code :(
>
> slave_cnt is signed, so a  (signed_hash % signed_slave_cnt) could
> potentially be negative ?
>
>
Yes, it does make sense to change it to u32. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ