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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1396280686.29410.36.camel@edumazet-glaptop2.roam.corp.google.com>
Date:	Mon, 31 Mar 2014 08:44:46 -0700
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Mahesh Bandewar <maheshb@...gle.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 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 ?


--
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