From f9f2106011f4ed077549c29dda13a51ee206dabe Mon Sep 17 00:00:00 2001 From: fbt Date: Wed, 13 Nov 2013 11:04:27 +0400 Subject: [PATCH] checking for the tun module --- init.d/cjdroute | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/init.d/cjdroute b/init.d/cjdroute index a759550..5d33f5f 100755 --- a/init.d/cjdroute +++ b/init.d/cjdroute @@ -24,7 +24,18 @@ cjdroute.destroy_tun() { ip tuntap del mode tun "$cjdroute_tun_interface" } +cjdroute.check_tun_module() { + [[ -e '/dev/net/tun' ]] || { + modprobe tun || { + watchman.err "Could not load module tun!" + return 1 + } + } +} + start() { + cjdroute.check_tun_module || { return 1; } + [[ "$service_username" ]] && { cjdroute.create_tun || { return 1; } }