benjarobbi/get-a-robot-vpnc

Internal addresses will not work without domain suffix

Opened this issue · 1 comments

What steps will reproduce the problem?
1. Connect to CISCO Group Auth UDP VPN
2. Attempt to visit internal network address without domain suffix

What is the expected output? What do you see instead?
Expect to see content of internal server

What version of the product are you using? On what operating system?
v.99 on Evo4G CM7

Please provide any additional information below.
I am able to access the content of the server if I access it via the following 
URL pattern: http://myinternalsite.myinternaldomain 

I am UNABLE to access the content of the server if I access it via the 
following URL pattern: http://myinternalsite

Original issue reported on code.google.com by a432...@gmail.com on 12 May 2011 at 11:06

I solved the issue by modifying a couple lines of code in the vpnc-script file. 
Maybe this could be added in the next release? See below:

Replace the modify_resolvconf_android() function with this:

modify_resolvconf_android() {
        echo "backing up dns and resolve.conf"
        INTERNAL_IP4_DNS_TEMP="$INTERNAL_IP4_DNS"

        PREVIOUS_DNS1=`getprop net.dns1`
        PREVIOUS_DNS2=`getprop net.dns2`
        PREVIOUS_DNSSEARCH=`getprop net.dns.search`

        echo $PREVIOUS_DNS1 > `dirname $0`/dns1.txt
        echo $PREVIOUS_DNS2 > `dirname $0`/dns2.txt
        echo $PREVIOUS_DNSSEARCH > `dirname $0`/dnssearch.txt

        RESOLV_CONF_BACKUP=`dirname $0`/resolv.conf-backup
        cp /etc/resolv.conf $RESOLV_CONF_BACKUP

        N=1

        for i in $INTERNAL_IP4_DNS; do
                setprop net.dns$N $i
                N=`expr $N + 1`
        done

        setprop net.dns.search $CISCO_DEF_DOMAIN

}

Replace the restore_resolvconf_android() function with this:

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

You will notice that I added setprop net.dns.search to the script. Now I can 
get to my internal sites!

Original comment by a432...@gmail.com on 13 May 2011 at 7:15