diff options
author | Eric Dumazet <edumazet@google.com> | 2013-04-29 01:58:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-29 15:14:02 -0400 |
commit | aebda156a570782a86fc4426842152237a19427d (patch) | |
tree | 013aecdd1e2223ff91faa08b604d4e4b91283252 /net/ipv4 | |
parent | 2d177be8e4a1f6ea7e3280b3a578a6b86472a39d (diff) |
net: defer net_secret[] initialization
Instead of feeding net_secret[] at boot time, defer the init
at the point first socket is created.
This permits some platforms to use better entropy sources than
the ones available at boot time.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/af_inet.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 93824c57b108..c61b3bb87a16 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -114,6 +114,7 @@ | |||
114 | #include <net/inet_common.h> | 114 | #include <net/inet_common.h> |
115 | #include <net/xfrm.h> | 115 | #include <net/xfrm.h> |
116 | #include <net/net_namespace.h> | 116 | #include <net/net_namespace.h> |
117 | #include <net/secure_seq.h> | ||
117 | #ifdef CONFIG_IP_MROUTE | 118 | #ifdef CONFIG_IP_MROUTE |
118 | #include <linux/mroute.h> | 119 | #include <linux/mroute.h> |
119 | #endif | 120 | #endif |
@@ -262,8 +263,10 @@ void build_ehash_secret(void) | |||
262 | get_random_bytes(&rnd, sizeof(rnd)); | 263 | get_random_bytes(&rnd, sizeof(rnd)); |
263 | } while (rnd == 0); | 264 | } while (rnd == 0); |
264 | 265 | ||
265 | if (cmpxchg(&inet_ehash_secret, 0, rnd) == 0) | 266 | if (cmpxchg(&inet_ehash_secret, 0, rnd) == 0) { |
266 | get_random_bytes(&ipv6_hash_secret, sizeof(ipv6_hash_secret)); | 267 | get_random_bytes(&ipv6_hash_secret, sizeof(ipv6_hash_secret)); |
268 | net_secret_init(); | ||
269 | } | ||
267 | } | 270 | } |
268 | EXPORT_SYMBOL(build_ehash_secret); | 271 | EXPORT_SYMBOL(build_ehash_secret); |
269 | 272 | ||