diff options
author | Tom Herbert <therbert@google.com> | 2015-02-24 09:17:31 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-27 16:00:01 -0500 |
commit | 723b8e460d87e957f251dc5764f4ab86af6ab44e (patch) | |
tree | 2453607eb05e7cdf3913fedfe55599641c6a66b1 /net/ipv4/udp.c | |
parent | fed0a159c8c5e453d79d6a73897c576efea0a8a5 (diff) |
udp: In udp_flow_src_port use random hash value if skb_get_hash fails
In the unlikely event that skb_get_hash is unable to deduce a hash
in udp_flow_src_port we use a consistent random value instead.
This is specified in GRE/UDP draft section 3.2.1:
https://tools.ietf.org/html/draft-ietf-tsvwg-gre-in-udp-encap-04
Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r-- | net/ipv4/udp.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 97ef1f8b7be8..0224f930c613 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2525,6 +2525,16 @@ void __init udp_table_init(struct udp_table *table, const char *name) } } +u32 udp_flow_hashrnd(void) +{ + static u32 hashrnd __read_mostly; + + net_get_random_once(&hashrnd, sizeof(hashrnd)); + + return hashrnd; +} +EXPORT_SYMBOL(udp_flow_hashrnd); + void __init udp_init(void) { unsigned long limit; |