[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL1RGDWbCi_nE8tRp9zyX3Z1yBHKP9ygxNV6TNKp4Up+0g2EPA@mail.gmail.com>
Date: Fri, 8 Jul 2011 12:26:17 -0700
From: Roland Dreier <roland@...estorage.com>
To: David Miller <davem@...emloft.net>
Cc: johnwheffner@...il.com, mj@....cz, netdev@...r.kernel.org
Subject: Re: ipv4: Simplify ARP hash function.
On Fri, Jul 8, 2011 at 11:06 AM, David Miller <davem@...emloft.net> wrote:
> Ok, there was also an unintended bug in my original patch,
> I lost the bottom 8 bits in the fold, the hash function
> should instead be:
>
> +static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd)
> +{
> + u32 val = key ^ dev->ifindex ^ hash_rnd;
> +
> + return val ^ (val >> 8) ^ (val >> 16) ^ (val >> 24);
> +}
Doesn't seem to matter much -- this is now equivalent to
a = key ^ dev->ifindex
return (a ^ (a >> 8) ^ (a >> 16) ^ (a >> 24)) // (1)
^ (rnd ^ (rnd >> 8) ^ (rnd >> 16) ^ (rnd >> 24)) // (2)
where again the attacker controls (1), and (2) is a constant.
--
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