aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/netfilter/nfnetlink_log.c8
-rw-r--r--net/netfilter/nft_hash.c2
-rw-r--r--net/netfilter/xt_RATEEST.c2
-rw-r--r--net/netfilter/xt_connlimit.c2
-rw-r--r--net/netfilter/xt_hashlimit.c2
-rw-r--r--net/netfilter/xt_recent.c2
6 files changed, 5 insertions, 13 deletions
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 3c4b69e5fe17..7d4254b0dc6b 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -28,8 +28,6 @@
28#include <linux/proc_fs.h> 28#include <linux/proc_fs.h>
29#include <linux/security.h> 29#include <linux/security.h>
30#include <linux/list.h> 30#include <linux/list.h>
31#include <linux/jhash.h>
32#include <linux/random.h>
33#include <linux/slab.h> 31#include <linux/slab.h>
34#include <net/sock.h> 32#include <net/sock.h>
35#include <net/netfilter/nf_log.h> 33#include <net/netfilter/nf_log.h>
@@ -75,7 +73,6 @@ struct nfulnl_instance {
75}; 73};
76 74
77#define INSTANCE_BUCKETS 16 75#define INSTANCE_BUCKETS 16
78static unsigned int hash_init;
79 76
80static int nfnl_log_net_id __read_mostly; 77static int nfnl_log_net_id __read_mostly;
81 78
@@ -1066,11 +1063,6 @@ static int __init nfnetlink_log_init(void)
1066{ 1063{
1067 int status = -ENOMEM; 1064 int status = -ENOMEM;
1068 1065
1069 /* it's not really all that important to have a random value, so
1070 * we can do this from the init function, even if there hasn't
1071 * been that much entropy yet */
1072 get_random_bytes(&hash_init, sizeof(hash_init));
1073
1074 netlink_register_notifier(&nfulnl_rtnl_notifier); 1066 netlink_register_notifier(&nfulnl_rtnl_notifier);
1075 status = nfnetlink_subsys_register(&nfulnl_subsys); 1067 status = nfnetlink_subsys_register(&nfulnl_subsys);
1076 if (status < 0) { 1068 if (status < 0) {
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c
index 3d3f8fce10a5..6aae699aeb46 100644
--- a/net/netfilter/nft_hash.c
+++ b/net/netfilter/nft_hash.c
@@ -164,7 +164,7 @@ static int nft_hash_init(const struct nft_set *set,
164 unsigned int cnt, i; 164 unsigned int cnt, i;
165 165
166 if (unlikely(!nft_hash_rnd_initted)) { 166 if (unlikely(!nft_hash_rnd_initted)) {
167 get_random_bytes(&nft_hash_rnd, 4); 167 nft_hash_rnd = prandom_u32();
168 nft_hash_rnd_initted = true; 168 nft_hash_rnd_initted = true;
169 } 169 }
170 170
diff --git a/net/netfilter/xt_RATEEST.c b/net/netfilter/xt_RATEEST.c
index 370adf622cef..190854be7629 100644
--- a/net/netfilter/xt_RATEEST.c
+++ b/net/netfilter/xt_RATEEST.c
@@ -100,7 +100,7 @@ static int xt_rateest_tg_checkentry(const struct xt_tgchk_param *par)
100 int ret; 100 int ret;
101 101
102 if (unlikely(!rnd_inited)) { 102 if (unlikely(!rnd_inited)) {
103 get_random_bytes(&jhash_rnd, sizeof(jhash_rnd)); 103 jhash_rnd = prandom_u32();
104 rnd_inited = true; 104 rnd_inited = true;
105 } 105 }
106 106
diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c
index c40b2695633b..7671e8214919 100644
--- a/net/netfilter/xt_connlimit.c
+++ b/net/netfilter/xt_connlimit.c
@@ -229,7 +229,7 @@ static int connlimit_mt_check(const struct xt_mtchk_param *par)
229 u_int32_t rand; 229 u_int32_t rand;
230 230
231 do { 231 do {
232 get_random_bytes(&rand, sizeof(rand)); 232 rand = prandom_u32();
233 } while (!rand); 233 } while (!rand);
234 cmpxchg(&connlimit_rnd, 0, rand); 234 cmpxchg(&connlimit_rnd, 0, rand);
235 } 235 }
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 9ff035c71403..a83a35c81150 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -177,7 +177,7 @@ dsthash_alloc_init(struct xt_hashlimit_htable *ht,
177 /* initialize hash with random val at the time we allocate 177 /* initialize hash with random val at the time we allocate
178 * the first hashtable entry */ 178 * the first hashtable entry */
179 if (unlikely(!ht->rnd_initialized)) { 179 if (unlikely(!ht->rnd_initialized)) {
180 get_random_bytes(&ht->rnd, sizeof(ht->rnd)); 180 ht->rnd = prandom_u32();
181 ht->rnd_initialized = true; 181 ht->rnd_initialized = true;
182 } 182 }
183 183
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index 1e657cf715c4..bfdc29f1a04a 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -334,7 +334,7 @@ static int recent_mt_check(const struct xt_mtchk_param *par,
334 size_t sz; 334 size_t sz;
335 335
336 if (unlikely(!hash_rnd_inited)) { 336 if (unlikely(!hash_rnd_inited)) {
337 get_random_bytes(&hash_rnd, sizeof(hash_rnd)); 337 hash_rnd = prandom_u32();
338 hash_rnd_inited = true; 338 hash_rnd_inited = true;
339 } 339 }
340 if (info->check_set & ~XT_RECENT_VALID_FLAGS) { 340 if (info->check_set & ~XT_RECENT_VALID_FLAGS) {