]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Pretend the RNG is initialized withinthe VM
authorJohannes Berg <johannes.berg@intel.com>
Mon, 11 Apr 2022 09:41:20 +0000 (11:41 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 16 Apr 2022 13:51:54 +0000 (16:51 +0300)
We don't particularly care about the quality of random numbers
during the test. So far, there hasn't been an issue with the
RNG not being initialized completely, we only get a few prints
about uninitialized reads from urandom. However, if some tool
were to actually use /dev/random, it might get stuck. Call the
RNDADDTOENTCNT ioctl to unblock this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
tests/hwsim/vm/inside.sh

index 11ded93f43f18cffd169fb7eb7f34a0edcfca28a..c46c524775394fbb5e93cc3f15f4131c61cdc8a5 100755 (executable)
@@ -58,6 +58,11 @@ ln -s /proc/self/fd/0 /dev/stdin
 ln -s /proc/self/fd/1 /dev/stdout
 ln -s /proc/self/fd/2 /dev/stderr
 
+# pretend we've initialized the RNG, we don't care here
+# about the actual quality of the randomness. The ioctl
+# is RNDADDTOENTCNT (at least on x86).
+PYTHONHASHSEED=0 python3 -c 'import fcntl; fd=open("/dev/random", "w"); fcntl.ioctl(fd.fileno(), 0x40045201, b"\x00\x01\x00\x00")'
+
 echo "VM has started up" > /dev/ttyS0
 
 # create stub sudo - everything runs as uid 0