]> www.infradead.org Git - users/dwmw2/vpnc-scripts.git/commitdiff
Support for OpenBSD's resolvd via route messages
authorAndrew Hewus Fresh <andrew@afresh1.com>
Sat, 30 Oct 2021 19:10:06 +0000 (12:10 -0700)
committerDaniel Lenski <dlenski@gmail.com>
Fri, 19 Nov 2021 20:36:39 +0000 (12:36 -0800)
This adds support for managing resolv.conf via resolvd(8),
by sending nameserver messages with route(8) to add and
remove nameservers.

https://man.openbsd.org/resolvd.8
https://man.openbsd.org/route.8#nameserver

vpnc-script

index 237062e734dc984cc6dd0b669c4c603e88e8f2c4..09550081bf09e2434cddf6d7f2c87ff14a3a4be7 100755 (executable)
@@ -192,6 +192,10 @@ elif [ -x /sbin/modify_resolvconf ]; then
 elif [ -x /usr/sbin/unbound-control ] && /usr/sbin/unbound-control status > /dev/null 2>&1; then
        MODIFYRESOLVCONF=modify_resolvconf_unbound
        RESTORERESOLVCONF=restore_resolvconf_unbound
+elif [ -x /usr/sbin/rcctl ] && /usr/sbin/rcctl check resolvd >/dev/null; then
+       # OpenBSD's resolvd by sending route messages
+       MODIFYRESOLVCONF=modify_resolvconf_resolvd
+       RESTORERESOLVCONF=restore_resolvconf_resolvd
 else # Generic for any OS
        MODIFYRESOLVCONF=modify_resolvconf_generic
        RESTORERESOLVCONF=restore_resolvconf_generic
@@ -899,6 +903,16 @@ restore_resolvconf_unbound() {
        fi
 }
 
+# === resolv.conf handling via resolvd =========
+
+modify_resolvconf_resolvd() {
+       /sbin/route nameserver $TUNDEV $INTERNAL_IP4_DNS $INTERNAL_IP6_DNS
+}
+
+restore_resolvconf_resolvd() {
+       /sbin/route nameserver $TUNDEV
+}
+
 # ========= Toplevel state handling  =======================================
 
 do_pre_init() {