summaryrefslogtreecommitdiffhomepage
path: root/random.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2013-10-18 21:38:01 +0800
committerMatt Johnston <matt@ucc.asn.au>2013-10-18 21:38:01 +0800
commit45bd0edae52c07daa2d54ca7f7c0a57d51130791 (patch)
tree38ab731e4c38f1e287c187a9ca14ea73a92f9434 /random.c
parentaafeebd0c841494e4f7315890bc97ed0daf99cbd (diff)
parent3d733a16e9ee856a45a1fbd9a1b48005d78063f9 (diff)
Merge in changes from the past couple of releases
--HG-- branch : ecc
Diffstat (limited to 'random.c')
-rw-r--r--random.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/random.c b/random.c
index 17e3086..88c8327 100644
--- a/random.c
+++ b/random.c
@@ -78,7 +78,7 @@ process_file(hash_state *hs, const char *filename,
while (len == 0 || readcount < len)
{
int readlen, wantread;
- unsigned char readbuf[2048];
+ unsigned char readbuf[4096];
if (!already_blocked)
{
int ret;
@@ -209,12 +209,13 @@ void seedrandom() {
process_file(&hs, "/proc/loadavg", 0, 0);
process_file(&hs, "/proc/sys/kernel/random/entropy_avail", 0, 0);
- /* Mostly network visible but useful in some situations */
- process_file(&hs, "/proc/net/netstat", 0, 0);
- process_file(&hs, "/proc/net/dev", 0, 0);
- process_file(&hs, "/proc/net/tcp", 0, 0);
+ /* Mostly network visible but useful in some situations.
+ * Limit size to avoid slowdowns on systems with lots of routes */
+ process_file(&hs, "/proc/net/netstat", 4096, 0);
+ process_file(&hs, "/proc/net/dev", 4096, 0);
+ process_file(&hs, "/proc/net/tcp", 4096, 0);
/* Also includes interface lo */
- process_file(&hs, "/proc/net/rt_cache", 0, 0);
+ process_file(&hs, "/proc/net/rt_cache", 4096, 0);
process_file(&hs, "/proc/vmstat", 0, 0);
#endif