Package: pdnsd
Version: 1.2.4par-0.2
Followup-For: Bug #388436

Hello everyone,

the problem might be related to the problem I'm having. I'm using
pdnsd as DNS proxy and resolvconf to automatically set DNS servers
learned via DHCP as upstream servers for pdnsd.

During system boot, there is a race condition. When pdnsd is starting,
it forks into the background as a daemon and then needs some time before
it starts answering requests (including control requests via pdnsd-ctl).
Since the init script doesn't wait until pdnsd has been fully started,
it might happen that the resolvconf init script runs before pdnsd has
started answering and thus resolvconf fails to add upstream DNS servers
to pdnsd.

The obvious solution is for the init script to wait until pdnsd starts
answering (the delay is normally only a fraction of a second, even on a
slow system, but it's enough to cause the trouble). Attached is a patch
that does just that.

Andreas

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (650, 'testing'), (250, 'unstable'), (200, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16.18-skas3-v8.2-toshiba
Locale: LANG=C, LC_CTYPE=de_DE (charmap=ISO-8859-1)

Versions of packages pdnsd depends on:
ii  adduser                      3.99        Add and remove users and groups
ii  libc6                        2.3.6.ds1-4 GNU C Library: Shared libraries

pdnsd recommends no packages.

-- no debconf information
--- pdnsd.dpkg-dist     2006-10-12 08:35:53.000000000 +0200
+++ pdnsd       2006-04-29 11:25:49.000000000 +0200
@@ -38,6 +38,21 @@
        return 0
 }
 
+start_wait()
+{
+       for f in `seq 1 60`; do
+               sleep 0.1
+               if pdnsd-ctl status >/dev/null 2>&1; then
+                       break
+               fi
+       done
+       if pdnsd-ctl status >/dev/null 2>&1; then
+               return 0
+       else
+               return 1
+       fi
+}
+
 start()
 {
        # Return
@@ -48,6 +63,7 @@
        start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec "$DAEMON" 
-- \
                --daemon -p "$PIDFILE" $START_OPTIONS \
                || return 2
+       start_wait || return 2
 }
 
 start_resolvconf()

Reply via email to