benjarobbi / get-a-robot-vpnc

Automatically exported from code.google.com/p/get-a-robot-vpnc
1 stars 0 forks source link

DNS settings are not restored after client disconnect #139

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Establish connection.
2. Disconnect.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Using VPN_Connections_v099.apk on SAMSUNG galaxy TAB with Android 2.2

Please provide any additional information below.

The problem is in vpnc-script. I fixed it with this diff:

############################################
--- vpnc-script 2010-06-12 13:08:30.000000000 +0300
+++ vpnc-script_v099.vilkata    2010-11-25 11:37:01.000000000 +0200
@@ -147,7 +147,7 @@
        echo $PREVIOUS_DNS2 > `dirname $0`/dns2.txt

        RESOLV_CONF_BACKUP=`dirname $0`/resolv.conf-backup
-       cp /etc/resolv.conf $RESOLV_CONF_BACKUP
+       cp /etc/resolv.conf $RESOLV_CONF_BACKUP 2>/dev/null

        N=1

@@ -160,13 +160,17 @@

 restore_resolvconf_android() {
        RESOLV_CONF_BACKUP=`dirname $0`/resolv.conf-backup
+       SCRIPT_DIR=`dirname $0`
        if [ -e "$RESOLV_CONF_BACKUP" ]; then
-               echo "restore script at work!"
+               echo "restoring /etc/resolv.conf"
                grep '^#@VPNC_GENERATED@' /etc/resolv.conf > /dev/null 2>&1 && cat "$RESOLV_CONF_BACKUP" > /etc/resolv.conf
                rm -f -- "$RESOLV_CONF_BACKUP"
-               SCRIPT_DIR=`dirname $0`
+       fi
+       if [ -e "$SCRIPT_DIR/dns1.txt" ]; then
+               echo "restoring DNS properties"
                setprop net.dns1 `cat $SCRIPT_DIR/dns1.txt`
                setprop net.dns2 `cat $SCRIPT_DIR/dns2.txt`
+               rm -f "$SCRIPT_DIR/dns1.txt" "$SCRIPT_DIR/dns2.txt"
        fi
 }
#############################################

There is no /etc/resolv.conf on this device.

Original issue reported on code.google.com by vge...@gmail.com on 25 Nov 2010 at 9:52

GoogleCodeExporter commented 9 years ago
The solution I have seen posted elsewhere that works for me is to enable and 
disable wifi.  Everything should work fine after that.

Original comment by rrhu...@gmail.com on 2 Jan 2011 at 12:40