]> www.infradead.org Git - users/dwmw2/vpnc-scripts.git/commitdiff
Add support for "unbound" DNS resolver
authorAntonio Borneo <borneo.antonio@gmail.com>
Sun, 1 Dec 2013 07:06:41 +0000 (15:06 +0800)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Tue, 5 Aug 2014 13:38:58 +0000 (14:38 +0100)
Original patch from Erinn Looney-Triggs <erinn.looneytriggs@gmail.com>
posted at Red Hat Bugzilla - Bug #865092
https://bugzilla.redhat.com/show_bug.cgi?id=865092

Removed bashism, removed trailing spaces, use tab for indentation.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
vpnc-script

index dfbad3651db55825d7cfe7dce572076d21979c86..cc49aedb7cb953b4c9f7e8cba4bab54231dacb43 100755 (executable)
@@ -130,6 +130,9 @@ elif [ -x /sbin/netconfig ]; then # tool on Suse after 11.1
 elif [ -x /sbin/modify_resolvconf ]; then # Mandatory tool on Suse earlier than 11.1
        MODIFYRESOLVCONF=modify_resolvconf_suse
        RESTORERESOLVCONF=restore_resolvconf_suse
+elif [ -x /usr/sbin/unbound-control ] && /usr/sbin/unbound-control status > /dev/null 2>&1; then
+       MODIFYRESOLVCONF=modify_resolvconf_unbound
+       RESTORERESOLVCONF=restore_resolvconf_unbound
 else # Generic for any OS
        MODIFYRESOLVCONF=modify_resolvconf_generic
        RESTORERESOLVCONF=restore_resolvconf_generic
@@ -557,6 +560,24 @@ restore_resolvconf_manager() {
        /sbin/resolvconf -d $TUNDEV
 }
 
+# === resolv.conf handling via unbound =========
+
+modify_resolvconf_unbound() {
+       if [ -n "$CISCO_DEF_DOMAIN" ]; then
+               /usr/sbin/unbound-control forward_add +i ${CISCO_DEF_DOMAIN} ${INTERNAL_IP4_DNS}
+               /usr/sbin/unbound-control flush_requestlist
+               /usr/sbin/unbound-control flush_zone ${CISCO_DEF_DOMAIN}
+       fi
+}
+
+restore_resolvconf_unbound() {
+       if [ -n "$CISCO_DEF_DOMAIN" ]; then
+               /usr/sbin/unbound-control forward_remove +i ${CISCO_DEF_DOMAIN}
+               /usr/sbin/unbound-control flush_zone ${CISCO_DEF_DOMAIN}
+               /usr/sbin/unbound-control flush_requestlist
+       fi
+}
+
 # ========= Toplevel state handling  =======================================
 
 kernel_is_2_6_or_above() {