Comment 0 for bug 6078

Revision history for this message
LeoRochael (leorochael) wrote :

The vpnc-connect script that is bundled with ubuntu version of vpnc manipulates /etc/resolv.conf directly even when resolvconf is present. Despite the fact that this package suggests resolvconf (implying that vpnc colaborates with resolvconf).

This patch is an attempt at adding resolvconf colaboration to vpnc. It works for me, YMMV, etc...

--- /usr/sbin/vpnc-script.orig 2005-12-23 09:35:15.000000000 -0200
+++ /usr/sbin/vpnc-script 2005-12-23 10:06:17.000000000 -0200
@@ -160,6 +160,19 @@
 fi

 write_resolvconf() {
+ if [ -x /sbin/resolvconf ]; then
+ (
+ if [ -n "$CISCO_DEF_DOMAIN" ] ; then
+ echo domain "$CISCO_DEF_DOMAIN"
+ echo search "$CISCO_DEF_DOMAIN"
+ fi
+ for ip in "$INTERNAL_IP4_DNS" ; do
+ echo nameserver $ip
+ done
+ ) | /sbin/resolvconf -a $TUNDEV
+ return
+ fi
+
        grep '^#@VPNC_GENERATED@' /etc/resolv.conf > /dev/null 2>&1 || cp -- /etc/resolv.conf "$RESOLV_CONF_BACKUP"
        NEW_RESOLVCONF="#@VPNC_GENERATED@ -- this file is generated by vpnc
 # and will be overwritten by vpnc
@@ -202,6 +215,11 @@
 }

 reset_resolvconf() {
+ if [ -x /sbin/resolvconf ] ; then
+ /sbin/resolvconf -d $TUNDEV
+ return
+ fi
+
        if [ ! -e "$RESOLV_CONF_BACKUP" ]; then
                return
        fi