From ee44b907957f02f2d5b5f25da663ee90df6c41b3 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 30 Jan 2008 15:57:01 +0000 Subject: Add a timeout for creating tun/tap interfaces. --- net.Linux/tuntap.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/net.Linux/tuntap.sh b/net.Linux/tuntap.sh index 62008135..bd494db5 100644 --- a/net.Linux/tuntap.sh +++ b/net.Linux/tuntap.sh @@ -25,6 +25,18 @@ tuntap_pre_start() eerror "TUN/TAP support is not present in this kernel" return 1 fi + vebegin "Waiting for /dev/net/tun" + # /dev/net/tun can take it's time to appear + local timeout=10 + while [ ! -e /dev/net/tun -a ${timeout} -gt 0 ]; do + sleep 1 + timeout=$((${timeout} - 1)) + done + if [ ! -e /dev/net/tun ]; then + eerror "TUN/TAP support present but /dev/net/tun is not" + return 1 + fi + veend 0 fi ebegin "Creating Tun/Tap interface ${IFACE}" -- cgit v1.2.3