Add support for pdnsd.
authorRoy Marples <roy@marples.name>
Thu, 28 Oct 2010 21:43:00 +0000 (21:43 +0000)
committerRoy Marples <roy@marples.name>
Thu, 28 Oct 2010 21:43:00 +0000 (21:43 +0000)
.gitignore
Makefile
pdnsd.in [new file with mode: 0644]
resolvconf.conf.5.in

index f0c09891a1c0af219cb7ae95368b12f3d1fb5be0..a9adcd2dd85e670dadb61a9983afb8ee5064a76d 100644 (file)
@@ -5,4 +5,5 @@ named
 resolvconf
 resolvconf.8
 resolvconf.conf.5
+pdnsd
 unbound
index bddc92e234786d4aaa0281a596461ad6a9caa690..4d1c89a36368bfb04c30ee19760c8c9f9d4eb1ca 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,7 @@ VARDIR?=      ${VARBASE}/run/resolvconf
 MANDIR?=       ${MANPREFIX}/man
 
 RESOLVCONF=    resolvconf resolvconf.8 resolvconf.conf.5
-SUBSCRIBERS=   libc dnsmasq named unbound
+SUBSCRIBERS=   libc dnsmasq named pdnsd unbound
 TARGET=                ${RESOLVCONF} ${SUBSCRIBERS}
 SRCS=          ${TARGET:C,$,.in,} # pmake
 SRCS:=         ${TARGET:=.in} # gmake
diff --git a/pdnsd.in b/pdnsd.in
new file mode 100644 (file)
index 0000000..d94d2fe
--- /dev/null
+++ b/pdnsd.in
@@ -0,0 +1,55 @@
+#!/bin/sh
+# Copyright (c) 2010 Roy Marples
+# All rights reserved
+
+# pdnsd subscriber for resolvconf
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+#       copyright notice, this list of conditions and the following
+#       disclaimer in the documentation and/or other materials provided
+#       with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+[ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
+. "@SYSCONFDIR@/resolvconf.conf" || exit 1
+[ -z "$pdnsd_resolv" ] && exit 0
+[ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
+
+: ${pdnsd_restart:=pdnsd-ctl config}
+newresolv="# Generated by resolvconf\n"
+
+for n in $NAMESERVERS; do
+       newresolv="${newresolv}nameserver $n\n"
+done
+
+# pdnsd does now support domain forwarding
+
+changed=false
+if [ -n "$pdnsd_resolv" ]; then
+       if [ ! -f "$pdnsd_resolv" ] || \
+               [ "$(cat "$pdnsd_resolv")" != "$(printf "$newresolv")" ]
+       then
+               changed=true
+               printf "$newresolv" >"$pdnsd_resolv"
+       fi
+fi
+
+if $changed; then
+       eval $pdnsd_restart
+fi
index b0e54a00854d9a625b8b3e414cc0719025e3dc4a..432c92e74ecd1f391b779982353fadd32d1242b5 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd July 4, 2010
+.Dd October 28, 2010
 .Dt RESOLVCONF.CONF 5 SMM
 .Os
 .Sh NAME
@@ -134,6 +134,21 @@ Example named.conf:
 .D1    include "/etc/named-options.conf";
 .D1 };
 .D1 include "/etc/named-zones.conf";
+.It Sy pdnsd_resolv
+This file tells pdnsd about global nameservers.
+.Pp
+Example resolvconf.conf for pdnsd:
+.D1 nameservers=127.0.0.1
+.D1 pdnsd_resolv=/etc/pdnsd-resolv.conf
+.Pp
+Example pdnsd.conf:
+.D1 global {
+.D1    server_ip = 127.0.0.1;
+.D1 }
+.D1 server {
+.D1    label="resolvconf";
+.D1    file="/etc/pdnsd-resolv.conf";
+.D1 }
 .It Sy unbound_conf
 This file tells unbound about specific and global nameservers.
 .Pp