[PATCH 2/4] allow custom resolv.conf handling via hooks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The primary goal of this is to allow for no resolv.conf handling at
all. This is useful on a host that functions as a router for clients
that need VPN access, in which case the router should not actually
have its own DNS tampered with.

In this case, the user will need to do further configuration to ensure
that clients get the correct DNS, such as:
* sending the clients the VPN DNS server(s) via DHCP, or
* running a local DNS cache (such as powerdns, which can forward
  requests for specific domains to the VPN DNS server(s)

Signed-off-by: Corey Hickey <bugfood-ml at fatooh.org>
---
 vpnc-script | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/vpnc-script b/vpnc-script
index 3bf7757..8cf897b 100755
--- a/vpnc-script
+++ b/vpnc-script
@@ -116,7 +116,10 @@ else
 	ifconfig_syntax_ptpv6=""
 fi
 
-if [ -r /etc/openwrt_release ] && [ -n "$OPENWRT_INTERFACE" ]; then
+if [ -d "$HOOKS_DIR/modify-resolvconf.d" ]; then
+	MODIFYRESOLVCONF=modify_resolvconf_custom
+	RESTORERESOLVCONF=restore_resolvconf_custom
+elif [ -r /etc/openwrt_release ] && [ -n "$OPENWRT_INTERFACE" ]; then
         . /etc/functions.sh
 	include /lib/network
 	MODIFYRESOLVCONF=modify_resolvconf_openwrt
@@ -361,6 +364,16 @@ fi
 
 # =========== resolv.conf handling ====================================
 
+# =========== resolv.conf handling via custom hooks ===================
+modify_resolvconf_custom() {
+	run_hooks modify-resolvconf
+}
+
+restore_resolvconf_custom() {
+	run_hooks restore-resolvconf
+}
+
+
 # =========== resolv.conf handling for any OS =========================
 
 modify_resolvconf_generic() {
-- 
2.9.3




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux