summaryrefslogtreecommitdiffstats
path: root/etc/rc
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2000-10-14 12:56:08 +0000
committermarkm <markm@FreeBSD.org>2000-10-14 12:56:08 +0000
commitf81d689f634aebffd19debbf383a6ead88d96ce5 (patch)
tree3166ec58c9b9524952fe350daef5b7c3764d02b7 /etc/rc
parenta8d2363750f62cf99c9e91b3edb208a5862543e9 (diff)
downloadFreeBSD-src-f81d689f634aebffd19debbf383a6ead88d96ce5.zip
FreeBSD-src-f81d689f634aebffd19debbf383a6ead88d96ce5.tar.gz
Reseed the random device as early as possible to prevent hangs,
and provide some form of entropy in case there is no seed file to prevent a reboot from hanging unnecessarily.
Diffstat (limited to 'etc/rc')
-rw-r--r--etc/rc39
1 files changed, 25 insertions, 14 deletions
diff --git a/etc/rc b/etc/rc
index d89bfd3..4935b5f 100644
--- a/etc/rc
+++ b/etc/rc
@@ -69,6 +69,31 @@ elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi
+# Recover some entropy so the rebooting /dev/random can reseed
+#
+case ${entropy_file} in
+[Nn][Oo] | '')
+ ;;
+*)
+ if [ -w /dev/random ]; then
+ if [ -f ${entropy_file} -a -r ${entropy_file} ]; then
+ echo "Reading entropy file"
+ cat ${entropy_file} > /dev/random 2> /dev/random
+ rm -f ${entropy_file}
+ else
+ echo "No entropy file, trying other sources"
+ # XXX temporary until we can get the entropy
+ # harvesting rate up
+ # Entropy below is not great, but better than nothing.
+ (ps -gauxwww; iostat; vmstat; dmesg) > /dev/random 2> /dev/random
+ ( for i in /etc /var/run ; do
+ cd $i ; ls -al ; cat *
+ done ) > /dev/random 2> /dev/random
+ fi
+ fi
+ ;;
+esac
+
# Configure ccd devices.
#
if [ -r /etc/ccd.conf ]; then
@@ -158,20 +183,6 @@ if [ -n "${diskless_mount}" -a -r "${diskless_mount}" ]; then
sh ${diskless_mount}
fi
-# Recover some entropy so the rebooting /dev/random can reseed
-#
-case ${entropy_file} in
-[Nn][Oo] | '')
- ;;
-*)
- if [ -f ${entropy_file} -a -r ${entropy_file} -a -w /dev/random ]; then
- echo "Reading entropy file"
- cat ${entropy_file} > /dev/random
- rm -f ${entropy_file}
- fi
- ;;
-esac
-
adjkerntz -i
purgedir() {
OpenPOWER on IntegriCloud