SOURCES: openvpn.init - detect invalid tunnel due missing configur...

glen glen at pld-linux.org
Thu Jan 11 13:13:44 CET 2007


Author: glen                         Date: Thu Jan 11 12:13:44 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- detect invalid tunnel due missing configuration early

---- Files affected:
SOURCES:
   openvpn.init (1.29 -> 1.30) 

---- Diffs:

================================================================
Index: SOURCES/openvpn.init
diff -u SOURCES/openvpn.init:1.29 SOURCES/openvpn.init:1.30
--- SOURCES/openvpn.init:1.29	Thu Dec  7 19:27:23 2006
+++ SOURCES/openvpn.init	Thu Jan 11 13:13:38 2007
@@ -62,14 +62,22 @@
 	if ! tunlsup; then
 		msg_starting "OpenVPN"; started
 		for tun in $TUNNELS; do
-			show "Starting OpenVPN tunnel %s" "$tun"
-			if tunlup $tun; then
-				started
-				continue
+			config="/etc/openvpn/$tun.conf"
+			if [ ! -f "$config" ]; then
+				nls "Invalid tunnel \`%s': missing config: %s" $tun "$config"
+				fail
+				RET=1
+			else
+				show "Starting OpenVPN tunnel %s" "$tun"
+				if tunlup $tun; then
+					started
+					continue
+				fi
+
+				daemon openvpn --daemon --writepid "/var/run/openvpn/$tun.pid" \
+					--config $config --cd /etc/openvpn
+				RET=$?
 			fi
-			daemon openvpn --daemon --writepid "/var/run/openvpn/$tun.pid" \
-				--config "/etc/openvpn/$tun.conf" --cd /etc/openvpn
-			RET=$?
 			[ $RETVAL -eq 0 ] && RETVAL=$RET
 		done
 		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/openvpn
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/openvpn.init?r1=1.29&r2=1.30&f=u



More information about the pld-cvs-commit mailing list