From 318cc4ad599dedb3a212652ebe60ca40140936f2 Mon Sep 17 00:00:00 2001 From: Mark Murray Date: Sat, 14 Oct 2000 12:56:08 +0000 Subject: [PATCH] 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. --- etc/rc | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/etc/rc b/etc/rc index d89bfd3f5fc3..4935b5f2450b 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() {