]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Check for mac80211_hwsim module before loading it
authorJohannes Berg <johannes.berg@intel.com>
Sun, 31 May 2020 09:40:32 +0000 (11:40 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 10 Jun 2020 18:12:44 +0000 (21:12 +0300)
Instead of checking if the kernel allows modules (via the presence of
/proc/modules), check if mac80211_hwsim is already there and load it
only if not. This gets rid of some ugly prints from modprobe in case
code isn't even a module and cannot be found, etc.

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

index 7a26d28254ef573b5206ccf2c4af35c93763bbba..ac43d10afad865cc100930f89c78947791995519 100755 (executable)
@@ -110,7 +110,7 @@ else
        NUM_CH=1
 fi
 
-test -f /proc/modules && sudo modprobe mac80211_hwsim radios=7 channels=$NUM_CH support_p2p_device=0 dyndbg=+p
+test -d /sys/module/mac80211_hwsim || sudo modprobe mac80211_hwsim radios=7 channels=$NUM_CH support_p2p_device=0 dyndbg=+p
 
 sudo ifconfig hwsim0 up
 sudo $WLANTEST -i hwsim0 -n $LOGDIR/hwsim0.pcapng -c -dtN -L $LOGDIR/hwsim0 &