From: Antonio Borneo Date: Sun, 1 Dec 2013 07:06:41 +0000 (+0800) Subject: Add support for "unbound" DNS resolver X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=df5808b301ba767578ffbec966db3b9ff154f588;p=users%2Fdwmw2%2Fvpnc-scripts.git Add support for "unbound" DNS resolver Original patch from Erinn Looney-Triggs 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 --- diff --git a/vpnc-script b/vpnc-script index dfbad36..cc49aed 100755 --- a/vpnc-script +++ b/vpnc-script @@ -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() {