packet: Use symmetric hash for PACKET_FANOUT_HASH.
authorDavid S. Miller <davem@davemloft.net>
Fri, 1 Jul 2016 20:07:50 +0000 (16:07 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Jul 2016 16:47:31 +0000 (09:47 -0700)
commit424848bd9895979e2758156ca99e317a3c2d5804
tree65706e5f467f866358d1a370409a4f517298f3e8
parent43b1bfec0e2d57497718fd01f7151b2c78de99fc
packet: Use symmetric hash for PACKET_FANOUT_HASH.

[ Upstream commit eb70db8756717b90c01ccc765fdefc4dd969fc74 ]

People who use PACKET_FANOUT_HASH want a symmetric hash, meaning that
they want packets going in both directions on a flow to hash to the
same bucket.

The core kernel SKB hash became non-symmetric when the ipv6 flow label
and other entities were incorporated into the standard flow hash order
to increase entropy.

But there are no users of PACKET_FANOUT_HASH who want an assymetric
hash, they all want a symmetric one.

Therefore, use the flow dissector to compute a flat symmetric hash
over only the protocol, addresses and ports.  This hash does not get
installed into and override the normal skb hash, so this change has
no effect whatsoever on the rest of the stack.

Reported-by: Eric Leblond <eric@regit.org>
Tested-by: Eric Leblond <eric@regit.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/skbuff.h
net/core/flow_dissector.c
net/packet/af_packet.c