Package: openvpn
Version: 2.1.3-2+squeeze1
Severity: minor
Tags: patch

Dear Maintainer,

   * What led up to the situation?
    * I wanted to start lighttpd on a openvpn interface, unfortunately it could 
not bind to the interface
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
    * Added some code to the init script, so that it only exits when the 
interface is really up
   * What was the outcome of this action?
    * Now openvpn init script only exits when interfaces are really up

Here is my patch

--- /etc/init.d/openvpn.bak     2012-07-12 05:20:07.000000000 -0500
+++ /etc/init.d/openvpn 2012-07-18 02:58:54.000000000 -0500
@@ -36,6 +36,7 @@
 fi
 
 start_vpn () {
+    local dev=$(grep "^dev " $CONFIG_DIR/$NAME.conf | awk '{ print $NF }')
     if grep -q '^[      ]*daemon' $CONFIG_DIR/$NAME.conf ; then
       # daemon already given in config file
       DAEMONARG=
@@ -56,13 +57,19 @@
     fi
 
     log_progress_msg "$NAME"
-    STATUS=0
+    STATUS=1
 
     start-stop-daemon --start --quiet --oknodo \
         --pidfile /var/run/openvpn.$NAME.pid \
         --exec $DAEMON -- $OPTARGS --writepid /var/run/openvpn.$NAME.pid \
         $DAEMONARG $STATUSARG --cd $CONFIG_DIR \
-        --config $CONFIG_DIR/$NAME.conf || STATUS=1
+        --config $CONFIG_DIR/$NAME.conf || return
+
+    for i in `seq 8`; do
+        sleep 1
+        ip -o -f inet addr show $dev >/dev/null 2>&1 && STATUS=0 && break
+        log_progress_msg "."
+    done
 }
 stop_vpn () {
   kill `cat $PIDFILE` || true


-- System Information:
Debian Release: 6.0.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to