From: Roy Marples Date: Fri, 29 Oct 2010 18:37:55 +0000 (+0000) Subject: Allow pdnsd_conf to work without pdnsd_resolv. X-Git-Tag: openresolv-3.4.0~12 X-Git-Url: https://roy.marples.name/git?ds=inline Allow pdnsd_conf to work without pdnsd_resolv. --- diff --git a/pdnsd.in b/pdnsd.in index 72a20d3..e78d703 100644 --- a/pdnsd.in +++ b/pdnsd.in @@ -28,7 +28,7 @@ [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0 . "@SYSCONFDIR@/resolvconf.conf" || exit 1 -[ -z "$pdnsd_resolv" ] && exit 0 +[ -z "$pdnsd_conf" -a -z "$pdnsd_resolv" ] && exit 0 [ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)" : ${pdnsd_restart:=pdnsd-ctl config $pdnsd_conf} @@ -83,16 +83,37 @@ change_file() newresolv="# Generated by resolvconf\n" changed=false -for n in $NAMESERVERS; do - newresolv="${newresolv}nameserver $n\n" -done +if [ -n "$pdnsd_resolv" ]; then + for n in $NAMESERVERS; do + newresolv="${newresolv}nameserver $n\n" + done +fi if [ -n "$pdnsd_conf" ]; then cf="$pdnsd_conf.new" newconf= + + if [ -z "$pdnsd_resolv" ]; then + newconf="${newconf}server {\n" + newconf="${newconf}\tlabel=resolvconf;\n" + if [ -n "$NAMESERVERS" ]; then + newconf="${newconf}\tip=" + first=true + for n in $NAMESERVERS; do + if $first; then + first=false + else + newconf="${newconf}," + fi + newconf="$newconf$n" + done + newconf="${newconf};\n}\n" + fi + fi + for d in $DOMAINS; do newconf="${newconf}server {\n" - newconf="${newconf}\tinclude=\"${d%%:*}\";\n" + newconf="${newconf}\tinclude=.${d%%:*}.;\n" newconf="${newconf}\tpolicy=excluded;\n" newconf="${newconf}\tip=" ns="${d#*:}" diff --git a/resolvconf.conf.5.in b/resolvconf.conf.5.in index c295e72..0682ca0 100644 --- a/resolvconf.conf.5.in +++ b/resolvconf.conf.5.in @@ -138,13 +138,19 @@ Example named.conf: .It Sy pdnsd_conf This is the main pdnsd configuration file which we modify to add our forward domains to. +If this variable is not set then we rely on the pdnsd configuration file +setup to read +.Pa pdnsd_resolv +as documented below. .It Sy pdnsd_resolv This file tells pdnsd about global nameservers. +If this variable is not set then it's written to +.Pa pdnsd_conf . .Pp Example resolvconf.conf for pdnsd: .D1 nameservers=127.0.0.1 .D1 pdnsd_conf=/etc/pdnsd.conf -.D1 pdnsd_resolv=/etc/pdnsd-resolv.conf +.D1 # pdnsd_resolv=/etc/pdnsd-resolv.conf .Pp Example pdnsd.conf: .D1 global { @@ -152,8 +158,10 @@ Example pdnsd.conf: .D1 status_ctl = on; .D1 } .D1 server { -.D1 label="resolvconf"; -.D1 file="/etc/pdnsd-resolv.conf"; +.D1 # A server definition is required, even if emtpy. +.D1 label="empty"; +.D1 proxy_only=on; +.D1 # file="/etc/pdnsd-resolv.conf"; .D1 } .It Sy unbound_conf This file tells unbound about specific and global nameservers.