netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Herbert <therbert@google.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH net-next 0/6] net: Strengthen TX and RX hashes
Date: Fri, 27 Feb 2015 19:11:43 -0800	[thread overview]
Message-ID: <1425093109-1077-1-git-send-email-therbert@google.com> (raw)

Both the TX and RX hashes associated with skb->hash are mostly 4-tuple
hashes. This is potentially problematic. For instance one could
concieve of a DOS attack against a TCP connection using UDP with same
4-tuple.  Most switches already use at least a 5-tuple hash, NICs
probably should also (for instance Toeplitz hash for UDP could include
UDP protocol number). This patch set implements 5-tuple hashes in the
stack.

For transmit, we simply initialize sk_hash to a random value instead of
performing any actual hash computation. A random value should provide
full 32-bits of entropy and ensure that connected sockets have a
different hash value regardless of protocol, 4-tuple, network namespace,
etc. sock_init_txhash was created to provide this.  This also can be
called for any family not just IP.

For receive, we add a new field in flow_keys called hash_extra. When
doing the jhash this value is XORed into the destination address field.
In flow_dissector, the IP protocol is placed in this field so that we
get a 5-tuple hash.

Also, in flow_dissector, we add support for including VLAN ID and GRE
keyid in the hash (via hash_extra). We implement support for extracting
a hash from MPLS entropy labels (RFC 6790).

Tom Herbert (6):
  net: initialize sk_txhash using random value
  flow_dissector: Include ip_proto in hash computation
  flow_dissector: Add hash_extra field to flow_keys struct
  flow_dissector: Include VLAN ID in hash computation
  flow_dissector: Include GRE keyid in hash computation
  flow_dissector: Include MPLS entropy label in hash computation

 include/net/flow_keys.h   |  1 +
 include/net/ip.h          | 13 -------------
 include/net/ipv6.h        | 14 --------------
 include/net/sch_generic.h |  2 +-
 include/net/sock.h        |  6 ++++++
 include/uapi/linux/in.h   |  2 ++
 include/uapi/linux/mpls.h |  3 +++
 net/core/flow_dissector.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
 net/ipv4/datagram.c       |  2 +-
 net/ipv4/tcp_ipv4.c       |  4 ++--
 net/ipv6/datagram.c       |  2 +-
 net/ipv6/tcp_ipv6.c       |  4 ++--
 12 files changed, 61 insertions(+), 36 deletions(-)

-- 
2.2.0.rc0.207.ga3a616c

             reply	other threads:[~2015-02-28  3:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-28  3:11 Tom Herbert [this message]
2015-02-28  3:11 ` [PATCH net-next 1/6] net: initialize sk_txhash using random value Tom Herbert
2015-02-28  3:11 ` [PATCH net-next 2/6] flow_dissector: Include ip_proto in hash computation Tom Herbert
2015-02-28  3:11 ` [PATCH net-next 3/6] flow_dissector: Add hash_extra field to flow_keys struct Tom Herbert
2015-02-28  7:37   ` Eric Dumazet
2015-02-28 20:31     ` Florian Westphal
2015-02-28 20:46       ` Dave Taht
2015-03-01 18:16         ` Tom Herbert
2015-03-01 20:09           ` Dave Taht
2015-03-01 17:55       ` Tom Herbert
2015-03-01 18:24         ` Florian Westphal
2015-03-01 19:17           ` Tom Herbert
2015-03-01 19:43             ` Florian Westphal
2015-03-01 19:57           ` Dave Taht
2015-03-01 21:27         ` Eric Dumazet
2015-02-28  3:11 ` [PATCH net-next 4/6] flow_dissector: Include VLAN ID in hash computation Tom Herbert
2015-02-28  3:11 ` [PATCH net-next 5/6] flow_dissector: Include GRE keyid " Tom Herbert
2015-02-28  3:11 ` [PATCH net-next 6/6] flow_dissector: Include MPLS entropy label " Tom Herbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425093109-1077-1-git-send-email-therbert@google.com \
    --to=therbert@google.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).