[From nobody Tue Nov 24 12:24:12 2026
Received: (at submit) by bugs.debian.org; 2 Mar 2014 11:34:19 +0000
X-Spam-Checker-Version: SpamAssassin 3.3.2-bugs.debian.org_2005_01_02
 (2011-06-06) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-15.9 required=4.0 tests=BAYES_00,DIGITS_LETTERS,
 FOURLA,FROMDEVELOPER,HAS_PACKAGE,MURPHY_DRUGS_REL8,RCVD_IN_DNSWL_NONE,
 XMAILER_REPORTBUG,X_DEBBUGS_CC autolearn=ham
 version=3.3.2-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 51; hammy, 151; neutral, 197; spammy,
 0. spammytokens: hammytokens:0.000-+--H*r:TLSv1.2,
 0.000-+--H*M:reportbug, 
 0.000-+--H*MI:reportbug, 0.000-+--H*x:reportbug, 0.000-+--H*UA:reportbug
Return-path: &lt;rrs@researchut.com&gt;
Received: from mail-pd0-f175.google.com ([209.85.192.175])
 by buxtehude.debian.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:128)
 (Exim 4.80) (envelope-from &lt;rrs@researchut.com&gt;) id 1WK4ew-00019a-Vj
 for submit@bugs.debian.org; Sun, 02 Mar 2014 11:34:19 +0000
Received: by mail-pd0-f175.google.com with SMTP id x10so2579874pdj.20
 for &lt;submit@bugs.debian.org&gt;; Sun, 02 Mar 2014 03:34:12 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:content-type:mime-version
 :content-transfer-encoding:from:to:subject:message-id:date;
 bh=rzzSrThdj4BxgGY51eoztIbWtxNbvP/uC7OQE/AEg34=;
 b=QNTdsJqo1GOcNChVf3uTNde/W+QZtEGovDZ/Z2NYoCZMzxlKSxyEo3njOwLI0poedy
 +dGvL0U02KVGzNzsknfoyM0H3qAmZXfbQkr8GoLgkEmErZmKI3NeuavsktlDF8jsCCUL
 R290XgWCiUbYvnFEJoC3ma2xW7DhBBvGwuvFKlPdbGTqVxvNwmSPGpOwepQXODUyXBIg
 NLv1bNUxMPC1KhxoNwsB+ZBfym2e9ESnPPqN3nr6bCuPA2GU/gbyC0Ow02UdZA5q0lpc
 CIpmXj5Bm/+jaIGXSGwOMf5hOwYs0cr03ae5EcTg+AETRR6AJaUT3hTq2Zkw4rEZDf1m
 /WgQ==
X-Gm-Message-State: ALoCoQmk9qNN7TSvbVVgCEThgW2ls4soPpiU/opFA5j+fm51VA+ymyoRleGhdxWgTSnNUszBlTr8
X-Received: by 10.68.143.34 with SMTP id sb2mr118622pbb.135.1393760052015;
 Sun, 02 Mar 2014 03:34:12 -0800 (PST)
Received: from localhost ([27.7.162.194])
 by mx.google.com with ESMTPSA id ki3sm24725192pbc.6.2014.03.02.03.34.09
 for &lt;multiple recipients&gt;
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 02 Mar 2014 03:34:10 -0800 (PST)
Sender: Ritesh Raj Sarraf &lt;rrs@researchut.com&gt;
Received: by localhost (Postfix, from userid 1000)
 id 9FE813000EB; Sun,  2 Mar 2014 17:04:06 +0530 (IST)
Content-Type: text/plain; charset=&quot;us-ascii&quot;
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Ritesh Raj Sarraf &lt;rrs@debian.org&gt;
To: Debian Bug Tracking System &lt;submit@bugs.debian.org&gt;
Subject: network-manager-vpnc: check connectivity and loop
Message-ID: &lt;20140302113406.1953.91148.reportbug@localhost&gt;
X-Mailer: reportbug 6.5.0
Date: Sun, 02 Mar 2014 17:04:06 +0530
X-Debbugs-Cc: rrs@debian.org
Delivered-To: submit@bugs.debian.org

Package: network-manager-vpnc
Version: 0.9.8.6-1
Severity: wishlist

VPN connections could drop at time. Sometimes if the keep alive packet
is not served, and also for other reasons.

It would be good to have loop option available to ensure vpn
connectivity.


Currently, under NM, I do it using the dispatcher scripts.



========================================================================
rrs@zan:~$ cat /etc/NetworkManager/dispatcher.d/02vpnc 
#!/bin/sh -e


# Script to dispatch NetworkManager events
#

if [ -z &quot;$1&quot; ]; then
    echo &quot;$0: called with no interface&quot; 1&gt;&amp;2
    exit 1;
fi


# Fake ifupdown environment
export IFACE=&quot;$1&quot;
export LOGICAL=&quot;$1&quot;
export METHOD=&quot;NetworkManager&quot;
export VERBOSITY=&quot;0&quot;

if [ &quot;$CONNECTION_UUID&quot; = &quot;50655113-6dbb-4472-b865-3dadcfc55fb1&quot; ]; then
    # Run the right scripts
    case &quot;$2&quot; in
        up)
            export MODE=&quot;start&quot;
            export PHASE=&quot;post-up&quot;
            /home/rrs/bin/vpnc-connect.sh
            ;;
        down)
            export MODE=&quot;stop&quot;
            export PHASE=&quot;post-down&quot;
            /home/rrs/bin/vpnc-disconnect.sh
            ;;
# pre-up/pre-down not implemented. See
# https://bugzilla.gnome.org/show_bug.cgi?id=387832
#        pre-up)
#            export MODE=&quot;start&quot;
#            export PHASE=&quot;pre-up&quot;
#            run-parts /etc/network/if-pre-up.d
#            ;;
#        pre-down)
#            export MODE=&quot;stop&quot;
#            export PHASE=&quot;pre-down&quot;
#            run-parts /etc/network/if-down.d
#            ;;
        hostname|dhcp4-change|dhcp6-change)
            # Do nothing
            ;;
        *)
            echo &quot;$0: called with unknown action \`$2'&quot; 1&gt;&amp;2
            exit 1
            ;;
    esac
elif [ &quot;$CONNECTION_UUID&quot; = &quot;09e21baf-848a-4fcd-90a0-34b6f1890adc&quot; ];
then
    # Run the right scripts
    case &quot;$2&quot; in
        up)
            export MODE=&quot;start&quot;
            export PHASE=&quot;post-up&quot;
            /home/rrs/bin/vpnc-connect-external.sh
            ;;
        down)
            export MODE=&quot;stop&quot;
            export PHASE=&quot;post-down&quot;
            /home/rrs/bin/vpnc-disconnect-external.sh
            ;;
        hostname|dhcp4-change|dhcp6-change)
            # Do nothing
            ;;
        *)
            echo &quot;$0: called with unknown action \`$2'&quot; 1&gt;&amp;2
            exit 1
            ;;
    esac
fi

exit $?
==============================================================================


And then, a loop inside the calling shell script

==============================================================================

rrs@zan:~$ cat ~/bin/vpnc-connect.sh 
#!/bin/bash

SUDO=/usr/bin/sudo
VPNC_CONNECT=/usr/sbin/vpnc-connect
VPNC_DISCONNECT=/usr/sbin/vpnc-disconnect

if ! [ `pidof -x vpnc-loop.sh` ]; then
        /home/rrs/bin/vpnc-loop.sh &amp;
fi
rrs@zan:~$ cat ~/bin/vpnc-loop.sh 
#!/bin/sh

while true;
do
        # Check if vpnc is running.
        pidof vpnc-connect &amp;&amp; sleep 150 &amp;&amp; continue;

        # If not running, run it.
        sudo vpnc-disconnect &gt;/dev/null;
        sleep 1;
        sudo vpnc-connect &gt;/dev/null;
        sleep 150;
done

rrs@zan:~$ cat ~/bin/vpnc-disconnect.sh 
#!/bin/bash

SUDO=/usr/bin/sudo
VPNC_CONNECT=/usr/sbin/vpnc-connect
VPNC_DISCONNECT=/usr/sbin/vpnc-disconnect

test `pidof -x vpnc-loop.sh` &amp;&amp; kill -9 `pidof -x vpnc-loop.sh`
$SUDO $VPNC_DISCONNECT

==============================================================================

Having something like this natively in NM would be a good feature.



-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (101, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages network-manager-vpnc depends on:
ii  libc6             2.17-97
ii  libdbus-1-3       1.8.0-1
ii  libdbus-glib-1-2  0.102-1
ii  libglib2.0-0      2.38.2-5
ii  libnm-glib-vpn1   0.9.8.0-5
ii  libnm-glib4       0.9.8.0-5
ii  libnm-util2       0.9.8.0-5
ii  vpnc              0.5.3r512-2

network-manager-vpnc recommends no packages.

network-manager-vpnc suggests no packages.

-- no debconf information
]