[wide-dhcpv6] Initial import (#956147).

David Beveridge bevhost at fedoraproject.org
Sat Feb 7 20:17:21 UTC 2015


commit fa8428547d0ebc589fd2b3e175defa1089eed76b
Author: David Beveridge <dave at bevhost.com>
Date:   Sun Feb 8 06:16:57 2015 +1000

    Initial import (#956147).

 .gitignore                                         |    1 +
 CHANGELOG-LINUX                                    |  385 ++
 COPYRIGHT                                          |   42 +
 RELEASENOTES                                       |  130 +
 dhcp6c-script                                      |   40 +
 dhcp6c.service                                     |   10 +
 dhcp6r.service                                     |   10 +
 dhcp6s.service                                     |   10 +
 sources                                            |    1 +
 wide-dhcpv6-0001-Fix-manpages.patch                |  168 +
 wide-dhcpv6-0002-Don-t-strip-binaries.patch        |   28 +
 ...pv6-0003-Close-inherited-file-descriptors.patch |   80 +
 wide-dhcpv6-0004-GNU-libc6-fixes.patch             | 6710 ++++++++++++++++++++
 ...pv6-0005-Update-ifid-on-interface-restart.patch |   35 +
 ...cpv6-0006-Add-new-feature-dhcp6c-profiles.patch |  630 ++
 ...-option-to-the-dhcp6c.conf-prefix-interfa.patch |  122 +
 ...-dhcpv6-0008-Make-sla-len-config-optional.patch |   20 +
 wide-dhcpv6-0009-Make-sla-id-config-optional.patch |   60 +
 ...010-move-client-script-to-after-update_ia.patch |   34 +
 wide-dhcpv6-0011-fedora20-cflag.patch              |   32 +
 wide-dhcpv6-0012-Fix-renewal-of-IA-NA.patch        |   27 +
 ...pv6-0013-Fix-parallel-make-race-condition.patch |   16 +
 wide-dhcpv6.spec                                   |  137 +
 23 files changed, 8728 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..93cdb71 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/wide-dhcpv6-20080615.tar.gz
diff --git a/CHANGELOG-LINUX b/CHANGELOG-LINUX
new file mode 100644
index 0000000..63a768e
--- /dev/null
+++ b/CHANGELOG-LINUX
@@ -0,0 +1,385 @@
+wide-dhcpv6 (20080615-11.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix pending l10n issues. Debconf translations:
+    - Danish (Joe Hansen).  Closes: #645824
+    - Dutch; (Jeroen Schot).  Closes: #632629
+    - Polish (Michał Kułach).  Closes: #659242
+    - Italian (Beatrice Torracca).  Closes: #660000
+
+ -- Christian Perrier <bubulle at debian.org>  Sat, 18 Feb 2012 19:07:44 +0100
+
+wide-dhcpv6 (20080615-11) unstable; urgency=low
+
+  * Add wide-dhcpv6-client-udeb for d-i integration, thanks to
+    Matthew Palmer <mpalmer at debian.org> for the patch (Closes: #611870).
+
+ -- Jérémie Corbier <jcorbier at debian.org>  Thu, 03 Feb 2011 14:06:05 +0100
+
+wide-dhcpv6 (20080615-10) unstable; urgency=low
+
+  * Fix wide-dhcpv6-{server,relay}.config.
+  * Bumped up Standards-Version to 3.9.1: no changes needed.
+
+ -- Jérémie Corbier <jcorbier at debian.org>  Mon, 15 Nov 2010 21:50:12 +0100
+
+wide-dhcpv6 (20080615-9) unstable; urgency=low
+
+  * New maintainer email address.
+  * Init scripts gracefully exit if /etc/default/wide-dhcpv6-* files are not
+    available.
+  * debian/patches:
+    -> Added 0007-Adding-ifid-option-to-the-dhcp6c.conf-prefix-interfa.patch:
+       allows to override default EUI-64 address selection. Thanks to Bjørn Mork
+       <bjorn at mork.no> for the patch (Closes: #591828).
+  * Switch to a patch queue workflow.
+
+ -- Jérémie Corbier <jcorbier at debian.org>  Thu, 11 Nov 2010 16:31:21 +0100
+
+wide-dhcpv6 (20080615-8) unstable; urgency=low
+
+  * debian/patches:
+    -> Added debian/patches/103_update-ifid-on-restart.diff: interface id may
+       change between a stop and a start command sent to the client, reset it on
+       start. Thanks to Bjørn Mork <bjorn at mork.no> for the patch
+       (Closes: #561949).
+    -> Updated debian/patches/102_libc6-2.9-fixes.diff: now checks whether
+       in6_pktinfo is defined by the libc or not.
+  * debian/scripts/dhcp6c-script:
+    -> Only add nameservers if they are not already declared in /etc/resolv.conf
+      (Closes: #561945).
+  * Added dependency on $remote_fs in init scripts LSB headers.
+  * Switched to 3.0 (quilt) source package format ; no need for a README.source
+    file anymore.
+  * Bumped up Standards-Version to 3.8.4: no changes needed.
+
+ -- Jérémie Corbier <jeremie+debian at famille-corbier.net>  Thu, 25 Mar 2010 10:07:03 +0100
+
+wide-dhcpv6 (20080615-7) unstable; urgency=low
+
+  * New maintainer email address.
+  * debian/patches:
+    -> Added debian/patches/102_libc6-2.9-fixes.diff: renamed dprintf to
+       debug_printf since the libc already exports a dprintf symbol
+       (Closes: #552845).
+    -> Refreshed all patches.
+  * Switched to Debhelper compatibility level 7:
+    -> Got rid of cdbs.
+    -> Updated .install files accordingly.
+    -> Added a versionned dependency on quilt so as to be sure it provides a dh
+       plugin.
+  * Bumped up Standards-Version to 3.8.3:
+    -> Made sure init scripts don't fail if the daemon is already started or
+       already stopped.
+  * Init scripts:
+    -> Fix LSB header Provides field.
+    -> Have lintian shut up about supposedly invalid /etc/default files
+       sourcing.
+  * Added Russian debconf templates translation, thanks to Yuri Kozlov
+    (Closes: #551574).
+  * Added Japanese debconf templates translation, thanks to Hideki Yamane
+    (Closes: #553689).
+  * Removed note about 2.4 kernels in packages' description.
+  * Added the debian/README.source file.
+
+ -- Jérémie Corbier <jeremie+debian at famille-corbier.net>  Mon, 02 Nov 2009 15:02:53 +0100
+
+wide-dhcpv6 (20080615-6) unstable; urgency=low
+
+  * debian/patches/102_libc6-2.9-fixes.diff: fix build failures caused by
+    headers modifications in the latest libc6 (Closes: #518879).
+  * Removed the warning about configuring the client once the install has
+    finished since it is not displayed anymore.
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Mon, 09 Mar 2009 11:16:58 +0100
+
+wide-dhcpv6 (20080615-5) unstable; urgency=medium
+
+  * debian/patches/101_close-fds.diff: make sure dhcp6c does not close already
+    opened sockets (Closes: #513375).
+  * Added Spanish debconf templates translation, thanks to Francisco Javier
+    Cuadrado (Closes: #511920).
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Wed, 28 Jan 2009 14:42:49 +0100
+
+wide-dhcpv6 (20080615-4) unstable; urgency=medium
+
+  * debian/patches: added 200_close-fds.diff so wide-dhcpv6 binaries close
+    inherited file descriptors, from debconf, for instance (Closes: #512397).
+    Thanks to Colin Watson for noticing and providing a fix.
+  * debian/wide-dhcpv6-client.config: don't show Debconf note saying that one
+    should configure dhcp6c manually right after its installation.  This should
+    not be needed anymore thanks to profiles/default configuration.
+  * debian/watch: use qa.debian.org SourceForge redirector.
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Tue, 20 Jan 2009 15:33:37 +0100
+
+wide-dhcpv6 (20080615-3) unstable; urgency=low
+
+  * debian/patches/200_dhcp6c-profiles.diff: fix a segfault introduced by this
+    patch in the case dhcp6c is not given any profile on the command line and
+    the interface being handled does not have any configuration statement in
+    dhcp6c.conf.
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Mon, 29 Dec 2008 08:50:16 +0100
+
+wide-dhcpv6 (20080615-2) unstable; urgency=low
+
+  * Allowed to define profiles for groups of interfaces (Closes: #506300):
+    -> Added debian/patches/200_dhcp6c-profiles.diff
+    -> Modified default dhcp6c configuration so it provides a default profile
+    -> Modified dhcp6c init script to use this default profile
+  * Removed dependency on sharutils in wide-dhcpv6-server: it does not
+    generate an authentication key at install time anymore.
+  * Maintainer's scripts:
+    -> Ensure their execution is aborted when any command fails.
+    -> Update config scripts accordingly.
+    -> Fix /etc/default/wide-dhcpv6-* files handling.
+  * debian/patches: added patch descriptions so lintian stops complaining.
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Thu, 18 Dec 2008 09:14:19 +0100
+
+wide-dhcpv6 (20080615-1) unstable; urgency=low
+
+  * New upstream release.
+  * Made it possible for the server to actually handle several network
+    interfaces.  It required to remove the possibility to control the server
+    with dhcp6ctl though.
+  * debian/control: no need to have Conflicts anymore since wide-dhcpv6-server
+    no longer provides dhcp6ctl.
+  * debian/patches:
+    -> Removed 001_use-sig_atomic_t.diff, 002_singular-point-check-fix.diff,
+       003_sprint_uint64-buffer-overrun-fix.diff,
+       004_dhcp6s_accepts_relayed_req_msgs_with_auth_opt.diff,
+       005_possible-mem-leak-and-double-frees-fix.diff,
+       010_incorrect-valid-lifetime-in-IA_NA.diff,
+       020_malformed-OPTION_DOMAIN_LIST.diff,
+       030_NULL-pointer-access-with-non-binding-Decline-messages.diff:
+       fixed upstream.
+    -> Updated 006_wide-dhcpv6-mans-update.diff: escape a minus sign in
+       dhcp6c.conf.5 so it is not interpreted as a hyphen by groff.
+  * Bumped up Standards-Version to 3.8.0: no changes needed.
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Sat, 21 Jun 2008 18:36:41 +0200
+
+wide-dhcpv6 (20070507-5) unstable; urgency=low
+
+  * debian/patches:
+    -> Added 010_incorrect-valid-lifetime-in-IA_NA.diff: fix a bug where IA_NA
+       in replies to Renew and Rebind messages contain the preferred lifetime
+       instead of the valid lifetime in their valid lifetime field.
+    -> Added 020_malformed-OPTION_DOMAIN_LIST.diff: fix a bug where
+       OPTION_DOMAIN_LIST options could be malformed because of a
+       miscalculated option length.
+    -> Added 030_NULL-pointer-access-with-non-binding-Decline-messages.diff:
+       fix a possible NULL pointer access when receiving a Decline message for
+       a non-binding address.
+    -> Updated 005_possible-mem-leak-and-double-frees-fix.diff: more memory
+       leaks fixes.
+    -> Updated 006_wide-dhcpv6-mans-update.diff: fix dhcp6ctl manpage.
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Tue, 18 Mar 2008 12:47:39 +0100
+
+wide-dhcpv6 (20070507-4) unstable; urgency=low
+
+  * debian/patches:
+    -> Added 004_dhcp6s_accepts_relayed_req_msgs_with_auth_opt.diff: upstream
+       patch. Fix a bug which caused dhcp6s not to accept relayed request
+       messages with authentication option.
+    -> Added 005_possible-mem-leak-and-double-frees-fix.diff: upstream patch.
+       Fix a possible memory leak and a possible double free.
+  * debian/control:
+    -> Bumped up Standards-Version to 3.7.3: no changes needed.
+    -> Now use official Vcs-* and Homepage fields.
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Fri, 07 Dec 2007 15:09:49 +0100
+
+wide-dhcpv6 (20070507-3) unstable; urgency=low
+
+  * debian/patches:
+    -> Added 100_dont-strip-binaries.diff: prevent upstream build system from
+       stripping binaries (Closes: #438262).
+  * Added Portuguese debconf templates translation, thanks to Américo Monteiro
+    (Closes: #437280).
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Thu, 16 Aug 2007 09:10:41 -0700
+
+wide-dhcpv6 (20070507-2) unstable; urgency=low
+
+  * debian/patches:
+    -> Added 001_use-sig_atomic_t.diff: use sig_atomic_t for sigflags in
+       signal handlers.
+    -> Added 002_singular-point-check-fix.diff: fix a singular-point
+       detection failure in replay check.
+    -> Added 003_sprint_uint64-buffer-overrun-fix.diff: fix a potential buffer
+       overrun in sprint_uint64().
+  * Added German debconf templates translation, thanks to Helge Kreutzmann
+    (Closes: #428267).
+  * Removed extra spaces in the debconf templates. All translations updated
+    and unfuzzied (Closes: 428268).
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Tue, 24 Jul 2007 13:24:13 -0700
+
+wide-dhcpv6 (20070507-1) unstable; urgency=low
+
+  * Mew upstream release.
+  * Use quilt instead of dpatch.
+  * debian/patches:
+    -> Get rid of 002_Makefile.in.diff: dh_fixperms takes care of files
+       ownership.
+    -> Removed 001_bugfixes_20061227.diff: merged upstream.
+  * debian/control:
+    -> Added Vcs fields.
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Mon, 07 May 2007 10:37:01 -0700
+
+wide-dhcpv6 (20061016-2) unstable; urgency=low
+
+  * debian/control: added lsb-base as a dependency.
+  * debian/patches:
+    -> Added 01_bugfixes_20061227.dpatch:
+      + Bug fixes from CVS 20061227.
+      + dhcp6relay accepts Unique Local IPv6 unicast Addresses.
+      + Fix an IA allocation failure from pool in dhcp6s.
+      + Fix "-P" option in dhcp6s.
+    -> Updated 02_Makefile.in.dpatch.
+  * debian/scripts/dhcp6c-ifupdown: check whether dhcp6c is running and exit
+    silently if not. Avoid errors when network is brought up before the client
+    is started (Closes: #404887).
+  * debian/dhcp6c.conf: corrected typo in comment (Closes: #404584).
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Fri,  5 Jan 2007 16:01:17 -0800
+
+wide-dhcpv6 (20061016-1) unstable; urgency=low
+
+  * New upstream release.
+  * Cleaned up debian/rules.
+  * debian/patches:
+    -> Removed 02_CVS-20060920.dpatch: merged upstream.
+  * debian/scripts:
+    -> Fixed bashisms in dhcp6c-ifupdown (Closes: #396909).
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Fri,  3 Nov 2006 13:20:55 -0800
+
+wide-dhcpv6 (20060902-2) unstable; urgency=medium
+
+  * The "Why should I test my init files when users can do that better than
+    me" release..
+  * Fix typo in wide-dhcpv6-*.init.d: it's /lib/lsb/init-functions, not
+    init-functtions.. (Closes: #391718).
+  * In wide-dhcpv6-client.init.d: replace log_end_message by log_end_msg, I
+    must have been smoking crack when I updated those files.
+  * Fix typo in dhcp6c.8: dhcp6c_duid is in /var/lib/dhcpv6, not in
+    /var/lib/dhcp.
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Sun,  8 Oct 2006 11:26:40 -0700
+
+wide-dhcpv6 (20060902-1) unstable; urgency=low
+
+  * New upstream release.
+  * debian/wide-dhcpv6-*.init.d:
+    -> LSB compliant init scripts.
+  * debian/patches:
+    -> Added 02_CVS-20060920.dpatch:
+      + Update to CVS 20060920.
+      + Fix a memory violation in lease management.
+      + Fix a bug that dhcp6s inserts SIP server addresses into DNS server
+        address option.
+      + Fix a bug that status-code option might include a unexpected garbage
+        value.
+      + Fix dhcp6s documentation: you need to provide a preferred-lifetime for
+        each address-prefix (Closes: #387416).
+    -> Removed 02_remove-if-USE_POOL-macros.dpatch
+    -> Removed 03_pid_dump.dpatch
+    -> Removed 07_cftoken.l-bison.dpatch
+    -> Removed 08_support-include-statement.dpatch
+       All merged upstream.
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Wed, 20 Sep 2006 14:36:12 -0700
+
+wide-dhcpv6 (20060322-4) unstable; urgency=medium
+
+  * debian/wide-dhcpv6-*.postinst: don't modify
+    /etc/default/wide-dhcpv6-${daemon} if it already exists.
+  * debian/patches:
+    -> Removed 03_dhcp6c_pid_dump.dpatch, 04_dhcp6s_pid_dump.dpatch and
+       05_dhcp6relay_pid_dump.dpatch.
+    -> Added 03_pid_dump.dpatch: upstream patch.
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Wed, 23 Aug 2006 23:21:05 +0200
+
+wide-dhcpv6 (20060322-3) unstable; urgency=low
+
+  * debian/scripts/dhcp6c-script:
+    -> Added resolvconf support if it is installed, thanks to Mattias Guns
+       (Closes: #369674).
+  * debian/patches:
+    -> 01_Makefile.in.dpatch: removes a bashism which caused a FTBFS if
+       /bin/sh does not point to bash (Closes: #376369).
+    -> 08_support-include-statement.dpatch: upstream patch allowing the use of
+       include statements in config files.
+    -> 02_remove-if-USE_POOL-macros.dpatch: upstream patch removing #ifdef
+       USE_POOL macros since it is always enabled (patch needed by
+       08_support-include-statement.dpatch).
+    -> Removed old 02_client-bind-to-link-local.dpatch and
+       08_common.h-missing-macros.dpatch.
+  * Bumped up Standards-Version to 3.7.2.1 (no changes).
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Sat,  8 Jul 2006 14:38:23 +0200
+
+wide-dhcpv6 (20060322-2) unstable; urgency=low
+
+  * Enabled Information Refresh Timer in dhcp6c.
+  * Keys for the communication between dhcp6ctl and dhcp6c or dhcp6s are
+    now automatically created on install.
+  * Added default configuration for the client: installs a default stateless
+    config.
+  * Added a script to update /etc/resolv.conf with received DNS and domain
+    information.
+  * Added if-up/if-down scripts to enable/disable dhcp6c if needed.
+  * Migrated configuration files to /etc/wide-dhcpv6.
+  * Added Czech debconf templates translation, thanks to Miroslav Kure
+    (Closes: #360274).
+  * Bump up Standards-Version to 3.7.0 (no changes).
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Sun, 16 Apr 2006 20:17:59 +0200
+
+wide-dhcpv6 (20060322-1) unstable; urgency=low
+
+  * New upstream release.
+  * Disabled patches as upstream fixed the bugs:
+    -> 02_client-bind-to-link-local.dpatch
+    -> 08_common.h-missing-macros.dpatch
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Tue, 28 Mar 2006 17:41:07 +0200
+
+wide-dhcpv6 (20060214-1) unstable; urgency=low
+
+  * New upstream release.
+  * Added 08_common.h-missing-macros.dpatch: adds macros that exist only in
+    *BSD and which are required for pool management.
+  * Updated the debconf templates to be developper's reference compliant.
+  * Added Swedish debconf templates translation, thanks to Daniel Nylander
+    (Closes: #353785).
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Wed, 8 Mar 2006 14:06:04 +0100
+
+wide-dhcpv6 (20060114-1) unstable; urgency=low
+
+  * Initial release (Closes: #350329).
+  * Added 01_Makefile.in.dpatch:
+    -> minor changes so that the packages build correctly.
+    -> removes config.{log,status} and Makefile provided by the upstream
+       tarball.
+  * Added 02_client-bind-to-link-local.dpatch: a patch for the client. It
+    makes it bind to the link local address of the first configured network
+    interface instead of ::/0, which doesn't work.
+  * Added 03_dhcp6c_pid_dump.dpatch, 04_dhcp6s_pid_dump.dpatch and
+    05_dhcp6relay_pid_dump.dpatch so that daemons dump their PIDs to /var/run.
+  * Added 06_wide-dhcpv6-mans-update.dpatch to update the manpages and adapt
+    them to the linux and especially Debian-like file hierarchy.
+  * Added 07_cftoken.l-bison.dpatch: a little modification which makes the
+    client and the server compile with flex instead of lex.
+
+ -- Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr>  Sun, 29 Jan 2006 10:24:22 +0100
+
diff --git a/COPYRIGHT b/COPYRIGHT
new file mode 100644
index 0000000..d4db743
--- /dev/null
+++ b/COPYRIGHT
@@ -0,0 +1,42 @@
+This package was redhatized by David Beveridge <dave at bevhost.com> May 2013.
+The ubuntu patches that are included were downloaded from
+https://launchpad.net/ubuntu/+archive/primary/+files/wide-dhcpv6_20080615-11.1.debian.tar.gz
+
+
+This package was debianized by Jeremie Corbier <jeremie.corbier at resel.enst-bretagne.fr> on
+Sat, 28 Jan 2006 23:30:58 +0100.
+
+It was downloaded from http://wide-dhcpv6.sourceforge.net/
+
+Copyright Holder: WIDE Project
+
+License:
+
+$KAME: COPYRIGHT,v 1.2 2004/07/29 19:02:18 jinmei Exp $
+
+Copyright (C) 1998-2004 WIDE Project.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. 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.
+3. Neither the name of the project nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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.
diff --git a/RELEASENOTES b/RELEASENOTES
new file mode 100644
index 0000000..881fff0
--- /dev/null
+++ b/RELEASENOTES
@@ -0,0 +1,130 @@
+WHY USE WIDE-DHCPv6?
+
+Generally speaking the main DHCP package for Fedora/RedHat from ISC is 
+a much more complete implementation with a nearly full set of features.
+
+Unfortunately there are a few things it does not do, or does not do well (yet!).  
+
+This is where it might be appropriate to use an alternative such as wide-dhcpv6.
+
+Things wide-dhcpv6 is not.
+ 1. Being further developed.
+ 2. Fully RFC compilant.
+ 3. Able to do prefix delegation from a pool of addresses.
+ 4. Able to service (serve to) more than one interface per instance.
+
+
+Reasons to choose wide dhcp for IPv6.
+ 1. Your ISP wants to assign you a static /128 link address 
+    and a /64 or greater prefix for your LAN, both by DHCP. (eg comcast cable)
+    (until https://bugzilla.redhat.com/show_bug.cgi?id=836702 is finished)
+ 2. You need the client to assign IP addresses to your LAN interfaces for radvd.
+    (until https://bugzilla.redhat.com/show_bug.cgi?id=626514 is finished)
+ 3. Your ISP gave you a working sample configuration file for wide-dhcpv6
+ 4. You want a basic dhcpv6 server to run many separate instances 
+    on a range of interfaces (eg in a VPN concentrator)
+
+
+WIDE DHCPv6 Client Script Variables (ISC DHCP has many more)
+     REASON  The reason why the script is invoked.  
+             The value is always "NBI" and thus meaningless.
+     new_domain_name_servers
+             A list of available DNS servers.
+     new_domain_name
+             A list of DNS names, which provides DNS name search path.
+     new_ntp_servers
+             A list of available NTP servers.
+     new_sip_servers
+             A list of available SIP server addresses.
+     new_sip_name
+             A list of SIP server domain names.
+     new_nis_servers
+             A list of available NIS server addresses.
+     new_nis_name
+             A list of NIS domain names.
+     new_nisp_servers
+             A list of available NIS+ server addresses.
+     new_nisp_name
+             A list of NIS+ domain names.
+     new_bcmcs_servers
+             A list of available BCMCS server addresses.
+     new_bcmcs_name
+             A list of BCMCS server domain names.
+
+
+SAMPLE MINIMUM CONFIGURATIONS for /etc/wide-dhcp/dhcp6c.conf
+
+For these configurations, I assume that the user has IPv4
+for DNS or can use a well known DNS such as the google
+anycast address eg 2001:4860:4860::8888.
+
+There is a whole range of configuration options such as
+DNS domain search list that are supported, but these only
+need to be configured once, either via IPv4 or IPv6.  
+These are normally already set by IPv4.
+Therefore I do not cover them here.
+Read the man pages if you are IPv6 Only.
+
+Just Prefix Delegation for a single LAN (ppp0 WAN, eth0 LAN)
+============================================================
+interface ppp0 {
+        send ia-pd 0;
+};
+id-assoc pd {
+        prefix-interface eth0 { };
+};
+
+Just Prefix Delegation but for three LANs.
+=========================================
+interface ppp0 {
+        send ia-pd 0;
+};
+id-assoc pd {
+        prefix-interface eth0 { };
+        prefix-interface eth1 { };
+        prefix-interface eth2 { };
+};
+
+Prefix Delegation on two LANS plus link address
+===============================================
+interface wlan0 {
+        send ia-na 0;
+        send ia-pd 0;
+};
+id-assoc na { };
+id-assoc pd {
+        prefix-interface eth0 { };
+        prefix-interface eth1 { };
+};
+
+Prefix Delegation on two LANS plus link address where
+the ISP needs a separate PD request for each LAN
+=====================================================
+interface wlan0 {
+        send ia-na 0;
+        send ia-pd 0;
+        send ia-pd 1;
+};
+id-assoc na 0 { };
+id-assoc pd 0 {
+        prefix-interface eth0 { };
+id-assoc pd 1 {
+        prefix-interface eth1 { };
+};
+
+
+
+Some versions of wide-dhcpv6 require that you set 
+an sla-len as well as an sla-id.
+
+The default sla-len is 16 in most wide-dhcpv6 implementations.
+This assumes that the ISP always allocates a /48.
+In this release if the ISP allocates smaller than /48,
+sla-len defaults to the largest size that fits,
+so it is better to leave it out of the configuration.
+
+This version of wide-dhcpv6 will also set the sla_id.
+The default for the sla_id is to use the interface counter.
+So, 0 for the first, 1 for the second, 2 third etc.
+If you want to set the sla_id, it is best to set it
+for all interfaces.
diff --git a/dhcp6c-script b/dhcp6c-script
new file mode 100644
index 0000000..e6168f4
--- /dev/null
+++ b/dhcp6c-script
@@ -0,0 +1,40 @@
+#!/bin/sh
+# dhcp6c-script for Debian/Ubuntu. Jérémie Corbier, April, 2006.
+# resolvconf support by Mattias Guns, May 2006.
+
+RESOLVCONF="/sbin/resolvconf"
+
+[ -f /etc/default/wide-dhcpv6-client ] && . /etc/default/wide-dhcpv6-client
+
+if [ -n "$new_domain_name" -o -n "$new_domain_name_servers" ]; then
+    old_resolv_conf=/etc/resolv.conf
+    new_resolv_conf=/etc/resolv.conf.dhcp6c-new
+    rm -f $new_resolv_conf
+    if [ -n "$new_domain_name" ]; then
+        echo search $new_domain_name >> $new_resolv_conf
+    fi
+    if [ -n "$new_domain_name_servers" ]; then
+        for nameserver in $new_domain_name_servers; do
+            # No need to add an already existing nameserver
+            res=$(grep "nameserver $nameserver" $old_resolv_conf)
+            if [ -z "$res" ]; then
+                echo nameserver $nameserver >> $new_resolv_conf
+            fi
+        done
+    fi
+
+    # Use resolvconf if available
+    if [ -h "$old_resolv_conf" -a -x "$RESOLVCONF" ]; then
+        for IFACE in $INTERFACES; do
+            cat $new_resolv_conf | $RESOLVCONF -a $IFACE
+        done
+    else
+        # To preserve IPv4 informations...
+        cat $old_resolv_conf >> $new_resolv_conf
+        chown --reference=$old_resolv_conf $new_resolv_conf
+        chmod --reference=$old_resolv_conf $new_resolv_conf
+        mv -f $new_resolv_conf $old_resolv_conf
+    fi
+fi
+
+exit 0
diff --git a/dhcp6c.service b/dhcp6c.service
new file mode 100644
index 0000000..ee23388
--- /dev/null
+++ b/dhcp6c.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Wide DHCPv6 client
+Documentation=man:dhcp6c(8) man:dhcp6c.conf(5)
+
+[Service]
+ExecStart=/usr/sbin/dhcp6c -f eth0
+
+[Install]
+WantedBy=network.target
+
diff --git a/dhcp6r.service b/dhcp6r.service
new file mode 100644
index 0000000..9864e90
--- /dev/null
+++ b/dhcp6r.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Wide DHCPv6 relay agent
+Documentation=man:dhcp6relay(8)
+
+[Service]
+ExecStart=/usr/sbin/dhcp6relay -f
+
+[Install]
+WantedBy=network.target
+
diff --git a/dhcp6s.service b/dhcp6s.service
new file mode 100644
index 0000000..cfd6567
--- /dev/null
+++ b/dhcp6s.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Wide DHCPv6 server
+Documentation=man:dhcp6s(8) man:dhcp6s.conf(5)
+
+[Service]
+ExecStart=/usr/sbin/dhcp6s -f eth0
+
+[Install]
+WantedBy=network.target
+
diff --git a/sources b/sources
index e69de29..6e46e2b 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+1011e165850fe40d3e332dad2bfd30b3  wide-dhcpv6-20080615.tar.gz
diff --git a/wide-dhcpv6-0001-Fix-manpages.patch b/wide-dhcpv6-0001-Fix-manpages.patch
new file mode 100644
index 0000000..76622f7
--- /dev/null
+++ b/wide-dhcpv6-0001-Fix-manpages.patch
@@ -0,0 +1,168 @@
+From e9fd60840eb125dcd55aab859dd838a47c02931f Mon Sep 17 00:00:00 2001
+From: Jeremie Corbier <jeremie+debian at famille-corbier.net>
+Date: Tue, 6 Apr 2010 15:51:03 +0200
+Subject: [PATCH] Fix manpages
+
+This patch fixes wide-dhcpv6 manpages (paths, typos, ...).
+
+Signed-off-by: Jeremie Corbier <jeremie at famille-corbier.net>
+---
+ dhcp6c.8      |    8 ++++----
+ dhcp6c.conf.5 |    4 ++--
+ dhcp6ctl.8    |   13 ++++++-------
+ dhcp6relay.8  |    1 -
+ dhcp6s.8      |   10 +++++-----
+ dhcp6s.conf.5 |    2 +-
+ 6 files changed, 18 insertions(+), 20 deletions(-)
+
+diff --git a/dhcp6c.8 b/dhcp6c.8
+index 6824ae0..1d69c9d 100644
+--- a/dhcp6c.8
++++ b/dhcp6c.8
+@@ -114,13 +114,13 @@ In either case,
+ will send DHCPv6 Release messages to release resources assigned from servers.
+ .\"
+ .Sh FILES
+-.Bl -tag -width /usr/local/etc/dhcp6c.conf -compact
++.Bl -tag -width /etc/wide-dhcpv6/dhcp6c.conf -compact
+ .It Pa /var/run/dhcp6c.pid
+ is the default file that contains pid of the currently running
+ .Nm dhcp6c .
+-.It Pa /usr/local/etc/dhcp6c.conf
++.It Pa /etc/wide-dhcpv6/dhcp6c.conf
+ is the default configuration file.
+-.It Pa /var/db/dhcp6c_duid
++.It Pa /var/lib/dhcpv6/dhcp6c_duid
+ is the file to store the client's DUID.
+ .El
+ .Sh Configuration Script
+@@ -203,6 +203,6 @@ command first appeared in WIDE/KAME IPv6 protocol stack kit.
+ is incomplete and violates DHCPv6 protocol spec, in several aspects.
+ In particular, temporary address assignment is intentionally omitted.
+ .Pp
+-Information Refresh Time Option is not recognied in Info-req mode, since
++Information Refresh Time Option is not recognized in Info-req mode, since
+ .Nm
+ terminates after it receives a REPLY message.
+diff --git a/dhcp6c.conf.5 b/dhcp6c.conf.5
+index 611ab4f..5fc03d3 100644
+--- a/dhcp6c.conf.5
++++ b/dhcp6c.conf.5
+@@ -36,7 +36,7 @@
+ .Nd DHCPv6 client configuration file
+ .\"
+ .Sh SYNOPSIS
+-.Pa /usr/local/etc/dhcp6c.conf
++.Pa /etc/wide-dhcpv6/dhcp6c.conf
+ .\"
+ .Sh DESCRIPTION
+ The
+@@ -630,7 +630,7 @@ execute the
+ .Xr openssl 1
+ command (when available) as follows,
+ .Bd -literal -offset
+-% openssl rand -base64 16
++% openssl rand \-base64 16
+ .Ed
+ .Pp
+ and copy the output to the
+diff --git a/dhcp6ctl.8 b/dhcp6ctl.8
+index 86ea0e1..e11889b 100644
+--- a/dhcp6ctl.8
++++ b/dhcp6ctl.8
+@@ -85,12 +85,11 @@ Use
+ .Ar keyfile
+ to provide the shared secret to communicate with the process.
+ The default file name used when unspecified is
+-.Pa /usr/local/etc/dhcp6cctlkey
++.Pa /etc/wide-dhcpv6/dhcp6cctlkey
+ with a client,
+ and
+-.Pa /usr/local/etc/dhcp6sctlkey
++.Pa /etc/wide-dhcpv6/dhcp6sctlkey
+ with a server.
+-
+ .It Fl p Ar port
+ Specify
+ .Ar port
+@@ -99,7 +98,7 @@ The default port number used when unspecified is 5546 for a client,
+ and 5547 for a server.
+ .It Fl s Ar address
+ Specify
+-.A address
++.Ar address
+ as the listening address of the process.
+ The default address used when unspecified is ::1.
+ .El
+@@ -183,10 +182,10 @@ information (if any) and exits.
+ .El
+ .\"
+ .Sh FILES
+-.Bl -tag -width /usr/local/etc/dhcp6cctlkey -compact
+-.It Pa /usr/local/etc/dhcp6cctlkey
++.Bl -tag -width /etc/wide-dhcpv6/dhcp6cctlkey -compact
++.It Pa /etc/wide-dhcpv6/dhcp6cctlkey
+ is the default key file to communicate with a client.
+-.It Pa /usr/local/etc/dhcp6sctlkey
++.It Pa /etc/wide-dhcpv6/dhcp6sctlkey
+ is the default key file to communicate with a server.
+ .El
+ .\"
+diff --git a/dhcp6relay.8 b/dhcp6relay.8
+index 4f761b0..7ad8ada 100644
+--- a/dhcp6relay.8
++++ b/dhcp6relay.8
+@@ -107,7 +107,6 @@ to dump the process ID of
+ is the default file that contains pid of the currently running
+ .Nm .
+ .El
+-
+ .Sh SEE ALSO
+ .Xr dhcp6c 8 ,
+ .Xr dhcp6s 8
+diff --git a/dhcp6s.8 b/dhcp6s.8
+index 888117a..29dcc7b 100644
+--- a/dhcp6s.8
++++ b/dhcp6s.8
+@@ -102,7 +102,7 @@ Use
+ to store the shared secret to authenticate the communication with
+ .Nm dhcp6ctl .
+ The default file name used when unspecified is
+-.Pa /usr/local/etc/dhcp6sctlkey .
++.Pa /etc/wide-dhcpv6/dhcp6sctlkey .
+ The default name is intentionally same as that for
+ .Nm dhcp6ctl
+ so that the server and the control command can share the file when
+@@ -122,12 +122,12 @@ to dump the process ID of
+ .El
+ .\"
+ .Sh FILES
+-.Bl -tag -width /usr/local/etc/dhcp6s.conf -compact
+-.It Pa /usr/local/etc/dhcp6s.conf
++.Bl -tag -width /etc/wide-dhcpv6/dhcp6s.conf -compact
++.It Pa /etc/wide-dhcpv6/dhcp6s.conf
+ is the default configuration file.
+-.It Pa /var/db/dhcp6s_duid
++.It Pa /var/lib/dhcpv6/dhcp6s_duid
+ is the default file to store the server's DUID.
+-.It Pa /usr/local/etc/dhcp6sctlkey
++.It Pa /etc/wide-dhcpv6/dhcp6sctlkey
+ is the default key file to communicate with the control command.
+ See
+ .Xr dhcp6ctl 8
+diff --git a/dhcp6s.conf.5 b/dhcp6s.conf.5
+index 1206764..2cb08ce 100644
+--- a/dhcp6s.conf.5
++++ b/dhcp6s.conf.5
+@@ -36,7 +36,7 @@
+ .Nd DHCPv6 server configuration file
+ .\"
+ .Sh SYNOPSIS
+-.Pa /usr/local/etc/dhcp6s.conf
++.Pa /etc/wide-dhcpv6/dhcp6s.conf
+ .\"
+ .Sh DESCRIPTION
+ The
+-- 
+1.5.6.5
+
diff --git a/wide-dhcpv6-0002-Don-t-strip-binaries.patch b/wide-dhcpv6-0002-Don-t-strip-binaries.patch
new file mode 100644
index 0000000..6e8b60e
--- /dev/null
+++ b/wide-dhcpv6-0002-Don-t-strip-binaries.patch
@@ -0,0 +1,28 @@
+From 30c43a801bd5b4bb96c878d2efc97042511fea92 Mon Sep 17 00:00:00 2001
+From: Jeremie Corbier <jeremie+debian at famille-corbier.net>
+Date: Tue, 6 Apr 2010 15:51:06 +0200
+Subject: [PATCH] Don't strip binaries
+
+This patch prevents wide-dhcpv6 build system from stripping built binaries.
+
+Signed-off-by: Jeremie Corbier <jeremie at famille-corbier.net>
+---
+ Makefile.in |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index a39596f..de25f48 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -103,7 +103,7 @@ $(srcdir)/ianaopts.h: gentab.pl bootp-dhcp-parameters
+ 
+ install::
+ 	-mkdir -p $(sbindir) $(mandir)/man5 $(mandir)/man8
+-	$(INSTALL_PROGRAM) -s -o $(user) -g $(group) $(TARGET) $(sbindir)
++	$(INSTALL_PROGRAM) -o $(user) -g $(group) $(TARGET) $(sbindir)
+ 	$(INSTALL_DATA) -o $(user) -g $(group) dhcp6c.8 $(mandir)/man8
+ 	$(INSTALL_DATA) -o $(user) -g $(group) dhcp6s.8 $(mandir)/man8
+ 	$(INSTALL_DATA) -o $(user) -g $(group) dhcp6relay.8 $(mandir)/man8
+-- 
+1.5.6.5
+
diff --git a/wide-dhcpv6-0003-Close-inherited-file-descriptors.patch b/wide-dhcpv6-0003-Close-inherited-file-descriptors.patch
new file mode 100644
index 0000000..0942aef
--- /dev/null
+++ b/wide-dhcpv6-0003-Close-inherited-file-descriptors.patch
@@ -0,0 +1,80 @@
+From 2bb6f1769a5c3ea4f669382801c9bb2b74881d48 Mon Sep 17 00:00:00 2001
+From: Jeremie Corbier <jeremie+debian at famille-corbier.net>
+Date: Tue, 6 Apr 2010 15:51:08 +0200
+Subject: [PATCH] Close inherited file descriptors
+
+wide-dhcpv6 binaries should close inherited fds.
+
+Signed-off-by: Jeremie Corbier <jeremie at famille-corbier.net>
+---
+ dhcp6c.c     |    7 ++++++-
+ dhcp6relay.c |    6 ++++++
+ dhcp6s.c     |    5 +++++
+ 3 files changed, 17 insertions(+), 1 deletions(-)
+
+diff --git a/dhcp6c.c b/dhcp6c.c
+index 1caaaa5..b5f5ed7 100644
+--- a/dhcp6c.c
++++ b/dhcp6c.c
+@@ -159,6 +159,7 @@ main(argc, argv)
+ 	char *progname;
+ 	FILE *pidfp;
+ 	struct dhcp6_if *ifp;
++	int fd;
+ 
+ #ifndef HAVE_ARC4RANDOM
+ 	srandom(time(NULL) & getpid());
+@@ -205,8 +206,12 @@ main(argc, argv)
+ 		exit(0);
+ 	}
+ 
+-	if (foreground == 0)
++	if (foreground == 0) {
++		for (fd = 3; fd < 1024; fd++)
++			close(fd);
++
+ 		openlog(progname, LOG_NDELAY|LOG_PID, LOG_DAEMON);
++	}
+ 
+ 	setloglevel(debug);
+ 
+diff --git a/dhcp6relay.c b/dhcp6relay.c
+index fb84ce3..eb0bce9 100644
+--- a/dhcp6relay.c
++++ b/dhcp6relay.c
+@@ -207,8 +207,14 @@ main(argc, argv)
+ 	}
+ 
+ 	if (foreground == 0) {
++		int fd;
++
+ 		if (daemon(0, 0) < 0)
+ 			err(1, "daemon");
++
++		for (fd = 3; fd < 1024; fd++)
++			close(fd);
++
+ 		openlog(progname, LOG_NDELAY|LOG_PID, LOG_DAEMON);
+ 	}
+ 	setloglevel(debug);
+diff --git a/dhcp6s.c b/dhcp6s.c
+index 544afff..494e571 100644
+--- a/dhcp6s.c
++++ b/dhcp6s.c
+@@ -316,8 +316,13 @@ main(argc, argv)
+ 	}
+ 
+ 	if (foreground == 0) {
++		int fd;
++
+ 		if (daemon(0, 0) < 0)
+ 			err(1, "daemon");
++
++		for (fd = 3; fd < 1024; fd++)
++			close(fd);
+ 	}
+ 
+ 	/* dump current PID */
+-- 
+1.5.6.5
+
diff --git a/wide-dhcpv6-0004-GNU-libc6-fixes.patch b/wide-dhcpv6-0004-GNU-libc6-fixes.patch
new file mode 100644
index 0000000..a2553ba
--- /dev/null
+++ b/wide-dhcpv6-0004-GNU-libc6-fixes.patch
@@ -0,0 +1,6710 @@
+From 78c2ba34951f378f847aaeb0b82fa6be9014ad46 Mon Sep 17 00:00:00 2001
+From: Jeremie Corbier <jeremie+debian at famille-corbier.net>
+Date: Tue, 6 Apr 2010 15:51:10 +0200
+Subject: [PATCH] GNU libc6 fixes
+
+Fixes for recent libc releases.
+
+Signed-off-by: Jeremie Corbier <jeremie at famille-corbier.net>
+---
+ addrconf.c          |   16 +-
+ cftoken.c           |   12 +-
+ cftoken.l           |   12 +-
+ common.c            |  226 +++++++++++++-------------
+ common.h            |    2 +-
+ config.c            |  268 +++++++++++++++---------------
+ configure           |   50 ++++++-
+ configure.in        |    7 +
+ dhcp6.h             |    7 +
+ dhcp6_ctl.c         |   40 +++---
+ dhcp6c.c            |  246 ++++++++++++++--------------
+ dhcp6c_ia.c         |   86 +++++-----
+ dhcp6c_script.c     |   36 ++--
+ dhcp6relay.c        |  118 +++++++-------
+ dhcp6relay_script.c |   28 ++--
+ dhcp6s.c            |  446 +++++++++++++++++++++++++-------------------------
+ if.c                |   12 +-
+ lease.c             |   14 +-
+ prefixconf.c        |   24 ++--
+ timer.c             |    6 +-
+ 20 files changed, 859 insertions(+), 797 deletions(-)
+
+diff --git a/addrconf.c b/addrconf.c
+index d98373f..98d03e5 100644
+--- a/addrconf.c
++++ b/addrconf.c
+@@ -122,7 +122,7 @@ update_address(ia, addr, dhcpifp, ctlp, callback)
+ 	if (addr->vltime != DHCP6_DURATION_INFINITE &&
+ 	    (addr->pltime == DHCP6_DURATION_INFINITE ||
+ 	    addr->pltime > addr->vltime)) {
+-		dprintf(LOG_INFO, FNAME, "invalid address %s: "
++		debug_printf(LOG_INFO, FNAME, "invalid address %s: "
+ 		    "pltime (%lu) is larger than vltime (%lu)",
+ 		    in6addr2str(&addr->addr, 0),
+ 		    addr->pltime, addr->vltime);
+@@ -131,7 +131,7 @@ update_address(ia, addr, dhcpifp, ctlp, callback)
+ 
+ 	if (iac_na == NULL) {
+ 		if ((iac_na = malloc(sizeof(*iac_na))) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME, "memory allocation failed");
++			debug_printf(LOG_NOTICE, FNAME, "memory allocation failed");
+ 			return (-1);
+ 		}
+ 		memset(iac_na, 0, sizeof(*iac_na));
+@@ -152,7 +152,7 @@ update_address(ia, addr, dhcpifp, ctlp, callback)
+ 	/* search for the given address, and make a new one if it fails */
+ 	if ((sa = find_addr(&iac_na->statefuladdr_head, addr)) == NULL) {
+ 		if ((sa = malloc(sizeof(*sa))) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME, "memory allocation failed");
++			debug_printf(LOG_NOTICE, FNAME, "memory allocation failed");
+ 			return (-1);
+ 		}
+ 		memset(sa, 0, sizeof(*sa));
+@@ -169,7 +169,7 @@ update_address(ia, addr, dhcpifp, ctlp, callback)
+ 	sa->addr.pltime = addr->pltime;
+ 	sa->addr.vltime = addr->vltime;
+ 	sa->dhcpif = dhcpifp;
+-	dprintf(LOG_DEBUG, FNAME, "%s an address %s pltime=%lu, vltime=%lu",
++	debug_printf(LOG_DEBUG, FNAME, "%s an address %s pltime=%lu, vltime=%lu",
+ 	    sacreate ? "create" : "update",
+ 	    in6addr2str(&addr->addr, 0), addr->pltime, addr->vltime);
+ 
+@@ -194,7 +194,7 @@ update_address(ia, addr, dhcpifp, ctlp, callback)
+ 		if (sa->timer == NULL) {
+ 			sa->timer = dhcp6_add_timer(addr_timo, sa);
+ 			if (sa->timer == NULL) {
+-				dprintf(LOG_NOTICE, FNAME,
++				debug_printf(LOG_NOTICE, FNAME,
+ 				    "failed to add stateful addr timer");
+ 				remove_addr(sa); /* XXX */
+ 				return (-1);
+@@ -233,7 +233,7 @@ remove_addr(sa)
+ {
+ 	int ret;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "remove an address %s",
++	debug_printf(LOG_DEBUG, FNAME, "remove an address %s",
+ 	    in6addr2str(&sa->addr.addr, 0));
+ 
+ 	if (sa->timer)
+@@ -343,7 +343,7 @@ na_renew_data_free(evd)
+ 	struct dhcp6_list *ial;
+ 
+ 	if (evd->type != DHCP6_EVDATA_IANA) {
+-		dprintf(LOG_ERR, FNAME, "assumption failure");
++		debug_printf(LOG_ERR, FNAME, "assumption failure");
+ 		exit(1);
+ 	}
+ 
+@@ -362,7 +362,7 @@ addr_timo(arg)
+ 	struct ia *ia;
+ 	void (*callback)__P((struct ia *));
+ 
+-	dprintf(LOG_DEBUG, FNAME, "address timeout for %s",
++	debug_printf(LOG_DEBUG, FNAME, "address timeout for %s",
+ 	    in6addr2str(&sa->addr.addr, 0));
+ 
+ 	ia = sa->ctl->iacna_ia;
+diff --git a/cftoken.c b/cftoken.c
+index fcccc5a..0f6c1bf 100644
+--- a/cftoken.c
++++ b/cftoken.c
+@@ -2475,10 +2475,10 @@ cfdebug_print(w, t, l)
+ 	int l;
+ {
+ 	if (w) {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "<%d>%s [%s] (%d)", yy_start, w, t, l);
+ 	} else {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "<%d>[%s] (%d)", yy_start, t, l);
+ 	}
+ }
+@@ -2494,7 +2494,7 @@ yyerror0(int level, char *s, va_list ap)
+ 	if (bp < ep)
+ 		bp += vsnprintf(bp, ep - bp, s, ap);
+ 
+-	dprintf(level, FNAME, ebuf);
++	debug_printf(level, FNAME, ebuf);
+ }
+ 
+ void
+@@ -2532,7 +2532,7 @@ cfswitch_buffer(incl)
+ 	FILE *fp;
+ 
+ 	if (incstackp >= MAX_INCLUDE_DEPTH) {
+-		dprintf(LOG_ERR, FNAME, "cfparse: includes nested too deeply");
++		debug_printf(LOG_ERR, FNAME, "cfparse: includes nested too deeply");
+ 		return (-1);
+ 	}
+ 	incstack[incstackp].path = configfilename;
+@@ -2541,7 +2541,7 @@ cfswitch_buffer(incl)
+ 
+ 	fp = fopen(path, "r");
+ 	if (fp == NULL) {
+-		dprintf(LOG_ERR, FNAME, "cfparse: fopen(%s): %s",
++		debug_printf(LOG_ERR, FNAME, "cfparse: fopen(%s): %s",
+ 			path, strerror(errno));
+ 		if (errno == ENOENT)
+ 			return (0);
+@@ -2563,7 +2563,7 @@ cfparse(conf)
+ {
+ 	configfilename = conf;
+ 	if ((yyin = fopen(configfilename, "r")) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "cfparse: fopen(%s): %s",
++		debug_printf(LOG_ERR, FNAME, "cfparse: fopen(%s): %s",
+ 			configfilename, strerror(errno));
+ 		if (errno == ENOENT)
+ 			return (0);
+diff --git a/cftoken.l b/cftoken.l
+index ece7fbb..ad4128d 100644
+--- a/cftoken.l
++++ b/cftoken.l
+@@ -340,10 +340,10 @@ cfdebug_print(w, t, l)
+ 	int l;
+ {
+ 	if (w) {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "<%d>%s [%s] (%d)", yy_start, w, t, l);
+ 	} else {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "<%d>[%s] (%d)", yy_start, t, l);
+ 	}
+ }
+@@ -359,7 +359,7 @@ yyerror0(int level, char *s, va_list ap)
+ 	if (bp < ep)
+ 		bp += vsnprintf(bp, ep - bp, s, ap);
+ 
+-	dprintf(level, FNAME, ebuf);
++	debug_printf(level, FNAME, ebuf);
+ }
+ 
+ void
+@@ -397,7 +397,7 @@ cfswitch_buffer(incl)
+ 	FILE *fp;
+ 
+ 	if (incstackp >= MAX_INCLUDE_DEPTH) {
+-		dprintf(LOG_ERR, FNAME, "cfparse: includes nested too deeply");
++		debug_printf(LOG_ERR, FNAME, "cfparse: includes nested too deeply");
+ 		return (-1);
+ 	}
+ 	incstack[incstackp].path = configfilename;
+@@ -406,7 +406,7 @@ cfswitch_buffer(incl)
+ 
+ 	fp = fopen(path, "r");
+ 	if (fp == NULL) {
+-		dprintf(LOG_ERR, FNAME, "cfparse: fopen(%s): %s",
++		debug_printf(LOG_ERR, FNAME, "cfparse: fopen(%s): %s",
+ 			path, strerror(errno));
+ 		if (errno == ENOENT)
+ 			return (0);
+@@ -428,7 +428,7 @@ cfparse(conf)
+ {
+ 	configfilename = conf;
+ 	if ((yyin = fopen(configfilename, "r")) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "cfparse: fopen(%s): %s",
++		debug_printf(LOG_ERR, FNAME, "cfparse: fopen(%s): %s",
+ 			configfilename, strerror(errno));
+ 		if (errno == ENOENT)
+ 			return (0);
+diff --git a/common.c b/common.c
+index f35399c..cc4abcc 100644
+--- a/common.c
++++ b/common.c
+@@ -265,7 +265,7 @@ dhcp6_add_listval(head, type, val, sublist)
+ 	struct dhcp6_listval *lv = NULL;
+ 
+ 	if ((lv = malloc(sizeof(*lv))) == NULL) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "failed to allocate memory for list entry");
+ 		goto fail;
+ 	}
+@@ -298,7 +298,7 @@ dhcp6_add_listval(head, type, val, sublist)
+ 			goto fail;
+ 		break;
+ 	default:
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "unexpected list value type (%d)", type);
+ 		goto fail;
+ 	}
+@@ -361,7 +361,7 @@ dhcp6_get_addr(optlen, cp, type, list)
+ 	void *val;
+ 
+ 	if (optlen % sizeof(struct in6_addr) || optlen == 0) {
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 		    "malformed DHCP option: type %d, len %d", type, optlen);
+ 		return -1;
+ 	}
+@@ -371,14 +371,14 @@ dhcp6_get_addr(optlen, cp, type, list)
+ 		memcpy(&valaddr, val, sizeof(valaddr));
+ 		if (dhcp6_find_listval(list,
+ 		    DHCP6_LISTVAL_ADDR6, &valaddr, 0)) {
+-			dprintf(LOG_INFO, FNAME, "duplicated %s address (%s)",
++			debug_printf(LOG_INFO, FNAME, "duplicated %s address (%s)",
+ 			    dhcp6optstr(type), in6addr2str(&valaddr, 0));
+ 			continue;
+ 		}
+ 
+ 		if (dhcp6_add_listval(list, DHCP6_LISTVAL_ADDR6,
+ 		    &valaddr, NULL) == NULL) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "failed to copy %s address", dhcp6optstr(type));
+ 			return -1;
+ 		}
+@@ -405,7 +405,7 @@ dhcp6_set_addr(type, list, p, optep, len)
+ 	tmpbuf = NULL;
+ 	optlen = dhcp6_count_list(list) * sizeof(struct in6_addr);
+ 	if ((tmpbuf = malloc(optlen)) == NULL) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "memory allocation failed for %s options",
+ 		    dhcp6optstr(type));
+ 		return -1;
+@@ -438,10 +438,10 @@ dhcp6_get_domain(optlen, cp, type, list)
+ 
+ 		if (dnsdecode((u_char **)(void *)&val,
+ 		    (u_char *)(cp + optlen), name, sizeof(name)) == NULL) {
+-			dprintf(LOG_INFO, FNAME, "failed to "
++			debug_printf(LOG_INFO, FNAME, "failed to "
+ 			    "decode a %s domain name",
+ 			    dhcp6optstr(type));
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "malformed DHCP option: type %d, len %d",
+ 			     type, optlen);
+ 			return -1;
+@@ -452,7 +452,7 @@ dhcp6_get_domain(optlen, cp, type, list)
+ 
+ 		if (dhcp6_add_listval(list,
+ 		    DHCP6_LISTVAL_VBUF, &vb, NULL) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "failed to "
++			debug_printf(LOG_ERR, FNAME, "failed to "
+ 			    "copy a %s domain name", dhcp6optstr(type));
+ 			return -1;
+ 		}
+@@ -485,7 +485,7 @@ dhcp6_set_domain(type, list, p, optep, len)
+ 
+ 	tmpbuf = NULL;
+ 	if ((tmpbuf = malloc(optlen)) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "memory allocation failed for "
++		debug_printf(LOG_ERR, FNAME, "memory allocation failed for "
+ 		    "%s domain options", dhcp6optstr(type));
+ 		return -1;
+ 	}
+@@ -497,14 +497,14 @@ dhcp6_set_domain(type, list, p, optep, len)
+ 		nlen = dnsencode((const char *)d->val_vbuf.dv_buf,
+ 		    name, sizeof (name));
+ 		if (nlen < 0) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "failed to encode a %s domain name",
+ 			    dhcp6optstr(type));
+ 			free(tmpbuf);
+ 			return -1;
+ 		}
+ 		if (ep - cp < nlen) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "buffer length for %s domain name is too short",
+ 			    dhcp6optstr(type));
+ 			free(tmpbuf);
+@@ -530,7 +530,7 @@ dhcp6_create_event(ifp, state)
+ 	struct dhcp6_event *ev;
+ 
+ 	if ((ev = malloc(sizeof(*ev))) == NULL) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "failed to allocate memory for an event");
+ 		return (NULL);
+ 	}
+@@ -548,7 +548,7 @@ dhcp6_remove_event(ev)
+ {
+ 	struct dhcp6_serverinfo *sp, *sp_next;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "removing an event on %s, state=%s",
++	debug_printf(LOG_DEBUG, FNAME, "removing an event on %s, state=%s",
+ 	    ev->ifp->ifname, dhcp6_event_statestr(ev));
+ 
+ 	dhcp6_remove_evdata(ev);
+@@ -562,7 +562,7 @@ dhcp6_remove_event(ev)
+ 	for (sp = ev->servers; sp; sp = sp_next) {
+ 		sp_next = sp->next;
+ 
+-		dprintf(LOG_DEBUG, FNAME, "removing server (ID: %s)",
++		debug_printf(LOG_DEBUG, FNAME, "removing server (ID: %s)",
+ 		    duidstr(&sp->optinfo.serverID));
+ 		dhcp6_clear_options(&sp->optinfo);
+ 		if (sp->authparam != NULL)
+@@ -649,14 +649,14 @@ dhcp6_auth_replaycheck(method, prev, current)
+ 	char bufcurrent[] = "ffff ffff ffff ffff";
+ 
+ 	if (method != DHCP6_AUTHRDM_MONOCOUNTER) {
+-		dprintf(LOG_ERR, FNAME, "unsupported replay detection "
++		debug_printf(LOG_ERR, FNAME, "unsupported replay detection "
+ 		    "method (%d)", method);
+ 		return (-1);
+ 	}
+ 
+ 	(void)sprint_uint64(bufprev, sizeof(bufprev), prev);
+ 	(void)sprint_uint64(bufcurrent, sizeof(bufcurrent), current);
+-	dprintf(LOG_DEBUG, FNAME, "previous: %s, current: %s",
++	debug_printf(LOG_DEBUG, FNAME, "previous: %s, current: %s",
+ 	    bufprev, bufcurrent);
+ 
+ 	prev = ntohq(prev);
+@@ -667,7 +667,7 @@ dhcp6_auth_replaycheck(method, prev, current)
+ 	 * whether the serial number is increasing or not.
+ 	 */
+         if (prev == (current ^ 0x8000000000000000ULL)) {
+-		dprintf(LOG_INFO, FNAME, "detected a singular point");
++		debug_printf(LOG_INFO, FNAME, "detected a singular point");
+ 		return (1);
+ 	}
+ 
+@@ -688,7 +688,7 @@ getifaddr(addr, ifnam, prefix, plen, strong, ignoreflags)
+ 	int error = -1;
+ 
+ 	if (getifaddrs(&ifap) != 0) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 			"getifaddrs failed: %s", strerror(errno));
+ 		return (-1);
+ 	}
+@@ -765,7 +765,7 @@ getifidfromaddr(addr, ifidp)
+ 	int retval = -1;
+ 
+ 	if (getifaddrs(&ifap) != 0) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 			"getifaddrs failed: %s", strerror(errno));
+ 		return (-1);
+ 	}
+@@ -781,7 +781,7 @@ getifidfromaddr(addr, ifidp)
+ 
+ 	if (ifa != NULL) {
+ 		if ((ifid = if_nametoindex(ifa->ifa_name)) == 0) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "if_nametoindex failed for %s", ifa->ifa_name);
+ 			goto end;
+ 		}
+@@ -999,20 +999,20 @@ get_duid(idfile, duid)
+ 	char tmpbuf[256];	/* DUID should be no more than 256 bytes */
+ 
+ 	if ((fp = fopen(idfile, "r")) == NULL && errno != ENOENT)
+-		dprintf(LOG_NOTICE, FNAME, "failed to open DUID file: %s",
++		debug_printf(LOG_NOTICE, FNAME, "failed to open DUID file: %s",
+ 		    idfile);
+ 
+ 	if (fp) {
+ 		/* decode length */
+ 		if (fread(&len, sizeof(len), 1, fp) != 1) {
+-			dprintf(LOG_ERR, FNAME, "DUID file corrupted");
++			debug_printf(LOG_ERR, FNAME, "DUID file corrupted");
+ 			goto fail;
+ 		}
+ 	} else {
+ 		int l;
+ 
+ 		if ((l = gethwid(tmpbuf, sizeof(tmpbuf), NULL, &hwtype)) < 0) {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "failed to get a hardware address");
+ 			goto fail;
+ 		}
+@@ -1022,18 +1022,18 @@ get_duid(idfile, duid)
+ 	memset(duid, 0, sizeof(*duid));
+ 	duid->duid_len = len;
+ 	if ((duid->duid_id = (char *)malloc(len)) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "failed to allocate memory");
++		debug_printf(LOG_ERR, FNAME, "failed to allocate memory");
+ 		goto fail;
+ 	}
+ 
+ 	/* copy (and fill) the ID */
+ 	if (fp) {
+ 		if (fread(duid->duid_id, len, 1, fp) != 1) {
+-			dprintf(LOG_ERR, FNAME, "DUID file corrupted");
++			debug_printf(LOG_ERR, FNAME, "DUID file corrupted");
+ 			goto fail;
+ 		}
+ 
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "extracted an existing DUID from %s: %s",
+ 		    idfile, duidstr(duid));
+ 	} else {
+@@ -1047,27 +1047,27 @@ get_duid(idfile, duid)
+ 		dp->dh6_duid1_time = htonl((u_long)(t64 & 0xffffffff));
+ 		memcpy((void *)(dp + 1), tmpbuf, (len - sizeof(*dp)));
+ 
+-		dprintf(LOG_DEBUG, FNAME, "generated a new DUID: %s",
++		debug_printf(LOG_DEBUG, FNAME, "generated a new DUID: %s",
+ 		    duidstr(duid));
+ 	}
+ 
+ 	/* save the (new) ID to the file for next time */
+ 	if (!fp) {
+ 		if ((fp = fopen(idfile, "w+")) == NULL) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "failed to open DUID file for save");
+ 			goto fail;
+ 		}
+ 		if ((fwrite(&len, sizeof(len), 1, fp)) != 1) {
+-			dprintf(LOG_ERR, FNAME, "failed to save DUID");
++			debug_printf(LOG_ERR, FNAME, "failed to save DUID");
+ 			goto fail;
+ 		}
+ 		if ((fwrite(duid->duid_id, len, 1, fp)) != 1) {
+-			dprintf(LOG_ERR, FNAME, "failed to save DUID");
++			debug_printf(LOG_ERR, FNAME, "failed to save DUID");
+ 			goto fail;
+ 		}
+ 
+-		dprintf(LOG_DEBUG, FNAME, "saved generated DUID to %s",
++		debug_printf(LOG_DEBUG, FNAME, "saved generated DUID to %s",
+ 		    idfile);
+ 	}
+ 
+@@ -1104,7 +1104,7 @@ getifhwaddr(const char *ifname, char *buf, u_int16_t *hwtypep, int ppa)
+ 	dl_phys_addr_req_t dlpar;
+ 	dl_phys_addr_ack_t *dlpaa;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "trying %s ppa %d", ifname, ppa);
++	debug_printf(LOG_DEBUG, FNAME, "trying %s ppa %d", ifname, ppa);
+ 
+ 	if (ifname[0] == '\0')
+ 		return (-1);
+@@ -1239,7 +1239,7 @@ gethwid(buf, len, ifname, hwtypep)
+ 
+ 		if ((root = di_init("/", DINFOSUBTREE | DINFOMINOR |
+ 		    DINFOPROP)) == DI_NODE_NIL) {
+-			dprintf(LOG_INFO, FNAME, "di_init failed");
++			debug_printf(LOG_INFO, FNAME, "di_init failed");
+ 			return (-1);
+ 		}
+ 		parms.buf = buf;
+@@ -1283,7 +1283,7 @@ gethwid(buf, len, ifname, hwtypep)
+ 		default:
+ 			continue; /* XXX */
+ 		}
+-		dprintf(LOG_DEBUG, FNAME, "found an interface %s for DUID",
++		debug_printf(LOG_DEBUG, FNAME, "found an interface %s for DUID",
+ 		    ifa->ifa_name);
+ 		memcpy(buf, LLADDR(sdl), sdl->sdl_alen);
+ 		l = sdl->sdl_alen; /* sdl will soon be freed */
+@@ -1296,7 +1296,7 @@ gethwid(buf, len, ifname, hwtypep)
+ 		if (sll->sll_hatype != ARPHRD_ETHER)
+ 			continue;
+ 		*hwtypep = ARPHRD_ETHER;
+-		dprintf(LOG_DEBUG, FNAME, "found an interface %s for DUID",
++		debug_printf(LOG_DEBUG, FNAME, "found an interface %s for DUID",
+ 		    ifa->ifa_name);
+ 		memcpy(buf, sll->sll_addr, sll->sll_halen);
+ 		l = sll->sll_halen; /* sll will soon be freed */
+@@ -1512,12 +1512,12 @@ dhcp6_get_options(p, ep, optinfo)
+ 		cp = (char *)(p + 1);
+ 		np = (struct dhcp6opt *)(cp + optlen);
+ 
+-		dprintf(LOG_DEBUG, FNAME, "get DHCP option %s, len %d",
++		debug_printf(LOG_DEBUG, FNAME, "get DHCP option %s, len %d",
+ 		    dhcp6optstr(opt), optlen);
+ 
+ 		/* option length field overrun */
+ 		if (np > ep) {
+-			dprintf(LOG_INFO, FNAME, "malformed DHCP options");
++			debug_printf(LOG_INFO, FNAME, "malformed DHCP options");
+ 			goto fail;
+ 		}
+ 
+@@ -1527,10 +1527,10 @@ dhcp6_get_options(p, ep, optinfo)
+ 				goto malformed;
+ 			duid0.duid_len = optlen;
+ 			duid0.duid_id = cp;
+-			dprintf(LOG_DEBUG, "",
++			debug_printf(LOG_DEBUG, "",
+ 				"  DUID: %s", duidstr(&duid0));
+ 			if (duidcpy(&optinfo->clientID, &duid0)) {
+-				dprintf(LOG_ERR, FNAME, "failed to copy DUID");
++				debug_printf(LOG_ERR, FNAME, "failed to copy DUID");
+ 				goto fail;
+ 			}
+ 			break;
+@@ -1539,9 +1539,9 @@ dhcp6_get_options(p, ep, optinfo)
+ 				goto malformed;
+ 			duid0.duid_len = optlen;
+ 			duid0.duid_id = cp;
+-			dprintf(LOG_DEBUG, "", "  DUID: %s", duidstr(&duid0));
++			debug_printf(LOG_DEBUG, "", "  DUID: %s", duidstr(&duid0));
+ 			if (duidcpy(&optinfo->serverID, &duid0)) {
+-				dprintf(LOG_ERR, FNAME, "failed to copy DUID");
++				debug_printf(LOG_ERR, FNAME, "failed to copy DUID");
+ 				goto fail;
+ 			}
+ 			break;
+@@ -1550,14 +1550,14 @@ dhcp6_get_options(p, ep, optinfo)
+ 				goto malformed;
+ 			memcpy(&val16, cp, sizeof(val16));
+ 			num16 = ntohs(val16);
+-			dprintf(LOG_DEBUG, "", "  status code: %s",
++			debug_printf(LOG_DEBUG, "", "  status code: %s",
+ 			    dhcp6_stcodestr(num16));
+ 
+ 			/* need to check duplication? */
+ 
+ 			if (dhcp6_add_listval(&optinfo->stcode_list,
+ 			    DHCP6_LISTVAL_STCODE, &num16, NULL) == NULL) {
+-				dprintf(LOG_ERR, FNAME, "failed to copy "
++				debug_printf(LOG_ERR, FNAME, "failed to copy "
+ 				    "status code");
+ 				goto fail;
+ 			}
+@@ -1574,13 +1574,13 @@ dhcp6_get_options(p, ep, optinfo)
+ 				memcpy(&opttype, val, sizeof(u_int16_t));
+ 				num = (int)ntohs(opttype);
+ 
+-				dprintf(LOG_DEBUG, "",
++				debug_printf(LOG_DEBUG, "",
+ 					"  requested option: %s",
+ 					dhcp6optstr(num));
+ 
+ 				if (dhcp6_find_listval(&optinfo->reqopt_list,
+ 				    DHCP6_LISTVAL_NUM, &num, 0)) {
+-					dprintf(LOG_INFO, FNAME, "duplicated "
++					debug_printf(LOG_INFO, FNAME, "duplicated "
+ 					    "option type (%s)",
+ 					    dhcp6optstr(opttype));
+ 					goto nextoption;
+@@ -1588,7 +1588,7 @@ dhcp6_get_options(p, ep, optinfo)
+ 
+ 				if (dhcp6_add_listval(&optinfo->reqopt_list,
+ 				    DHCP6_LISTVAL_NUM, &num, NULL) == NULL) {
+-					dprintf(LOG_ERR, FNAME,
++					debug_printf(LOG_ERR, FNAME,
+ 					    "failed to copy requested option");
+ 					goto fail;
+ 				}
+@@ -1599,10 +1599,10 @@ dhcp6_get_options(p, ep, optinfo)
+ 		case DH6OPT_PREFERENCE:
+ 			if (optlen != 1)
+ 				goto malformed;
+-			dprintf(LOG_DEBUG, "", "  preference: %d",
++			debug_printf(LOG_DEBUG, "", "  preference: %d",
+ 			    (int)*(u_char *)cp);
+ 			if (optinfo->pref != DH6OPT_PREF_UNDEF) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "duplicated preference option");
+ 			} else
+ 				optinfo->pref = (int)*(u_char *)cp;
+@@ -1612,11 +1612,11 @@ dhcp6_get_options(p, ep, optinfo)
+ 				goto malformed;
+ 			memcpy(&val16, cp, sizeof(val16));
+ 			val16 = ntohs(val16);
+-			dprintf(LOG_DEBUG, "", "  elapsed time: %lu",
++			debug_printf(LOG_DEBUG, "", "  elapsed time: %lu",
+ 			    (u_int32_t)val16);
+ 			if (optinfo->elapsed_time !=
+ 			    DH6OPT_ELAPSED_TIME_UNDEF) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "duplicated elapsed time option");
+ 			} else
+ 				optinfo->elapsed_time = val16;
+@@ -1637,7 +1637,7 @@ dhcp6_get_options(p, ep, optinfo)
+ 			 * [RFC3315 Section 21.4.2]
+ 			 */
+ 			if (optinfo->authproto != DHCP6_AUTHPROTO_UNDEF) {
+-				dprintf(LOG_INFO, FNAME, "found more than one "
++				debug_printf(LOG_INFO, FNAME, "found more than one "
+ 				    "authentication option");
+ 				goto fail;
+ 			}
+@@ -1648,7 +1648,7 @@ dhcp6_get_options(p, ep, optinfo)
+ 			memcpy(&optinfo->authrd, cp, sizeof(optinfo->authrd));
+ 			cp += sizeof(optinfo->authrd);
+ 
+-			dprintf(LOG_DEBUG, "", "  %s", sprint_auth(optinfo));
++			debug_printf(LOG_DEBUG, "", "  %s", sprint_auth(optinfo));
+ 
+ 			authinfolen =
+ 			    optlen - (sizeof(struct dhcp6opt_auth) - 4);
+@@ -1670,7 +1670,7 @@ dhcp6_get_options(p, ep, optinfo)
+ 				optinfo->delayedauth_realmval =
+ 				    malloc(optinfo->delayedauth_realmlen);
+ 				if (optinfo->delayedauth_realmval == NULL) {
+-					dprintf(LOG_WARNING, FNAME, "failed "
++					debug_printf(LOG_WARNING, FNAME, "failed "
+ 					    "allocate memory for auth realm");
+ 					goto fail;
+ 				}
+@@ -1687,7 +1687,7 @@ dhcp6_get_options(p, ep, optinfo)
+ 				optinfo->delayedauth_offset = cp - bp;
+ 				cp += 16;
+ 
+-				dprintf(LOG_DEBUG, "", "  auth key ID: %x, "
++				debug_printf(LOG_DEBUG, "", "  auth key ID: %x, "
+ 				    "offset=%d, realmlen=%d",
+ 				    optinfo->delayedauth_keyid,
+ 				    optinfo->delayedauth_offset,
+@@ -1698,7 +1698,7 @@ dhcp6_get_options(p, ep, optinfo)
+ 				break;
+ #endif
+ 			default:
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "unsupported authentication protocol: %d",
+ 				    *cp);
+ 				goto fail;
+@@ -1779,14 +1779,14 @@ dhcp6_get_options(p, ep, optinfo)
+ 			ia.t1 = ntohl(optia.dh6_ia_t1);
+ 			ia.t2 = ntohl(optia.dh6_ia_t2);
+ 
+-			dprintf(LOG_DEBUG, "",
++			debug_printf(LOG_DEBUG, "",
+ 			    "  IA_PD: ID=%lu, T1=%lu, T2=%lu",
+ 			    ia.iaid, ia.t1, ia.t2);
+ 
+ 			/* duplication check */
+ 			if (dhcp6_find_listval(&optinfo->iapd_list,
+ 			    DHCP6_LISTVAL_IAPD, &ia, 0)) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "duplicated IA_PD %lu", ia.iaid);
+ 				break; /* ignore this IA_PD */
+ 			}
+@@ -1813,7 +1813,7 @@ dhcp6_get_options(p, ep, optinfo)
+ 				goto malformed;
+ 			memcpy(&val32, cp, sizeof(val32));
+ 			val32 = ntohl(val32);
+-			dprintf(LOG_DEBUG, "",
++			debug_printf(LOG_DEBUG, "",
+ 			    "   information refresh time: %lu", val32);
+ 			if (val32 < DHCP6_IRT_MINIMUM) {
+ 				/*
+@@ -1823,13 +1823,13 @@ dhcp6_get_options(p, ep, optinfo)
+ 				 * [draft-ietf-dhc-lifetime-02.txt,
+ 				 *  Section 3.2]
+ 				 */
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "refresh time is too small (%d), adjusted",
+ 				    val32);
+ 				val32 = DHCP6_IRT_MINIMUM;
+ 			}
+ 			if (optinfo->refreshtime != DH6OPT_REFRESHTIME_UNDEF) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "duplicated refresh time option");
+ 			} else
+ 				optinfo->refreshtime = (int64_t)val32;
+@@ -1843,14 +1843,14 @@ dhcp6_get_options(p, ep, optinfo)
+ 			ia.t1 = ntohl(optia.dh6_ia_t1);
+ 			ia.t2 = ntohl(optia.dh6_ia_t2);
+ 
+-			dprintf(LOG_DEBUG, "",
++			debug_printf(LOG_DEBUG, "",
+ 			    "  IA_NA: ID=%lu, T1=%lu, T2=%lu",
+ 			    ia.iaid, ia.t1, ia.t2);
+ 
+ 			/* duplication check */
+ 			if (dhcp6_find_listval(&optinfo->iana_list,
+ 			    DHCP6_LISTVAL_IANA, &ia, 0)) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "duplicated IA_NA %lu", ia.iaid);
+ 				break; /* ignore this IA_NA */
+ 			}
+@@ -1874,7 +1874,7 @@ dhcp6_get_options(p, ep, optinfo)
+ 			break;
+ 		default:
+ 			/* no option specific behavior */
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "unknown or unexpected DHCP6 option %s, len %d",
+ 			    dhcp6optstr(opt), optlen);
+ 			break;
+@@ -1884,7 +1884,7 @@ dhcp6_get_options(p, ep, optinfo)
+ 	return (0);
+ 
+   malformed:
+-	dprintf(LOG_INFO, FNAME, "malformed DHCP option: type %d, len %d",
++	debug_printf(LOG_INFO, FNAME, "malformed DHCP option: type %d, len %d",
+ 	    opt, optlen);
+   fail:
+ 	dhcp6_clear_options(optinfo);
+@@ -1967,11 +1967,11 @@ copyin_option(type, p, ep, list)
+ 		cp = (char *)(p + 1);
+ 		np = (struct dhcp6opt *)(cp + optlen);
+ 
+-		dprintf(LOG_DEBUG, FNAME, "get DHCP option %s, len %d",
++		debug_printf(LOG_DEBUG, FNAME, "get DHCP option %s, len %d",
+ 		    dhcp6optstr(opt), optlen);
+ 
+ 		if (np > ep) {
+-			dprintf(LOG_INFO, FNAME, "malformed DHCP option");
++			debug_printf(LOG_INFO, FNAME, "malformed DHCP option");
+ 			goto fail;
+ 		}
+ 
+@@ -1979,7 +1979,7 @@ copyin_option(type, p, ep, list)
+ 		case DH6OPT_IA_PD_PREFIX:
+ 			/* check option context */
+ 			if (type != DH6OPT_IA_PD) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "%s is an invalid position for %s",
+ 				    dhcp6optstr(type), dhcp6optstr(opt));
+ 				goto fail;
+@@ -1991,7 +1991,7 @@ copyin_option(type, p, ep, list)
+ 			/* copy and convert option values */
+ 			memcpy(&opt_iapd_prefix, p, sizeof(opt_iapd_prefix));
+ 			if (opt_iapd_prefix.dh6_iapd_prefix_prefix_len > 128) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "invalid prefix length (%d)",
+ 				    opt_iapd_prefix.dh6_iapd_prefix_prefix_len);
+ 				goto malformed;
+@@ -2006,7 +2006,7 @@ copyin_option(type, p, ep, list)
+ 			/* clear padding bits in the prefix address */
+ 			prefix6_mask(&iapd_prefix.addr, iapd_prefix.plen);
+ 
+-			dprintf(LOG_DEBUG, FNAME, "  IA_PD prefix: "
++			debug_printf(LOG_DEBUG, FNAME, "  IA_PD prefix: "
+ 			    "%s/%d pltime=%lu vltime=%lu",
+ 			    in6addr2str(&iapd_prefix.addr, 0),
+ 			    iapd_prefix.plen,
+@@ -2014,7 +2014,7 @@ copyin_option(type, p, ep, list)
+ 
+ 			if (dhcp6_find_listval(list, DHCP6_LISTVAL_PREFIX6,
+ 			    &iapd_prefix, 0)) {
+-				dprintf(LOG_INFO, FNAME, 
++				debug_printf(LOG_INFO, FNAME, 
+ 				    "duplicated IA_PD prefix "
+ 				    "%s/%d pltime=%lu vltime=%lu",
+ 				    in6addr2str(&iapd_prefix.addr, 0),
+@@ -2041,7 +2041,7 @@ copyin_option(type, p, ep, list)
+ 		case DH6OPT_IAADDR:
+ 			/* check option context */
+ 			if (type != DH6OPT_IA_NA) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "%s is an invalid position for %s",
+ 				    dhcp6optstr(type), dhcp6optstr(opt));
+ 				goto fail;
+@@ -2057,14 +2057,14 @@ copyin_option(type, p, ep, list)
+ 			memcpy(&ia_addr.addr, &opt_ia_addr.dh6_ia_addr_addr,
+ 			    sizeof(ia_addr.addr));
+ 
+-			dprintf(LOG_DEBUG, FNAME, "  IA_NA address: "
++			debug_printf(LOG_DEBUG, FNAME, "  IA_NA address: "
+ 			    "%s pltime=%lu vltime=%lu",
+ 			    in6addr2str(&ia_addr.addr, 0),
+ 			    ia_addr.pltime, ia_addr.vltime);
+ 
+ 			if (dhcp6_find_listval(list,
+ 			    DHCP6_LISTVAL_STATEFULADDR6, &ia_addr, 0)) {
+-				dprintf(LOG_INFO, FNAME, 
++				debug_printf(LOG_INFO, FNAME, 
+ 				    "duplicated IA_NA address"
+ 				    "%s pltime=%lu vltime=%lu",
+ 				    in6addr2str(&ia_addr.addr, 0),
+@@ -2093,7 +2093,7 @@ copyin_option(type, p, ep, list)
+ 			    type != DH6OPT_IA_PD_PREFIX &&
+ 			    type != DH6OPT_IA_NA &&
+ 			    type != DH6OPT_IAADDR) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "%s is an invalid position for %s",
+ 				    dhcp6optstr(type), dhcp6optstr(opt));
+ 				goto nextoption; /* or discard the message? */
+@@ -2107,13 +2107,13 @@ copyin_option(type, p, ep, list)
+ 			opt_stcode.dh6_stcode_code =
+ 			    ntohs(opt_stcode.dh6_stcode_code);
+ 
+-			dprintf(LOG_DEBUG, "", "  status code: %s",
++			debug_printf(LOG_DEBUG, "", "  status code: %s",
+ 			    dhcp6_stcodestr(opt_stcode.dh6_stcode_code));
+ 
+ 			/* duplication check */
+ 			if (dhcp6_find_listval(list, DHCP6_LISTVAL_STCODE,
+ 			    &opt_stcode.dh6_stcode_code, 0)) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "duplicated status code (%d)",
+ 				    opt_stcode.dh6_stcode_code);
+ 				goto nextoption;
+@@ -2133,7 +2133,7 @@ copyin_option(type, p, ep, list)
+ 	return (0);
+ 
+   malformed:
+-	dprintf(LOG_INFO, "", "  malformed DHCP option: type %d", opt);
++	debug_printf(LOG_INFO, "", "  malformed DHCP option: type %d", opt);
+ 
+   fail:
+ 	dhcp6_clear_list(&sublist);
+@@ -2221,7 +2221,7 @@ copy_option(type, len, val, optp, ep, totallenp)
+ 	struct dhcp6opt *opt = *optp, opth;
+ 
+ 	if ((void *)ep - (void *)optp < len + sizeof(struct dhcp6opt)) {
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 		    "option buffer short for %s", dhcp6optstr(type));
+ 		return (-1);
+ 	}
+@@ -2233,7 +2233,7 @@ copy_option(type, len, val, optp, ep, totallenp)
+ 
+ 	*optp = (struct dhcp6opt *)((char *)(opt + 1) + len);
+  	*totallenp += sizeof(struct dhcp6opt) + len;
+-	dprintf(LOG_DEBUG, FNAME, "set %s (len %d)", dhcp6optstr(type), len);
++	debug_printf(LOG_DEBUG, FNAME, "set %s (len %d)", dhcp6optstr(type), len);
+ 
+ 	return (0);
+ }
+@@ -2269,21 +2269,21 @@ dhcp6_set_options(type, optbp, optep, optinfo)
+ 
+ 		tmpbuf = NULL;
+ 		if ((optlen = copyout_option(NULL, NULL, op)) < 0) {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "failed to count option length");
+ 			goto fail;
+ 		}
+ 		if ((void *)optep - (void *)p < optlen) {
+-			dprintf(LOG_INFO, FNAME, "short buffer");
++			debug_printf(LOG_INFO, FNAME, "short buffer");
+ 			goto fail;
+ 		}
+ 		if ((tmpbuf = malloc(optlen)) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "memory allocation failed for IA_NA options");
+ 			goto fail;
+ 		}
+ 		if (copyout_option(tmpbuf, tmpbuf + optlen, op) < 0) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "failed to construct an IA_NA option");
+ 			goto fail;
+ 		}
+@@ -2340,7 +2340,7 @@ dhcp6_set_options(type, optbp, optep, optinfo)
+ 		buflen = dhcp6_count_list(&optinfo->reqopt_list) *
+ 			sizeof(u_int16_t);
+ 		if ((tmpbuf = malloc(buflen)) == NULL) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "memory allocation failed for options");
+ 			goto fail;
+ 		}
+@@ -2355,7 +2355,7 @@ dhcp6_set_options(type, optbp, optep, optinfo)
+ 			 */
+ 			if (opt->val_num == DH6OPT_REFRESHTIME &&
+ 			    type != DH6_INFORM_REQ) {
+-				dprintf(LOG_DEBUG, FNAME,
++				debug_printf(LOG_DEBUG, FNAME,
+ 				    "refresh time option is not requested "
+ 				    "for %s", dhcp6msgstr(type));
+ 			}
+@@ -2423,21 +2423,21 @@ dhcp6_set_options(type, optbp, optep, optinfo)
+ 
+ 		tmpbuf = NULL;
+ 		if ((optlen = copyout_option(NULL, NULL, op)) < 0) {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "failed to count option length");
+ 			goto fail;
+ 		}
+ 		if ((void *)optep - (void *)p < optlen) {
+-			dprintf(LOG_INFO, FNAME, "short buffer");
++			debug_printf(LOG_INFO, FNAME, "short buffer");
+ 			goto fail;
+ 		}
+ 		if ((tmpbuf = malloc(optlen)) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "memory allocation failed for IA_PD options");
+ 			goto fail;
+ 		}
+ 		if (copyout_option(tmpbuf, tmpbuf + optlen, op) < 0) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "failed to construct an IA_PD option");
+ 			goto fail;
+ 		}
+@@ -2492,13 +2492,13 @@ dhcp6_set_options(type, optbp, optep, optinfo)
+ 				break;
+ #endif
+ 			default:
+-				dprintf(LOG_ERR, FNAME,
++				debug_printf(LOG_ERR, FNAME,
+ 				    "unexpected authentication protocol");
+ 				goto fail;
+ 			}
+ 		}
+ 		if ((auth = malloc(authlen)) == NULL) {
+-			dprintf(LOG_WARNING, FNAME, "failed to allocate "
++			debug_printf(LOG_WARNING, FNAME, "failed to allocate "
+ 			    "memory for authentication information");
+ 			goto fail;
+ 		}
+@@ -2534,7 +2534,7 @@ dhcp6_set_options(type, optbp, optep, optinfo)
+ 				optinfo->delayedauth_offset =
+ 				    ((char *)p - (char *)optbp) + authlen - 16;
+ 
+-				dprintf(LOG_DEBUG, FNAME,
++				debug_printf(LOG_DEBUG, FNAME,
+ 				    "key ID %x, offset %d",
+ 				    optinfo->delayedauth_keyid,
+ 				    optinfo->delayedauth_offset); 
+@@ -2543,7 +2543,7 @@ dhcp6_set_options(type, optbp, optep, optinfo)
+ 			case DHCP6_AUTHPROTO_RECONFIG:
+ #endif
+ 			default:
+-				dprintf(LOG_ERR, FNAME,
++				debug_printf(LOG_ERR, FNAME,
+ 				    "unexpected authentication protocol");
+ 				free(auth);
+ 				goto fail;
+@@ -2695,7 +2695,7 @@ copyout_option(p, ep, optval)
+ 		 * we encounter an unknown option.  this should be an internal
+ 		 * error.
+ 		 */
+-		dprintf(LOG_ERR, FNAME, "unknown option: code %d",
++		debug_printf(LOG_ERR, FNAME, "unknown option: code %d",
+ 		    optval->type);
+ 		return (-1);
+ 	}
+@@ -2721,7 +2721,7 @@ copyout_option(p, ep, optval)
+ 	if (!p)
+ 		return(optlen);
+ 
+-	dprintf(LOG_DEBUG, FNAME, "set %s", dhcp6optstr(opttype));
++	debug_printf(LOG_DEBUG, FNAME, "set %s", dhcp6optstr(opttype));
+ 	if (ep - p < headlen) /* check it just in case */
+ 		return (-1);
+ 
+@@ -2812,7 +2812,7 @@ dhcp6_set_timeoparam(ev)
+ 		ev->max_retrans_cnt = REL_MAX_RC;
+ 		break;
+ 	default:
+-		dprintf(LOG_ERR, FNAME, "unexpected event state %d on %s",
++		debug_printf(LOG_ERR, FNAME, "unexpected event state %d on %s",
+ 		    ev->state, ev->ifp->ifname);
+ 		exit(1);
+ 	}
+@@ -2870,7 +2870,7 @@ dhcp6_reset_timer(ev)
+ 
+ 	statestr = dhcp6_event_statestr(ev);
+ 
+-	dprintf(LOG_DEBUG, FNAME, "reset a timer on %s, "
++	debug_printf(LOG_DEBUG, FNAME, "reset a timer on %s, "
+ 		"state=%s, timeo=%d, retrans=%d",
+ 		ev->ifp->ifname, statestr, ev->timeouts, ev->retrans);
+ }
+@@ -2881,7 +2881,7 @@ duidcpy(dd, ds)
+ {
+ 	dd->duid_len = ds->duid_len;
+ 	if ((dd->duid_id = malloc(dd->duid_len)) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "memory allocation failed");
++		debug_printf(LOG_ERR, FNAME, "memory allocation failed");
+ 		return (-1);
+ 	}
+ 	memcpy(dd->duid_id, ds->duid_id, dd->duid_len);
+@@ -2929,17 +2929,17 @@ get_rdvalue(rdm, rdvalue, rdsize)
+ 	u_int32_t u32, l32;
+ 
+ 	if (rdm != DHCP6_AUTHRDM_MONOCOUNTER) {
+-		dprintf(LOG_INFO, FNAME, "unsupported RDM (%d)", rdm);
++		debug_printf(LOG_INFO, FNAME, "unsupported RDM (%d)", rdm);
+ 		return (-1);
+ 	}
+ 	if (rdsize != sizeof(u_int64_t)) {
+-		dprintf(LOG_INFO, FNAME, "unsupported RD size (%d)", rdsize);
++		debug_printf(LOG_INFO, FNAME, "unsupported RD size (%d)", rdsize);
+ 		return (-1);
+ 	}
+ 
+ #if defined(HAVE_CLOCK_GETTIME)
+ 	if (clock_gettime(CLOCK_REALTIME, &tp)) {
+-		dprintf(LOG_WARNING, FNAME, "clock_gettime failed: %s",
++		debug_printf(LOG_WARNING, FNAME, "clock_gettime failed: %s",
+ 		    strerror(errno));
+ 		return (-1);
+ 	}
+@@ -2952,7 +2952,7 @@ get_rdvalue(rdm, rdvalue, rdsize)
+ 	l32 = (u_int32_t)nsec;
+ #else
+ 	if (gettimeofday(&tv, NULL) != 0) {
+-		dprintf(LOG_WARNING, FNAME, "gettimeofday failed: %s",
++		debug_printf(LOG_WARNING, FNAME, "gettimeofday failed: %s",
+ 		    strerror(errno));
+ 		return (-1);
+ 	}
+@@ -3207,7 +3207,7 @@ setloglevel(debuglevel)
+ }
+ 
+ void
+-dprintf(int level, const char *fname, const char *fmt, ...)
++debug_printf(int level, const char *fname, const char *fmt, ...)
+ {
+ 	va_list ap;
+ 	char logbuf[LINE_MAX];
+@@ -3293,7 +3293,7 @@ ifaddrconf(cmd, ifname, addr, plen, pltime, vltime)
+ 	}
+ 
+ 	if ((s = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "can't open a temporary socket: %s",
++		debug_printf(LOG_ERR, FNAME, "can't open a temporary socket: %s",
+ 		    strerror(errno));
+ 		return (-1);
+ 	}
+@@ -3311,7 +3311,7 @@ ifaddrconf(cmd, ifname, addr, plen, pltime, vltime)
+ 	memset(&ifr, 0, sizeof(ifr));
+ 	strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
+ 	if (ioctl(s, SIOGIFINDEX, &ifr) < 0) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to get the index of %s: %s",
++		debug_printf(LOG_NOTICE, FNAME, "failed to get the index of %s: %s",
+ 		    ifname, strerror(errno));
+ 		close(s); 
+ 		return (-1); 
+@@ -3325,7 +3325,7 @@ ifaddrconf(cmd, ifname, addr, plen, pltime, vltime)
+ #endif
+ 
+ 	if (ioctl(s, ioctl_cmd, &req)) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to %s an address on %s: %s",
++		debug_printf(LOG_NOTICE, FNAME, "failed to %s an address on %s: %s",
+ 		    cmdstr, ifname, strerror(errno));
+ 		close(s);
+ 		return (-1);
+@@ -3334,14 +3334,14 @@ ifaddrconf(cmd, ifname, addr, plen, pltime, vltime)
+ #ifdef __sun__
+ 	memcpy(&req.lifr_addr, addr, sizeof (*addr));
+ 	if (ioctl(s, SIOCSLIFADDR, &req) == -1) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to %s new address on %s: %s",
++		debug_printf(LOG_NOTICE, FNAME, "failed to %s new address on %s: %s",
+ 		    cmdstr, ifname, strerror(errno));
+ 		close(s);
+ 		return (-1);
+ 	}
+ #endif
+ 
+-	dprintf(LOG_DEBUG, FNAME, "%s an address %s/%d on %s", cmdstr,
++	debug_printf(LOG_DEBUG, FNAME, "%s an address %s/%d on %s", cmdstr,
+ 	    addr2str((struct sockaddr *)addr), plen, ifname);
+ 
+ 	close(s);
+@@ -3357,13 +3357,13 @@ safefile(path)
+ 
+ 	/* no setuid */
+ 	if (getuid() != geteuid()) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "setuid'ed execution not allowed");
+ 		return (-1);
+ 	}
+ 
+ 	if (lstat(path, &s) != 0) {
+-		dprintf(LOG_NOTICE, FNAME, "lstat failed: %s",
++		debug_printf(LOG_NOTICE, FNAME, "lstat failed: %s",
+ 		    strerror(errno));
+ 		return (-1);
+ 	}
+@@ -3371,7 +3371,7 @@ safefile(path)
+ 	/* the file must be owned by the running uid */
+ 	myuid = getuid();
+ 	if (s.st_uid != myuid) {
+-		dprintf(LOG_NOTICE, FNAME, "%s has invalid owner uid", path);
++		debug_printf(LOG_NOTICE, FNAME, "%s has invalid owner uid", path);
+ 		return (-1);
+ 	}
+ 
+@@ -3379,7 +3379,7 @@ safefile(path)
+ 	case S_IFREG:
+ 		break;
+ 	default:
+-		dprintf(LOG_NOTICE, FNAME, "%s is an invalid file type 0x%o",
++		debug_printf(LOG_NOTICE, FNAME, "%s is an invalid file type 0x%o",
+ 		    path, (s.st_mode & S_IFMT));
+ 		return (-1);
+ 	}
+diff --git a/common.h b/common.h
+index 7366c25..9fd8008 100644
+--- a/common.h
++++ b/common.h
+@@ -155,7 +155,7 @@ extern char *in6addr2str __P((struct in6_addr *, int));
+ extern int in6_addrscopebyif __P((struct in6_addr *, char *));
+ extern int in6_scope __P((struct in6_addr *));
+ extern void setloglevel __P((int));
+-extern void dprintf __P((int, const char *, const char *, ...));
++extern void debug_printf __P((int, const char *, const char *, ...));
+ extern int get_duid __P((char *, struct duid *));
+ extern void dhcp6_init_options __P((struct dhcp6_optinfo *));
+ extern void dhcp6_clear_options __P((struct dhcp6_optinfo *));
+diff --git a/config.c b/config.c
+index 383c12a..3721545 100644
+--- a/config.c
++++ b/config.c
+@@ -156,13 +156,13 @@ configure_interface(iflist)
+ 		struct cf_list *cfl;
+ 
+ 		if (if_nametoindex(ifp->name) == 0) {
+-			dprintf(LOG_ERR, FNAME, "invalid interface(%s): %s",
++			debug_printf(LOG_ERR, FNAME, "invalid interface(%s): %s",
+ 			    ifp->name, strerror(errno));
+ 			goto bad;
+ 		}
+ 
+ 		if ((ifc = malloc(sizeof(*ifc))) == NULL) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "memory allocation for %s failed", ifp->name);
+ 			goto bad;
+ 		}
+@@ -171,7 +171,7 @@ configure_interface(iflist)
+ 		dhcp6_ifconflist = ifc;
+ 
+ 		if ((ifc->ifname = strdup(ifp->name)) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "failed to copy ifname");
++			debug_printf(LOG_ERR, FNAME, "failed to copy ifname");
+ 			goto bad;
+ 		}
+ 
+@@ -183,7 +183,7 @@ configure_interface(iflist)
+ 			switch(cfl->type) {
+ 			case DECL_REQUEST:
+ 				if (dhcp6_mode != DHCP6_MODE_CLIENT) {
+-					dprintf(LOG_INFO, FNAME, "%s:%d "
++					debug_printf(LOG_INFO, FNAME, "%s:%d "
+ 						"client-only configuration",
+ 						configfilename,
+ 						cfl->line);
+@@ -208,7 +208,7 @@ configure_interface(iflist)
+ 				break;
+ 			case DECL_INFO_ONLY:
+ 				if (dhcp6_mode != DHCP6_MODE_CLIENT) {
+-					dprintf(LOG_INFO, FNAME, "%s:%d "
++					debug_printf(LOG_INFO, FNAME, "%s:%d "
+ 						"client-only configuration",
+ 						configfilename, cfl->line);
+ 					goto bad;
+@@ -217,7 +217,7 @@ configure_interface(iflist)
+ 				break;
+ 			case DECL_PREFERENCE:
+ 				if (dhcp6_mode != DHCP6_MODE_SERVER) {
+-					dprintf(LOG_INFO, FNAME, "%s:%d "
++					debug_printf(LOG_INFO, FNAME, "%s:%d "
+ 						"server-only configuration",
+ 						configfilename, cfl->line);
+ 					goto bad;
+@@ -225,7 +225,7 @@ configure_interface(iflist)
+ 				ifc->server_pref = (int)cfl->num;
+ 				if (ifc->server_pref < 0 ||
+ 				    ifc->server_pref > 255) {
+-					dprintf(LOG_INFO, FNAME, "%s:%d "
++					debug_printf(LOG_INFO, FNAME, "%s:%d "
+ 						"bad value: %d",
+ 						configfilename, cfl->line,
+ 						ifc->server_pref);
+@@ -234,13 +234,13 @@ configure_interface(iflist)
+ 				break;
+ 			case DECL_SCRIPT:
+ 				if (dhcp6_mode != DHCP6_MODE_CLIENT) {
+-					dprintf(LOG_INFO, FNAME, "%s:%d "
++					debug_printf(LOG_INFO, FNAME, "%s:%d "
+ 						"client-only configuration",
+ 						configfilename, cfl->line);
+ 					goto bad;
+ 				}
+ 				if (ifc->scriptpath) {
+-					dprintf(LOG_INFO, FNAME,
++					debug_printf(LOG_INFO, FNAME,
+ 					    "%s:%d duplicated configuration",
+ 					    configfilename, cfl->line);
+ 					goto bad;
+@@ -248,13 +248,13 @@ configure_interface(iflist)
+ 				cp = cfl->ptr;
+ 				ifc->scriptpath = strdup(cp + 1);
+ 				if (ifc->scriptpath == NULL) {
+-					dprintf(LOG_NOTICE, FNAME,
++					debug_printf(LOG_NOTICE, FNAME,
+ 					    "failed to copy script path");
+ 					goto bad;
+ 				}
+ 				cp = ifc->scriptpath;
+ 				if (*cp != '/') {
+-					dprintf(LOG_INFO, FNAME,
++					debug_printf(LOG_INFO, FNAME,
+ 					    "script must be an absolute path");
+ 					goto bad;
+ 				}
+@@ -272,7 +272,7 @@ configure_interface(iflist)
+ 						if (strcmp(spec->name, pool->name) == 0)
+ 							break;
+ 					if (pool == NULL) {
+-						dprintf(LOG_ERR, FNAME, "%s:%d "
++						debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 							"pool '%s' not found",
+ 							configfilename, cfl->line,
+ 					   		spec->name);
+@@ -281,7 +281,7 @@ configure_interface(iflist)
+ 					if (spec->vltime != DHCP6_DURATION_INFINITE &&
+ 						(spec->pltime == DHCP6_DURATION_INFINITE ||
+ 						spec->pltime > spec->vltime)) {
+-						dprintf(LOG_ERR, FNAME, "%s:%d ",
++						debug_printf(LOG_ERR, FNAME, "%s:%d ",
+ 							configfilename, cfl->line,
+ 							"specified a larger preferred lifetime "
+ 							"than valid lifetime");
+@@ -289,17 +289,17 @@ configure_interface(iflist)
+ 					}
+ 					ifc->pool = *spec;
+ 					if ((ifc->pool.name = strdup(spec->name)) == NULL) {
+-						dprintf(LOG_ERR, FNAME,
++						debug_printf(LOG_ERR, FNAME,
+ 							"memory allocation failed");
+ 						goto bad;
+ 					}
+-					dprintf(LOG_DEBUG, FNAME,
++					debug_printf(LOG_DEBUG, FNAME,
+ 						"pool '%s' is specified to the interface '%s'",
+ 						ifc->pool.name, ifc->ifname);
+ 				}
+ 				break;
+ 			default:
+-				dprintf(LOG_ERR, FNAME, "%s:%d "
++				debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 					"invalid interface configuration",
+ 					configfilename, cfl->line);
+ 				goto bad;
+@@ -338,7 +338,7 @@ configure_ia(ialist, iatype)
+ 		confsize = sizeof(struct iana_conf);
+ 		break;
+ 	default:
+-		dprintf(LOG_ERR, FNAME, "internal error");
++		debug_printf(LOG_ERR, FNAME, "internal error");
+ 		goto bad;
+ 	}
+ 
+@@ -346,7 +346,7 @@ configure_ia(ialist, iatype)
+ 		struct cf_list *cfl;
+ 
+ 		if ((iac = malloc(confsize)) == NULL) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "memory allocation for IA %s failed",
+ 			    iap->name);
+ 			goto bad;
+@@ -386,13 +386,13 @@ configure_ia(ialist, iatype)
+ 					if (add_prefix(&pdp->iapd_prefix_list,
+ 					    "IAPD", DHCP6_LISTVAL_PREFIX6,
+ 					    cfl->ptr)) {
+-						dprintf(LOG_NOTICE, FNAME, "failed "
++						debug_printf(LOG_NOTICE, FNAME, "failed "
+ 							"to configure prefix");
+ 						goto bad;
+ 					}
+ 					break;
+ 				default:
+-					dprintf(LOG_ERR, FNAME, "%s:%d "
++					debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 					    "invalid configuration",
+ 					    configfilename, cfl->line);
+ 					goto bad;
+@@ -404,20 +404,20 @@ configure_ia(ialist, iatype)
+ 					if (add_prefix(&nap->iana_address_list,
+ 					    "IANA", DHCP6_LISTVAL_STATEFULADDR6,
+ 					    cfl->ptr)) {
+-						dprintf(LOG_NOTICE, FNAME, "failed "
++						debug_printf(LOG_NOTICE, FNAME, "failed "
+ 							"to configure address");
+ 						goto bad;
+ 					}
+ 					break;
+ 				default:
+-					dprintf(LOG_ERR, FNAME, "%s:%d "
++					debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 					    "invalid configuration",
+ 					    configfilename, cfl->line);
+ 					goto bad;
+ 				}
+ 				break;
+ 			default:
+-				dprintf(LOG_ERR, FNAME, "%s:%d "
++				debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 				    "invalid iatype %d",
+ 				    configfilename, cfl->line, iatype);
+ 				goto bad;
+@@ -443,7 +443,7 @@ add_pd_pif(iapdc, cfl0)
+ 	for (pif = TAILQ_FIRST(&iapdc->iapd_pif_list); pif;
+ 	    pif = TAILQ_NEXT(pif, link)) {
+ 		if (strcmp(pif->ifname, cfl0->ptr) == 0) {
+-			dprintf(LOG_NOTICE, FNAME, "%s:%d "
++			debug_printf(LOG_NOTICE, FNAME, "%s:%d "
+ 			    "duplicated prefix interface: %s",
+ 			    configfilename, cfl0->line, cfl0->ptr);
+ 			return (0); /* ignore it */
+@@ -451,7 +451,7 @@ add_pd_pif(iapdc, cfl0)
+ 	}
+ 
+ 	if ((pif = malloc(sizeof(*pif))) == NULL) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "memory allocation for %s failed", cfl0->ptr);
+ 		goto bad;
+ 	}
+@@ -459,20 +459,20 @@ add_pd_pif(iapdc, cfl0)
+ 
+ 	/* validate and copy ifname */
+ 	if (if_nametoindex(cfl0->ptr) == 0) {
+-		dprintf(LOG_ERR, FNAME, "%s:%d invalid interface (%s): %s",
++		debug_printf(LOG_ERR, FNAME, "%s:%d invalid interface (%s): %s",
+ 		    configfilename, cfl0->line,
+ 		    cfl0->ptr, strerror(errno));
+ 		goto bad;
+ 	}
+ 	if ((pif->ifname = strdup(cfl0->ptr)) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy ifname");
++		debug_printf(LOG_ERR, FNAME, "failed to copy ifname");
+ 		goto bad;
+ 	}
+ 
+ 	pif->ifid_len = IFID_LEN_DEFAULT;
+ 	pif->sla_len = SLA_LEN_DEFAULT;
+ 	if (get_default_ifid(pif)) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to get default IF ID for %s", pif->ifname);
+ 		goto bad;
+ 	}
+@@ -485,14 +485,14 @@ add_pd_pif(iapdc, cfl0)
+ 		case IFPARAM_SLA_LEN:
+ 			pif->sla_len = (int)cfl->num;
+ 			if (pif->sla_len < 0 || pif->sla_len > 128) {
+-				dprintf(LOG_ERR, FNAME, "%s:%d "
++				debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 				    "invalid SLA length: %d",
+ 				    configfilename, cfl->line, pif->sla_len); 
+ 				goto bad;
+ 			}
+ 			break;
+ 		default:
+-			dprintf(LOG_ERR, FNAME, "%s:%d internal error: "
++			debug_printf(LOG_ERR, FNAME, "%s:%d internal error: "
+ 			    "invalid configuration",
+ 			    configfilename, cfl->line);
+ 			goto bad;
+@@ -520,7 +520,7 @@ configure_host(hostlist)
+ 		struct cf_list *cfl;
+ 
+ 		if ((hconf = malloc(sizeof(*hconf))) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "memory allocation failed "
++			debug_printf(LOG_ERR, FNAME, "memory allocation failed "
+ 				"for host %s", host->name);
+ 			goto bad;
+ 		}
+@@ -531,7 +531,7 @@ configure_host(hostlist)
+ 		host_conflist0 = hconf;
+ 
+ 		if ((hconf->name = strdup(host->name)) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "failed to copy host name: %s",
++			debug_printf(LOG_ERR, FNAME, "failed to copy host name: %s",
+ 			    host->name);
+ 			goto bad;
+ 		}
+@@ -540,7 +540,7 @@ configure_host(hostlist)
+ 			switch(cfl->type) {
+ 			case DECL_DUID:
+ 				if (hconf->duid.duid_id) {
+-					dprintf(LOG_ERR, FNAME, "%s:%d "
++					debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 					    "duplicated DUID for %s",
+ 					    configfilename,
+ 					    cfl->line, host->name);
+@@ -548,14 +548,14 @@ configure_host(hostlist)
+ 				}
+ 				if ((configure_duid((char *)cfl->ptr,
+ 						    &hconf->duid)) != 0) {
+-					dprintf(LOG_ERR, FNAME, "%s:%d "
++					debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 					    "failed to configure "
+ 					    "DUID for %s",
+ 					    configfilename, cfl->line,
+ 					    host->name);
+ 					goto bad;
+ 				}
+-				dprintf(LOG_DEBUG, FNAME,
++				debug_printf(LOG_DEBUG, FNAME,
+ 				    "configure DUID for %s: %s",
+ 				    host->name, duidstr(&hconf->duid));
+ 				break;
+@@ -563,7 +563,7 @@ configure_host(hostlist)
+ 				if (add_prefix(&hconf->prefix_list,
+ 				    hconf->name, DHCP6_LISTVAL_PREFIX6,
+ 				    cfl->ptr)) {
+-					dprintf(LOG_ERR, FNAME, "failed "
++					debug_printf(LOG_ERR, FNAME, "failed "
+ 					    "to configure prefix for %s",
+ 					    host->name);
+ 					goto bad;
+@@ -573,7 +573,7 @@ configure_host(hostlist)
+ 				if (add_prefix(&hconf->addr_list,
+ 				    hconf->name, DHCP6_LISTVAL_STATEFULADDR6,
+ 				    cfl->ptr)) {
+-					dprintf(LOG_ERR, FNAME, "failed "
++					debug_printf(LOG_ERR, FNAME, "failed "
+ 					    "to configure address for %s",
+ 					    host->name);
+ 					goto bad;
+@@ -581,7 +581,7 @@ configure_host(hostlist)
+ 				break;
+ 			case DECL_DELAYEDKEY:
+ 				if (hconf->delayedkey != NULL) {
+-					dprintf(LOG_WARNING, FNAME,
++					debug_printf(LOG_WARNING, FNAME,
+ 					    "%s:%d: duplicate key %s for %s"
+ 					    " (ignored)", configfilename,
+ 					    cfl->line, cfl->ptr, host->name);
+@@ -590,12 +590,12 @@ configure_host(hostlist)
+ 				if ((hconf->delayedkey =
+ 				    find_keybyname(key_list0, cfl->ptr))
+ 				    == NULL) {
+-					dprintf(LOG_ERR, FNAME, "failed to "
++					debug_printf(LOG_ERR, FNAME, "failed to "
+ 					    "find key information for %s",
+ 					    cfl->ptr);
+ 					goto bad;
+ 				}
+-				dprintf(LOG_DEBUG, FNAME, "configure key for "
++				debug_printf(LOG_DEBUG, FNAME, "configure key for "
+ 				    "delayed auth with %s (keyid=%08x)",
+ 				    host->name, hconf->delayedkey->keyid);
+ 				break;
+@@ -610,7 +610,7 @@ configure_host(hostlist)
+ 						if (strcmp(spec->name, pool->name) == 0)
+ 							break;
+ 					if (pool == NULL) {
+-						dprintf(LOG_ERR, FNAME, "%s:%d "
++						debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 							"pool '%s' not found",
+ 							configfilename, cfl->line,
+ 					   		spec->name);
+@@ -619,7 +619,7 @@ configure_host(hostlist)
+ 					if (spec->vltime != DHCP6_DURATION_INFINITE &&
+ 						(spec->pltime == DHCP6_DURATION_INFINITE ||
+ 						spec->pltime > spec->vltime)) {
+-						dprintf(LOG_ERR, FNAME, "%s:%d ",
++						debug_printf(LOG_ERR, FNAME, "%s:%d ",
+ 							configfilename, cfl->line,
+ 							"specified a larger preferred lifetime "
+ 							"than valid lifetime");
+@@ -627,17 +627,17 @@ configure_host(hostlist)
+ 					}
+ 					hconf->pool = *spec;
+ 					if ((hconf->pool.name = strdup(spec->name)) == NULL) {
+-						dprintf(LOG_ERR, FNAME,
++						debug_printf(LOG_ERR, FNAME,
+ 							"memory allocation failed");
+ 						goto bad;
+ 					}
+-					dprintf(LOG_DEBUG, FNAME,
++					debug_printf(LOG_DEBUG, FNAME,
+ 						"pool '%s' is specified to the host '%s'",
+ 						hconf->pool.name, hconf->name);
+ 				}
+ 				break;
+ 			default:
+-				dprintf(LOG_ERR, FNAME, "%s:%d "
++				debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 				    "invalid host configuration for %s",
+ 				    configfilename, cfl->line,
+ 				    host->name);
+@@ -669,7 +669,7 @@ configure_keys(keylist)
+ 		struct cf_list *cfl;
+ 
+ 		if ((kinfo = malloc(sizeof(*kinfo))) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "memory allocation failed "
++			debug_printf(LOG_ERR, FNAME, "memory allocation failed "
+ 				"for key %s", key->name);
+ 			goto bad;
+ 		}
+@@ -678,7 +678,7 @@ configure_keys(keylist)
+ 		key_list0 = kinfo;
+ 
+ 		if ((kinfo->name = strdup(key->name)) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "failed to copy key name: %s",
++			debug_printf(LOG_ERR, FNAME, "failed to copy key name: %s",
+ 			    key->name);
+ 			goto bad;
+ 		}
+@@ -689,7 +689,7 @@ configure_keys(keylist)
+ 			switch (cfl->type) {
+ 			case KEYPARAM_REALM:
+ 				if (kinfo->realm != NULL) {
+-					dprintf(LOG_WARNING, FNAME,
++					debug_printf(LOG_WARNING, FNAME,
+ 					    "%s:%d duplicate realm for key %s "
+ 					    "(ignored)", configfilename,
+ 					    cfl->line, key->name);
+@@ -697,7 +697,7 @@ configure_keys(keylist)
+ 				}
+ 				kinfo->realm = qstrdup(cfl->ptr);
+ 				if (kinfo->realm == NULL) {
+-					dprintf(LOG_WARNING, FNAME,
++					debug_printf(LOG_WARNING, FNAME,
+ 					    "failed to allocate memory for "
+ 					    "realm");
+ 					goto bad;
+@@ -706,7 +706,7 @@ configure_keys(keylist)
+ 				break;
+ 			case KEYPARAM_KEYID:
+ 				if (keyid != -1) {
+-					dprintf(LOG_WARNING, FNAME,
++					debug_printf(LOG_WARNING, FNAME,
+ 					    "%s:%d duplicate realm for key %s "
+ 					    "(ignored)",
+ 					    configfilename, cfl->line);
+@@ -714,7 +714,7 @@ configure_keys(keylist)
+ 				}
+ 				keyid = cfl->num;
+ 				if (keyid < 0 || keyid > 0xffffffff) {
+-					dprintf(LOG_WARNING, FNAME,
++					debug_printf(LOG_WARNING, FNAME,
+ 					    "%s:%d key ID overflow",
+ 					     configfilename, cfl->line);
+ 					goto bad;
+@@ -723,7 +723,7 @@ configure_keys(keylist)
+ 			case KEYPARAM_SECRET:
+ 				/* duplicate check */
+ 				if (kinfo->secret != NULL) {
+-					dprintf(LOG_WARNING, FNAME,
++					debug_printf(LOG_WARNING, FNAME,
+ 					    "%s:%d duplicate secret "
+ 					    "for key %s (ignored)",
+ 					    configfilename, cfl->line,
+@@ -733,7 +733,7 @@ configure_keys(keylist)
+ 
+ 				/* convert base64 string to binary secret */
+ 				if ((secretstr = qstrdup(cfl->ptr)) == NULL) {
+-					dprintf(LOG_WARNING, FNAME,
++					debug_printf(LOG_WARNING, FNAME,
+ 					    "failed to make a copy of secret");
+ 					goto bad;
+ 				}
+@@ -741,7 +741,7 @@ configure_keys(keylist)
+ 				secretlen = base64_decodestring(secretstr,
+ 				    secret, sizeof(secret));
+ 				if (secretlen < 0) {
+-					dprintf(LOG_ERR, FNAME,
++					debug_printf(LOG_ERR, FNAME,
+ 					    "%s:%d failed to parse base64 key",
+ 					    configfilename, cfl->line);
+ 					free(secretstr);
+@@ -752,7 +752,7 @@ configure_keys(keylist)
+ 				/* set the binary secret */
+ 				kinfo->secret = malloc(secretlen);
+ 				if (kinfo->secret == NULL) {
+-					dprintf(LOG_WARNING, FNAME,
++					debug_printf(LOG_WARNING, FNAME,
+ 					    "failed to allocate memory "
+ 					    "for secret");
+ 					goto bad;
+@@ -762,7 +762,7 @@ configure_keys(keylist)
+ 				break;
+ 			case KEYPARAM_EXPIRE:
+ 				if (expire != NULL) {
+-					dprintf(LOG_WARNING, FNAME,
++					debug_printf(LOG_WARNING, FNAME,
+ 					    "%s:%d duplicate expire for key "
+ 					    "%s (ignored)", configfilename,
+ 					    cfl->line, key->name);
+@@ -771,7 +771,7 @@ configure_keys(keylist)
+ 				expire = qstrdup(cfl->ptr);
+ 				break;
+ 			default:
+-				dprintf(LOG_ERR, FNAME,
++				debug_printf(LOG_ERR, FNAME,
+ 				    "%s:%d invalid key parameter for %s",
+ 				    configfilename, cfl->line, key->name);
+ 				goto bad;
+@@ -780,18 +780,18 @@ configure_keys(keylist)
+ 
+ 		/* check for mandatory parameters or use default */
+ 		if (kinfo->realm == NULL) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "realm not specified for key %s", key->name);
+ 			goto bad;
+ 		}
+ 		if (keyid == -1) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "key ID not specified for key %s", key->name);
+ 			goto bad;
+ 		}
+ 		kinfo->keyid = keyid;
+ 		if (kinfo->secret == NULL) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "secret not specified for key %s", key->name);
+ 			goto bad;
+ 		}
+@@ -802,7 +802,7 @@ configure_keys(keylist)
+ 				struct tm *lt;
+ 
+ 				if (time(&now) == -1) {
+-					dprintf(LOG_ERR, FNAME, "cannot get "
++					debug_printf(LOG_ERR, FNAME, "cannot get "
+ 					    "current time: %s",
+ 					    strerror(errno));
+ 					goto bad;
+@@ -815,14 +815,14 @@ configure_keys(keylist)
+ 				    strptime(expire, "%m-%d %H:%M", lt)
+ 				    == NULL &&
+ 				    strptime(expire, "%H:%M", lt) == NULL) {
+-					dprintf(LOG_ERR, FNAME, "invalid "
++					debug_printf(LOG_ERR, FNAME, "invalid "
+ 					    "expiration time: %s");
+ 					goto bad;
+ 				}
+ 
+ 				expire_time = mktime(lt);
+ 				if (expire_time < now) {
+-					dprintf(LOG_ERR, FNAME, "past "
++					debug_printf(LOG_ERR, FNAME, "past "
+ 					    "expiration time specified: %s",
+ 					    expire);
+ 					goto bad;
+@@ -867,7 +867,7 @@ configure_authinfo(authlist)
+ 		struct cf_list *cfl;
+ 
+ 		if ((ainfo = malloc(sizeof(*ainfo))) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "memory allocation failed "
++			debug_printf(LOG_ERR, FNAME, "memory allocation failed "
+ 				"for auth info %s", auth->name);
+ 			goto bad;
+ 		}
+@@ -879,7 +879,7 @@ configure_authinfo(authlist)
+ 		ainfo->rdm = DHCP6_AUTHRDM_UNDEF;
+ 
+ 		if ((ainfo->name = strdup(auth->name)) == NULL) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "failed to copy auth info name: %s", auth->name);
+ 			goto bad;
+ 		}
+@@ -888,7 +888,7 @@ configure_authinfo(authlist)
+ 			switch (cfl->type) {
+ 			case AUTHPARAM_PROTO:
+ 				if (ainfo->protocol != DHCP6_AUTHPROTO_UNDEF) {
+-					dprintf(LOG_WARNING, FNAME,
++					debug_printf(LOG_WARNING, FNAME,
+ 					    "%s:%d duplicate protocol "
+ 					    "for auth info %s "
+ 					    "(ignored)",
+@@ -900,7 +900,7 @@ configure_authinfo(authlist)
+ 				break;
+ 			case AUTHPARAM_ALG:
+ 				if (ainfo->algorithm != DHCP6_AUTHALG_UNDEF) {
+-					dprintf(LOG_WARNING, FNAME,
++					debug_printf(LOG_WARNING, FNAME,
+ 					    "%s:%d duplicate algorithm "
+ 					    "for auth info %s "
+ 					    "(ignored)",
+@@ -912,7 +912,7 @@ configure_authinfo(authlist)
+ 				break;
+ 			case AUTHPARAM_RDM:
+ 				if (ainfo->rdm != DHCP6_AUTHRDM_UNDEF) {
+-					dprintf(LOG_WARNING, FNAME,
++					debug_printf(LOG_WARNING, FNAME,
+ 					    "%s:%d duplicate RDM "
+ 					    "for auth info %s "
+ 					    "(ignored)",
+@@ -923,13 +923,13 @@ configure_authinfo(authlist)
+ 				ainfo->rdm = (int)cfl->num;
+ 				break;
+ 			case AUTHPARAM_KEY:
+-				dprintf(LOG_WARNING, FNAME,
++				debug_printf(LOG_WARNING, FNAME,
+ 				    "%s:%d auth info specific keys "
+ 				    "are not supported",
+ 				    configfilename, cfl->line);
+ 				break;
+ 			default:
+-				dprintf(LOG_ERR, FNAME,
++				debug_printf(LOG_ERR, FNAME,
+ 				    "%s:%d invalid auth info parameter for %s",
+ 				    configfilename, cfl->line, auth->name);
+ 				goto bad;
+@@ -939,20 +939,20 @@ configure_authinfo(authlist)
+ 		/* check for mandatory parameters and consistency */
+ 		switch (ainfo->protocol) {
+ 		case DHCP6_AUTHPROTO_UNDEF:
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "auth protocol is not specified for %s",
+ 			    auth->name);
+ 			goto bad;
+ 		case DHCP6_AUTHPROTO_DELAYED:
+ 			if (dhcp6_mode != DHCP6_MODE_CLIENT) {
+-				dprintf(LOG_ERR, FNAME,
++				debug_printf(LOG_ERR, FNAME,
+ 				    "client-only auth protocol is specified");
+ 				goto bad;
+ 			}
+ 			break;
+ 		case DHCP6_AUTHPROTO_RECONFIG:
+ 			if (dhcp6_mode != DHCP6_MODE_SERVER) {
+-				dprintf(LOG_ERR, FNAME,
++				debug_printf(LOG_ERR, FNAME,
+ 				    "server-only auth protocol is specified");
+ 				goto bad;
+ 			}
+@@ -1039,7 +1039,7 @@ configure_addr(cf_addr_list, list0, optname)
+ 
+ 	/* check against configuration restriction */
+ 	if (cf_addr_list != NULL && dhcp6_mode != DHCP6_MODE_SERVER) {
+-		dprintf(LOG_INFO, FNAME, "%s:%d server-only configuration",
++		debug_printf(LOG_INFO, FNAME, "%s:%d server-only configuration",
+ 		    configfilename, cf_addr_list->line);
+ 		return -1;
+ 	}
+@@ -1049,7 +1049,7 @@ configure_addr(cf_addr_list, list0, optname)
+ 		/* duplication check */
+ 		if (dhcp6_find_listval(list0, DHCP6_LISTVAL_ADDR6,
+ 		    cl->ptr, 0)) {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "%s:%d duplicated %s server: %s",
+ 			    configfilename, cl->line,
+ 			    optname,
+@@ -1058,7 +1058,7 @@ configure_addr(cf_addr_list, list0, optname)
+ 		}
+ 		if (dhcp6_add_listval(list0, DHCP6_LISTVAL_ADDR6,
+ 		    cl->ptr, NULL) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "failed to add a %s server",
++			debug_printf(LOG_ERR, FNAME, "failed to add a %s server",
+ 			    optname);
+ 			return -1;
+ 		}
+@@ -1077,7 +1077,7 @@ configure_domain(cf_name_list, list0, optname)
+ 
+ 	/* check against configuration restriction */
+ 	if (cf_name_list != NULL && dhcp6_mode != DHCP6_MODE_SERVER) {
+-		dprintf(LOG_INFO, FNAME, "%s:%d server-only configuration",
++		debug_printf(LOG_INFO, FNAME, "%s:%d server-only configuration",
+ 		    configfilename, cf_name_list->line);
+ 		return -1;
+ 	}
+@@ -1089,7 +1089,7 @@ configure_domain(cf_name_list, list0, optname)
+ 
+ 		name = strdup(cl->ptr + 1);
+ 		if (name == NULL) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "failed to copy a %s domain name",
+ 			    optname);
+ 			return -1;
+@@ -1103,7 +1103,7 @@ configure_domain(cf_name_list, list0, optname)
+ 		/* duplication check */
+ 		if (dhcp6_find_listval(list0, DHCP6_LISTVAL_VBUF,
+ 		    &name_vbuf, 0)) {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "%s:%d duplicated %s name: %s",
+ 			    configfilename, cl->line, optname,
+ 			    name_vbuf.dv_buf);
+@@ -1114,7 +1114,7 @@ configure_domain(cf_name_list, list0, optname)
+ 		/* add the name */
+ 		if (dhcp6_add_listval(list0, DHCP6_LISTVAL_VBUF,
+ 		    &name_vbuf, NULL) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "failed to add a %s name",
++			debug_printf(LOG_ERR, FNAME, "failed to add a %s name",
+ 			    optname);
+ 			dhcp6_vbuf_free(&name_vbuf);
+ 			return -1;
+@@ -1145,12 +1145,12 @@ configure_duid(str, duid)
+ 		goto bad;
+ 	duidlen += (slen / 3);
+ 	if (duidlen > 128) {
+-		dprintf(LOG_ERR, FNAME, "too long DUID (%d)", duidlen);
++		debug_printf(LOG_ERR, FNAME, "too long DUID (%d)", duidlen);
+ 		return (-1);
+ 	}
+ 
+ 	if ((idbuf = malloc(duidlen)) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "memory allocation failed");
++		debug_printf(LOG_ERR, FNAME, "memory allocation failed");
+ 		return (-1);
+ 	}
+ 
+@@ -1175,7 +1175,7 @@ configure_duid(str, duid)
+   bad:
+ 	if (idbuf)
+ 		free(idbuf);
+-	dprintf(LOG_ERR, FNAME, "assumption failure (bad string)");
++	debug_printf(LOG_ERR, FNAME, "assumption failure (bad string)");
+ 	return (-1);
+ }
+ 
+@@ -1193,12 +1193,12 @@ get_default_ifid(pif)
+ #endif
+ 
+ 	if (pif->ifid_len < 64) {
+-		dprintf(LOG_NOTICE, FNAME, "ID length too short");
++		debug_printf(LOG_NOTICE, FNAME, "ID length too short");
+ 		return (-1);
+ 	}
+ 
+ 	if (getifaddrs(&ifap) < 0) {
+-		dprintf(LOG_ERR, FNAME, "getifaddrs failed: %s",
++		debug_printf(LOG_ERR, FNAME, "getifaddrs failed: %s",
+ 		    strerror(errno));
+ 		return (-1);
+ 	}
+@@ -1218,7 +1218,7 @@ get_default_ifid(pif)
+ 
+ 		sdl = (struct sockaddr_dl *)ifa->ifa_addr;
+ 		if (sdl->sdl_alen < 6) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "link layer address is too short (%s)",
+ 			    pif->ifname);
+ 			goto fail;
+@@ -1233,7 +1233,7 @@ get_default_ifid(pif)
+ 
+ 		sll = (struct sockaddr_ll *)ifa->ifa_addr;
+ 		if (sll->sll_halen < 6) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "link layer address is too short (%s)",
+ 			    pif->ifname);
+ 			goto fail;
+@@ -1256,7 +1256,7 @@ get_default_ifid(pif)
+ 	}
+ 
+ 	if (ifa == NULL) {
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 		    "cannot find interface information for %s", pif->ifname);
+ 		goto fail;
+ 	}
+@@ -1352,7 +1352,7 @@ configure_commit()
+ 
+ 	/* clear unused IA configuration */
+ 	if (!TAILQ_EMPTY(&ia_conflist0)) {
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 		    "some IA configuration defined but not used");
+ 	}
+ 	clear_iaconf(&ia_conflist0);
+@@ -1475,7 +1475,7 @@ clear_iaconf(ialist)
+ 		switch(iac->type) {
+ 		case IATYPE_PD:
+ 			if (!TAILQ_EMPTY(&iac->iadata)) {
+-				dprintf(LOG_ERR, FNAME, "assumption failure");
++				debug_printf(LOG_ERR, FNAME, "assumption failure");
+ 				exit(1);
+ 			}
+ 			clear_pd_pif((struct iapd_conf *)iac);
+@@ -1557,7 +1557,7 @@ add_options(opcode, ifc, cfl0)
+ 				ifc->allow_flags |= DHCIFF_RAPID_COMMIT;
+ 				break;
+ 			default:
+-				dprintf(LOG_ERR, FNAME,
++				debug_printf(LOG_ERR, FNAME,
+ 				    "invalid operation (%d) "
+ 				    "for option type (%d)",
+ 				    opcode, cfl->type);
+@@ -1566,7 +1566,7 @@ add_options(opcode, ifc, cfl0)
+ 			break;
+ 		case DHCPOPT_AUTHINFO:
+ 			if (opcode != DHCPOPTCODE_SEND) {
+-				dprintf(LOG_ERR, FNAME,
++				debug_printf(LOG_ERR, FNAME,
+ 				    "invalid operation (%d) "
+ 				    "for option type (%d)",
+ 				    opcode, cfl->type);
+@@ -1574,14 +1574,14 @@ add_options(opcode, ifc, cfl0)
+ 			}
+ 			ainfo = find_authinfo(auth_list0, cfl->ptr);
+ 			if (ainfo == NULL) {
+-				dprintf(LOG_ERR, FNAME, "%s:%d "
++				debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 				    "auth info (%s) is not defined",
+ 				    configfilename, cfl->line,
+ 				    (char *)cfl->ptr);
+ 				return (-1);
+ 			}
+ 			if (ifc->authinfo != NULL) {
+-				dprintf(LOG_ERR, FNAME,
++				debug_printf(LOG_ERR, FNAME,
+ 				    "%s:%d authinfo is doubly specified on %s",
+ 				    configfilename, cfl->line, ifc->ifname);
+ 				return (-1);
+@@ -1594,7 +1594,7 @@ add_options(opcode, ifc, cfl0)
+ 				iac = find_iaconf(&ia_conflist0, IATYPE_PD,
+ 				    (u_int32_t)cfl->num);
+ 				if (iac == NULL) {
+-					dprintf(LOG_ERR, FNAME, "%s:%d "
++					debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 					    "IA_PD (%lu) is not defined",
+ 					    configfilename, cfl->line,
+ 					    (u_long)cfl->num);
+@@ -1607,7 +1607,7 @@ add_options(opcode, ifc, cfl0)
+ 
+ 				break;
+ 			default:
+-				dprintf(LOG_ERR, FNAME,
++				debug_printf(LOG_ERR, FNAME,
+ 				    "invalid operation (%d) "
+ 				    "for option type (%d)", opcode, cfl->type);
+ 				break;
+@@ -1619,7 +1619,7 @@ add_options(opcode, ifc, cfl0)
+ 				iac = find_iaconf(&ia_conflist0, IATYPE_NA,
+ 				    (u_int32_t)cfl->num);
+ 				if (iac == NULL) {
+-					dprintf(LOG_ERR, FNAME, "%s:%d "
++					debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 					    "IA_NA (%lu) is not defined",
+ 					    configfilename, cfl->line,
+ 					    (u_long)cfl->num);
+@@ -1632,7 +1632,7 @@ add_options(opcode, ifc, cfl0)
+ 
+ 				break;
+ 			default:
+-				dprintf(LOG_ERR, FNAME,
++				debug_printf(LOG_ERR, FNAME,
+ 				    "invalid operation (%d) "
+ 				    "for option type (%d)", opcode, cfl->type);
+ 				break;
+@@ -1693,7 +1693,7 @@ add_options(opcode, ifc, cfl0)
+ 				if (dhcp6_find_listval(&ifc->reqopt_list,
+ 					DHCP6_LISTVAL_NUM, &opttype, 0)
+ 				    != NULL) {
+-					dprintf(LOG_INFO, FNAME,
++					debug_printf(LOG_INFO, FNAME,
+ 					    "duplicated requested option: %s",
+ 					    dhcp6optstr(opttype));
+ 					goto next; /* ignore it */
+@@ -1701,20 +1701,20 @@ add_options(opcode, ifc, cfl0)
+ 				if (dhcp6_add_listval(&ifc->reqopt_list,
+ 				    DHCP6_LISTVAL_NUM, &opttype, NULL)
+ 				    == NULL) {
+-					dprintf(LOG_ERR, FNAME, "failed to "
++					debug_printf(LOG_ERR, FNAME, "failed to "
+ 					    "configure an option");
+ 					return (-1);
+ 				}
+ 				break;
+ 			default:
+-				dprintf(LOG_ERR, FNAME,
++				debug_printf(LOG_ERR, FNAME,
+ 				    "invalid operation (%d) "
+ 				    "for option type (%d)", opcode, cfl->type);
+ 				break;
+ 			}
+ 			break;
+ 		default:
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "%s:%d unsupported option type: %d",
+ 			    configfilename, cfl->line, cfl->type);
+ 			return (-1);
+@@ -1740,13 +1740,13 @@ add_prefix(head, name, type, prefix0)
+ 
+ 	/* additional validation of parameters */
+ 	if (oprefix.plen < 0 || oprefix.plen > 128) {
+-		dprintf(LOG_ERR, FNAME, "invalid prefix: %d", oprefix.plen);
++		debug_printf(LOG_ERR, FNAME, "invalid prefix: %d", oprefix.plen);
+ 		return (-1);
+ 	}
+ 	/* clear trailing bits */
+ 	prefix6_mask(&oprefix.addr, oprefix.plen);
+ 	if (!IN6_ARE_ADDR_EQUAL(&prefix0->addr, &oprefix.addr)) {
+-		dprintf(LOG_WARNING, FNAME, "prefix %s/%d for %s "
++		debug_printf(LOG_WARNING, FNAME, "prefix %s/%d for %s "
+ 		    "has a trailing garbage.  It should be %s/%d",
+ 		    in6addr2str(&prefix0->addr, 0), prefix0->plen,
+ 		    name, in6addr2str(&oprefix.addr, 0), oprefix.plen);
+@@ -1757,7 +1757,7 @@ add_prefix(head, name, type, prefix0)
+ 	if (IN6_IS_ADDR_MULTICAST(&oprefix.addr) ||
+ 	    IN6_IS_ADDR_LINKLOCAL(&oprefix.addr) ||
+ 	    IN6_IS_ADDR_SITELOCAL(&oprefix.addr)) {
+-		dprintf(LOG_ERR, FNAME, "invalid prefix address: %s",
++		debug_printf(LOG_ERR, FNAME, "invalid prefix address: %s",
+ 		    in6addr2str(&oprefix.addr, 0));
+ 		return (-1);
+ 	}
+@@ -1765,11 +1765,11 @@ add_prefix(head, name, type, prefix0)
+ 	/* prefix duplication check */
+ 	if (dhcp6_find_listval(head, type, &oprefix, 0)) {
+ 		if (type == DHCP6_LISTVAL_PREFIX6) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "duplicated prefix: %s/%d for %s",
+ 			    in6addr2str(&oprefix.addr, 0), oprefix.plen, name);
+ 		} else {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "duplicated address: %s for %s",
+ 			    in6addr2str(&oprefix.addr, 0), name);
+ 		}
+@@ -1781,12 +1781,12 @@ add_prefix(head, name, type, prefix0)
+ 	    (oprefix.pltime == DHCP6_DURATION_INFINITE ||
+ 	    oprefix.pltime > oprefix.vltime)) {
+ 		if (type == DHCP6_LISTVAL_PREFIX6) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "%s/%d has larger preferred lifetime "
+ 			    "than valid lifetime",
+ 			    in6addr2str(&oprefix.addr, 0), oprefix.plen);
+ 		} else {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "%s has larger preferred lifetime "
+ 			    "than valid lifetime",
+ 			    in6addr2str(&oprefix.addr, 0));
+@@ -1915,10 +1915,10 @@ configure_pool(poollist)
+ {
+ 	struct cf_namelist *plp;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "called");
++	debug_printf(LOG_DEBUG, FNAME, "called");
+ 
+ 	if (poollist && dhcp6_mode != DHCP6_MODE_SERVER) {
+-		dprintf(LOG_ERR, FNAME, "%s:%d "
++		debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 			"pool statement is server-only",
+ 			configfilename, poollist->line);
+ 		goto bad;
+@@ -1935,7 +1935,7 @@ configure_pool(poollist)
+ 				range = cfl->ptr;
+ 				break;
+ 			default:
+-				dprintf(LOG_ERR, FNAME, "%s:%d "
++				debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 					"invalid pool configuration",
+ 					configfilename, cfl->line);
+ 				goto bad;
+@@ -1943,14 +1943,14 @@ configure_pool(poollist)
+ 		}
+ 
+ 		if (!range) {
+-			dprintf(LOG_ERR, FNAME, "%s:%d "
++			debug_printf(LOG_ERR, FNAME, "%s:%d "
+ 				"pool '%s' has no range declaration",
+ 				configfilename, plp->line,
+ 				plp->name);
+ 			goto bad;
+ 		}
+ 		if ((pool = create_pool(plp->name, range)) == NULL) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 				"faled to craete pool '%s'", plp->name);
+ 			goto bad;
+ 		}
+@@ -1971,7 +1971,7 @@ clear_poolconf(plist)
+ {
+ 	struct pool_conf *pool, *pool_next;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "called");
++	debug_printf(LOG_DEBUG, FNAME, "called");
+ 
+ 	for (pool = plist; pool; pool = pool_next) {
+ 		pool_next = pool->next;
+@@ -1999,7 +1999,7 @@ create_dynamic_hostconf(duid, pool)
+ 	if (dynamic_hostconf_count >= DHCP6_DYNAMIC_HOSTCONF_MAX) {
+ 		struct dynamic_hostconf_listhead *head = &dynamic_hostconf_head;
+ 
+-		dprintf(LOG_DEBUG, FNAME, "reached to the max count (count=%lu)",
++		debug_printf(LOG_DEBUG, FNAME, "reached to the max count (count=%lu)",
+ 			dynamic_hostconf_count);
+ 
+ 		/* Find the last entry that doesn't need authentication */
+@@ -2013,14 +2013,14 @@ create_dynamic_hostconf(duid, pool)
+ 		clear_hostconf(dynconf->host);
+ 	} else {
+ 		if ((dynconf = malloc(sizeof(*dynconf))) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "memory allocation failed");
++			debug_printf(LOG_ERR, FNAME, "memory allocation failed");
+ 			return (NULL);
+ 		}
+ 	}
+ 	memset(dynconf, 0, sizeof(*dynconf));
+ 
+ 	if ((host = malloc(sizeof(*host))) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "memory allocation failed");
++		debug_printf(LOG_ERR, FNAME, "memory allocation failed");
+ 		goto bad;
+ 	}
+ 	memset(host, 0, sizeof(*host));
+@@ -2030,7 +2030,7 @@ create_dynamic_hostconf(duid, pool)
+ 	if ((strid = duidstr(duid)) == NULL)
+ 		strid = "???";
+ 	if ((host->name = strdup(strid)) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "memory allocation failed");
++		debug_printf(LOG_ERR, FNAME, "memory allocation failed");
+ 		goto bad;
+ 	}
+ 	if (duidcpy(&host->duid, duid) != 0) {
+@@ -2038,7 +2038,7 @@ create_dynamic_hostconf(duid, pool)
+ 	}
+ 	if (pool->name) {
+ 		if ((host->pool.name = strdup(pool->name)) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "memory allocation failed");
++			debug_printf(LOG_ERR, FNAME, "memory allocation failed");
+ 			goto bad;
+ 		}
+ 	}
+@@ -2049,7 +2049,7 @@ create_dynamic_hostconf(duid, pool)
+ 	TAILQ_INSERT_HEAD(&dynamic_hostconf_head, dynconf, link);
+ 	dynamic_hostconf_count++; 
+ 
+-	dprintf(LOG_DEBUG, FNAME, "created host_conf (name=%s)", host->name);
++	debug_printf(LOG_DEBUG, FNAME, "created host_conf (name=%s)", host->name);
+ 
+ 	return (host);
+ 
+@@ -2097,22 +2097,22 @@ create_pool(name, range)
+ 		return (NULL);
+ 	}
+ 
+-	dprintf(LOG_DEBUG, FNAME, "name=%s, range=%s->%s", name,
++	debug_printf(LOG_DEBUG, FNAME, "name=%s, range=%s->%s", name,
+ 		in6addr2str(&range->min, 0), in6addr2str(&range->max, 0));
+ 
+ 	if (in6_addr_cmp(&range->min, &range->max) > 0) {
+-		dprintf(LOG_ERR, FNAME, "invalid address range %s->%s",
++		debug_printf(LOG_ERR, FNAME, "invalid address range %s->%s",
+ 			in6addr2str(&range->min, 0),
+ 			in6addr2str(&range->max, 0));
+ 		return (NULL);
+ 	}
+ 
+ 	if ((pool = malloc(sizeof(struct pool_conf))) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "memory allocation failed");
++		debug_printf(LOG_ERR, FNAME, "memory allocation failed");
+ 		return (NULL);
+ 	}
+ 	if ((pool->name = strdup(name)) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "memory allocation failed");
++		debug_printf(LOG_ERR, FNAME, "memory allocation failed");
+ 		free(pool);
+ 		return (NULL);
+ 	}
+@@ -2131,16 +2131,16 @@ find_pool(name)
+ 	if (!name)
+ 		return (NULL);
+ 
+-	dprintf(LOG_DEBUG, FNAME, "name=%s", name);
++	debug_printf(LOG_DEBUG, FNAME, "name=%s", name);
+ 
+ 	for (pool = pool_conflist; pool; pool = pool->next) {
+ 		if (strcmp(name, pool->name) == 0) {
+-			dprintf(LOG_DEBUG, FNAME, "found (name=%s)", name);
++			debug_printf(LOG_DEBUG, FNAME, "found (name=%s)", name);
+ 			return (pool);
+ 		}
+ 	}
+ 
+-	dprintf(LOG_DEBUG, FNAME, "not found (name=%s)", name);
++	debug_printf(LOG_DEBUG, FNAME, "not found (name=%s)", name);
+ 
+ 	return (NULL);
+ }
+@@ -2154,7 +2154,7 @@ get_free_address_from_pool(pool, addr)
+ 	if (!pool || !addr)
+ 		return (0);
+ 
+-	dprintf(LOG_DEBUG, FNAME, "called (pool=%s)", pool->name);
++	debug_printf(LOG_DEBUG, FNAME, "called (pool=%s)", pool->name);
+ 
+ 	for (cur = pool->min; in6_addr_cmp(&cur, &pool->max) <= 0;
+ 	    in6_addr_inc(&cur)) {
+@@ -2162,17 +2162,17 @@ get_free_address_from_pool(pool, addr)
+ 		    !IN6_IS_ADDR_MULTICAST(&cur) &&
+ 		    !IN6_IS_ADDR_LINKLOCAL(&cur) &&
+ 		    !IN6_IS_ADDR_SITELOCAL(&cur)) {
+-			dprintf(LOG_DEBUG, FNAME, "found %s",
++			debug_printf(LOG_DEBUG, FNAME, "found %s",
+ 				in6addr2str(&cur, 0));
+ 			*addr= cur;
+ 			return 1;
+ 		}
+ 
+-		dprintf(LOG_DEBUG, FNAME, "next address %s",
++		debug_printf(LOG_DEBUG, FNAME, "next address %s",
+ 			in6addr2str(&cur, 0));
+ 	}
+ 
+-	dprintf(LOG_NOTICE, FNAME, "no available address");
++	debug_printf(LOG_NOTICE, FNAME, "no available address");
+ 	return 0;
+ }
+ 
+@@ -2184,7 +2184,7 @@ is_available_in_pool(pool, addr)
+ 	if (!pool || !addr)
+ 		return (0);
+ 
+-	dprintf(LOG_DEBUG, FNAME, "pool=%s, addr=%s",
++	debug_printf(LOG_DEBUG, FNAME, "pool=%s, addr=%s",
+ 		 pool->name, in6addr2str(addr, 0));
+ 
+ 	if (in6_addr_cmp(addr, &pool->min) >= 0 &&
+@@ -2196,7 +2196,7 @@ is_available_in_pool(pool, addr)
+ 		return (1);
+ 	}
+ 
+-	dprintf(LOG_DEBUG, FNAME, "unavailable address (pool=%s, addr=%s)",
++	debug_printf(LOG_DEBUG, FNAME, "unavailable address (pool=%s, addr=%s)",
+ 		 pool->name, in6addr2str(addr, 0));
+ 
+ 	return (0);
+diff --git a/configure b/configure
+index 6f50634..4722b7b 100755
+--- a/configure
++++ b/configure
+@@ -6013,7 +6013,55 @@ fi
+ done
+ 
+ 
+-          ac_config_files="$ac_config_files Makefile"
++{ echo "$as_me:$LINENO: checking whether libc defines struct in6_pktinfo" >&5
++echo $ECHO_N "checking whether libc defines struct in6_pktinfo... $ECHO_C" >&6; }
++cat >conftest.$ac_ext <<_ACEOF
++/* confdefs.h.  */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h.  */
++#include <netinet/in.h>
++int
++main ()
++{
++struct in6_pktinfo p6;
++  ;
++  return 0;
++}
++_ACEOF
++rm -f conftest.$ac_objext
++if { (ac_try="$ac_compile"
++case "(($ac_try" in
++  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
++  *) ac_try_echo=$ac_try;;
++esac
++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
++  (eval "$ac_compile") 2>conftest.er1
++  ac_status=$?
++  grep -v '^ *+' conftest.er1 >conftest.err
++  rm -f conftest.er1
++  cat conftest.err >&5
++  echo "$as_me:$LINENO: \$? = $ac_status" >&5
++  (exit $ac_status); } && {
++	 test -z "$ac_c_werror_flag" ||
++	 test ! -s conftest.err
++       } && test -s conftest.$ac_objext; then
++  { echo "$as_me:$LINENO: result: yes" >&5
++echo "${ECHO_T}yes" >&6; }
++  CFLAGS="$CFLAGS -DHAVE_IN6_PKTINFO"
++else
++  echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++	{ echo "$as_me:$LINENO: result: no" >&5
++echo "${ECHO_T}no" >&6; }
++fi
++
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++
++ac_config_files="$ac_config_files Makefile"
++
+ cat >confcache <<\_ACEOF
+ # This file is a shell script that caches the results of configure
+ # tests run on this system so they can be shared between configure
+diff --git a/configure.in b/configure.in
+index 59dd84e..6da9af5 100644
+--- a/configure.in
++++ b/configure.in
+@@ -236,4 +236,11 @@ AC_SUBST(group)
+ 
+ AC_CHECK_HEADERS(stdarg.h)
+ 
++AC_MSG_CHECKING(whether libc defines struct in6_pktinfo)
++AC_TRY_COMPILE([#include <netinet/in.h>],
++ [struct in6_pktinfo p6;],
++ [AC_MSG_RESULT(yes)
++  CFLAGS="$CFLAGS -DHAVE_IN6_PKTINFO"],
++ [AC_MSG_RESULT(no)])
++
+ AC_OUTPUT(Makefile)
+diff --git a/dhcp6.h b/dhcp6.h
+index 6afb517..9f3a62d 100644
+--- a/dhcp6.h
++++ b/dhcp6.h
+@@ -108,6 +108,13 @@ typedef uint64_t u_int64_t;
+ #define DHCP6_IRT_DEFAULT 86400	/* 1 day */
+ #define DHCP6_IRT_MINIMUM 600
+ 
++#ifndef HAVE_IN6_PKTINFO
++struct in6_pktinfo {
++	struct in6_addr ipi6_addr;  /* src/dst IPv6 address */
++	unsigned int ipi6_ifindex;  /* send/recv interface index */
++};
++#endif
++
+ /* DUID: DHCP unique Identifier */
+ struct duid {
+ 	size_t duid_len;	/* length */
+diff --git a/dhcp6_ctl.c b/dhcp6_ctl.c
+index ab1f18d..a12f82a 100644
+--- a/dhcp6_ctl.c
++++ b/dhcp6_ctl.c
+@@ -93,32 +93,32 @@ dhcp6_ctl_init(addr, port, max, sockp)
+ 	hints.ai_protocol = IPPROTO_TCP;
+ 	error = getaddrinfo(addr, port, &hints, &res);
+ 	if (error) {
+-		dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
++		debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ 		    gai_strerror(error));
+ 		return (-1);
+ 	}
+ 	ctlsock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
+ 	if (ctlsock < 0) {
+-		dprintf(LOG_ERR, FNAME, "socket(control sock): %s",
++		debug_printf(LOG_ERR, FNAME, "socket(control sock): %s",
+ 		    strerror(errno));
+ 		goto fail;
+ 	}
+ 	on = 1;
+ 	if (setsockopt(ctlsock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))
+ 	    < 0) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "setsockopt(control sock, SO_REUSEADDR: %s",
+ 		    strerror(errno));
+ 		goto fail;
+ 	}
+ 	if (bind(ctlsock, res->ai_addr, res->ai_addrlen) < 0) {
+-		dprintf(LOG_ERR, FNAME, "bind(control sock): %s",
++		debug_printf(LOG_ERR, FNAME, "bind(control sock): %s",
+ 		    strerror(errno));
+ 		goto fail;
+ 	}
+ 	freeaddrinfo(res);
+ 	if (listen(ctlsock, 1)) {
+-		dprintf(LOG_ERR, FNAME, "listen(control sock): %s",
++		debug_printf(LOG_ERR, FNAME, "listen(control sock): %s",
+ 		    strerror(errno));
+ 		goto fail;
+ 	}
+@@ -126,7 +126,7 @@ dhcp6_ctl_init(addr, port, max, sockp)
+ 	TAILQ_INIT(&commandqueue_head);
+ 
+ 	if (max <= 0) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "invalid maximum number of commands (%d)", max_commands);
+ 		goto fail;
+ 	}
+@@ -159,27 +159,27 @@ dhcp6_ctl_authinit(keyfile, keyinfop, digestlenp)
+ 	*digestlenp = MD5_DIGESTLENGTH;
+ 
+ 	if ((fp = fopen(keyfile, "r")) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "failed to open %s: %s", keyfile,
++		debug_printf(LOG_ERR, FNAME, "failed to open %s: %s", keyfile,
+ 		    strerror(errno));
+ 		return (-1);
+ 	}
+ 	if (fgets(line, sizeof(line), fp) == NULL && ferror(fp)) {
+-		dprintf(LOG_ERR, FNAME, "failed to read key file: %s",
++		debug_printf(LOG_ERR, FNAME, "failed to read key file: %s",
+ 		    strerror(errno));
+ 		goto fail;
+ 	}
+ 	if ((secretlen = base64_decodestring(line, secret, sizeof(secret)))
+ 	    < 0) {
+-		dprintf(LOG_ERR, FNAME, "failed to decode base64 string");
++		debug_printf(LOG_ERR, FNAME, "failed to decode base64 string");
+ 		goto fail;
+ 	}
+ 	if ((ctlkey = malloc(sizeof(*ctlkey))) == NULL) {
+-		dprintf(LOG_WARNING, FNAME, "failed to allocate control key");
++		debug_printf(LOG_WARNING, FNAME, "failed to allocate control key");
+ 		goto fail;
+ 	}
+ 	memset(ctlkey, 0, sizeof(*ctlkey));
+ 	if ((ctlkey->secret = malloc(secretlen)) == NULL) {
+-		dprintf(LOG_WARNING, FNAME, "failed to allocate secret key");
++		debug_printf(LOG_WARNING, FNAME, "failed to allocate secret key");
+ 		goto fail;
+ 	}
+ 	ctlkey->secretlen = (size_t)secretlen;
+@@ -214,24 +214,24 @@ dhcp6_ctl_acceptcommand(sl, callback)
+ 
+ 	fromlen = sizeof(from_ss);
+ 	if ((s = accept(sl, from, &fromlen)) < 0) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "failed to accept control connection: %s",
+ 		    strerror(errno));
+ 		return (-1);
+ 	}
+ 
+-	dprintf(LOG_DEBUG, FNAME, "accept control connection from %s",
++	debug_printf(LOG_DEBUG, FNAME, "accept control connection from %s",
+ 	    addr2str(from));
+ 
+ 	if (max_commands <= 0) {
+-		dprintf(LOG_ERR, FNAME, "command queue is not initialized");
++		debug_printf(LOG_ERR, FNAME, "command queue is not initialized");
+ 		close(s);
+ 		return (-1);
+ 	}
+ 
+ 	new = malloc(sizeof(*new));
+ 	if (new == NULL) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "failed to allocate new command context");
+ 		goto fail;
+ 	}
+@@ -240,7 +240,7 @@ dhcp6_ctl_acceptcommand(sl, callback)
+ 	if (commands == max_commands) {
+ 		ctx = TAILQ_FIRST(&commandqueue_head);
+ 
+-		dprintf(LOG_INFO, FNAME, "command queue is full. "
++		debug_printf(LOG_INFO, FNAME, "command queue is full. "
+ 		    "drop the oldest one (fd=%d)", ctx->s);
+ 
+ 		TAILQ_REMOVE(&commandqueue_head, ctx, link);
+@@ -271,7 +271,7 @@ dhcp6_ctl_closecommand(ctx)
+ 	free(ctx);
+ 
+ 	if (commands == 0) {
+-		dprintf(LOG_ERR, FNAME, "assumption error: "
++		debug_printf(LOG_ERR, FNAME, "assumption error: "
+ 		    "command queue is empty?");
+ 		exit(1);	/* XXX */
+ 	}
+@@ -299,12 +299,12 @@ dhcp6_ctl_readcommand(read_fds)
+ 
+ 			cc = read(ctx->s, cp, resid);
+ 			if (cc < 0) {
+-				dprintf(LOG_WARNING, FNAME, "read failed: %s",
++				debug_printf(LOG_WARNING, FNAME, "read failed: %s",
+ 				    strerror(errno));
+ 				goto closecommand;
+ 			}
+ 			if (cc == 0) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "control channel was reset by peer");
+ 				goto closecommand;
+ 			}
+@@ -330,7 +330,7 @@ dhcp6_ctl_readcommand(read_fds)
+ 					break;
+ 				}
+ 			} else if (ctx->input_len > sizeof(ctx->inputbuf)) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "too large command (%d bytes)",
+ 				    ctx->input_len);
+ 				goto closecommand;
+diff --git a/dhcp6c.c b/dhcp6c.c
+index b5f5ed7..c959b7c 100644
+--- a/dhcp6c.c
++++ b/dhcp6c.c
+@@ -218,7 +218,7 @@ main(argc, argv)
+ 	client6_init();
+ 	while (argc-- > 0) { 
+ 		if ((ifp = ifinit(argv[0])) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "failed to initialize %s",
++			debug_printf(LOG_ERR, FNAME, "failed to initialize %s",
+ 			    argv[0]);
+ 			exit(1);
+ 		}
+@@ -226,7 +226,7 @@ main(argc, argv)
+ 	}
+ 
+ 	if (infreq_mode == 0 && (cfparse(conffile)) != 0) {
+-		dprintf(LOG_ERR, FNAME, "failed to parse configuration file");
++		debug_printf(LOG_ERR, FNAME, "failed to parse configuration file");
+ 		exit(1);
+ 	}
+ 
+@@ -266,12 +266,12 @@ client6_init()
+ 
+ 	/* get our DUID */
+ 	if (get_duid(DUID_FILE, &client_duid)) {
+-		dprintf(LOG_ERR, FNAME, "failed to get a DUID");
++		debug_printf(LOG_ERR, FNAME, "failed to get a DUID");
+ 		exit(1);
+ 	}
+ 
+ 	if (dhcp6_ctl_authinit(ctlkeyfile, &ctlkey, &ctldigestlen) != 0) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed initialize control message authentication");
+ 		/* run the server anyway */
+ 	}
+@@ -283,25 +283,25 @@ client6_init()
+ 	hints.ai_flags = AI_PASSIVE;
+ 	error = getaddrinfo(NULL, DH6PORT_DOWNSTREAM, &hints, &res);
+ 	if (error) {
+-		dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
++		debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ 		    gai_strerror(error));
+ 		exit(1);
+ 	}
+ 	sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
+ 	if (sock < 0) {
+-		dprintf(LOG_ERR, FNAME, "socket");
++		debug_printf(LOG_ERR, FNAME, "socket");
+ 		exit(1);
+ 	}
+ 	if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT,
+ 		       &on, sizeof(on)) < 0) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "setsockopt(SO_REUSEPORT): %s", strerror(errno));
+ 		exit(1);
+ 	}
+ #ifdef IPV6_RECVPKTINFO
+ 	if (setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on,
+ 		       sizeof(on)) < 0) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 			"setsockopt(IPV6_RECVPKTINFO): %s",
+ 			strerror(errno));
+ 		exit(1);
+@@ -309,7 +309,7 @@ client6_init()
+ #else
+ 	if (setsockopt(sock, IPPROTO_IPV6, IPV6_PKTINFO, &on,
+ 		       sizeof(on)) < 0) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "setsockopt(IPV6_PKTINFO): %s",
+ 		    strerror(errno));
+ 		exit(1);
+@@ -317,7 +317,7 @@ client6_init()
+ #endif
+ 	if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &on,
+ 		       sizeof(on)) < 0) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "setsockopt(sock, IPV6_MULTICAST_LOOP): %s",
+ 		    strerror(errno));
+ 		exit(1);
+@@ -325,7 +325,7 @@ client6_init()
+ #ifdef IPV6_V6ONLY
+ 	if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,
+ 	    &on, sizeof(on)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "setsockopt(IPV6_V6ONLY): %s",
++		debug_printf(LOG_ERR, FNAME, "setsockopt(IPV6_V6ONLY): %s",
+ 		    strerror(errno));
+ 		exit(1);
+ 	}
+@@ -337,14 +337,14 @@ client6_init()
+ 	 * the outgoing port is also bound to the DH6PORT_DOWNSTREAM.
+ 	 */
+ 	if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) {
+-		dprintf(LOG_ERR, FNAME, "bind: %s", strerror(errno));
++		debug_printf(LOG_ERR, FNAME, "bind: %s", strerror(errno));
+ 		exit(1);
+ 	}
+ 	freeaddrinfo(res);
+ 
+ 	/* open a routing socket to watch the routing table */
+ 	if ((rtsock = socket(PF_ROUTE, SOCK_RAW, 0)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "open a routing socket: %s",
++		debug_printf(LOG_ERR, FNAME, "open a routing socket: %s",
+ 		    strerror(errno));
+ 		exit(1);
+ 	}
+@@ -355,7 +355,7 @@ client6_init()
+ 	hints.ai_protocol = IPPROTO_UDP;
+ 	error = getaddrinfo(DH6ADDR_ALLAGENT, DH6PORT_UPSTREAM, &hints, &res);
+ 	if (error) {
+-		dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
++		debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ 		    gai_strerror(error));
+ 		exit(1);
+ 	}
+@@ -365,21 +365,21 @@ client6_init()
+ 
+ 	/* set up control socket */
+ 	if (ctlkey == NULL)
+-		dprintf(LOG_NOTICE, FNAME, "skip opening control port");
++		debug_printf(LOG_NOTICE, FNAME, "skip opening control port");
+ 	else if (dhcp6_ctl_init(ctladdr, ctlport,
+ 	    DHCP6CTL_DEF_COMMANDQUEUELEN, &ctlsock)) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "failed to initialize control channel");
+ 		exit(1);
+ 	}
+ 
+ 	if (signal(SIGHUP, client6_signal) == SIG_ERR) {
+-		dprintf(LOG_WARNING, FNAME, "failed to set signal: %s",
++		debug_printf(LOG_WARNING, FNAME, "failed to set signal: %s",
+ 		    strerror(errno));
+ 		exit(1);
+ 	}
+ 	if (signal(SIGTERM, client6_signal) == SIG_ERR) {
+-		dprintf(LOG_WARNING, FNAME, "failed to set signal: %s",
++		debug_printf(LOG_WARNING, FNAME, "failed to set signal: %s",
+ 		    strerror(errno));
+ 		exit(1);
+ 	}
+@@ -393,28 +393,28 @@ client6_start(ifp)
+ 
+ 	/* make sure that the interface does not have a timer */
+ 	if (ifp->timer != NULL) {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "removed existing timer on %s", ifp->ifname);
+ 		dhcp6_remove_timer(&ifp->timer);
+ 	}
+ 
+ 	/* create an event for the initial delay */
+ 	if ((ev = dhcp6_create_event(ifp, DHCP6S_INIT)) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to create an event");
++		debug_printf(LOG_NOTICE, FNAME, "failed to create an event");
+ 		return (-1);
+ 	}
+ 	TAILQ_INSERT_TAIL(&ifp->event_list, ev, link);
+ 
+ 	if ((ev->authparam = new_authparam(ifp->authproto,
+ 	    ifp->authalgorithm, ifp->authrdm)) == NULL) {
+-		dprintf(LOG_WARNING, FNAME, "failed to allocate "
++		debug_printf(LOG_WARNING, FNAME, "failed to allocate "
+ 		    "authentication parameters");
+ 		dhcp6_remove_event(ev);
+ 		return (-1);
+ 	}
+ 
+ 	if ((ev->timer = dhcp6_add_timer(client6_timo, ev)) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to add a timer for %s",
++		debug_printf(LOG_NOTICE, FNAME, "failed to add a timer for %s",
+ 		    ifp->ifname);
+ 		dhcp6_remove_event(ev);
+ 		return (-1);
+@@ -432,7 +432,7 @@ client6_startall(isrestart)
+ 
+ 	for (ifp = dhcp6_if; ifp; ifp = ifp->next) {
+ 		if (isrestart &&ifreset(ifp)) {
+-			dprintf(LOG_NOTICE, FNAME, "failed to reset %s",
++			debug_printf(LOG_NOTICE, FNAME, "failed to reset %s",
+ 			    ifp->ifname);
+ 			continue; /* XXX: try to recover? */
+ 		}
+@@ -489,7 +489,7 @@ check_exit()
+ 	}
+ 
+ 	/* We have no existing event.  Do exit. */
+-	dprintf(LOG_INFO, FNAME, "exiting");
++	debug_printf(LOG_INFO, FNAME, "exiting");
+ 
+ 	exit(0);
+ }
+@@ -504,7 +504,7 @@ process_signals()
+ 		check_exit();
+ 	}
+ 	if ((sig_flags & SIGF_HUP)) {
+-		dprintf(LOG_INFO, FNAME, "restarting");
++		debug_printf(LOG_INFO, FNAME, "restarting");
+ 		free_resources(NULL);
+ 		client6_startall(1);
+ 	}
+@@ -539,7 +539,7 @@ client6_mainloop()
+ 		switch (ret) {
+ 		case -1:
+ 			if (errno != EINTR) {
+-				dprintf(LOG_ERR, FNAME, "select: %s",
++				debug_printf(LOG_ERR, FNAME, "select: %s",
+ 				    strerror(errno));
+ 				exit(1);
+ 			}
+@@ -633,31 +633,31 @@ client6_do_ctlcommand(buf, len)
+ 	commandlen = (int)(ntohs(ctlhead->len));
+ 	version = ntohs(ctlhead->version);
+ 	if (len != sizeof(struct dhcp6ctl) + commandlen) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "assumption failure: command length mismatch");
+ 		return (DHCP6CTL_R_FAILURE);
+ 	}
+ 
+ 	/* replay protection and message authentication */
+ 	if ((now = time(NULL)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "failed to get current time: %s",
++		debug_printf(LOG_ERR, FNAME, "failed to get current time: %s",
+ 		    strerror(errno));
+ 		return (DHCP6CTL_R_FAILURE);
+ 	}
+ 	ts0 = (u_int32_t)now;
+ 	ts = ntohl(ctlhead->timestamp);
+ 	if (ts + CTLSKEW < ts0 || (ts - CTLSKEW) > ts0) {
+-		dprintf(LOG_INFO, FNAME, "timestamp is out of range");
++		debug_printf(LOG_INFO, FNAME, "timestamp is out of range");
+ 		return (DHCP6CTL_R_FAILURE);
+ 	}
+ 
+ 	if (ctlkey == NULL) {	/* should not happen!! */
+-		dprintf(LOG_ERR, FNAME, "no secret key for control channel");
++		debug_printf(LOG_ERR, FNAME, "no secret key for control channel");
+ 		return (DHCP6CTL_R_FAILURE);
+ 	}
+ 	if (dhcp6_verify_mac(buf, len, DHCP6CTL_AUTHPROTO_UNDEF,
+ 	    DHCP6CTL_AUTHALG_HMACMD5, sizeof(*ctlhead), ctlkey) != 0) {
+-		dprintf(LOG_INFO, FNAME, "authentication failure");
++		debug_printf(LOG_INFO, FNAME, "authentication failure");
+ 		return (DHCP6CTL_R_FAILURE);
+ 	}
+ 
+@@ -665,14 +665,14 @@ client6_do_ctlcommand(buf, len)
+ 	commandlen -= ctldigestlen;
+ 
+ 	if (version > DHCP6CTL_VERSION) {
+-		dprintf(LOG_INFO, FNAME, "unsupported version: %d", version);
++		debug_printf(LOG_INFO, FNAME, "unsupported version: %d", version);
+ 		return (DHCP6CTL_R_FAILURE);
+ 	}
+ 
+ 	switch (command) {
+ 	case DHCP6CTL_COMMAND_RELOAD:
+ 		if (commandlen != 0) {
+-			dprintf(LOG_INFO, FNAME, "invalid command length "
++			debug_printf(LOG_INFO, FNAME, "invalid command length "
+ 			    "for reload: %d", commandlen);
+ 			return (DHCP6CTL_R_DONE);
+ 		}
+@@ -691,7 +691,7 @@ client6_do_ctlcommand(buf, len)
+ 				return (DHCP6CTL_R_FAILURE);
+ 			break;
+ 		default:
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "unknown start target: %ul", p32);
+ 			return (DHCP6CTL_R_FAILURE);
+ 		}
+@@ -718,14 +718,14 @@ client6_do_ctlcommand(buf, len)
+ 				}
+ 				break;
+ 			default:
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "unknown start target: %ul", p32);
+ 				return (DHCP6CTL_R_FAILURE);
+ 			}
+ 		}
+ 		break;
+ 	default:
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 		    "unknown control command: %d (len=%d)",
+ 		    (int)command, commandlen);
+ 		return (DHCP6CTL_R_FAILURE);
+@@ -739,12 +739,12 @@ client6_reload()
+ {
+ 	/* reload the configuration file */
+ 	if (cfparse(conffile) != 0) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "failed to reload configuration file");
+ 		return;
+ 	}
+ 
+-	dprintf(LOG_NOTICE, FNAME, "client reloaded");
++	debug_printf(LOG_NOTICE, FNAME, "client reloaded");
+ 
+ 	return;
+ }
+@@ -757,20 +757,20 @@ client6_ifctl(ifname, command)
+ 	struct dhcp6_if *ifp;
+ 
+ 	if ((ifp = find_ifconfbyname(ifname)) == NULL) {
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 		    "failed to find interface configuration for %s",
+ 		    ifname);
+ 		return (-1);
+ 	}
+ 
+-	dprintf(LOG_DEBUG, FNAME, "%s interface %s",
++	debug_printf(LOG_DEBUG, FNAME, "%s interface %s",
+ 	    command == DHCP6CTL_COMMAND_START ? "start" : "stop", ifname);
+ 
+ 	switch(command) {
+ 	case DHCP6CTL_COMMAND_START:
+ 		free_resources(ifp);
+ 		if (client6_start(ifp)) {
+-			dprintf(LOG_NOTICE, FNAME, "failed to restart %s",
++			debug_printf(LOG_NOTICE, FNAME, "failed to restart %s",
+ 			    ifname);
+ 			return (-1);
+ 		}
+@@ -778,13 +778,13 @@ client6_ifctl(ifname, command)
+ 	case DHCP6CTL_COMMAND_STOP:
+ 		free_resources(ifp);
+ 		if (ifp->timer != NULL) {
+-			dprintf(LOG_DEBUG, FNAME,
++			debug_printf(LOG_DEBUG, FNAME,
+ 			    "removed existing timer on %s", ifp->ifname);
+ 			dhcp6_remove_timer(&ifp->timer);
+ 		}
+ 		break;
+ 	default:		/* impossible case, should be a bug */
+-		dprintf(LOG_ERR, FNAME, "unknown command: %d", (int)command);
++		debug_printf(LOG_ERR, FNAME, "unknown command: %d", (int)command);
+ 		break;
+ 	}
+ 
+@@ -797,7 +797,7 @@ client6_expire_refreshtime(arg)
+ {
+ 	struct dhcp6_if *ifp = arg;
+ 
+-	dprintf(LOG_DEBUG, FNAME,
++	debug_printf(LOG_DEBUG, FNAME,
+ 	    "information refresh time on %s expired", ifp->ifname);
+ 
+ 	dhcp6_remove_timer(&ifp->timer);
+@@ -823,7 +823,7 @@ client6_timo(arg)
+ 	 * [RFC3315 14.]
+ 	 */
+ 	if (ev->max_retrans_cnt && ev->timeouts >= ev->max_retrans_cnt) {
+-		dprintf(LOG_INFO, FNAME, "no responses were received");
++		debug_printf(LOG_INFO, FNAME, "no responses were received");
+ 		dhcp6_remove_event(ev);
+ 
+ 		if (state == DHCP6S_RELEASE)
+@@ -840,7 +840,7 @@ client6_timo(arg)
+ 		else {
+ 			ev->state = DHCP6S_SOLICIT;
+ 			if (construct_confdata(ifp, ev)) {
+-				dprintf(LOG_ERR, FNAME, "can't send solicit");
++				debug_printf(LOG_ERR, FNAME, "can't send solicit");
+ 				exit(1); /* XXX */
+ 			}
+ 		}
+@@ -856,7 +856,7 @@ client6_timo(arg)
+ 		if (!TAILQ_EMPTY(&ev->data_list))
+ 			client6_send(ev);
+ 		else {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "all information to be updated was canceled");
+ 			dhcp6_remove_event(ev);
+ 			return (NULL);
+@@ -875,13 +875,13 @@ client6_timo(arg)
+ 			ev->current_server = select_server(ev);
+ 			if (ev->current_server == NULL) {
+ 				/* this should not happen! */
+-				dprintf(LOG_NOTICE, FNAME,
++				debug_printf(LOG_NOTICE, FNAME,
+ 				    "can't find a server");
+ 				exit(1); /* XXX */
+ 			}
+ 			if (duidcpy(&ev->serverid,
+ 			    &ev->current_server->optinfo.serverID)) {
+-				dprintf(LOG_NOTICE, FNAME,
++				debug_printf(LOG_NOTICE, FNAME,
+ 				    "can't copy server ID");
+ 				return (NULL); /* XXX: better recovery? */
+ 			}
+@@ -896,7 +896,7 @@ client6_timo(arg)
+ 
+ 			if (construct_reqdata(ifp,
+ 			    &ev->current_server->optinfo, ev)) {
+-				dprintf(LOG_NOTICE, FNAME,
++				debug_printf(LOG_NOTICE, FNAME,
+ 				    "failed to construct request data");
+ 				break;
+ 			}
+@@ -930,7 +930,7 @@ construct_confdata(ifp, ev)
+ 
+ 		evd = NULL;
+ 		if ((evd = malloc(sizeof(*evd))) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to create a new event data");
+ 			goto fail;
+ 		}
+@@ -982,7 +982,7 @@ construct_confdata(ifp, ev)
+ 			TAILQ_INSERT_TAIL(&ev->data_list, evd, link);
+ 			break;
+ 		default:
+-			dprintf(LOG_ERR, FNAME, "internal error");
++			debug_printf(LOG_ERR, FNAME, "internal error");
+ 			exit(1);
+ 		}
+ 	}
+@@ -1078,7 +1078,7 @@ construct_reqdata(ifp, optinfo, ev)
+ 			TAILQ_INSERT_TAIL(&ev->data_list, evd, link);
+ 			break;
+ 		default:
+-			dprintf(LOG_ERR, FNAME, "internal error");
++			debug_printf(LOG_ERR, FNAME, "internal error");
+ 			exit(1);
+ 		}
+ 	}
+@@ -1102,7 +1102,7 @@ destruct_iadata(evd)
+ 	struct dhcp6_list *ial;
+ 
+ 	if (evd->type != DHCP6_EVDATA_IAPD && evd->type != DHCP6_EVDATA_IANA) {
+-		dprintf(LOG_ERR, FNAME, "assumption failure %d", evd->type);
++		debug_printf(LOG_ERR, FNAME, "assumption failure %d", evd->type);
+ 		exit(1);
+ 	}
+ 
+@@ -1124,7 +1124,7 @@ select_server(ev)
+ 	 */
+ 	for (s = ev->servers; s; s = s->next) {
+ 		if (s->active) {
+-			dprintf(LOG_DEBUG, FNAME, "picked a server (ID: %s)",
++			debug_printf(LOG_DEBUG, FNAME, "picked a server (ID: %s)",
+ 			    duidstr(&s->optinfo.serverID));
+ 			return (s);
+ 		}
+@@ -1185,7 +1185,7 @@ client6_send(ev)
+ 		dh6->dh6_msgtype = DH6_INFORM_REQ;
+ 		break;
+ 	default:
+-		dprintf(LOG_ERR, FNAME, "unexpected state");
++		debug_printf(LOG_ERR, FNAME, "unexpected state");
+ 		exit(1);	/* XXX */
+ 	}
+ 
+@@ -1203,7 +1203,7 @@ client6_send(ev)
+ #else
+ 		ev->xid = random() & DH6_XIDMASK;
+ #endif
+-		dprintf(LOG_DEBUG, FNAME, "a new XID (%x) is generated",
++		debug_printf(LOG_DEBUG, FNAME, "a new XID (%x) is generated",
+ 		    ev->xid);
+ 	}
+ 	dh6->dh6_xid &= ~ntohl(DH6_XIDMASK);
+@@ -1221,7 +1221,7 @@ client6_send(ev)
+ 	case DHCP6S_RENEW:
+ 	case DHCP6S_RELEASE:
+ 		if (duidcpy(&optinfo.serverID, &ev->serverid)) {
+-			dprintf(LOG_ERR, FNAME, "failed to copy server ID");
++			debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
+ 			goto end;
+ 		}
+ 		break;
+@@ -1229,7 +1229,7 @@ client6_send(ev)
+ 
+ 	/* client ID */
+ 	if (duidcpy(&optinfo.clientID, &client_duid)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy client ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
+ 		goto end;
+ 	}
+ 
+@@ -1274,7 +1274,7 @@ client6_send(ev)
+ 	/* option request options */
+ 	if (ev->state != DHCP6S_RELEASE &&
+ 	    dhcp6_copy_list(&optinfo.reqopt_list, &ifp->reqopt_list)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy requested options");
++		debug_printf(LOG_ERR, FNAME, "failed to copy requested options");
+ 		goto end;
+ 	}
+ 
+@@ -1285,7 +1285,7 @@ client6_send(ev)
+ 		case DHCP6_EVDATA_IAPD:
+ 			if (dhcp6_copy_list(&optinfo.iapd_list,
+ 			    (struct dhcp6_list *)evd->data)) {
+-				dprintf(LOG_NOTICE, FNAME,
++				debug_printf(LOG_NOTICE, FNAME,
+ 				    "failed to add an IAPD");
+ 				goto end;
+ 			}
+@@ -1293,13 +1293,13 @@ client6_send(ev)
+ 		case DHCP6_EVDATA_IANA:
+ 			if (dhcp6_copy_list(&optinfo.iana_list,
+ 			    (struct dhcp6_list *)evd->data)) {
+-				dprintf(LOG_NOTICE, FNAME,
++				debug_printf(LOG_NOTICE, FNAME,
+ 				    "failed to add an IAPD");
+ 				goto end;
+ 			}
+ 			break;
+ 		default:
+-			dprintf(LOG_ERR, FNAME, "unexpected event data (%d)",
++			debug_printf(LOG_ERR, FNAME, "unexpected event data (%d)",
+ 			    evd->type);
+ 			exit(1);
+ 		}
+@@ -1307,7 +1307,7 @@ client6_send(ev)
+ 
+ 	/* authentication information */
+ 	if (set_auth(ev, &optinfo)) {
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 		    "failed to set authentication option");
+ 		goto end;
+ 	}
+@@ -1316,7 +1316,7 @@ client6_send(ev)
+ 	if ((optlen = dhcp6_set_options(dh6->dh6_msgtype,
+ 	    (struct dhcp6opt *)(dh6 + 1),
+ 	    (struct dhcp6opt *)(buf + sizeof(buf)), &optinfo)) < 0) {
+-		dprintf(LOG_INFO, FNAME, "failed to construct options");
++		debug_printf(LOG_INFO, FNAME, "failed to construct options");
+ 		goto end;
+ 	}
+ 	len += optlen;
+@@ -1332,7 +1332,7 @@ client6_send(ev)
+ 			    optinfo.authproto, optinfo.authalgorithm,
+ 			    optinfo.delayedauth_offset + sizeof(*dh6),
+ 			    ev->authparam->key)) {
+-				dprintf(LOG_WARNING, FNAME,
++				debug_printf(LOG_WARNING, FNAME,
+ 				    "failed to calculate MAC");
+ 				goto end;
+ 			}
+@@ -1354,12 +1354,12 @@ client6_send(ev)
+ 
+ 	if (sendto(sock, buf, len, 0, (struct sockaddr *)&dst,
+ 	    sysdep_sa_len((struct sockaddr *)&dst)) == -1) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "transmit failed: %s", strerror(errno));
+ 		goto end;
+ 	}
+ 
+-	dprintf(LOG_DEBUG, FNAME, "send %s to %s",
++	debug_printf(LOG_DEBUG, FNAME, "send %s to %s",
+ 	    dhcp6msgstr(dh6->dh6_msgtype), addr2str((struct sockaddr *)&dst));
+ 
+   end:
+@@ -1417,7 +1417,7 @@ client6_recv()
+ 	mhdr.msg_control = (caddr_t)cmsgbuf;
+ 	mhdr.msg_controllen = sizeof(cmsgbuf);
+ 	if ((len = recvmsg(sock, &mhdr, 0)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "recvmsg: %s", strerror(errno));
++		debug_printf(LOG_ERR, FNAME, "recvmsg: %s", strerror(errno));
+ 		return;
+ 	}
+ 
+@@ -1431,24 +1431,24 @@ client6_recv()
+ 		}
+ 	}
+ 	if (pi == NULL) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to get packet info");
++		debug_printf(LOG_NOTICE, FNAME, "failed to get packet info");
+ 		return;
+ 	}
+ 
+ 	if ((ifp = find_ifconfbyid((unsigned int)pi->ipi6_ifindex)) == NULL) {
+-		dprintf(LOG_INFO, FNAME, "unexpected interface (%d)",
++		debug_printf(LOG_INFO, FNAME, "unexpected interface (%d)",
+ 		    (unsigned int)pi->ipi6_ifindex);
+ 		return;
+ 	}
+ 
+ 	if (len < sizeof(*dh6)) {
+-		dprintf(LOG_INFO, FNAME, "short packet (%d bytes)", len);
++		debug_printf(LOG_INFO, FNAME, "short packet (%d bytes)", len);
+ 		return;
+ 	}
+ 
+ 	dh6 = (struct dhcp6 *)rbuf;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "receive %s from %s on %s",
++	debug_printf(LOG_DEBUG, FNAME, "receive %s from %s on %s",
+ 	    dhcp6msgstr(dh6->dh6_msgtype),
+ 	    addr2str((struct sockaddr *)&from), ifp->ifname);
+ 
+@@ -1457,7 +1457,7 @@ client6_recv()
+ 	p = (struct dhcp6opt *)(dh6 + 1);
+ 	ep = (struct dhcp6opt *)((char *)dh6 + len);
+ 	if (dhcp6_get_options(p, ep, &optinfo) < 0) {
+-		dprintf(LOG_INFO, FNAME, "failed to parse options");
++		debug_printf(LOG_INFO, FNAME, "failed to parse options");
+ 		return;
+ 	}
+ 
+@@ -1469,7 +1469,7 @@ client6_recv()
+ 		(void)client6_recvreply(ifp, dh6, len, &optinfo);
+ 		break;
+ 	default:
+-		dprintf(LOG_INFO, FNAME, "received an unexpected message (%s) "
++		debug_printf(LOG_INFO, FNAME, "received an unexpected message (%s) "
+ 		    "from %s", dhcp6msgstr(dh6->dh6_msgtype),
+ 		    addr2str((struct sockaddr *)&from));
+ 		break;
+@@ -1494,32 +1494,32 @@ client6_recvadvert(ifp, dh6, len, optinfo)
+ 	/* find the corresponding event based on the received xid */
+ 	ev = find_event_withid(ifp, ntohl(dh6->dh6_xid) & DH6_XIDMASK);
+ 	if (ev == NULL) {
+-		dprintf(LOG_INFO, FNAME, "XID mismatch");
++		debug_printf(LOG_INFO, FNAME, "XID mismatch");
+ 		return (-1);
+ 	}
+ 
+ 	/* packet validation based on Section 15.3 of RFC3315. */
+ 	if (optinfo->serverID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no server ID option");
++		debug_printf(LOG_INFO, FNAME, "no server ID option");
+ 		return (-1);
+ 	} else {
+-		dprintf(LOG_DEBUG, FNAME, "server ID: %s, pref=%d",
++		debug_printf(LOG_DEBUG, FNAME, "server ID: %s, pref=%d",
+ 		    duidstr(&optinfo->serverID),
+ 		    optinfo->pref);
+ 	}
+ 	if (optinfo->clientID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no client ID option");
++		debug_printf(LOG_INFO, FNAME, "no client ID option");
+ 		return (-1);
+ 	}
+ 	if (duidcmp(&optinfo->clientID, &client_duid)) {
+-		dprintf(LOG_INFO, FNAME, "client DUID mismatch");
++		debug_printf(LOG_INFO, FNAME, "client DUID mismatch");
+ 		return (-1);
+ 	}
+ 
+ 	/* validate authentication */
+ 	authparam0 = *ev->authparam;
+ 	if (process_auth(&authparam0, dh6, len, optinfo)) {
+-		dprintf(LOG_INFO, FNAME, "failed to process authentication");
++		debug_printf(LOG_INFO, FNAME, "failed to process authentication");
+ 		return (-1);
+ 	}
+ 
+@@ -1552,7 +1552,7 @@ client6_recvadvert(ifp, dh6, len, optinfo)
+ 		}
+ 		if (dhcp6_find_listval(&optinfo->stcode_list,
+ 		    DHCP6_LISTVAL_STCODE, &stcode, 0)) {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "advertise contains %s status", stcodestr);
+ 			return (-1);
+ 		}
+@@ -1567,20 +1567,20 @@ client6_recvadvert(ifp, dh6, len, optinfo)
+ 		 * We process the message as if we expected the Advertise.
+ 		 * [RFC3315 Section 17.1.4]
+ 		 */
+-		dprintf(LOG_INFO, FNAME, "unexpected advertise");
++		debug_printf(LOG_INFO, FNAME, "unexpected advertise");
+ 		/* proceed anyway */
+ 	}
+ 
+ 	/* ignore the server if it is known */
+ 	if (find_server(ev, &optinfo->serverID)) {
+-		dprintf(LOG_INFO, FNAME, "duplicated server (ID: %s)",
++		debug_printf(LOG_INFO, FNAME, "duplicated server (ID: %s)",
+ 		    duidstr(&optinfo->serverID));
+ 		return (-1);
+ 	}
+ 
+ 	/* keep the server */
+ 	if ((newserver = malloc(sizeof(*newserver))) == NULL) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "memory allocation failed for server");
+ 		return (-1);
+ 	}
+@@ -1595,7 +1595,7 @@ client6_recvadvert(ifp, dh6, len, optinfo)
+ 	/* allocate new authentication parameter for the soliciting event */
+ 	if ((authparam = new_authparam(ev->authparam->authproto,
+ 	    ev->authparam->authalgorithm, ev->authparam->authrdm)) == NULL) {
+-		dprintf(LOG_WARNING, FNAME, "memory allocation failed "
++		debug_printf(LOG_WARNING, FNAME, "memory allocation failed "
+ 		    "for authentication parameters");
+ 		free(newserver);
+ 		return (-1);
+@@ -1605,7 +1605,7 @@ client6_recvadvert(ifp, dh6, len, optinfo)
+ 	/* copy options */
+ 	dhcp6_init_options(&newserver->optinfo);
+ 	if (dhcp6_copy_options(&newserver->optinfo, optinfo)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy options");
++		debug_printf(LOG_ERR, FNAME, "failed to copy options");
+ 		if (newserver->authparam != NULL)
+ 			free(newserver->authparam);
+ 		free(newserver);
+@@ -1633,11 +1633,11 @@ client6_recvadvert(ifp, dh6, len, optinfo)
+ 		ev->current_server = newserver;
+ 		if (duidcpy(&ev->serverid,
+ 		    &ev->current_server->optinfo.serverID)) {
+-			dprintf(LOG_NOTICE, FNAME, "can't copy server ID");
++			debug_printf(LOG_NOTICE, FNAME, "can't copy server ID");
+ 			return (-1); /* XXX: better recovery? */
+ 		}
+ 		if (construct_reqdata(ifp, &ev->current_server->optinfo, ev)) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to construct request data");
+ 			return (-1); /* XXX */
+ 		}
+@@ -1673,7 +1673,7 @@ client6_recvadvert(ifp, dh6, len, optinfo)
+ 		else
+ 			timo.tv_sec = timo.tv_usec = 0;
+ 
+-		dprintf(LOG_DEBUG, FNAME, "reset timer for %s to %d.%06d",
++		debug_printf(LOG_DEBUG, FNAME, "reset timer for %s to %d.%06d",
+ 		    ifp->ifname, (int)timo.tv_sec, (int)timo.tv_usec);
+ 
+ 		dhcp6_set_timer(&timo, ev->timer);
+@@ -1711,7 +1711,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
+ 	/* find the corresponding event based on the received xid */
+ 	ev = find_event_withid(ifp, ntohl(dh6->dh6_xid) & DH6_XIDMASK);
+ 	if (ev == NULL) {
+-		dprintf(LOG_INFO, FNAME, "XID mismatch");
++		debug_printf(LOG_INFO, FNAME, "XID mismatch");
+ 		return (-1);
+ 	}
+ 
+@@ -1723,13 +1723,13 @@ client6_recvreply(ifp, dh6, len, optinfo)
+ 	    state != DHCP6S_RELEASE &&
+ 	    (state != DHCP6S_SOLICIT ||
+ 	     !(ifp->send_flags & DHCIFF_RAPID_COMMIT))) {
+-		dprintf(LOG_INFO, FNAME, "unexpected reply");
++		debug_printf(LOG_INFO, FNAME, "unexpected reply");
+ 		return (-1);
+ 	}
+ 
+ 	/* A Reply message must contain a Server ID option */
+ 	if (optinfo->serverID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no server ID option");
++		debug_printf(LOG_INFO, FNAME, "no server ID option");
+ 		return (-1);
+ 	}
+ 
+@@ -1738,17 +1738,17 @@ client6_recvreply(ifp, dh6, len, optinfo)
+ 	 * client implementation) must match ours.
+ 	 */
+ 	if (optinfo->clientID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no client ID option");
++		debug_printf(LOG_INFO, FNAME, "no client ID option");
+ 		return (-1);
+ 	}
+ 	if (duidcmp(&optinfo->clientID, &client_duid)) {
+-		dprintf(LOG_INFO, FNAME, "client DUID mismatch");
++		debug_printf(LOG_INFO, FNAME, "client DUID mismatch");
+ 		return (-1);
+ 	}
+ 
+ 	/* validate authentication */
+ 	if (process_auth(ev->authparam, dh6, len, optinfo)) {
+-		dprintf(LOG_INFO, FNAME, "failed to process authentication");
++		debug_printf(LOG_INFO, FNAME, "failed to process authentication");
+ 		return (-1);
+ 	}
+ 
+@@ -1762,7 +1762,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
+ 	if (state == DHCP6S_SOLICIT &&
+ 	    (ifp->send_flags & DHCIFF_RAPID_COMMIT) &&
+ 	    !optinfo->rapidcommit) {
+-		dprintf(LOG_INFO, FNAME, "no rapid commit");
++		debug_printf(LOG_INFO, FNAME, "no rapid commit");
+ 		return (-1);
+ 	}
+ 
+@@ -1773,7 +1773,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
+ 	 */
+ 	for (lv = TAILQ_FIRST(&optinfo->stcode_list); lv;
+ 	     lv = TAILQ_NEXT(lv, link)) {
+-		dprintf(LOG_INFO, FNAME, "status code: %s",
++		debug_printf(LOG_INFO, FNAME, "status code: %s",
+ 		    dhcp6_stcodestr(lv->val_num16));
+ 	}
+ 
+@@ -1837,7 +1837,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
+ 	 * configuration parameters.
+ 	 */
+ 	if (ifp->scriptpath != NULL && strlen(ifp->scriptpath) != 0) {
+-		dprintf(LOG_DEBUG, FNAME, "executes %s", ifp->scriptpath);
++		debug_printf(LOG_DEBUG, FNAME, "executes %s", ifp->scriptpath);
+ 		client6_script(ifp->scriptpath, state, optinfo);
+ 	}
+ 
+@@ -1855,7 +1855,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
+ 
+ 		ifp->timer = dhcp6_add_timer(client6_expire_refreshtime, ifp);
+ 		if (ifp->timer == NULL) {
+-			dprintf(LOG_WARNING, FNAME,
++			debug_printf(LOG_WARNING, FNAME,
+ 			    "failed to add timer for refresh time");
+ 		} else {
+ 			struct timeval tv;
+@@ -1868,7 +1868,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
+ 				 * XXX: tv_sec can overflow for an
+ 				 * unsigned 32bit value.
+ 				 */
+-				dprintf(LOG_WARNING, FNAME,
++				debug_printf(LOG_WARNING, FNAME,
+ 				    "refresh time is too large: %lu",
+ 				    (u_int32_t)refreshtime);
+ 				tv.tv_sec = 0x7fffffff;	/* XXX */
+@@ -1881,7 +1881,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
+ 		 * draft-ietf-dhc-lifetime-02 clarifies that refresh time
+ 		 * is only used for information-request and reply exchanges.
+ 		 */
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 		    "unexpected information refresh time option (ignored)");
+ 	}
+ 
+@@ -1906,7 +1906,7 @@ client6_recvreply(ifp, dh6, len, optinfo)
+ 		check_exit();
+ 	}
+ 
+-	dprintf(LOG_DEBUG, FNAME, "got an expected reply, sleeping.");
++	debug_printf(LOG_DEBUG, FNAME, "got an expected reply, sleeping.");
+ 
+ 	if (infreq_mode) {
+ 		exit_ok = 1;
+@@ -1949,19 +1949,19 @@ process_auth(authparam, dh6, len, optinfo)
+ 		break;
+ 	case DHCP6_AUTHPROTO_DELAYED:
+ 		if ((optinfo->authflags & DHCP6OPT_AUTHFLAG_NOINFO)) {
+-			dprintf(LOG_INFO, FNAME, "server did not include "
++			debug_printf(LOG_INFO, FNAME, "server did not include "
+ 			    "authentication information");
+ 			break;
+ 		}
+ 
+ 		if (optinfo->authalgorithm != DHCP6_AUTHALG_HMACMD5) {
+-			dprintf(LOG_INFO, FNAME, "unknown authentication "
++			debug_printf(LOG_INFO, FNAME, "unknown authentication "
+ 			    "algorithm (%d)", optinfo->authalgorithm);
+ 			break;
+ 		}
+ 
+ 		if (optinfo->authrdm != DHCP6_AUTHRDM_MONOCOUNTER) {
+-			dprintf(LOG_INFO, FNAME,"unknown RDM (%d)",
++			debug_printf(LOG_INFO, FNAME,"unknown RDM (%d)",
+ 			    optinfo->authrdm);
+ 			break;
+ 		}
+@@ -1971,12 +1971,12 @@ process_auth(authparam, dh6, len, optinfo)
+ 		 * we accept the message anyway (XXX).
+ 		 */
+ 		if ((authparam->flags & AUTHPARAM_FLAGS_NOPREVRD)) {
+-			dprintf(LOG_WARNING, FNAME, "previous RD value is "
++			debug_printf(LOG_WARNING, FNAME, "previous RD value is "
+ 			    "unknown (accept it)");
+ 		} else {
+ 			if (dhcp6_auth_replaycheck(optinfo->authrdm,
+ 			    authparam->prevrd, optinfo->authrd)) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "possible replay attack detected");
+ 				break;
+ 			}
+@@ -1993,7 +1993,7 @@ process_auth(authparam, dh6, len, optinfo)
+ 			    optinfo->delayedauth_realmlen != key->realmlen ||
+ 			    memcmp(optinfo->delayedauth_realmval, key->realm,
+ 			    key->realmlen) != 0) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "authentication key mismatch");
+ 				break;
+ 			}
+@@ -2002,12 +2002,12 @@ process_auth(authparam, dh6, len, optinfo)
+ 			    optinfo->delayedauth_realmlen,
+ 			    optinfo->delayedauth_keyid);
+ 			if (key == NULL) {
+-				dprintf(LOG_INFO, FNAME, "failed to find key "
++				debug_printf(LOG_INFO, FNAME, "failed to find key "
+ 				    "provided by the server (ID: %x)",
+ 				    optinfo->delayedauth_keyid);
+ 				break;
+ 			} else {
+-				dprintf(LOG_DEBUG, FNAME, "found key for "
++				debug_printf(LOG_DEBUG, FNAME, "found key for "
+ 				    "authentication: %s", key->name);
+ 			}
+ 			authparam->key = key;
+@@ -2015,7 +2015,7 @@ process_auth(authparam, dh6, len, optinfo)
+ 
+ 		/* check for the key lifetime */
+ 		if (dhcp6_validate_key(key)) {
+-			dprintf(LOG_INFO, FNAME, "key %s has expired",
++			debug_printf(LOG_INFO, FNAME, "key %s has expired",
+ 			    key->name);
+ 			break;
+ 		}
+@@ -2024,24 +2024,24 @@ process_auth(authparam, dh6, len, optinfo)
+ 		if (dhcp6_verify_mac((char *)dh6, len, optinfo->authproto,
+ 		    optinfo->authalgorithm,
+ 		    optinfo->delayedauth_offset + sizeof(*dh6), key) == 0) {
+-			dprintf(LOG_DEBUG, FNAME, "message authentication "
++			debug_printf(LOG_DEBUG, FNAME, "message authentication "
+ 			    "validated");
+ 			authenticated = 1;
+ 		} else {
+-			dprintf(LOG_INFO, FNAME, "invalid message "
++			debug_printf(LOG_INFO, FNAME, "invalid message "
+ 			    "authentication");
+ 		}
+ 
+ 		break;
+ 	default:
+-		dprintf(LOG_INFO, FNAME, "server sent unsupported "
++		debug_printf(LOG_INFO, FNAME, "server sent unsupported "
+ 		    "authentication protocol (%d)", optinfo->authproto);
+ 		break;
+ 	}
+ 
+ 	if (authenticated == 0) {
+ 		if (authparam->authproto != DHCP6_AUTHPROTO_UNDEF) {
+-			dprintf(LOG_INFO, FNAME, "message not authenticated "
++			debug_printf(LOG_INFO, FNAME, "message not authenticated "
+ 			    "while authentication required");
+ 
+ 			/*
+@@ -2084,7 +2084,7 @@ set_auth(ev, optinfo)
+ 			 * exchanges doesn't work.  Specification is also
+ 			 * unclear on this usage.
+ 			 */
+-			dprintf(LOG_WARNING, FNAME, "delayed authentication "
++			debug_printf(LOG_WARNING, FNAME, "delayed authentication "
+ 			    "cannot be used for Information-request yet");
+ 			return (-1);
+ 		}
+@@ -2095,21 +2095,21 @@ set_auth(ev, optinfo)
+ 		}
+ 
+ 		if (authparam->key == NULL) {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "no authentication key for %s",
+ 			    dhcp6_event_statestr(ev));
+ 			return (-1);
+ 		}
+ 
+ 		if (dhcp6_validate_key(authparam->key)) {
+-			dprintf(LOG_INFO, FNAME, "key %s is invalid",
++			debug_printf(LOG_INFO, FNAME, "key %s is invalid",
+ 			    authparam->key->name);
+ 			return (-1);
+ 		}
+ 
+ 		if (get_rdvalue(optinfo->authrdm, &optinfo->authrd,
+ 		    sizeof(optinfo->authrd))) {
+-			dprintf(LOG_ERR, FNAME, "failed to get a replay "
++			debug_printf(LOG_ERR, FNAME, "failed to get a replay "
+ 			    "detection value");
+ 			return (-1);
+ 		}
+@@ -2119,7 +2119,7 @@ set_auth(ev, optinfo)
+ 		optinfo->delayedauth_realmval =
+ 		    malloc(optinfo->delayedauth_realmlen);
+ 		if (optinfo->delayedauth_realmval == NULL) {
+-			dprintf(LOG_ERR, FNAME, "failed to allocate memory "
++			debug_printf(LOG_ERR, FNAME, "failed to allocate memory "
+ 			    "for authentication realm");
+ 			return (-1);
+ 		}
+@@ -2128,7 +2128,7 @@ set_auth(ev, optinfo)
+ 
+ 		break;
+ 	default:
+-		dprintf(LOG_ERR, FNAME, "unsupported authentication protocol "
++		debug_printf(LOG_ERR, FNAME, "unsupported authentication protocol "
+ 		    "%d", authparam->authproto);
+ 		return (-1);
+ 	}
+@@ -2145,7 +2145,7 @@ info_printf(const char *fmt, ...)
+ 	va_start(ap, fmt);
+ 	vsnprintf(logbuf, sizeof(logbuf), fmt, ap);
+ 
+-	dprintf(LOG_DEBUG, FNAME, "%s", logbuf);
++	debug_printf(LOG_DEBUG, FNAME, "%s", logbuf);
+ 	if (infreq_mode)
+ 		printf("%s\n", logbuf);
+ 
+diff --git a/dhcp6c_ia.c b/dhcp6c_ia.c
+index 6877c20..1dc37d3 100644
+--- a/dhcp6c_ia.c
++++ b/dhcp6c_ia.c
+@@ -122,7 +122,7 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
+ 		 * We apply the same rule to IA_PD as well.
+ 		 */
+ 		if (iav->val_ia.t2 != 0 && iav->val_ia.t1 > iav->val_ia.t2) {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "invalid IA: T1(%lu) > T2(%lu)",
+ 			    iav->val_ia.t1, iav->val_ia.t2);
+ 			continue;
+@@ -131,14 +131,14 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
+ 		/* locate the local IA or make a new one */
+ 		ia = get_ia(iatype, ifp, iac, iav, serverid);
+ 		if (ia == NULL) {
+-			dprintf(LOG_WARNING, FNAME, "failed to get an IA "
++			debug_printf(LOG_WARNING, FNAME, "failed to get an IA "
+ 			    "type: %s, ID: %u", iastr(iac->type), iac->iaid);
+ 			continue;
+ 		}
+ 
+ 		/* update authentication parameters */
+ 		if (update_authparam(ia, authparam)) {
+-			dprintf(LOG_WARNING, FNAME, "failed to update "
++			debug_printf(LOG_WARNING, FNAME, "failed to update "
+ 			    "authentication param for IA "
+ 			    "type: %s, ID: %u", iastr(iac->type), iac->iaid);
+ 			remove_ia(ia);
+@@ -155,7 +155,7 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
+ 				if (update_prefix(ia, &siav->val_prefix6,
+ 				    &iapdc->iapd_pif_list, ifp, &ia->ctl,
+ 				    callback)) {
+-					dprintf(LOG_NOTICE, FNAME,
++					debug_printf(LOG_NOTICE, FNAME,
+ 					    "failed to update a prefix %s/%d",
+ 					    in6addr2str(&siav->val_prefix6.addr, 0),
+ 					    siav->val_prefix6.plen);
+@@ -165,13 +165,13 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
+ 				ianac = (struct iana_conf *)iac;
+ 				if (update_address(ia, &siav->val_statefuladdr6,
+ 				    ifp, &ia->ctl, callback)) {
+-					dprintf(LOG_NOTICE, FNAME,
++					debug_printf(LOG_NOTICE, FNAME,
+ 					    "failed to update an address %s",
+ 					    in6addr2str(&siav->val_statefuladdr6.addr, 0));
+ 				}
+ 				break;
+ 			case DHCP6_LISTVAL_STCODE:
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "status code for %s-%lu: %s",
+ 				    iastr(iatype), iav->val_ia.iaid,
+ 				    dhcp6_stcodestr(siav->val_num16));
+@@ -187,7 +187,7 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
+ 					 * [RFC3315 18.1.8]
+ 					 * XXX: what about the PD case?
+ 					 */
+-					dprintf(LOG_INFO, FNAME,
++					debug_printf(LOG_INFO, FNAME,
+ 					    "receive NoBinding against "
+ 					    "renew/rebind for %s-%lu",
+ 					    iastr(ia->conf->type),
+@@ -197,14 +197,14 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
+ 				}
+ 				break;
+ 			default:
+-				dprintf(LOG_ERR, FNAME, "impossible case");
++				debug_printf(LOG_ERR, FNAME, "impossible case");
+ 				goto nextia;
+ 			}
+ 		}
+ 
+ 		/* see if this IA is still valid.  if not, remove it. */
+ 		if (ia->ctl == NULL || !(*ia->ctl->isvalid)(ia->ctl)) {
+-			dprintf(LOG_DEBUG, FNAME, "IA %s-%lu is invalidated",
++			debug_printf(LOG_DEBUG, FNAME, "IA %s-%lu is invalidated",
+ 			    iastr(ia->conf->type), ia->conf->iaid);
+ 			remove_ia(ia);
+ 			continue;
+@@ -236,7 +236,7 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
+ 			if (ia->t1 > ia->t2)
+ 				ia->t1 = ia->t2 * 5 / 8;
+ 
+-			dprintf(LOG_INFO, FNAME, "T1(%lu) and/or T2(%lu) "
++			debug_printf(LOG_INFO, FNAME, "T1(%lu) and/or T2(%lu) "
+ 			    "is locally determined",  ia->t1, ia->t2);
+ 		}
+ 
+@@ -246,11 +246,11 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
+ 		 * without renewal.
+ 		 */
+ 		if (ia->t2 < DHCP6_DURATION_MIN) {
+-			dprintf(LOG_INFO, FNAME, "T1 (%lu) or T2 (%lu) "
++			debug_printf(LOG_INFO, FNAME, "T1 (%lu) or T2 (%lu) "
+ 			    "is too small", ia->t1, ia->t2);
+ 			ia->t2 = DHCP6_DURATION_MIN;
+ 			ia->t1 = ia->t2 * 5 / 8;
+-			dprintf(LOG_INFO, "", "  adjusted to %lu and %lu",
++			debug_printf(LOG_INFO, "", "  adjusted to %lu and %lu",
+ 			    ia->t1, ia->t2);
+ 		}
+ 
+@@ -262,7 +262,7 @@ update_ia(iatype, ialist, ifp, serverid, authparam)
+ 			if (ia->timer == NULL)
+ 				ia->timer = dhcp6_add_timer(ia_timo, ia);
+ 			if (ia->timer == NULL) {
+-				dprintf(LOG_ERR, FNAME,
++				debug_printf(LOG_ERR, FNAME,
+ 				    "failed to add IA timer");
+ 				remove_ia(ia); /* XXX */
+ 				continue;
+@@ -289,7 +289,7 @@ update_authparam(ia, authparam)
+ 
+ 	if (ia->authparam == NULL) {
+ 		if ((ia->authparam = copy_authparam(authparam)) == NULL) {
+-			dprintf(LOG_WARNING, FNAME,
++			debug_printf(LOG_WARNING, FNAME,
+ 			    "failed to copy authparam");
+ 			return (-1);
+ 		}
+@@ -311,11 +311,11 @@ reestablish_ia(ia)
+ 	struct dhcp6_event *ev;
+ 	struct dhcp6_eventdata *evd;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "re-establishing IA: %s-%lu", 
++	debug_printf(LOG_DEBUG, FNAME, "re-establishing IA: %s-%lu", 
+ 	    iastr(ia->conf->type), ia->conf->iaid);
+ 
+ 	if (ia->state != IAS_RENEW && ia->state != IAS_REBIND) {
+-		dprintf(LOG_ERR, FNAME, "internal error (invalid IA status)");
++		debug_printf(LOG_ERR, FNAME, "internal error (invalid IA status)");
+ 		exit(1);	/* XXX */
+ 	}
+ 
+@@ -333,19 +333,19 @@ reestablish_ia(ia)
+ 		dhcp6_remove_timer(&ia->timer);
+ 
+ 	if ((ev = dhcp6_create_event(ia->ifp, DHCP6S_REQUEST)) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to create a new event");
++		debug_printf(LOG_NOTICE, FNAME, "failed to create a new event");
+ 		goto fail;
+ 	}
+ 	TAILQ_INSERT_TAIL(&ia->ifp->event_list, ev, link);
+ 
+ 	if ((ev->timer = dhcp6_add_timer(client6_timo, ev)) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to create a new event timer");
+ 		goto fail;
+ 	}
+ 
+ 	if ((evd = malloc(sizeof(*evd))) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to create a new event data");
+ 		goto fail;
+ 	}
+@@ -354,7 +354,7 @@ reestablish_ia(ia)
+ 	TAILQ_INSERT_TAIL(&ev->data_list, evd, link);
+ 
+ 	if (duidcpy(&ev->serverid, &ia->serverid)) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to copy server ID");
++		debug_printf(LOG_NOTICE, FNAME, "failed to copy server ID");
+ 		goto fail;
+ 	}
+ 
+@@ -365,7 +365,7 @@ reestablish_ia(ia)
+ 	if (ia->ctl && ia->ctl->reestablish_data) {
+ 		if ((*ia->ctl->reestablish_data)(ia->ctl, &iaparam,
+ 		    &ia->evdata, evd)) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to make reestablish data");
+ 			goto fail;
+ 		}
+@@ -373,7 +373,7 @@ reestablish_ia(ia)
+ 
+ 	if (ia->authparam != NULL) {
+ 		if ((ev->authparam = copy_authparam(ia->authparam)) == NULL) {
+-			dprintf(LOG_WARNING, FNAME,
++			debug_printf(LOG_WARNING, FNAME,
+ 			    "failed to copy authparam");
+ 			goto fail;
+ 		}
+@@ -402,7 +402,7 @@ callback(ia)
+ {
+ 	/* see if this IA is still valid.  if not, remove it. */
+ 	if (ia->ctl == NULL || !(*ia->ctl->isvalid)(ia->ctl)) {
+-		dprintf(LOG_DEBUG, FNAME, "IA %s-%lu is invalidated",
++		debug_printf(LOG_DEBUG, FNAME, "IA %s-%lu is invalidated",
+ 		    iastr(ia->conf->type), ia->conf->iaid);
+ 		remove_ia(ia);
+ 	}
+@@ -441,30 +441,30 @@ release_ia(ia)
+ 	struct dhcp6_event *ev;
+ 	struct dhcp6_eventdata *evd;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "release an IA: %s-%lu",
++	debug_printf(LOG_DEBUG, FNAME, "release an IA: %s-%lu",
+ 	    iastr(ia->conf->type), ia->conf->iaid);
+ 
+ 	if ((ev = dhcp6_create_event(ia->ifp, DHCP6S_RELEASE))
+ 	    == NULL) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to create a new event");
++		debug_printf(LOG_NOTICE, FNAME, "failed to create a new event");
+ 		goto fail;
+ 	}
+ 	TAILQ_INSERT_TAIL(&ia->ifp->event_list, ev, link);
+ 
+ 
+ 	if ((ev->timer = dhcp6_add_timer(client6_timo, ev)) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to create a new event timer");
+ 		goto fail;
+ 	}
+ 
+ 	if (duidcpy(&ev->serverid, &ia->serverid)) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to copy server ID");
++		debug_printf(LOG_NOTICE, FNAME, "failed to copy server ID");
+ 		goto fail;
+ 	}
+ 
+ 	if ((evd = malloc(sizeof(*evd))) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to create a new event data");
+ 		goto fail;
+ 	}
+@@ -476,7 +476,7 @@ release_ia(ia)
+ 
+ 	if (ia->ctl && ia->ctl->release_data) {
+ 		if ((*ia->ctl->release_data)(ia->ctl, &iaparam, NULL, evd)) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to make release data");
+ 			goto fail;
+ 		}
+@@ -489,7 +489,7 @@ release_ia(ia)
+ 
+ 	if (ia->authparam != NULL) {
+ 		if ((ev->authparam = copy_authparam(ia->authparam)) == NULL) {
+-			dprintf(LOG_WARNING, FNAME,
++			debug_printf(LOG_WARNING, FNAME,
+ 			    "failed to copy authparam");
+ 			goto fail;
+ 		}
+@@ -513,7 +513,7 @@ remove_ia(ia)
+ 	struct ia_conf *iac = ia->conf;
+ 	struct dhcp6_if *ifp = ia->ifp;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "remove an IA: %s-%lu",
++	debug_printf(LOG_DEBUG, FNAME, "remove an IA: %s-%lu",
+ 	    iastr(ia->conf->type), ia->conf->iaid);
+ 
+ 	TAILQ_REMOVE(&iac->iadata, ia, link);
+@@ -553,7 +553,7 @@ ia_timo(arg)
+ 	struct timeval timo;
+ 	int dhcpstate;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "IA timeout for %s-%lu, state=%s",
++	debug_printf(LOG_DEBUG, FNAME, "IA timeout for %s-%lu, state=%s",
+ 	    iastr(ia->conf->type), ia->conf->iaid, statestr(ia->state));
+ 
+ 	/* cancel the current event for the prefix. */
+@@ -586,25 +586,25 @@ ia_timo(arg)
+ 		dhcp6_remove_timer(&ia->timer);
+ 		break;
+ 	default:
+-		dprintf(LOG_ERR, FNAME, "invalid IA state (%d)",
++		debug_printf(LOG_ERR, FNAME, "invalid IA state (%d)",
+ 		    (int)ia->state);
+ 		return (NULL);	/* XXX */
+ 	}
+ 
+ 	if ((ev = dhcp6_create_event(ia->ifp, dhcpstate)) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to create a new event");
++		debug_printf(LOG_NOTICE, FNAME, "failed to create a new event");
+ 		goto fail;
+ 	}
+ 	TAILQ_INSERT_TAIL(&ia->ifp->event_list, ev, link);
+ 
+ 	if ((ev->timer = dhcp6_add_timer(client6_timo, ev)) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to create a new event timer");
+ 		goto fail;
+ 	}
+ 
+ 	if ((evd = malloc(sizeof(*evd))) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to create a new event data");
+ 		goto fail;
+ 	}
+@@ -614,7 +614,7 @@ ia_timo(arg)
+ 
+ 	if (ia->state == IAS_RENEW) {
+ 		if (duidcpy(&ev->serverid, &ia->serverid)) {
+-			dprintf(LOG_NOTICE, FNAME, "failed to copy server ID");
++			debug_printf(LOG_NOTICE, FNAME, "failed to copy server ID");
+ 			goto fail;
+ 		}
+ 	}
+@@ -627,7 +627,7 @@ ia_timo(arg)
+ 		if (ia->ctl && ia->ctl->renew_data) {
+ 			if ((*ia->ctl->renew_data)(ia->ctl, &iaparam,
+ 			    &ia->evdata, evd)) {
+-				dprintf(LOG_NOTICE, FNAME,
++				debug_printf(LOG_NOTICE, FNAME,
+ 				    "failed to make renew data");
+ 				goto fail;
+ 			}
+@@ -637,7 +637,7 @@ ia_timo(arg)
+ 		if (ia->ctl && ia->ctl->rebind_data) {
+ 			if ((*ia->ctl->rebind_data)(ia->ctl, &iaparam,
+ 			    &ia->evdata, evd)) {
+-				dprintf(LOG_NOTICE, FNAME,
++				debug_printf(LOG_NOTICE, FNAME,
+ 				    "failed to make rebind data");
+ 				goto fail;
+ 			}
+@@ -653,7 +653,7 @@ ia_timo(arg)
+ 
+ 	if (ia->authparam != NULL) {
+ 		if ((ev->authparam = copy_authparam(ia->authparam)) == NULL) {
+-			dprintf(LOG_WARNING, FNAME,
++			debug_printf(LOG_WARNING, FNAME,
+ 			    "failed to copy authparam");
+ 			goto fail;
+ 		}
+@@ -693,13 +693,13 @@ get_ia(type, ifp, iac, iaparam, serverid)
+ 	int create = 0;
+ 
+ 	if (duidcpy(&newserver, serverid)) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to copy server ID");
++		debug_printf(LOG_NOTICE, FNAME, "failed to copy server ID");
+ 		return (NULL);
+ 	}
+ 
+ 	if ((ia = find_ia(iac, type, iaparam->val_ia.iaid)) == NULL) {
+ 		if ((ia = malloc(sizeof(*ia))) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME, "memory allocation failed");
++			debug_printf(LOG_NOTICE, FNAME, "memory allocation failed");
+ 			duidfree(&newserver); /* XXX */
+ 			return (NULL);
+ 		}
+@@ -718,7 +718,7 @@ get_ia(type, ifp, iac, iaparam, serverid)
+ 	ia->ifp = ifp;
+ 	ia->serverid = newserver;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "%s an IA: %s-%lu",
++	debug_printf(LOG_DEBUG, FNAME, "%s an IA: %s-%lu",
+ 	    create ? "make" : "update", iastr(type), ia->conf->iaid);
+ 
+ 	return (ia);
+diff --git a/dhcp6c_script.c b/dhcp6c_script.c
+index 05ccf8c..583ac7d 100644
+--- a/dhcp6c_script.c
++++ b/dhcp6c_script.c
+@@ -156,7 +156,7 @@ client6_script(scriptpath, state, optinfo)
+ 
+ 	/* allocate an environments array */
+ 	if ((envp = malloc(sizeof (char *) * envc)) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to allocate environment buffer");
+ 		return -1;
+ 	}
+@@ -168,7 +168,7 @@ client6_script(scriptpath, state, optinfo)
+ 	i = 0;
+ 	/* reason */
+ 	if ((envp[i++] = strdup(reason)) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to allocate reason strings");
+ 		ret = -1;
+ 		goto clean;
+@@ -178,7 +178,7 @@ client6_script(scriptpath, state, optinfo)
+ 		elen = sizeof (dnsserver_str) +
+ 		    (INET6_ADDRSTRLEN + 1) * dnsservers + 1;
+ 		if ((s = envp[i++] = malloc(elen)) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to allocate strings for DNS servers");
+ 			ret = -1;
+ 			goto clean;
+@@ -198,7 +198,7 @@ client6_script(scriptpath, state, optinfo)
+ 		elen = sizeof (ntpserver_str) +
+ 		    (INET6_ADDRSTRLEN + 1) * ntpservers + 1;
+ 		if ((s = envp[i++] = malloc(elen)) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to allocate strings for NTP servers");
+ 			ret = -1;
+ 			goto clean;
+@@ -218,7 +218,7 @@ client6_script(scriptpath, state, optinfo)
+ 	if (dnsnamelen) {
+ 		elen = sizeof (dnsname_str) + dnsnamelen + 1;
+ 		if ((s = envp[i++] = malloc(elen)) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to allocate strings for DNS name");
+ 			ret = -1;
+ 			goto clean;
+@@ -236,7 +236,7 @@ client6_script(scriptpath, state, optinfo)
+ 		elen = sizeof (sipserver_str) +
+ 		    (INET6_ADDRSTRLEN + 1) * sipservers + 1;
+ 		if ((s = envp[i++] = malloc(elen)) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to allocate strings for SIP servers");
+ 			ret = -1;
+ 			goto clean;
+@@ -255,7 +255,7 @@ client6_script(scriptpath, state, optinfo)
+ 	if (sipnamelen) {
+ 		elen = sizeof (sipname_str) + sipnamelen + 1;
+ 		if ((s = envp[i++] = malloc(elen)) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to allocate strings for SIP domain name");
+ 			ret = -1;
+ 			goto clean;
+@@ -273,7 +273,7 @@ client6_script(scriptpath, state, optinfo)
+ 		elen = sizeof (nisserver_str) +
+ 		    (INET6_ADDRSTRLEN + 1) * nisservers + 1;
+ 		if ((s = envp[i++] = malloc(elen)) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to allocate strings for NIS servers");
+ 			ret = -1;
+ 			goto clean;
+@@ -292,7 +292,7 @@ client6_script(scriptpath, state, optinfo)
+ 	if (nisnamelen) {
+ 		elen = sizeof (nisname_str) + nisnamelen + 1;
+ 		if ((s = envp[i++] = malloc(elen)) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to allocate strings for NIS domain name");
+ 			ret = -1;
+ 			goto clean;
+@@ -310,7 +310,7 @@ client6_script(scriptpath, state, optinfo)
+ 		elen = sizeof (nispserver_str) +
+ 		    (INET6_ADDRSTRLEN + 1) * nispservers + 1;
+ 		if ((s = envp[i++] = malloc(elen)) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to allocate strings for NIS+ servers");
+ 			ret = -1;
+ 			goto clean;
+@@ -329,7 +329,7 @@ client6_script(scriptpath, state, optinfo)
+ 	if (nispnamelen) {
+ 		elen = sizeof (nispname_str) + nispnamelen + 1;
+ 		if ((s = envp[i++] = malloc(elen)) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to allocate strings for NIS+ domain name");
+ 			ret = -1;
+ 			goto clean;
+@@ -347,7 +347,7 @@ client6_script(scriptpath, state, optinfo)
+ 		elen = sizeof (bcmcsserver_str) +
+ 		    (INET6_ADDRSTRLEN + 1) * bcmcsservers + 1;
+ 		if ((s = envp[i++] = malloc(elen)) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to allocate strings for BCMC servers");
+ 			ret = -1;
+ 			goto clean;
+@@ -366,7 +366,7 @@ client6_script(scriptpath, state, optinfo)
+ 	if (bcmcsnamelen) {
+ 		elen = sizeof (bcmcsname_str) + bcmcsnamelen + 1;
+ 		if ((s = envp[i++] = malloc(elen)) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to allocate strings for BCMC domain name");
+ 			ret = -1;
+ 			goto clean;
+@@ -383,7 +383,7 @@ client6_script(scriptpath, state, optinfo)
+ 	/* launch the script */
+ 	pid = fork();
+ 	if (pid < 0) {
+-		dprintf(LOG_ERR, FNAME, "failed to fork: %s", strerror(errno));
++		debug_printf(LOG_ERR, FNAME, "failed to fork: %s", strerror(errno));
+ 		ret = -1;
+ 		goto clean;
+ 	} else if (pid) {
+@@ -394,9 +394,9 @@ client6_script(scriptpath, state, optinfo)
+ 		} while (wpid != pid && wpid > 0);
+ 
+ 		if (wpid < 0)
+-			dprintf(LOG_ERR, FNAME, "wait: %s", strerror(errno));
++			debug_printf(LOG_ERR, FNAME, "wait: %s", strerror(errno));
+ 		else {
+-			dprintf(LOG_DEBUG, FNAME,
++			debug_printf(LOG_DEBUG, FNAME,
+ 			    "script \"%s\" terminated", scriptpath);
+ 		}
+ 	} else {
+@@ -407,7 +407,7 @@ client6_script(scriptpath, state, optinfo)
+ 		argv[1] = NULL;
+ 
+ 		if (safefile(scriptpath)) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "script \"%s\" cannot be executed safely",
+ 			    scriptpath);
+ 			exit(1);
+@@ -423,7 +423,7 @@ client6_script(scriptpath, state, optinfo)
+ 
+ 		execve(scriptpath, argv, envp);
+ 
+-		dprintf(LOG_ERR, FNAME, "child: exec failed: %s",
++		debug_printf(LOG_ERR, FNAME, "child: exec failed: %s",
+ 		    strerror(errno));
+ 		exit(0);
+ 	}
+diff --git a/dhcp6relay.c b/dhcp6relay.c
+index eb0bce9..99b1227 100644
+--- a/dhcp6relay.c
++++ b/dhcp6relay.c
+@@ -228,7 +228,7 @@ main(argc, argv)
+ 
+ 	relay6_init(argc, argv);
+ 
+-	dprintf(LOG_INFO, FNAME, "dhcp6relay started");
++	debug_printf(LOG_INFO, FNAME, "dhcp6relay started");
+ 	relay6_loop();
+ 
+ 	exit(0);
+@@ -246,7 +246,7 @@ make_prefix(pstr0)
+ 
+ 	/* make a local copy for safety */
+ 	if (strlcpy(pstr, pstr0, sizeof (pstr)) >= sizeof (pstr)) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "prefix string too long (maybe bogus): %s", pstr0);
+ 		return (NULL);
+ 	}
+@@ -256,27 +256,27 @@ make_prefix(pstr0)
+ 		plen = 128; /* assumes it as a host prefix */
+ 	else {
+ 		if (p[1] == '\0') {
+-			dprintf(LOG_WARNING, FNAME,
++			debug_printf(LOG_WARNING, FNAME,
+ 			    "no prefix length (ignored): %s", p + 1);
+ 			return (NULL);
+ 		}
+ 		plen = (int)strtoul(p + 1, &ep, 10);
+ 		if (*ep != '\0') {
+-			dprintf(LOG_WARNING, FNAME,
++			debug_printf(LOG_WARNING, FNAME,
+ 			    "illegal prefix length (ignored): %s", p + 1);
+ 			return (NULL);
+ 		}
+ 		*p = '\0';
+ 	}
+ 	if (inet_pton(AF_INET6, pstr, &paddr) != 1) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "inet_pton failed for %s", pstr);
+ 		return (NULL);
+ 	}
+ 
+ 	/* allocate a new entry */
+ 	if ((pent = (struct prefix_list *)malloc(sizeof (*pent))) == NULL) {
+-		dprintf(LOG_WARNING, FNAME, "memory allocation failed");
++		debug_printf(LOG_WARNING, FNAME, "memory allocation failed");
+ 		return (NULL);	/* or abort? */
+ 	}
+ 
+@@ -318,14 +318,14 @@ relay6_init(int ifnum, char *iflist[])
+ 	hints.ai_flags = AI_PASSIVE;
+ 	error = getaddrinfo(serveraddr, DH6PORT_UPSTREAM, &hints, &res);
+ 	if (error) {
+-		dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
++		debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ 		    gai_strerror(error));
+ 		goto failexit;
+ 	}
+ 	if (res->ai_family != PF_INET6 ||
+ 	    res->ai_addrlen < sizeof (sa6_server)) {
+ 		/* this should be impossible, but check for safety */
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "getaddrinfo returned a bogus address: %s",
+ 		    strerror(errno));
+ 		goto failexit;
+@@ -341,7 +341,7 @@ relay6_init(int ifnum, char *iflist[])
+ 	rmh.msg_iovlen = 1;
+ 	rmsgctllen = CMSG_SPACE(sizeof (struct in6_pktinfo));
+ 	if ((rmsgctlbuf = (char *)malloc(rmsgctllen)) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "memory allocation failed");
++		debug_printf(LOG_ERR, FNAME, "memory allocation failed");
+ 		goto failexit;
+ 	}
+ 
+@@ -355,13 +355,13 @@ relay6_init(int ifnum, char *iflist[])
+ 	hints.ai_flags = AI_PASSIVE;
+ 	error = getaddrinfo(NULL, DH6PORT_UPSTREAM, &hints, &res);
+ 	if (error) {
+-		dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
++		debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ 		    gai_strerror(error));
+ 		goto failexit;
+ 	}
+ 	csock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
+ 	if (csock < 0) {
+-		dprintf(LOG_ERR, FNAME, "socket(csock): %s", strerror(errno));
++		debug_printf(LOG_ERR, FNAME, "socket(csock): %s", strerror(errno));
+ 		goto failexit;
+ 	}
+ 	if (csock > maxfd)
+@@ -369,20 +369,20 @@ relay6_init(int ifnum, char *iflist[])
+ 	on = 1;
+ 	if (setsockopt(csock, SOL_SOCKET, SO_REUSEPORT,
+ 	    &on, sizeof(on)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "setsockopt(csock, SO_REUSEPORT): %s",
++		debug_printf(LOG_ERR, FNAME, "setsockopt(csock, SO_REUSEPORT): %s",
+ 		    strerror(errno));
+ 		goto failexit;
+ 	}
+ #ifdef IPV6_V6ONLY
+ 	if (setsockopt(csock, IPPROTO_IPV6, IPV6_V6ONLY,
+ 	    &on, sizeof (on)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "setsockopt(csock, IPV6_V6ONLY): %s",
++		debug_printf(LOG_ERR, FNAME, "setsockopt(csock, IPV6_V6ONLY): %s",
+ 		    strerror(errno));
+ 		goto failexit;
+ 	}
+ #endif
+ 	if (bind(csock, res->ai_addr, res->ai_addrlen) < 0) {
+-		dprintf(LOG_ERR, FNAME, "bind(csock): %s", strerror(errno));
++		debug_printf(LOG_ERR, FNAME, "bind(csock): %s", strerror(errno));
+ 		goto failexit;
+ 	}
+ 	freeaddrinfo(res);
+@@ -390,14 +390,14 @@ relay6_init(int ifnum, char *iflist[])
+ #ifdef IPV6_RECVPKTINFO
+ 	if (setsockopt(csock, IPPROTO_IPV6, IPV6_RECVPKTINFO,
+ 	    &on, sizeof (on)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "setsockopt(IPV6_RECVPKTINFO): %s",
++		debug_printf(LOG_ERR, FNAME, "setsockopt(IPV6_RECVPKTINFO): %s",
+ 		    strerror(errno));
+ 		goto failexit;
+ 	}
+ #else
+ 	if (setsockopt(csock, IPPROTO_IPV6, IPV6_PKTINFO,
+ 	    &on, sizeof (on)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "setsockopt(IPV6_PKTINFO): %s",
++		debug_printf(LOG_ERR, FNAME, "setsockopt(IPV6_PKTINFO): %s",
+ 		    strerror(errno));
+ 		goto failexit;
+ 	}
+@@ -406,7 +406,7 @@ relay6_init(int ifnum, char *iflist[])
+ 	hints.ai_flags = 0;
+ 	error = getaddrinfo(DH6ADDR_ALLAGENT, 0, &hints, &res2);
+ 	if (error) {
+-		dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
++		debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ 		    gai_strerror(error));
+ 		goto failexit;
+ 	}
+@@ -422,21 +422,21 @@ relay6_init(int ifnum, char *iflist[])
+ 
+ 		ifd = (struct ifid_list *)malloc(sizeof (*ifd));
+ 		if (ifd == NULL) {
+-			dprintf(LOG_WARNING, FNAME,
++			debug_printf(LOG_WARNING, FNAME,
+ 			    "memory allocation failed");
+ 			goto failexit;
+ 		}
+ 		memset(ifd, 0, sizeof (*ifd));
+ 		ifd->ifid = if_nametoindex(ifp);
+ 		if (ifd->ifid == 0) {
+-			dprintf(LOG_ERR, FNAME, "invalid interface %s", ifp);
++			debug_printf(LOG_ERR, FNAME, "invalid interface %s", ifp);
+ 			goto failexit;
+ 		}
+ 		mreq6.ipv6mr_interface = ifd->ifid;
+ 
+ 		if (setsockopt(csock, IPPROTO_IPV6, IPV6_JOIN_GROUP,
+ 		    &mreq6, sizeof (mreq6))) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "setsockopt(csock, IPV6_JOIN_GROUP): %s",
+ 			     strerror(errno));
+ 			goto failexit;
+@@ -451,7 +451,7 @@ relay6_init(int ifnum, char *iflist[])
+ 	 */
+ 	relayifid = if_nametoindex(relaydevice);
+ 	if (relayifid == 0)
+-		dprintf(LOG_ERR, FNAME, "invalid interface %s", relaydevice);
++		debug_printf(LOG_ERR, FNAME, "invalid interface %s", relaydevice);
+ 	/*
+ 	 * We are not really sure if we need to listen on the downstream
+ 	 * port to receive packets from servers.  We'll need to clarify the
+@@ -460,14 +460,14 @@ relay6_init(int ifnum, char *iflist[])
+ 	hints.ai_flags = AI_PASSIVE;
+ 	error = getaddrinfo(boundaddr, DH6PORT_DOWNSTREAM, &hints, &res);
+ 	if (error) {
+-		dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
++		debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ 		    gai_strerror(error));
+ 		goto failexit;
+ 	}
+ 	memcpy(&sa6_client, res->ai_addr, sizeof (sa6_client));
+ 	ssock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
+ 	if (ssock < 0) {
+-		dprintf(LOG_ERR, FNAME, "socket(outsock): %s",
++		debug_printf(LOG_ERR, FNAME, "socket(outsock): %s",
+ 		    strerror(error));
+ 		goto failexit;
+ 	}
+@@ -480,7 +480,7 @@ relay6_init(int ifnum, char *iflist[])
+ 	 */
+ 	if (setsockopt(ssock, SOL_SOCKET, SO_REUSEPORT,
+ 	    &on, sizeof (on)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "setsockopt(ssock, SO_REUSEPORT): %s",
++		debug_printf(LOG_ERR, FNAME, "setsockopt(ssock, SO_REUSEPORT): %s",
+ 		    strerror(errno));
+ 		goto failexit;
+ 	}
+@@ -488,13 +488,13 @@ relay6_init(int ifnum, char *iflist[])
+ #ifdef IPV6_V6ONLY
+ 	if (setsockopt(ssock, IPPROTO_IPV6, IPV6_V6ONLY,
+ 	    &on, sizeof (on)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "setsockopt(ssock, IPV6_V6ONLY): %s",
++		debug_printf(LOG_ERR, FNAME, "setsockopt(ssock, IPV6_V6ONLY): %s",
+ 		    strerror(errno));
+ 		goto failexit;
+ 	}
+ #endif
+ 	if (bind(ssock, res->ai_addr, res->ai_addrlen) < 0) {
+-		dprintf(LOG_ERR, FNAME, "bind(ssock): %s", strerror(errno));
++		debug_printf(LOG_ERR, FNAME, "bind(ssock): %s", strerror(errno));
+ 		goto failexit;
+ 	}
+ 	freeaddrinfo(res);
+@@ -503,21 +503,21 @@ relay6_init(int ifnum, char *iflist[])
+ #ifdef IPV6_RECVPKTINFO
+ 	if (setsockopt(ssock, IPPROTO_IPV6, IPV6_RECVPKTINFO,
+ 	    &on, sizeof (on)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "setsockopt(IPV6_RECVPKTINFO): %s",
++		debug_printf(LOG_ERR, FNAME, "setsockopt(IPV6_RECVPKTINFO): %s",
+ 		    strerror(errno));
+ 		goto failexit;
+ 	}
+ #else
+ 	if (setsockopt(ssock, IPPROTO_IPV6, IPV6_PKTINFO,
+ 	    &on, sizeof (on)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "setsockopt(IPV6_PKTINFO): %s",
++		debug_printf(LOG_ERR, FNAME, "setsockopt(IPV6_PKTINFO): %s",
+ 		    strerror(errno));
+ 		goto failexit;
+ 	}
+ #endif
+ 
+ 	if (signal(SIGTERM, relay6_signal) == SIG_ERR) {
+-		dprintf(LOG_WARNING, FNAME, "failed to set signal: %s",
++		debug_printf(LOG_WARNING, FNAME, "failed to set signal: %s",
+ 		    strerror(errno));
+ 		exit(1);
+ 	}
+@@ -605,15 +605,15 @@ relay6_recv(s, fromclient)
+ 	rmh.msg_namelen = sizeof (from);
+ 
+ 	if ((len = recvmsg(s, &rmh, 0)) < 0) {
+-		dprintf(LOG_WARNING, FNAME, "recvmsg: %s", strerror(errno));
++		debug_printf(LOG_WARNING, FNAME, "recvmsg: %s", strerror(errno));
+ 		return;
+ 	}
+ 
+-	dprintf(LOG_DEBUG, FNAME, "from %s, size %d",
++	debug_printf(LOG_DEBUG, FNAME, "from %s, size %d",
+ 	    addr2str((struct sockaddr *)&from), len);
+ 
+ 	if (((struct sockaddr *)&from)->sa_family != AF_INET6) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "non-IPv6 packet is received (AF %d) ",
+ 		    ((struct sockaddr *)&from)->sa_family);
+ 		return;
+@@ -632,7 +632,7 @@ relay6_recv(s, fromclient)
+ 		}
+ 	}
+ 	if (pi == NULL) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "failed to get the arrival interface");
+ 		return;
+ 	}
+@@ -649,7 +649,7 @@ relay6_recv(s, fromclient)
+ 	if (ifd == NULL && pi->ipi6_ifindex != relayifid)
+ 		return;
+ 	if (if_indextoname(pi->ipi6_ifindex, ifname) == NULL) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "if_indextoname(id = %d): %s",
+ 		    pi->ipi6_ifindex, strerror(errno));
+ 		return;
+@@ -657,12 +657,12 @@ relay6_recv(s, fromclient)
+ 
+ 	/* packet validation */
+ 	if (len < sizeof (*dh6)) {
+-		dprintf(LOG_INFO, FNAME, "short packet (%d bytes)", len);
++		debug_printf(LOG_INFO, FNAME, "short packet (%d bytes)", len);
+ 		return;
+ 	}
+ 
+ 	dh6 = (struct dhcp6 *)rdatabuf;
+-	dprintf(LOG_DEBUG, FNAME, "received %s from %s",
++	debug_printf(LOG_DEBUG, FNAME, "received %s from %s",
+ 	    dhcp6msgstr(dh6->dh6_msgtype), addr2str((struct sockaddr *)&from));
+ 
+ 	/*
+@@ -694,7 +694,7 @@ relay6_recv(s, fromclient)
+ 			    (struct sockaddr *)&from);
+ 			break;
+ 		default:
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "unexpected message (%s) on the client side "
+ 			    "from %s", dhcp6msgstr(dh6->dh6_msgtype),
+ 			    addr2str((struct sockaddr *)&from));
+@@ -702,7 +702,7 @@ relay6_recv(s, fromclient)
+ 		}
+ 	} else {
+ 		if (dh6->dh6_msgtype != DH6_RELAY_REPLY) {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "unexpected message (%s) on the server side"
+ 			    "from %s", dhcp6msgstr(dh6->dh6_msgtype),
+ 			    addr2str((struct sockaddr *)&from));
+@@ -787,7 +787,7 @@ relay_to_server(dh6, len, from, ifname, ifid)
+ 
+ 	/* Relay message */
+ 	if ((optinfo.relaymsg_msg = malloc(len)) == NULL) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "failed to allocate memory to copy the original packet: "
+ 		    "%s", strerror(errno));
+ 		goto out;
+@@ -797,7 +797,7 @@ relay_to_server(dh6, len, from, ifname, ifid)
+ 
+ 	/* Interface-id.  We always use this option. */
+ 	if ((optinfo.ifidopt_id = malloc(sizeof (ifid))) == NULL) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "failed to allocate memory for IFID: %s", strerror(errno));
+ 		goto out;
+ 	}
+@@ -823,7 +823,7 @@ relay_to_server(dh6, len, from, ifname, ifid)
+ 			break;
+ 	}
+ 	if (p == NULL) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to find a global address on %s", ifname);
+ 
+ 		/*
+@@ -848,7 +848,7 @@ relay_to_server(dh6, len, from, ifname, ifid)
+ 		 * [RFC3315 Section 20.1.2]
+ 		 */
+ 		if (dh6relay0->dh6relay_hcnt >= DHCP6_RELAY_HOP_COUNT_LIMIT) {
+-			dprintf(LOG_INFO, FNAME, "too many relay forwardings");
++			debug_printf(LOG_INFO, FNAME, "too many relay forwardings");
+ 			goto out;
+ 		}
+ 
+@@ -871,7 +871,7 @@ relay_to_server(dh6, len, from, ifname, ifid)
+ 	    (struct dhcp6opt *)(dh6relay + 1),
+ 	    (struct dhcp6opt *)(relaybuf + sizeof (relaybuf)),
+ 	    &optinfo)) < 0) {
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 		    "failed to construct relay options");
+ 		goto out;
+ 	}
+@@ -892,22 +892,22 @@ relay_to_server(dh6, len, from, ifname, ifid)
+ 		pktinfo.ipi6_ifindex = relayifid;
+ 		if (make_msgcontrol(&mh, ctlbuf, sizeof (ctlbuf),
+ 		    &pktinfo, mhops)) {
+-			dprintf(LOG_WARNING, FNAME,
++			debug_printf(LOG_WARNING, FNAME,
+ 			    "failed to make message control data");
+ 			goto out;
+ 		}
+ 	}
+ 
+ 	if ((cc = sendmsg(ssock, &mh, 0)) < 0) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "sendmsg %s failed: %s",
+ 		    addr2str((struct sockaddr *)&sa6_server), strerror(errno));
+ 	} else if (cc != relaylen) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "failed to send a complete packet to %s",
+ 		    addr2str((struct sockaddr *)&sa6_server));
+ 	} else {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "relay a message to a server %s",
+ 		    addr2str((struct sockaddr *)&sa6_server));
+ 	}
+@@ -934,7 +934,7 @@ relay_to_client(dh6relay, len, from)
+ 	static struct iovec iov[2];
+ 	char ctlbuf[CMSG_SPACE(sizeof (struct in6_pktinfo))];
+ 
+-	dprintf(LOG_DEBUG, FNAME,
++	debug_printf(LOG_DEBUG, FNAME,
+ 	    "dhcp6 relay reply: hop=%d, linkaddr=%s, peeraddr=%s",
+ 	    dh6relay->dh6relay_hcnt,
+ 	    in6addr2str(&dh6relay->dh6relay_linkaddr, 0),
+@@ -946,20 +946,20 @@ relay_to_client(dh6relay, len, from)
+ 	dhcp6_init_options(&optinfo);
+ 	if (dhcp6_get_options((struct dhcp6opt *)(dh6relay + 1),
+ 	    (struct dhcp6opt *)((char *)dh6relay + len), &optinfo) < 0) {
+-		dprintf(LOG_INFO, FNAME, "failed to parse options");
++		debug_printf(LOG_INFO, FNAME, "failed to parse options");
+ 		return;
+ 	}
+ 
+ 	/* A relay reply message must include a relay message option */
+ 	if (optinfo.relaymsg_msg == NULL) {
+-		dprintf(LOG_INFO, FNAME, "relay reply message from %s "
++		debug_printf(LOG_INFO, FNAME, "relay reply message from %s "
+ 		    "without a relay message", addr2str(from));
+ 		goto out;
+ 	}
+ 
+ 	/* minimum validation for the inner message */
+ 	if (optinfo.relaymsg_len < sizeof (struct dhcp6)) {
+-		dprintf(LOG_INFO, FNAME, "short relay message from %s",
++		debug_printf(LOG_INFO, FNAME, "short relay message from %s",
+ 		    addr2str(from));
+ 		goto out;
+ 	}
+@@ -971,7 +971,7 @@ relay_to_client(dh6relay, len, from)
+ 	ifid = 0;
+ 	if (optinfo.ifidopt_id) {
+ 		if (optinfo.ifidopt_len != sizeof (ifid)) {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "unexpected length (%d) for Interface ID from %s",
+ 			    optinfo.ifidopt_len, addr2str(from));
+ 			goto out;
+@@ -981,13 +981,13 @@ relay_to_client(dh6relay, len, from)
+ 
+ 			/* validation for ID */
+ 			if ((if_indextoname(ifid, ifnamebuf)) == NULL) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "invalid interface ID: %x", ifid);
+ 				goto out;
+ 			}
+ 		}
+ 	} else {
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 		    "Interface ID is not included from %s", addr2str(from));
+ 		/*
+ 		 * the responding server should be buggy, but we deal with it.
+@@ -1005,7 +1005,7 @@ relay_to_client(dh6relay, len, from)
+ 	}
+ 
+ 	if (ifid == 0) {
+-		dprintf(LOG_INFO, FNAME, "failed to determine relay link");
++		debug_printf(LOG_INFO, FNAME, "failed to determine relay link");
+ 		goto out;
+ 	}
+ 
+@@ -1036,22 +1036,22 @@ relay_to_client(dh6relay, len, from)
+ 	memset(&pktinfo, 0, sizeof (pktinfo));
+ 	pktinfo.ipi6_ifindex = ifid;
+ 	if (make_msgcontrol(&mh, ctlbuf, sizeof (ctlbuf), &pktinfo, 0)) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "failed to make message control data");
+ 		goto out;
+ 	}
+ 
+ 	/* send packet */
+ 	if ((cc = sendmsg(csock, &mh, 0)) < 0) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "sendmsg to %s failed: %s",
+ 		    addr2str((struct sockaddr *)&peer), strerror(errno));
+ 	} else if (cc != optinfo.relaymsg_len) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "failed to send a complete packet to %s",
+ 		    addr2str((struct sockaddr *)&peer));
+ 	} else {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "relay a message to a client %s",
+ 		    addr2str((struct sockaddr *)&peer));
+ 	}
+diff --git a/dhcp6relay_script.c b/dhcp6relay_script.c
+index 82f5eab..7444b54 100644
+--- a/dhcp6relay_script.c
++++ b/dhcp6relay_script.c
+@@ -87,7 +87,7 @@ relay6_script(scriptpath, client, dh6, len)
+ 	/* only replies are interesting */
+ 	if (dh6->dh6_msgtype != DH6_REPLY) {
+ 		if (dh6->dh6_msgtype != DH6_ADVERTISE) {
+-			dprintf(LOG_INFO, FNAME, "forward msg#%d to client?",
++			debug_printf(LOG_INFO, FNAME, "forward msg#%d to client?",
+ 			    dh6->dh6_msgtype);
+ 			return -1;
+ 		}
+@@ -99,7 +99,7 @@ relay6_script(scriptpath, client, dh6, len)
+ 	dhcp6_init_options(&optinfo);
+ 	if (dhcp6_get_options((struct dhcp6opt *)(dh6 + 1), optend,
+ 	    &optinfo) < 0) {
+-		dprintf(LOG_INFO, FNAME, "failed to parse options");
++		debug_printf(LOG_INFO, FNAME, "failed to parse options");
+ 		return -1;
+ 	}
+ 
+@@ -118,7 +118,7 @@ relay6_script(scriptpath, client, dh6, len)
+ 
+ 	/* allocate an environments array */
+ 	if ((envp = malloc(sizeof (char *) * envc)) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to allocate environment buffer");
+ 		dhcp6_clear_options(&optinfo);
+ 		return -1;
+@@ -132,14 +132,14 @@ relay6_script(scriptpath, client, dh6, len)
+ 	/* address */
+ 	t = addr2str((struct sockaddr *) client);
+ 	if (t == NULL) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to get address of client");
+ 		ret = -1;
+ 		goto clean;
+ 	}
+ 	elen = sizeof (client_str) + 1 + strlen(t) + 1;
+ 	if ((s = envp[i++] = malloc(elen)) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to allocate string for client");
+ 		ret = -1;
+ 		goto clean;
+@@ -167,7 +167,7 @@ relay6_script(scriptpath, client, dh6, len)
+ 	/* launch the script */
+ 	pid = fork();
+ 	if (pid < 0) {
+-		dprintf(LOG_ERR, FNAME, "failed to fork: %s", strerror(errno));
++		debug_printf(LOG_ERR, FNAME, "failed to fork: %s", strerror(errno));
+ 		ret = -1;
+ 		goto clean;
+ 	} else if (pid) {
+@@ -178,9 +178,9 @@ relay6_script(scriptpath, client, dh6, len)
+ 		} while (wpid != pid && wpid > 0);
+ 
+ 		if (wpid < 0)
+-			dprintf(LOG_ERR, FNAME, "wait: %s", strerror(errno));
++			debug_printf(LOG_ERR, FNAME, "wait: %s", strerror(errno));
+ 		else {
+-			dprintf(LOG_DEBUG, FNAME,
++			debug_printf(LOG_DEBUG, FNAME,
+ 			    "script \"%s\" terminated", scriptpath);
+ 		}
+ 	} else {
+@@ -191,7 +191,7 @@ relay6_script(scriptpath, client, dh6, len)
+ 		argv[1] = NULL;
+ 
+ 		if (safefile(scriptpath)) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "script \"%s\" cannot be executed safely",
+ 			    scriptpath);
+ 			exit(1);
+@@ -208,7 +208,7 @@ relay6_script(scriptpath, client, dh6, len)
+ 
+ 		execve(scriptpath, argv, envp);
+ 
+-		dprintf(LOG_ERR, FNAME, "child: exec failed: %s",
++		debug_printf(LOG_ERR, FNAME, "child: exec failed: %s",
+ 		    strerror(errno));
+ 		exit(0);
+ 	}
+@@ -254,12 +254,12 @@ iapd2str(num, iav)
+ 			break;
+ 
+ 		default:
+-			dprintf(LOG_ERR, FNAME, "impossible subopt");
++			debug_printf(LOG_ERR, FNAME, "impossible subopt");
+ 		}
+ 	}
+ 
+ 	if ((r = strdup(s)) == NULL)
+-		dprintf(LOG_ERR, FNAME, "failed to allocate iapd_%d", num);
++		debug_printf(LOG_ERR, FNAME, "failed to allocate iapd_%d", num);
+ 	return r;
+ }
+ 
+@@ -294,11 +294,11 @@ iana2str(num, iav)
+ 			break;
+ 
+ 		default:
+-			dprintf(LOG_ERR, FNAME, "impossible subopt");
++			debug_printf(LOG_ERR, FNAME, "impossible subopt");
+ 		}
+ 	}
+ 
+ 	if ((r = strdup(s)) == NULL)
+-		dprintf(LOG_ERR, FNAME, "failed to allocate iana_%d", num);
++		debug_printf(LOG_ERR, FNAME, "failed to allocate iana_%d", num);
+ 	return r;
+ }
+diff --git a/dhcp6s.c b/dhcp6s.c
+index 494e571..ff8b17d 100644
+--- a/dhcp6s.c
++++ b/dhcp6s.c
+@@ -311,7 +311,7 @@ main(argc, argv)
+ 		exit(1);
+ 
+ 	if ((cfparse(conffile)) != 0) {
+-		dprintf(LOG_ERR, FNAME, "failed to parse configuration file");
++		debug_printf(LOG_ERR, FNAME, "failed to parse configuration file");
+ 		exit(1);
+ 	}
+ 
+@@ -335,7 +335,7 @@ main(argc, argv)
+ 	/* prohibit a mixture of old and new style of DNS server config */
+ 	if (!TAILQ_EMPTY(&arg_dnslist)) {
+ 		if (!TAILQ_EMPTY(&dnslist)) {
+-			dprintf(LOG_INFO, FNAME, "do not specify DNS servers "
++			debug_printf(LOG_INFO, FNAME, "do not specify DNS servers "
+ 			    "both by command line and by configuration file.");
+ 			exit(1);
+ 		}
+@@ -374,24 +374,24 @@ server6_init()
+ 
+ 	TAILQ_INIT(&dhcp6_binding_head);
+ 	if (lease_init() != 0) {
+-		dprintf(LOG_ERR, FNAME, "failed to initialize the lease table");
++		debug_printf(LOG_ERR, FNAME, "failed to initialize the lease table");
+ 		exit(1);
+ 	}
+ 
+ 	ifidx = if_nametoindex(device);
+ 	if (ifidx == 0) {
+-		dprintf(LOG_ERR, FNAME, "invalid interface %s", device);
++		debug_printf(LOG_ERR, FNAME, "invalid interface %s", device);
+ 		exit(1);
+ 	}
+ 
+ 	/* get our DUID */
+ 	if (get_duid(DUID_FILE, &server_duid)) {
+-		dprintf(LOG_ERR, FNAME, "failed to get a DUID");
++		debug_printf(LOG_ERR, FNAME, "failed to get a DUID");
+ 		exit(1);
+ 	}
+ 
+ 	if (dhcp6_ctl_authinit(ctlkeyfile, &ctlkey, &ctldigestlen) != 0) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to initialize control message authentication");
+ 		/* run the server anyway */
+ 	}
+@@ -403,7 +403,7 @@ server6_init()
+ 	rmh.msg_iovlen = 1;
+ 	rmsgctllen = CMSG_SPACE(sizeof(struct in6_pktinfo));
+ 	if ((rmsgctlbuf = (char *)malloc(rmsgctllen)) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "memory allocation failed");
++		debug_printf(LOG_ERR, FNAME, "memory allocation failed");
+ 		exit(1);
+ 	}
+ 
+@@ -415,32 +415,32 @@ server6_init()
+ 	hints.ai_flags = AI_PASSIVE;
+ 	error = getaddrinfo(NULL, DH6PORT_UPSTREAM, &hints, &res);
+ 	if (error) {
+-		dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
++		debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ 		    gai_strerror(error));
+ 		exit(1);
+ 	}
+ 	insock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
+ 	if (insock < 0) {
+-		dprintf(LOG_ERR, FNAME, "socket(insock): %s",
++		debug_printf(LOG_ERR, FNAME, "socket(insock): %s",
+ 		    strerror(errno));
+ 		exit(1);
+ 	}
+ 	if (setsockopt(insock, SOL_SOCKET, SO_REUSEPORT, &on,
+ 		       sizeof(on)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "setsockopt(insock, SO_REUSEPORT): %s",
++		debug_printf(LOG_ERR, FNAME, "setsockopt(insock, SO_REUSEPORT): %s",
+ 		    strerror(errno));
+ 		exit(1);
+ 	}
+ 	if (setsockopt(insock, SOL_SOCKET, SO_REUSEADDR, &on,
+ 		       sizeof(on)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "setsockopt(insock, SO_REUSEADDR): %s",
++		debug_printf(LOG_ERR, FNAME, "setsockopt(insock, SO_REUSEADDR): %s",
+ 		    strerror(errno));
+ 		exit(1);
+ 	}
+ #ifdef IPV6_RECVPKTINFO
+ 	if (setsockopt(insock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on,
+ 		       sizeof(on)) < 0) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "setsockopt(inbound, IPV6_RECVPKTINFO): %s",
+ 		    strerror(errno));
+ 		exit(1);
+@@ -448,7 +448,7 @@ server6_init()
+ #else
+ 	if (setsockopt(insock, IPPROTO_IPV6, IPV6_PKTINFO, &on,
+ 		       sizeof(on)) < 0) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "setsockopt(inbound, IPV6_PKTINFO): %s",
+ 		    strerror(errno));
+ 		exit(1);
+@@ -457,13 +457,13 @@ server6_init()
+ #ifdef IPV6_V6ONLY
+ 	if (setsockopt(insock, IPPROTO_IPV6, IPV6_V6ONLY,
+ 	    &on, sizeof(on)) < 0) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "setsockopt(inbound, IPV6_V6ONLY): %s", strerror(errno));
+ 		exit(1);
+ 	}
+ #endif
+ 	if (bind(insock, res->ai_addr, res->ai_addrlen) < 0) {
+-		dprintf(LOG_ERR, FNAME, "bind(insock): %s", strerror(errno));
++		debug_printf(LOG_ERR, FNAME, "bind(insock): %s", strerror(errno));
+ 		exit(1);
+ 	}
+ 	freeaddrinfo(res);
+@@ -471,7 +471,7 @@ server6_init()
+ 	hints.ai_flags = 0;
+ 	error = getaddrinfo(DH6ADDR_ALLAGENT, DH6PORT_UPSTREAM, &hints, &res2);
+ 	if (error) {
+-		dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
++		debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ 		    gai_strerror(error));
+ 		exit(1);
+ 	}
+@@ -482,7 +482,7 @@ server6_init()
+ 	    sizeof(mreq6.ipv6mr_multiaddr));
+ 	if (setsockopt(insock, IPPROTO_IPV6, IPV6_JOIN_GROUP,
+ 	    &mreq6, sizeof(mreq6))) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "setsockopt(insock, IPV6_JOIN_GROUP): %s",
+ 		    strerror(errno));
+ 		exit(1);
+@@ -493,7 +493,7 @@ server6_init()
+ 	error = getaddrinfo(DH6ADDR_ALLSERVER, DH6PORT_UPSTREAM,
+ 			    &hints, &res2);
+ 	if (error) {
+-		dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
++		debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ 		    gai_strerror(error));
+ 		exit(1);
+ 	}
+@@ -504,7 +504,7 @@ server6_init()
+ 	    sizeof(mreq6.ipv6mr_multiaddr));
+ 	if (setsockopt(insock, IPPROTO_IPV6, IPV6_JOIN_GROUP,
+ 	    &mreq6, sizeof(mreq6))) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "setsockopt(insock, IPV6_JOIN_GROUP): %s",
+ 		    strerror(errno));
+ 		exit(1);
+@@ -514,20 +514,20 @@ server6_init()
+ 	hints.ai_flags = 0;
+ 	error = getaddrinfo(NULL, DH6PORT_DOWNSTREAM, &hints, &res);
+ 	if (error) {
+-		dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
++		debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ 		    gai_strerror(error));
+ 		exit(1);
+ 	}
+ 	outsock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
+ 	if (outsock < 0) {
+-		dprintf(LOG_ERR, FNAME, "socket(outsock): %s",
++		debug_printf(LOG_ERR, FNAME, "socket(outsock): %s",
+ 		    strerror(errno));
+ 		exit(1);
+ 	}
+ 	/* set outgoing interface of multicast packets for DHCP reconfig */
+ 	if (setsockopt(outsock, IPPROTO_IPV6, IPV6_MULTICAST_IF,
+ 	    &ifidx, sizeof(ifidx)) < 0) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "setsockopt(outsock, IPV6_MULTICAST_IF): %s",
+ 		    strerror(errno));
+ 		exit(1);
+@@ -535,7 +535,7 @@ server6_init()
+ #if !defined(__linux__) && !defined(__sun__)
+ 	/* make the socket write-only */
+ 	if (shutdown(outsock, 0)) {
+-		dprintf(LOG_ERR, FNAME, "shutdown(outbound, 0): %s",
++		debug_printf(LOG_ERR, FNAME, "shutdown(outbound, 0): %s",
+ 		    strerror(errno));
+ 		exit(1);
+ 	}
+@@ -548,7 +548,7 @@ server6_init()
+ 	hints.ai_protocol = IPPROTO_UDP;
+ 	error = getaddrinfo("::", DH6PORT_DOWNSTREAM, &hints, &res);
+ 	if (error) {
+-		dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
++		debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ 		    gai_strerror(error));
+ 		exit(1);
+ 	}
+@@ -563,7 +563,7 @@ server6_init()
+ 	hints.ai_protocol = IPPROTO_UDP;
+ 	error = getaddrinfo("::", DH6PORT_UPSTREAM, &hints, &res);
+ 	if (error) {
+-		dprintf(LOG_ERR, FNAME, "getaddrinfo: %s",
++		debug_printf(LOG_ERR, FNAME, "getaddrinfo: %s",
+ 		    gai_strerror(error));
+ 		exit(1);
+ 	}
+@@ -574,16 +574,16 @@ server6_init()
+ 
+ 	/* set up control socket */
+ 	if (ctlkey == NULL)
+-		dprintf(LOG_NOTICE, FNAME, "skip opening control port");
++		debug_printf(LOG_NOTICE, FNAME, "skip opening control port");
+ 	else if (dhcp6_ctl_init(ctladdr, ctlport,
+ 	    DHCP6CTL_DEF_COMMANDQUEUELEN, &ctlsock)) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "failed to initialize control channel");
+ 		exit(1);
+ 	}
+ 
+ 	if (signal(SIGTERM, server6_signal) == SIG_ERR) {
+-		dprintf(LOG_WARNING, FNAME, "failed to set signal: %s",
++		debug_printf(LOG_WARNING, FNAME, "failed to set signal: %s",
+ 		    strerror(errno));
+ 		exit(1);
+ 	}
+@@ -627,7 +627,7 @@ server6_mainloop()
+ 		switch (ret) {
+ 		case -1:
+ 			if (errno != EINTR) {
+-				dprintf(LOG_ERR, FNAME, "select: %s",
++				debug_printf(LOG_ERR, FNAME, "select: %s",
+ 				    strerror(errno));
+ 				exit(1);
+ 			}
+@@ -714,31 +714,31 @@ server6_do_ctlcommand(buf, len)
+ 	commandlen = (int)(ntohs(ctlhead->len));
+ 	version = ntohs(ctlhead->version);
+ 	if (len != sizeof(struct dhcp6ctl) + commandlen) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "assumption failure: command length mismatch");
+ 		return (DHCP6CTL_R_FAILURE);
+ 	}
+ 
+ 	/* replay protection and message authentication */
+ 	if ((now = time(NULL)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "failed to get current time: %s",
++		debug_printf(LOG_ERR, FNAME, "failed to get current time: %s",
+ 		    strerror(errno));
+ 		return (DHCP6CTL_R_FAILURE);
+ 	}
+ 	ts0 = (u_int32_t)now;
+ 	ts = ntohl(ctlhead->timestamp);
+ 	if (ts + CTLSKEW < ts0 || (ts - CTLSKEW) > ts0) {
+-		dprintf(LOG_INFO, FNAME, "timestamp is out of range");
++		debug_printf(LOG_INFO, FNAME, "timestamp is out of range");
+ 		return (DHCP6CTL_R_FAILURE);
+ 	}
+ 
+ 	if (ctlkey == NULL) {	/* should not happen!! */
+-		dprintf(LOG_ERR, FNAME, "no secret key for control channel");
++		debug_printf(LOG_ERR, FNAME, "no secret key for control channel");
+ 		return (DHCP6CTL_R_FAILURE);
+ 	}
+ 	if (dhcp6_verify_mac(buf, len, DHCP6CTL_AUTHPROTO_UNDEF,
+ 	    DHCP6CTL_AUTHALG_HMACMD5, sizeof(*ctlhead), ctlkey) != 0) {
+-		dprintf(LOG_INFO, FNAME, "authentication failure");
++		debug_printf(LOG_INFO, FNAME, "authentication failure");
+ 		return (DHCP6CTL_R_FAILURE);
+ 	}
+ 
+@@ -746,14 +746,14 @@ server6_do_ctlcommand(buf, len)
+ 	commandlen -= ctldigestlen;
+ 
+ 	if (version > DHCP6CTL_VERSION) {
+-		dprintf(LOG_INFO, FNAME, "unsupported version: %d", version);
++		debug_printf(LOG_INFO, FNAME, "unsupported version: %d", version);
+ 		return (DHCP6CTL_R_FAILURE);
+ 	}
+ 
+ 	switch (command) {
+ 	case DHCP6CTL_COMMAND_RELOAD:
+ 		if (commandlen != 0) {
+-			dprintf(LOG_INFO, FNAME, "invalid command length "
++			debug_printf(LOG_INFO, FNAME, "invalid command length "
+ 			    "for reload: %d", commandlen);
+ 			return (DHCP6CTL_R_DONE);
+ 		}
+@@ -761,7 +761,7 @@ server6_do_ctlcommand(buf, len)
+ 		break;
+ 	case DHCP6CTL_COMMAND_STOP:
+ 		if (commandlen != 0) {
+-			dprintf(LOG_INFO, FNAME, "invalid command length "
++			debug_printf(LOG_INFO, FNAME, "invalid command length "
+ 			    "for stop: %d", commandlen);
+ 			return (DHCP6CTL_R_DONE);
+ 		}
+@@ -771,7 +771,7 @@ server6_do_ctlcommand(buf, len)
+ 		if (get_val32(&bp, &commandlen, &p32))
+ 			return (DHCP6CTL_R_FAILURE);
+ 		if (p32 != DHCP6CTL_BINDING) {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "unknown remove target: %ul", p32);
+ 			return (DHCP6CTL_R_FAILURE);
+ 		}
+@@ -779,7 +779,7 @@ server6_do_ctlcommand(buf, len)
+ 		if (get_val32(&bp, &commandlen, &p32))
+ 			return (DHCP6CTL_R_FAILURE);
+ 		if (p32 != DHCP6CTL_BINDING_IA) {
+-			dprintf(LOG_INFO, FNAME, "unknown binding type: %ul",
++			debug_printf(LOG_INFO, FNAME, "unknown binding type: %ul",
+ 			    p32);
+ 			return (DHCP6CTL_R_FAILURE);
+ 		}
+@@ -788,7 +788,7 @@ server6_do_ctlcommand(buf, len)
+ 			return (DHCP6CTL_R_FAILURE);
+ 		if (ntohl(iaspec.type) != DHCP6CTL_IA_PD &&
+ 		    ntohl(iaspec.type) != DHCP6CTL_IA_NA) {
+-			dprintf(LOG_INFO, FNAME, "unknown IA type: %ul",
++			debug_printf(LOG_INFO, FNAME, "unknown IA type: %ul",
+ 			    ntohl(iaspec.type));
+ 			return (DHCP6CTL_R_FAILURE);
+ 		}
+@@ -796,7 +796,7 @@ server6_do_ctlcommand(buf, len)
+ 		duidlen = ntohl(iaspec.duidlen);
+ 
+ 		if (duidlen > commandlen) {
+-			dprintf(LOG_INFO, FNAME, "DUID length mismatch");
++			debug_printf(LOG_INFO, FNAME, "DUID length mismatch");
+ 			return (DHCP6CTL_R_FAILURE);
+ 		}
+ 
+@@ -809,7 +809,7 @@ server6_do_ctlcommand(buf, len)
+ 			binding = find_binding(&duid, DHCP6_BINDING_IA,
+ 			    DHCP6_LISTVAL_IANA, iaid);
+ 			if (binding == NULL) {
+-				dprintf(LOG_INFO, FNAME, "no such binding");
++				debug_printf(LOG_INFO, FNAME, "no such binding");
+ 				return (DHCP6CTL_R_FAILURE);
+ 			}
+ 		}
+@@ -817,7 +817,7 @@ server6_do_ctlcommand(buf, len)
+ 		    
+ 		break;
+ 	default:
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 		    "unknown control command: %d (len=%d)",
+ 		    (int)command, commandlen);
+ 		return (DHCP6CTL_R_FAILURE);
+@@ -831,12 +831,12 @@ server6_reload()
+ {
+ 	/* reload the configuration file */
+ 	if (cfparse(conffile) != 0) {
+-		dprintf(LOG_WARNING, FNAME,
++		debug_printf(LOG_WARNING, FNAME,
+ 		    "failed to reload configuration file");
+ 		return;
+ 	}
+ 
+-	dprintf(LOG_NOTICE, FNAME, "server reloaded");
++	debug_printf(LOG_NOTICE, FNAME, "server reloaded");
+ 
+ 	return;
+ }
+@@ -846,7 +846,7 @@ server6_stop()
+ {
+ 	/* Right now, we simply stop running */
+ 
+-	dprintf(LOG_NOTICE, FNAME, "exiting");
++	debug_printf(LOG_NOTICE, FNAME, "exiting");
+ 
+ 	exit (0);
+ }
+@@ -885,7 +885,7 @@ server6_recv(s)
+ 	mhdr.msg_controllen = sizeof(cmsgbuf);
+ 
+ 	if ((len = recvmsg(insock, &mhdr, 0)) < 0) {
+-		dprintf(LOG_ERR, FNAME, "recvmsg: %s", strerror(errno));
++		debug_printf(LOG_ERR, FNAME, "recvmsg: %s", strerror(errno));
+ 		return;
+ 	}
+ 	fromlen = mhdr.msg_namelen;
+@@ -899,7 +899,7 @@ server6_recv(s)
+ 		}
+ 	}
+ 	if (pi == NULL) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to get packet info");
++		debug_printf(LOG_NOTICE, FNAME, "failed to get packet info");
+ 		return;
+ 	}
+ 	/*
+@@ -910,7 +910,7 @@ server6_recv(s)
+ 	if (pi->ipi6_ifindex != ifidx)
+ 		return;
+ 	if ((ifp = find_ifconfbyid((unsigned int)pi->ipi6_ifindex)) == NULL) {
+-		dprintf(LOG_INFO, FNAME, "unexpected interface (%d)",
++		debug_printf(LOG_INFO, FNAME, "unexpected interface (%d)",
+ 		    (unsigned int)pi->ipi6_ifindex);
+ 		return;
+ 	}
+@@ -918,11 +918,11 @@ server6_recv(s)
+ 	dh6 = (struct dhcp6 *)rdatabuf;
+ 
+ 	if (len < sizeof(*dh6)) {
+-		dprintf(LOG_INFO, FNAME, "short packet (%d bytes)", len);
++		debug_printf(LOG_INFO, FNAME, "short packet (%d bytes)", len);
+ 		return;
+ 	}
+ 
+-	dprintf(LOG_DEBUG, FNAME, "received %s from %s",
++	debug_printf(LOG_DEBUG, FNAME, "received %s from %s",
+ 	    dhcp6msgstr(dh6->dh6_msgtype),
+ 	    addr2str((struct sockaddr *)&from));
+ 
+@@ -937,7 +937,7 @@ server6_recv(s)
+ 	    dh6->dh6_msgtype == DH6_CONFIRM ||
+ 	    dh6->dh6_msgtype == DH6_REBIND ||
+ 	    dh6->dh6_msgtype == DH6_INFORM_REQ)) {
+-		dprintf(LOG_INFO, FNAME, "invalid unicast message");
++		debug_printf(LOG_INFO, FNAME, "invalid unicast message");
+ 		return;
+ 	}
+ 
+@@ -947,7 +947,7 @@ server6_recv(s)
+ 	 * reject them here.
+ 	 */
+ 	if (dh6->dh6_msgtype == DH6_RELAY_REPLY) {
+-		dprintf(LOG_INFO, FNAME, "relay reply message from %s",
++		debug_printf(LOG_INFO, FNAME, "relay reply message from %s",
+ 		    addr2str((struct sockaddr *)&from));
+ 		return;
+ 		
+@@ -969,7 +969,7 @@ server6_recv(s)
+ 	dhcp6_init_options(&optinfo);
+ 	if (dhcp6_get_options((struct dhcp6opt *)(dh6 + 1),
+ 	    optend, &optinfo) < 0) {
+-		dprintf(LOG_INFO, FNAME, "failed to parse options");
++		debug_printf(LOG_INFO, FNAME, "failed to parse options");
+ 		goto end;
+ 	}
+ 
+@@ -1007,7 +1007,7 @@ server6_recv(s)
+ 		    (struct sockaddr *)&from, fromlen, &relayinfohead);
+ 		break;
+ 	default:
+-		dprintf(LOG_INFO, FNAME, "unknown or unsupported msgtype (%s)",
++		debug_printf(LOG_INFO, FNAME, "unknown or unsupported msgtype (%s)",
+ 		    dhcp6msgstr(dh6->dh6_msgtype));
+ 		break;
+ 	}
+@@ -1052,11 +1052,11 @@ process_relayforw(dh6p, optendp, relayinfohead, from)
+   again:
+ 	len = (void *)optend - (void *)dh6relay;
+ 	if (len < sizeof (*dh6relay)) {
+-		dprintf(LOG_INFO, FNAME, "short relay message from %s",
++		debug_printf(LOG_INFO, FNAME, "short relay message from %s",
+ 		    addr2str(from));
+ 		return (-1);
+ 	}
+-	dprintf(LOG_DEBUG, FNAME,
++	debug_printf(LOG_DEBUG, FNAME,
+ 	    "dhcp6 relay: hop=%d, linkaddr=%s, peeraddr=%s",
+ 	    dh6relay->dh6relay_hcnt,
+ 	    in6addr2str(&dh6relay->dh6relay_linkaddr, 0),
+@@ -1068,13 +1068,13 @@ process_relayforw(dh6p, optendp, relayinfohead, from)
+ 	dhcp6_init_options(&optinfo);
+ 	if (dhcp6_get_options((struct dhcp6opt *)(dh6relay + 1),
+ 	    optend, &optinfo) < 0) {
+-		dprintf(LOG_INFO, FNAME, "failed to parse options");
++		debug_printf(LOG_INFO, FNAME, "failed to parse options");
+ 		return (-1);
+ 	}
+ 
+ 	/* A relay forward message must include a relay message option */
+ 	if (optinfo.relaymsg_msg == NULL) {
+-		dprintf(LOG_INFO, FNAME, "relay forward from %s "
++		debug_printf(LOG_INFO, FNAME, "relay forward from %s "
+ 		    "without a relay message", addr2str(from));
+ 		return (-1);
+ 	}
+@@ -1082,13 +1082,13 @@ process_relayforw(dh6p, optendp, relayinfohead, from)
+ 	/* relay message must contain a DHCPv6 message. */
+ 	len = optinfo.relaymsg_len;
+ 	if (len < sizeof (struct dhcp6)) {
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 		    "short packet (%d bytes) in relay message", len);
+ 		return (-1);
+ 	}
+ 
+ 	if ((relayinfo = malloc(sizeof (*relayinfo))) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "failed to allocate relay info");
++		debug_printf(LOG_ERR, FNAME, "failed to allocate relay info");
+ 		return (-1);
+ 	}
+ 	memset(relayinfo, 0, sizeof (*relayinfo));
+@@ -1139,71 +1139,71 @@ set_statelessinfo(type, optinfo)
+ {
+ 	/* SIP domain name */
+ 	if (dhcp6_copy_list(&optinfo->sipname_list, &sipnamelist)) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "failed to copy SIP domain list");
+ 		return (-1);
+ 	}
+ 
+ 	/* SIP server */
+ 	if (dhcp6_copy_list(&optinfo->sip_list, &siplist)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy SIP servers");
++		debug_printf(LOG_ERR, FNAME, "failed to copy SIP servers");
+ 		return (-1);
+ 	}
+ 
+ 	/* DNS server */
+ 	if (dhcp6_copy_list(&optinfo->dns_list, &dnslist)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy DNS servers");
++		debug_printf(LOG_ERR, FNAME, "failed to copy DNS servers");
+ 		return (-1);
+ 	}
+ 
+ 	/* DNS search list */
+ 	if (dhcp6_copy_list(&optinfo->dnsname_list, &dnsnamelist)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy DNS search list");
++		debug_printf(LOG_ERR, FNAME, "failed to copy DNS search list");
+ 		return (-1);
+ 	}
+ 
+ 	/* NTP server */
+ 	if (dhcp6_copy_list(&optinfo->ntp_list, &ntplist)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy NTP servers");
++		debug_printf(LOG_ERR, FNAME, "failed to copy NTP servers");
+ 		return (-1);
+ 	}
+ 
+ 	/* NIS domain name */
+ 	if (dhcp6_copy_list(&optinfo->nisname_list, &nisnamelist)) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "failed to copy NIS domain list");
+ 		return (-1);
+ 	}
+ 
+ 	/* NIS server */
+ 	if (dhcp6_copy_list(&optinfo->nis_list, &nislist)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy NIS servers");
++		debug_printf(LOG_ERR, FNAME, "failed to copy NIS servers");
+ 		return (-1);
+ 	}
+ 
+ 	/* NIS+ domain name */
+ 	if (dhcp6_copy_list(&optinfo->nispname_list, &nispnamelist)) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "failed to copy NIS+ domain list");
+ 		return (-1);
+ 	}
+ 
+ 	/* NIS+ server */
+ 	if (dhcp6_copy_list(&optinfo->nisp_list, &nisplist)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy NIS+ servers");
++		debug_printf(LOG_ERR, FNAME, "failed to copy NIS+ servers");
+ 		return (-1);
+ 	}
+ 
+ 	/* BCMCS domain name */
+ 	if (dhcp6_copy_list(&optinfo->bcmcsname_list, &bcmcsnamelist)) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "failed to copy BCMCS domain list");
+ 		return (-1);
+ 	}
+ 
+ 	/* BCMCS server */
+ 	if (dhcp6_copy_list(&optinfo->bcmcs_list, &bcmcslist)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy BCMCS servers");
++		debug_printf(LOG_ERR, FNAME, "failed to copy BCMCS servers");
+ 		return (-1);
+ 	}
+ 
+@@ -1239,10 +1239,10 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	 * [RFC3315 Section 15.2]
+ 	 */
+ 	if (optinfo->clientID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no client ID option");
++		debug_printf(LOG_INFO, FNAME, "no client ID option");
+ 		return (-1);
+ 	} else {
+-		dprintf(LOG_DEBUG, FNAME, "client ID %s",
++		debug_printf(LOG_DEBUG, FNAME, "client ID %s",
+ 		    duidstr(&optinfo->clientID));
+ 	}
+ 
+@@ -1252,13 +1252,13 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	 * [RFC3315 Section 15.2]
+ 	 */
+ 	if (optinfo->serverID.duid_len) {
+-		dprintf(LOG_INFO, FNAME, "server ID option found");
++		debug_printf(LOG_INFO, FNAME, "server ID option found");
+ 		return (-1);
+ 	}
+ 
+ 	/* get per-host configuration for the client, if any. */
+ 	if ((client_conf = find_hostconf(&optinfo->clientID))) {
+-		dprintf(LOG_DEBUG, FNAME, "found a host configuration for %s",
++		debug_printf(LOG_DEBUG, FNAME, "found a host configuration for %s",
+ 		    client_conf->name);
+ 	}
+ 
+@@ -1269,7 +1269,7 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* process authentication */
+ 	if (process_auth(dh6, len, client_conf, optinfo, &roptinfo)) {
+-		dprintf(LOG_INFO, FNAME, "failed to process authentication "
++		debug_printf(LOG_INFO, FNAME, "failed to process authentication "
+ 		    "information for %s",
+ 		    clientstr(client_conf, &optinfo->clientID));
+ 		goto fail;
+@@ -1277,13 +1277,13 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* server identifier option */
+ 	if (duidcpy(&roptinfo.serverID, &server_duid)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy server ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
+ 		goto fail;
+ 	}
+ 
+ 	/* copy client information back */
+ 	if (duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy client ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
+ 		goto fail;
+ 	}
+ 
+@@ -1293,7 +1293,7 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* add other configuration information */
+ 	if (set_statelessinfo(DH6_SOLICIT, &roptinfo)) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "failed to set other stateless information");
+ 		goto fail;
+ 	}
+@@ -1320,7 +1320,7 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 		/* make a local copy of the configured prefixes */
+ 		if (client_conf &&
+ 		    dhcp6_copy_list(&conflist, &client_conf->prefix_list)) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to make local data");
+ 			goto fail;
+ 		}
+@@ -1366,7 +1366,7 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 		if (client_conf == NULL && ifp->pool.name) {
+ 			if ((client_conf = create_dynamic_hostconf(&optinfo->clientID,
+ 				&ifp->pool)) == NULL)
+-				dprintf(LOG_NOTICE, FNAME,
++				debug_printf(LOG_NOTICE, FNAME,
+ 			    	"failed to make host configuration");
+ 		}
+ 		TAILQ_INIT(&conflist);
+@@ -1374,7 +1374,7 @@ react_solicit(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 		/* make a local copy of the configured addresses */
+ 		if (client_conf &&
+ 		    dhcp6_copy_list(&conflist, &client_conf->addr_list)) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to make local data");
+ 			goto fail;
+ 		}
+@@ -1444,17 +1444,17 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* the message must include a Server Identifier option */
+ 	if (optinfo->serverID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no server ID option");
++		debug_printf(LOG_INFO, FNAME, "no server ID option");
+ 		return (-1);
+ 	}
+ 	/* the contents of the Server Identifier option must match ours */
+ 	if (duidcmp(&optinfo->serverID, &server_duid)) {
+-		dprintf(LOG_INFO, FNAME, "server ID mismatch");
++		debug_printf(LOG_INFO, FNAME, "server ID mismatch");
+ 		return (-1);
+ 	}
+ 	/* the message must include a Client Identifier option */
+ 	if (optinfo->clientID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no client ID option");
++		debug_printf(LOG_INFO, FNAME, "no client ID option");
+ 		return (-1);
+ 	}
+ 
+@@ -1465,24 +1465,24 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* server identifier option */
+ 	if (duidcpy(&roptinfo.serverID, &server_duid)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy server ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
+ 		goto fail;
+ 	}
+ 	/* copy client information back */
+ 	if (duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy client ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
+ 		goto fail;
+ 	}
+ 
+ 	/* get per-host configuration for the client, if any. */
+ 	if ((client_conf = find_hostconf(&optinfo->clientID))) {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "found a host configuration named %s", client_conf->name);
+ 	}
+ 
+ 	/* process authentication */
+ 	if (process_auth(dh6, len, client_conf, optinfo, &roptinfo)) {
+-		dprintf(LOG_INFO, FNAME, "failed to process authentication "
++		debug_printf(LOG_INFO, FNAME, "failed to process authentication "
+ 		    "information for %s",
+ 		    clientstr(client_conf, &optinfo->clientID));
+ 		goto fail;
+@@ -1504,11 +1504,11 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	    TAILQ_EMPTY(relayinfohead)) {
+ 		u_int16_t stcode = DH6OPT_STCODE_USEMULTICAST;
+ 
+-		dprintf(LOG_INFO, FNAME, "unexpected unicast message from %s",
++		debug_printf(LOG_INFO, FNAME, "unexpected unicast message from %s",
+ 		    addr2str(from));
+ 		if (dhcp6_add_listval(&roptinfo.stcode_list,
+ 		    DHCP6_LISTVAL_STCODE, &stcode, NULL) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "failed to add a status code");
++			debug_printf(LOG_ERR, FNAME, "failed to add a status code");
+ 			goto fail;
+ 		}
+ 		server6_send(DH6_REPLY, ifp, dh6, optinfo, from,
+@@ -1538,7 +1538,7 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 		/* make a local copy of the configured prefixes */
+ 		if (client_conf &&
+ 		    dhcp6_copy_list(&conflist, &client_conf->prefix_list)) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to make local data");
+ 			goto fail;
+ 		}
+@@ -1563,7 +1563,7 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 				    iapd->val_ia.iaid,
+ 				    DH6OPT_STCODE_NOPREFIXAVAIL,
+ 				    &roptinfo.iapd_list)) {
+-					dprintf(LOG_NOTICE, FNAME,
++					debug_printf(LOG_NOTICE, FNAME,
+ 					    "failed to make an option list");
+ 					dhcp6_clear_list(&conflist);
+ 					goto fail;
+@@ -1581,7 +1581,7 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 		if (client_conf == NULL && ifp->pool.name) {
+ 			if ((client_conf = create_dynamic_hostconf(&optinfo->clientID,
+ 				&ifp->pool)) == NULL)
+-				dprintf(LOG_NOTICE, FNAME,
++				debug_printf(LOG_NOTICE, FNAME,
+ 			    	"failed to make host configuration");
+ 		}
+ 		TAILQ_INIT(&conflist);
+@@ -1589,7 +1589,7 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 		/* make a local copy of the configured prefixes */
+ 		if (client_conf &&
+ 		    dhcp6_copy_list(&conflist, &client_conf->addr_list)) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to make local data");
+ 			goto fail;
+ 		}
+@@ -1607,7 +1607,7 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 				    iana->val_ia.iaid,
+ 				    DH6OPT_STCODE_NOADDRSAVAIL,
+ 				    &roptinfo.iana_list)) {
+-					dprintf(LOG_NOTICE, FNAME,
++					debug_printf(LOG_NOTICE, FNAME,
+ 					    "failed to make an option list");
+ 					dhcp6_clear_list(&conflist);
+ 					goto fail;
+@@ -1640,7 +1640,7 @@ react_request(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	 * information to be assigned to the client.
+ 	 */
+ 	if (set_statelessinfo(DH6_REQUEST, &roptinfo)) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "failed to set other stateless information");
+ 		goto fail;
+ 	}
+@@ -1677,17 +1677,17 @@ react_renew(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* the message must include a Server Identifier option */
+ 	if (optinfo->serverID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no server ID option");
++		debug_printf(LOG_INFO, FNAME, "no server ID option");
+ 		return (-1);
+ 	}
+ 	/* the contents of the Server Identifier option must match ours */
+ 	if (duidcmp(&optinfo->serverID, &server_duid)) {
+-		dprintf(LOG_INFO, FNAME, "server ID mismatch");
++		debug_printf(LOG_INFO, FNAME, "server ID mismatch");
+ 		return (-1);
+ 	}
+ 	/* the message must include a Client Identifier option */
+ 	if (optinfo->clientID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no client ID option");
++		debug_printf(LOG_INFO, FNAME, "no client ID option");
+ 		return (-1);
+ 	}
+ 
+@@ -1698,24 +1698,24 @@ react_renew(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* server identifier option */
+ 	if (duidcpy(&roptinfo.serverID, &server_duid)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy server ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
+ 		goto fail;
+ 	}
+ 	/* copy client information back */
+ 	if (duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy client ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
+ 		goto fail;
+ 	}
+ 
+ 	/* get per-host configuration for the client, if any. */
+ 	if ((client_conf = find_hostconf(&optinfo->clientID))) {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "found a host configuration named %s", client_conf->name);
+ 	}
+ 
+ 	/* process authentication */
+ 	if (process_auth(dh6, len, client_conf, optinfo, &roptinfo)) {
+-		dprintf(LOG_INFO, FNAME, "failed to process authentication "
++		debug_printf(LOG_INFO, FNAME, "failed to process authentication "
+ 		    "information for %s",
+ 		    clientstr(client_conf, &optinfo->clientID));
+ 		goto fail;
+@@ -1735,11 +1735,11 @@ react_renew(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	    TAILQ_EMPTY(relayinfohead)) {
+ 		u_int16_t stcode = DH6OPT_STCODE_USEMULTICAST;
+ 
+-		dprintf(LOG_INFO, FNAME, "unexpected unicast message from %s",
++		debug_printf(LOG_INFO, FNAME, "unexpected unicast message from %s",
+ 		    addr2str(from));
+ 		if (dhcp6_add_listval(&roptinfo.stcode_list,
+ 		    DHCP6_LISTVAL_STCODE, &stcode, NULL) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "failed to add a status code");
++			debug_printf(LOG_ERR, FNAME, "failed to add a status code");
+ 			goto fail;
+ 		}
+ 		server6_send(DH6_REPLY, ifp, dh6, optinfo, from,
+@@ -1764,7 +1764,7 @@ react_renew(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* add other configuration information */
+ 	if (set_statelessinfo(DH6_RENEW, &roptinfo)) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "failed to set other stateless information");
+ 		goto fail;
+ 	}
+@@ -1799,13 +1799,13 @@ react_rebind(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* the message must include a Client Identifier option */
+ 	if (optinfo->clientID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no client ID option");
++		debug_printf(LOG_INFO, FNAME, "no client ID option");
+ 		return (-1);
+ 	}
+ 
+ 	/* the message must not include a server Identifier option */
+ 	if (optinfo->serverID.duid_len) {
+-		dprintf(LOG_INFO, FNAME, "server ID option is included in "
++		debug_printf(LOG_INFO, FNAME, "server ID option is included in "
+ 		    "a rebind message");
+ 		return (-1);
+ 	}
+@@ -1817,24 +1817,24 @@ react_rebind(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* server identifier option */
+ 	if (duidcpy(&roptinfo.serverID, &server_duid)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy server ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
+ 		goto fail;
+ 	}
+ 	/* copy client information back */
+ 	if (duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy client ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
+ 		goto fail;
+ 	}
+ 
+ 	/* get per-host configuration for the client, if any. */
+ 	if ((client_conf = find_hostconf(&optinfo->clientID))) {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "found a host configuration named %s", client_conf->name);
+ 	}
+ 
+ 	/* process authentication */
+ 	if (process_auth(dh6, len, client_conf, optinfo, &roptinfo)) {
+-		dprintf(LOG_INFO, FNAME, "failed to process authentication "
++		debug_printf(LOG_INFO, FNAME, "failed to process authentication "
+ 		    "information for %s",
+ 		    clientstr(client_conf, &optinfo->clientID));
+ 		goto fail;
+@@ -1866,13 +1866,13 @@ react_rebind(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	 */
+ 	if (TAILQ_EMPTY(&roptinfo.iapd_list) &&
+ 	    TAILQ_EMPTY(&roptinfo.iana_list)) {
+-		dprintf(LOG_INFO, FNAME, "no useful information for a rebind");
++		debug_printf(LOG_INFO, FNAME, "no useful information for a rebind");
+ 		goto fail;	/* discard the rebind */
+ 	}
+ 
+ 	/* add other configuration information */
+ 	if (set_statelessinfo(DH6_REBIND, &roptinfo)) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "failed to set other stateless information");
+ 		goto fail;
+ 	}
+@@ -1908,17 +1908,17 @@ react_release(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* the message must include a Server Identifier option */
+ 	if (optinfo->serverID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no server ID option");
++		debug_printf(LOG_INFO, FNAME, "no server ID option");
+ 		return (-1);
+ 	}
+ 	/* the contents of the Server Identifier option must match ours */
+ 	if (duidcmp(&optinfo->serverID, &server_duid)) {
+-		dprintf(LOG_INFO, FNAME, "server ID mismatch");
++		debug_printf(LOG_INFO, FNAME, "server ID mismatch");
+ 		return (-1);
+ 	}
+ 	/* the message must include a Client Identifier option */
+ 	if (optinfo->clientID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no client ID option");
++		debug_printf(LOG_INFO, FNAME, "no client ID option");
+ 		return (-1);
+ 	}
+ 
+@@ -1929,24 +1929,24 @@ react_release(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* server identifier option */
+ 	if (duidcpy(&roptinfo.serverID, &server_duid)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy server ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
+ 		goto fail;
+ 	}
+ 	/* copy client information back */
+ 	if (duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy client ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
+ 		goto fail;
+ 	}
+ 
+ 	/* get per-host configuration for the client, if any. */
+ 	if ((client_conf = find_hostconf(&optinfo->clientID))) {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "found a host configuration named %s", client_conf->name);
+ 	}
+ 
+ 	/* process authentication */
+ 	if (process_auth(dh6, len, client_conf, optinfo, &roptinfo)) {
+-		dprintf(LOG_INFO, FNAME, "failed to process authentication "
++		debug_printf(LOG_INFO, FNAME, "failed to process authentication "
+ 		    "information for %s",
+ 		    clientstr(client_conf, &optinfo->clientID));
+ 		goto fail;
+@@ -1966,11 +1966,11 @@ react_release(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	    TAILQ_EMPTY(relayinfohead)) {
+ 		u_int16_t stcode = DH6OPT_STCODE_USEMULTICAST;
+ 
+-		dprintf(LOG_INFO, FNAME, "unexpected unicast message from %s",
++		debug_printf(LOG_INFO, FNAME, "unexpected unicast message from %s",
+ 		    addr2str(from));
+ 		if (dhcp6_add_listval(&roptinfo.stcode_list,
+ 		    DHCP6_LISTVAL_STCODE, &stcode, NULL) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "failed to add a status code");
++			debug_printf(LOG_ERR, FNAME, "failed to add a status code");
+ 			goto fail;
+ 		}
+ 		server6_send(DH6_REPLY, ifp, dh6, optinfo, from,
+@@ -2001,7 +2001,7 @@ react_release(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	stcode = DH6OPT_STCODE_SUCCESS;
+ 	if (dhcp6_add_listval(&roptinfo.stcode_list,
+ 	    DHCP6_LISTVAL_STCODE, &stcode, NULL) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to add a status code");
++		debug_printf(LOG_NOTICE, FNAME, "failed to add a status code");
+ 		goto fail;
+ 	}
+ 
+@@ -2037,17 +2037,17 @@ react_decline(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* the message must include a Server Identifier option */
+ 	if (optinfo->serverID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no server ID option");
++		debug_printf(LOG_INFO, FNAME, "no server ID option");
+ 		return (-1);
+ 	}
+ 	/* the contents of the Server Identifier option must match ours */
+ 	if (duidcmp(&optinfo->serverID, &server_duid)) {
+-		dprintf(LOG_INFO, FNAME, "server ID mismatch");
++		debug_printf(LOG_INFO, FNAME, "server ID mismatch");
+ 		return (-1);
+ 	}
+ 	/* the message must include a Client Identifier option */
+ 	if (optinfo->clientID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no client ID option");
++		debug_printf(LOG_INFO, FNAME, "no client ID option");
+ 		return (-1);
+ 	}
+ 
+@@ -2058,24 +2058,24 @@ react_decline(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* server identifier option */
+ 	if (duidcpy(&roptinfo.serverID, &server_duid)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy server ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
+ 		goto fail;
+ 	}
+ 	/* copy client information back */
+ 	if (duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy client ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
+ 		goto fail;
+ 	}
+ 
+ 	/* get per-host configuration for the client, if any. */
+ 	if ((client_conf = find_hostconf(&optinfo->clientID))) {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "found a host configuration named %s", client_conf->name);
+ 	}
+ 
+ 	/* process authentication */
+ 	if (process_auth(dh6, len, client_conf, optinfo, &roptinfo)) {
+-		dprintf(LOG_INFO, FNAME, "failed to process authentication "
++		debug_printf(LOG_INFO, FNAME, "failed to process authentication "
+ 		    "information for %s",
+ 		    clientstr(client_conf, &optinfo->clientID));
+ 		goto fail;
+@@ -2095,11 +2095,11 @@ react_decline(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	    TAILQ_EMPTY(relayinfohead)) {
+ 		stcode = DH6OPT_STCODE_USEMULTICAST;
+ 
+-		dprintf(LOG_INFO, FNAME, "unexpected unicast message from %s",
++		debug_printf(LOG_INFO, FNAME, "unexpected unicast message from %s",
+ 		    addr2str(from));
+ 		if (dhcp6_add_listval(&roptinfo.stcode_list,
+ 		    DHCP6_LISTVAL_STCODE, &stcode, NULL) == NULL) {
+-			dprintf(LOG_ERR, FNAME, "failed to add a status code");
++			debug_printf(LOG_ERR, FNAME, "failed to add a status code");
+ 			goto fail;
+ 		}
+ 		server6_send(DH6_REPLY, ifp, dh6, optinfo, from,
+@@ -2126,7 +2126,7 @@ react_decline(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	stcode = DH6OPT_STCODE_SUCCESS;
+ 	if (dhcp6_add_listval(&roptinfo.stcode_list,
+ 	    DHCP6_LISTVAL_STCODE, &stcode, NULL) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to add a status code");
++		debug_printf(LOG_NOTICE, FNAME, "failed to add a status code");
+ 		goto fail;
+ 	}
+ 
+@@ -2164,12 +2164,12 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* the message may not include a Server Identifier option */
+ 	if (optinfo->serverID.duid_len) {
+-		dprintf(LOG_INFO, FNAME, "server ID option found");
++		debug_printf(LOG_INFO, FNAME, "server ID option found");
+ 		return (-1);
+ 	}
+ 	/* the message must include a Client Identifier option */
+ 	if (optinfo->clientID.duid_len == 0) {
+-		dprintf(LOG_INFO, FNAME, "no client ID option");
++		debug_printf(LOG_INFO, FNAME, "no client ID option");
+ 		return (-1);
+ 	}
+ 
+@@ -2177,24 +2177,24 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* server identifier option */
+ 	if (duidcpy(&roptinfo.serverID, &server_duid)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy server ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
+ 		goto fail;
+ 	}
+ 	/* copy client information back */
+ 	if (duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy client ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
+ 		goto fail;
+ 	}
+ 
+ 	/* get per-host configuration for the client, if any. */
+ 	if ((client_conf = find_hostconf(&optinfo->clientID))) {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "found a host configuration named %s", client_conf->name);
+ 	}
+ 
+ 	/* process authentication */
+ 	if (process_auth(dh6, len, client_conf, optinfo, &roptinfo)) {
+-		dprintf(LOG_INFO, FNAME, "failed to process authentication "
++		debug_printf(LOG_INFO, FNAME, "failed to process authentication "
+ 		    "information for %s",
+ 		    clientstr(client_conf, &optinfo->clientID));
+ 		goto fail;
+@@ -2203,7 +2203,7 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	if (client_conf == NULL && ifp->pool.name) {
+ 		if ((client_conf = create_dynamic_hostconf(&optinfo->clientID,
+ 			&ifp->pool)) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 		    	"failed to make host configuration");
+ 			goto fail;
+ 		}
+@@ -2211,7 +2211,7 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	TAILQ_INIT(&conflist);
+ 	/* make a local copy of the configured addresses */
+ 	if (dhcp6_copy_list(&conflist, &client_conf->addr_list)) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to make local data");
+ 		goto fail;
+ 	}
+@@ -2221,13 +2221,13 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	 * [RFC3315 18.2]. (IA-PD is just ignored [RFC3633 12.1])
+ 	 */
+ 	if (TAILQ_EMPTY(&optinfo->iana_list)) {
+-		dprintf(LOG_INFO, FNAME, "no IA-NA option found");
++		debug_printf(LOG_INFO, FNAME, "no IA-NA option found");
+ 		goto fail;
+ 	}
+ 	for (iana = TAILQ_FIRST(&optinfo->iana_list); iana;
+ 	    iana = TAILQ_NEXT(iana, link)) {
+ 		if (TAILQ_EMPTY(&iana->sublist)) {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "no IA-ADDR option found in IA-NA %d",
+ 			    iana->val_ia.iaid);
+ 			goto fail;
+@@ -2250,7 +2250,7 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 				struct relayinfo *relayinfo;
+ 
+ 				if (relayinfohead == NULL) {
+-					dprintf(LOG_INFO, FNAME,
++					debug_printf(LOG_INFO, FNAME,
+ 					    "no link-addr found");
+ 					goto fail;
+ 				}
+@@ -2264,7 +2264,7 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 			}
+ 
+ 			if (memcmp(linkaddr, confaddr, 8) != 0) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "%s does not seem to belong to %s's link",
+ 				    in6addr2str(confaddr, 0),
+ 				    in6addr2str(linkaddr, 0));
+@@ -2283,7 +2283,7 @@ react_confirm(ifp, pi, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	    iana = TAILQ_NEXT(iana, link)) {
+ 		if (make_ia(iana, &conflist, &roptinfo.iana_list,
+ 		    client_conf, 1) == 0) {
+-			dprintf(LOG_DEBUG, FNAME,
++			debug_printf(LOG_DEBUG, FNAME,
+ 			    "IA-NA configuration not found");
+ 			goto fail;
+ 		}
+@@ -2326,12 +2326,12 @@ react_informreq(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	 * [RFC3315 Section 15]
+ 	 */
+ 	if (!TAILQ_EMPTY(&optinfo->iapd_list)) {
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 		    "information request contains an IA_PD option");
+ 		return (-1);
+ 	}
+ 	if (!TAILQ_EMPTY(&optinfo->iana_list)) {
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 		    "information request contains an IA_NA option");
+ 		return (-1);
+ 	}
+@@ -2339,7 +2339,7 @@ react_informreq(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 	/* if a server identifier is included, it must match ours. */
+ 	if (optinfo->serverID.duid_len &&
+ 	    duidcmp(&optinfo->serverID, &server_duid)) {
+-		dprintf(LOG_INFO, FNAME, "server DUID mismatch");
++		debug_printf(LOG_INFO, FNAME, "server DUID mismatch");
+ 		return (-1);
+ 	}
+ 
+@@ -2350,20 +2350,20 @@ react_informreq(ifp, dh6, len, optinfo, from, fromlen, relayinfohead)
+ 
+ 	/* server identifier option */
+ 	if (duidcpy(&roptinfo.serverID, &server_duid)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy server ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy server ID");
+ 		goto fail;
+ 	}
+ 
+ 	/* copy client information back (if provided) */
+ 	if (optinfo->clientID.duid_id &&
+ 	    duidcpy(&roptinfo.clientID, &optinfo->clientID)) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy client ID");
++		debug_printf(LOG_ERR, FNAME, "failed to copy client ID");
+ 		goto fail;
+ 	}
+ 
+ 	/* set stateless information */
+ 	if (set_statelessinfo(DH6_INFORM_REQ, &roptinfo)) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "failed to set other stateless information");
+ 		goto fail;
+ 	}
+@@ -2391,7 +2391,7 @@ update_ia(msgtype, iap, retlist, optinfo)
+ 
+ 	/* get per-host configuration for the client, if any. */
+ 	if ((client_conf = find_hostconf(&optinfo->clientID))) {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "found a host configuration named %s", client_conf->name);
+ 	}
+ 
+@@ -2404,7 +2404,7 @@ update_ia(msgtype, iap, retlist, optinfo)
+ 		 * Sections 18.2.3 and 18.2.4 of RFC3315, and the two sets
+ 		 * of behavior are identical.
+ 		 */
+-		dprintf(LOG_INFO, FNAME, "no binding found for %s",
++		debug_printf(LOG_INFO, FNAME, "no binding found for %s",
+ 		    duidstr(&optinfo->clientID));
+ 
+ 		switch (msgtype) {
+@@ -2418,7 +2418,7 @@ update_ia(msgtype, iap, retlist, optinfo)
+ 			 */
+ 			if (make_ia_stcode(iap->type, iap->val_ia.iaid,
+ 			    DH6OPT_STCODE_NOBINDING, retlist)) {
+-				dprintf(LOG_NOTICE, FNAME,
++				debug_printf(LOG_NOTICE, FNAME,
+ 				    "failed to make an option list");
+ 				return (-1);
+ 			}
+@@ -2440,7 +2440,7 @@ update_ia(msgtype, iap, retlist, optinfo)
+ 			 */
+ 			return (-1);
+ 		default:	/* XXX: should be a bug */
+-			dprintf(LOG_ERR, FNAME, "impossible message type %s",
++			debug_printf(LOG_ERR, FNAME, "impossible message type %s",
+ 			    dhcp6msgstr(msgtype));
+ 			return (-1);
+ 		}
+@@ -2468,7 +2468,7 @@ update_ia(msgtype, iap, retlist, optinfo)
+ 				blv = dhcp6_find_listval(&binding->val_list,
+ 				    DHCP6_LISTVAL_PREFIX6, &prefix, 0);
+ 				if (blv == NULL) {
+-					dprintf(LOG_DEBUG, FNAME,
++					debug_printf(LOG_DEBUG, FNAME,
+ 					    "%s/%d is not found in %s",
+ 					    in6addr2str(&prefix.addr, 0),
+ 					    prefix.plen, bindingstr(binding));
+@@ -2484,7 +2484,7 @@ update_ia(msgtype, iap, retlist, optinfo)
+ 				if (dhcp6_add_listval(&ialist,
+ 				    DHCP6_LISTVAL_PREFIX6, &prefix, NULL)
+ 				    == NULL) {
+-					dprintf(LOG_NOTICE, FNAME,
++					debug_printf(LOG_NOTICE, FNAME,
+ 					    "failed  to copy binding info");
+ 					dhcp6_clear_list(&ialist);
+ 					return (-1);
+@@ -2498,7 +2498,7 @@ update_ia(msgtype, iap, retlist, optinfo)
+ 				blv = dhcp6_find_listval(&binding->val_list,
+ 				    DHCP6_LISTVAL_STATEFULADDR6, &saddr, 0);
+ 				if (blv == NULL) {
+-					dprintf(LOG_DEBUG, FNAME,
++					debug_printf(LOG_DEBUG, FNAME,
+ 					    "%s is not found in %s",
+ 					    in6addr2str(&saddr.addr, 0),
+ 					    bindingstr(binding));
+@@ -2514,14 +2514,14 @@ update_ia(msgtype, iap, retlist, optinfo)
+ 				if (dhcp6_add_listval(&ialist,
+ 				    DHCP6_LISTVAL_STATEFULADDR6, &saddr, NULL)
+ 				    == NULL) {
+-					dprintf(LOG_NOTICE, FNAME,
++					debug_printf(LOG_NOTICE, FNAME,
+ 					    "failed  to copy binding info");
+ 					dhcp6_clear_list(&ialist);
+ 					return (-1);
+ 				}
+ 				break;
+ 			default:
+-				dprintf(LOG_ERR, FNAME, "unsupported IA type");
++				debug_printf(LOG_ERR, FNAME, "unsupported IA type");
+ 				return (-1); /* XXX */
+ 			}
+ 		}
+@@ -2560,7 +2560,7 @@ release_binding_ia(iap, retlist, optinfo)
+ 		 */
+ 		if (make_ia_stcode(iap->type, iap->val_ia.iaid,
+ 		    DH6OPT_STCODE_NOBINDING, retlist)) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to make an option list");
+ 			return (-1);
+ 		}
+@@ -2582,7 +2582,7 @@ release_binding_ia(iap, retlist, optinfo)
+ 			if ((lvia = find_binding_ia(lv, binding)) != NULL) {
+ 				switch (binding->iatype) {
+ 					case DHCP6_LISTVAL_IAPD:
+-						dprintf(LOG_DEBUG, FNAME,
++						debug_printf(LOG_DEBUG, FNAME,
+ 						    "bound prefix %s/%d "
+ 						    "has been released",
+ 						    in6addr2str(&lvia->val_prefix6.addr,
+@@ -2591,7 +2591,7 @@ release_binding_ia(iap, retlist, optinfo)
+ 						break;
+ 					case DHCP6_LISTVAL_IANA:
+ 						release_address(&lvia->val_prefix6.addr);
+-						dprintf(LOG_DEBUG, FNAME,
++						debug_printf(LOG_DEBUG, FNAME,
+ 						    "bound address %s "
+ 						    "has been released",
+ 						    in6addr2str(&lvia->val_prefix6.addr,
+@@ -2635,7 +2635,7 @@ decline_binding_ia(iap, retlist, optinfo)
+ 		 */
+ 		if (make_ia_stcode(iap->type, iap->val_ia.iaid,
+ 		    DH6OPT_STCODE_NOBINDING, retlist)) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to make an option list");
+ 			return (-1);
+ 		}
+@@ -2657,13 +2657,13 @@ decline_binding_ia(iap, retlist, optinfo)
+ 		}
+ 
+ 		if ((lvia = find_binding_ia(lv, binding)) == NULL) {
+-			dprintf(LOG_DEBUG, FNAME, "no binding found "
++			debug_printf(LOG_DEBUG, FNAME, "no binding found "
+ 			    "for address %s",
+ 			    in6addr2str(&lv->val_statefuladdr6.addr, 0));
+ 			continue;
+ 		}
+ 
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "bound address %s has been marked as declined",
+ 		    in6addr2str(&lvia->val_statefuladdr6.addr, 0));
+ 		decline_address(&lvia->val_statefuladdr6.addr);
+@@ -2688,7 +2688,7 @@ server6_signal(sig)
+ 	int sig;
+ {
+ 
+-	dprintf(LOG_INFO, FNAME, "received a signal (%d)", sig);
++	debug_printf(LOG_INFO, FNAME, "received a signal (%d)", sig);
+ 
+ 	switch (sig) {
+ 	case SIGTERM:
+@@ -2717,7 +2717,7 @@ server6_send(type, ifp, origmsg, optinfo, from, fromlen,
+ 	struct relayinfo *relayinfo;
+ 
+ 	if (sizeof(struct dhcp6) > sizeof(replybuf)) {
+-		dprintf(LOG_ERR, FNAME, "buffer size assumption failed");
++		debug_printf(LOG_ERR, FNAME, "buffer size assumption failed");
+ 		return (-1);
+ 	}
+ 
+@@ -2730,7 +2730,7 @@ server6_send(type, ifp, origmsg, optinfo, from, fromlen,
+ 	/* set options in the reply message */
+ 	if ((optlen = dhcp6_set_options(type, (struct dhcp6opt *)(dh6 + 1),
+ 	    (struct dhcp6opt *)(replybuf + sizeof(replybuf)), roptinfo)) < 0) {
+-		dprintf(LOG_INFO, FNAME, "failed to construct reply options");
++		debug_printf(LOG_INFO, FNAME, "failed to construct reply options");
+ 		return (-1);
+ 	}
+ 	len += optlen;
+@@ -2740,7 +2740,7 @@ server6_send(type, ifp, origmsg, optinfo, from, fromlen,
+ 	case DHCP6_AUTHPROTO_DELAYED:
+ 		if (client_conf == NULL || client_conf->delayedkey == NULL) {
+ 			/* This case should have been caught earlier */
+-			dprintf(LOG_ERR, FNAME, "authentication required "
++			debug_printf(LOG_ERR, FNAME, "authentication required "
+ 			    "but not key provided");
+ 			break;
+ 		}
+@@ -2748,7 +2748,7 @@ server6_send(type, ifp, origmsg, optinfo, from, fromlen,
+ 		    roptinfo->authalgorithm,
+ 		    roptinfo->delayedauth_offset + sizeof(*dh6),
+ 		    client_conf->delayedkey)) {
+-			dprintf(LOG_WARNING, FNAME, "failed to calculate MAC");
++			debug_printf(LOG_WARNING, FNAME, "failed to calculate MAC");
+ 			return (-1);
+ 		}
+ 		break;
+@@ -2792,7 +2792,7 @@ server6_send(type, ifp, origmsg, optinfo, from, fromlen,
+ 		    (struct dhcp6opt *)(dh6relay + 1),
+ 		    (struct dhcp6opt *)(replybuf + sizeof(replybuf)),
+ 		    &relayopt)) < 0) {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "failed to construct relay message");
+ 			dhcp6_clear_options(&relayopt);
+ 			return (-1);
+@@ -2808,12 +2808,12 @@ server6_send(type, ifp, origmsg, optinfo, from, fromlen,
+ 	dst.sin6_scope_id = ((struct sockaddr_in6 *)from)->sin6_scope_id;
+ 	if (transmit_sa(outsock, (struct sockaddr *)&dst,
+ 	    replybuf, len) != 0) {
+-		dprintf(LOG_ERR, FNAME, "transmit %s to %s failed",
++		debug_printf(LOG_ERR, FNAME, "transmit %s to %s failed",
+ 		    dhcp6msgstr(type), addr2str((struct sockaddr *)&dst));
+ 		return (-1);
+ 	}
+ 
+-	dprintf(LOG_DEBUG, FNAME, "transmit %s to %s",
++	debug_printf(LOG_DEBUG, FNAME, "transmit %s to %s",
+ 	    dhcp6msgstr(type), addr2str((struct sockaddr *)&dst));
+ 
+ 	return (0);
+@@ -2835,13 +2835,13 @@ make_ia_stcode(iatype, iaid, stcode, retlist)
+ 	TAILQ_INIT(&stcode_list);
+ 	if (dhcp6_add_listval(&stcode_list, DHCP6_LISTVAL_STCODE,
+ 	    &stcode, NULL) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to make an option list");
++		debug_printf(LOG_NOTICE, FNAME, "failed to make an option list");
+ 		return (-1);
+ 	}
+ 
+ 	if (dhcp6_add_listval(retlist, iatype,
+ 	    &ia_empty, &stcode_list) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to make an option list");
++		debug_printf(LOG_NOTICE, FNAME, "failed to make an option list");
+ 		dhcp6_clear_list(&stcode_list);
+ 		return (-1);
+ 	}
+@@ -2872,7 +2872,7 @@ make_ia(spec, conflist, retlist, client_conf, do_binding)
+ 		struct dhcp6_list *blist = &binding->val_list;
+ 		struct dhcp6_listval *bia, *v;
+ 
+-		dprintf(LOG_DEBUG, FNAME, "we have a binding already: %s",
++		debug_printf(LOG_DEBUG, FNAME, "we have a binding already: %s",
+ 		    bindingstr(binding));
+ 
+ 		update_binding(binding);
+@@ -2883,7 +2883,7 @@ make_ia(spec, conflist, retlist, client_conf, do_binding)
+ 		calc_ia_timo(&ia, blist, client_conf);
+ 		if (dhcp6_add_listval(retlist, spec->type, &ia, blist)
+ 		    == NULL) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to copy binding info");
+ 			return (0);
+ 		}
+@@ -2959,7 +2959,7 @@ make_ia(spec, conflist, retlist, client_conf, do_binding)
+ 		if (do_binding) {
+ 			if (add_binding(&client_conf->duid, DHCP6_BINDING_IA,
+ 			    spec->type, spec->val_ia.iaid, &ialist) == NULL) {
+-				dprintf(LOG_NOTICE, FNAME,
++				debug_printf(LOG_NOTICE, FNAME,
+ 				    "failed to make a binding");
+ 				found = 0;
+ 			}
+@@ -3000,7 +3000,7 @@ make_match_ia(spec, conflist, retlist)
+ 				match = 0;
+ 			break;
+ 		default:
+-			dprintf(LOG_ERR, FNAME, "unsupported IA type");
++			debug_printf(LOG_ERR, FNAME, "unsupported IA type");
+ 			return (0); /* XXX */
+ 		}
+ 	}
+@@ -3032,10 +3032,10 @@ make_iana_from_pool(poolspec, spec, retlist)
+ 	struct pool_conf *pool;
+ 	int found = 0;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "called");
++	debug_printf(LOG_DEBUG, FNAME, "called");
+ 
+ 	if ((pool = find_pool(poolspec->name)) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "pool '%s' not found", poolspec->name);
++		debug_printf(LOG_ERR, FNAME, "pool '%s' not found", poolspec->name);
+ 		return (0);
+ 	}
+ 
+@@ -3060,7 +3060,7 @@ make_iana_from_pool(poolspec, spec, retlist)
+ 		}
+ 	}
+ 
+-	dprintf(LOG_DEBUG, FNAME, "returns (found=%d)", found);
++	debug_printf(LOG_DEBUG, FNAME, "returns (found=%d)", found);
+ 
+ 	return (found);
+ }
+@@ -3078,7 +3078,7 @@ calc_ia_timo(ia, ialist, client_conf)
+ 	iatype = TAILQ_FIRST(ialist)->type;
+ 	for (iav = TAILQ_FIRST(ialist); iav; iav = TAILQ_NEXT(iav, link)) {
+ 		if (iav->type != iatype) {
+-			dprintf(LOG_ERR, FNAME,
++			debug_printf(LOG_ERR, FNAME,
+ 			    "assumption failure: IA list is not consistent");
+ 			exit (1); /* XXX */
+ 		}
+@@ -3144,7 +3144,7 @@ update_binding_duration(binding)
+ 				lifetime = iav->val_statefuladdr6.vltime;
+ 				break;
+ 			default:
+-				dprintf(LOG_ERR, FNAME, "unsupported IA type");
++				debug_printf(LOG_ERR, FNAME, "unsupported IA type");
+ 				return;	/* XXX */
+ 			}
+ 
+@@ -3162,7 +3162,7 @@ update_binding_duration(binding)
+ 		break;
+ 	default:
+ 		/* should be internal error. */
+-		dprintf(LOG_ERR, FNAME, "unknown binding type (%d)",
++		debug_printf(LOG_ERR, FNAME, "unknown binding type (%d)",
+ 		    binding->type);
+ 		return;
+ 	}
+@@ -3182,13 +3182,13 @@ add_binding(clientid, btype, iatype, iaid, val0)
+ 	u_int32_t duration = DHCP6_DURATION_INFINITE;
+ 
+ 	if ((binding = malloc(sizeof(*binding))) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to allocate memory");
++		debug_printf(LOG_NOTICE, FNAME, "failed to allocate memory");
+ 		return (NULL);
+ 	}
+ 	memset(binding, 0, sizeof(*binding));
+ 	binding->type = btype;
+ 	if (duidcpy(&binding->clientid, clientid)) {
+-		dprintf(LOG_NOTICE, FNAME, "failed to copy DUID");
++		debug_printf(LOG_NOTICE, FNAME, "failed to copy DUID");
+ 		goto fail;
+ 	}
+ 	binding->iatype = iatype;
+@@ -3200,7 +3200,7 @@ add_binding(clientid, btype, iatype, iaid, val0)
+ 		TAILQ_INIT(&binding->val_list);
+ 		if (dhcp6_copy_list(&binding->val_list,
+ 		    (struct dhcp6_list *)val0)) {
+-			dprintf(LOG_NOTICE, FNAME,
++			debug_printf(LOG_NOTICE, FNAME,
+ 			    "failed to copy binding data");
+ 			goto fail;
+ 		}
+@@ -3213,13 +3213,13 @@ add_binding(clientid, btype, iatype, iaid, val0)
+ 				lv_next = TAILQ_NEXT(lv, link);
+ 
+ 				if (lv->type != DHCP6_LISTVAL_STATEFULADDR6) {
+-					dprintf(LOG_ERR, FNAME,
++					debug_printf(LOG_ERR, FNAME,
+ 						"unexpected binding value type(%d)", lv->type);
+ 					continue;
+ 				}
+ 
+ 				if (!lease_address(&lv->val_statefuladdr6.addr)) {
+-					dprintf(LOG_NOTICE, FNAME,
++					debug_printf(LOG_NOTICE, FNAME,
+ 						"cannot lease address %s",
+ 						in6addr2str(&lv->val_statefuladdr6.addr, 0));
+ 					TAILQ_REMOVE(ia_list, lv, link);
+@@ -3227,13 +3227,13 @@ add_binding(clientid, btype, iatype, iaid, val0)
+ 				}
+ 			}
+ 			if (TAILQ_EMPTY(ia_list)) {
+-				dprintf(LOG_NOTICE, FNAME, "cannot lease any address");
++				debug_printf(LOG_NOTICE, FNAME, "cannot lease any address");
+ 				goto fail;
+ 			}
+ 		}
+ 		break;
+ 	default:
+-		dprintf(LOG_ERR, FNAME, "unexpected binding type(%d)", btype);
++		debug_printf(LOG_ERR, FNAME, "unexpected binding type(%d)", btype);
+ 		goto fail;
+ 	}
+ 
+@@ -3245,7 +3245,7 @@ add_binding(clientid, btype, iatype, iaid, val0)
+ 
+ 		binding->timer = dhcp6_add_timer(binding_timo, binding);
+ 		if (binding->timer == NULL) {
+-			dprintf(LOG_NOTICE, FNAME, "failed to add timer");
++			debug_printf(LOG_NOTICE, FNAME, "failed to add timer");
+ 			goto fail;
+ 		}
+ 		timo.tv_sec = (long)duration;
+@@ -3255,7 +3255,7 @@ add_binding(clientid, btype, iatype, iaid, val0)
+ 
+ 	TAILQ_INSERT_TAIL(&dhcp6_binding_head, binding, link);
+ 
+-	dprintf(LOG_DEBUG, FNAME, "add a new binding %s", bindingstr(binding));
++	debug_printf(LOG_DEBUG, FNAME, "add a new binding %s", bindingstr(binding));
+ 
+ 	return (binding);
+ 
+@@ -3295,7 +3295,7 @@ update_binding(binding)
+ {
+ 	struct timeval timo;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "update binding %s for %s",
++	debug_printf(LOG_DEBUG, FNAME, "update binding %s for %s",
+ 	    bindingstr(binding), duidstr(&binding->clientid));
+ 
+ 	/* update timestamp and calculate new duration */
+@@ -3316,7 +3316,7 @@ static void
+ remove_binding(binding)
+ 	struct dhcp6_binding *binding;
+ {
+-	dprintf(LOG_DEBUG, FNAME, "remove a binding %s",
++	debug_printf(LOG_DEBUG, FNAME, "remove a binding %s",
+ 	    bindingstr(binding));
+ 
+ 	if (binding->timer)
+@@ -3343,7 +3343,7 @@ free_binding(binding)
+ 
+ 			for (lv = TAILQ_FIRST(ia_list); lv; lv = TAILQ_NEXT(lv, link)) {
+ 				if (lv->type != DHCP6_LISTVAL_STATEFULADDR6) {
+-					dprintf(LOG_ERR, FNAME,
++					debug_printf(LOG_ERR, FNAME,
+ 						"unexpected binding value type(%d)", lv->type);
+ 					continue;
+ 				}
+@@ -3353,7 +3353,7 @@ free_binding(binding)
+ 		dhcp6_clear_list(&binding->val_list);
+ 		break;
+ 	default:
+-		dprintf(LOG_ERR, FNAME, "unknown binding type %d",
++		debug_printf(LOG_ERR, FNAME, "unknown binding type %d",
+ 		    binding->type);
+ 		break;
+ 	}
+@@ -3386,7 +3386,7 @@ binding_timo(arg)
+ 				lifetime = iav->val_prefix6.vltime;
+ 				break;
+ 			default:
+-				dprintf(LOG_ERR, FNAME, "internal error: "
++				debug_printf(LOG_ERR, FNAME, "internal error: "
+ 				    "unknown binding type (%d)",
+ 				    binding->iatype);
+ 				return (NULL); /* XXX */
+@@ -3394,7 +3394,7 @@ binding_timo(arg)
+ 
+ 			if (lifetime != DHCP6_DURATION_INFINITE &&
+ 			    lifetime <= past) {
+-				dprintf(LOG_DEBUG, FNAME, "bound prefix %s/%d"
++				debug_printf(LOG_DEBUG, FNAME, "bound prefix %s/%d"
+ 				    " in %s has expired",
+ 				    in6addr2str(&iav->val_prefix6.addr, 0),
+ 				    iav->val_prefix6.plen,
+@@ -3414,7 +3414,7 @@ binding_timo(arg)
+ 
+ 		break;
+ 	default:
+-		dprintf(LOG_ERR, FNAME, "unknown binding type %d",
++		debug_printf(LOG_ERR, FNAME, "unknown binding type %d",
+ 		    binding->type);
+ 		return (NULL);	/* XXX */
+ 	}
+@@ -3444,7 +3444,7 @@ find_binding_ia(key, binding)
+ 	case DHCP6_BINDING_IA:
+ 		return (dhcp6_find_listval(ia_list, key->type, &key->uv, 0));
+ 	default:
+-		dprintf(LOG_ERR, FNAME, "unknown binding type %d",
++		debug_printf(LOG_ERR, FNAME, "unknown binding type %d",
+ 		    binding->type);
+ 		return (NULL);	/* XXX */
+ 	}
+@@ -3474,7 +3474,7 @@ bindingstr(binding)
+ 		    (u_long)binding->duration);
+ 		break;
+ 	default:
+-		dprintf(LOG_ERR, FNAME, "unexpected binding type(%d)",
++		debug_printf(LOG_ERR, FNAME, "unexpected binding type(%d)",
+ 		    binding->type);
+ 		return ("???");
+ 	}
+@@ -3508,7 +3508,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
+ 		return (0);
+ 	case DHCP6_AUTHPROTO_DELAYED:
+ 		if (optinfo->authalgorithm != DHCP6_AUTHALG_HMACMD5) {
+-			dprintf(LOG_INFO, FNAME, "unknown authentication "
++			debug_printf(LOG_INFO, FNAME, "unknown authentication "
+ 			    "algorithm (%d) required by %s",
+ 			    optinfo->authalgorithm,
+ 			    clientstr(client_conf, &optinfo->clientID));
+@@ -3516,7 +3516,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
+ 		}
+ 
+ 		if (optinfo->authrdm != DHCP6_AUTHRDM_MONOCOUNTER) {
+-			dprintf(LOG_INFO, FNAME,
++			debug_printf(LOG_INFO, FNAME,
+ 			    "unknown RDM (%d) required by %s",
+ 			    optinfo->authrdm,
+ 			    clientstr(client_conf, &optinfo->clientID));
+@@ -3525,13 +3525,13 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
+ 
+ 		/* see if we have a key for the client */
+ 		if (client_conf == NULL || client_conf->delayedkey == NULL) {
+-			dprintf(LOG_INFO, FNAME, "client %s wanted "
++			debug_printf(LOG_INFO, FNAME, "client %s wanted "
+ 			    "authentication, but no key found",
+ 			    clientstr(client_conf, &optinfo->clientID));
+ 			break;
+ 		}
+ 		key = client_conf->delayedkey;
+-		dprintf(LOG_DEBUG, FNAME, "found key %s for client %s",
++		debug_printf(LOG_DEBUG, FNAME, "found key %s for client %s",
+ 		    key->name, clientstr(client_conf, &optinfo->clientID));
+ 
+ 		if (msgtype == DH6_SOLICIT) {
+@@ -3540,7 +3540,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
+ 				 * A solicit message should not contain
+ 				 * authentication information.
+ 				 */
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "authentication information "
+ 				    "provided in solicit from %s",
+ 				    clientstr(client_conf,
+@@ -3550,7 +3550,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
+ 		} else {
+ 			/* replay protection */
+ 			if (!client_conf->saw_previous_rd) {
+-				dprintf(LOG_WARNING, FNAME,
++				debug_printf(LOG_WARNING, FNAME,
+ 				    "previous RD value for %s is unknown "
+ 				    "(accept it)", clientstr(client_conf,
+ 				    &optinfo->clientID));
+@@ -3558,7 +3558,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
+ 				if (dhcp6_auth_replaycheck(optinfo->authrdm,
+ 				    client_conf->previous_rd,
+ 				    optinfo->authrd)) {
+-					dprintf(LOG_INFO, FNAME,
++					debug_printf(LOG_INFO, FNAME,
+ 					    "possible replay attack detected "
+ 					    "for client %s",
+ 					    clientstr(client_conf,
+@@ -3568,7 +3568,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
+ 			}
+ 
+ 			if ((optinfo->authflags & DHCP6OPT_AUTHFLAG_NOINFO)) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "client %s did not provide authentication "
+ 				    "information in %s",
+ 				    clientstr(client_conf, &optinfo->clientID),
+@@ -3588,7 +3588,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
+ 			    optinfo->delayedauth_realmlen != key->realmlen ||
+ 			    memcmp(optinfo->delayedauth_realmval, key->realm,
+ 			    key->realmlen) != 0) {
+-				dprintf(LOG_INFO, FNAME, "authentication key "
++				debug_printf(LOG_INFO, FNAME, "authentication key "
+ 				    "mismatch with client %s",
+ 				    clientstr(client_conf,
+ 				    &optinfo->clientID));
+@@ -3597,7 +3597,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
+ 
+ 			/* check for the key lifetime */
+ 			if (dhcp6_validate_key(key)) {
+-				dprintf(LOG_INFO, FNAME, "key %s has expired",
++				debug_printf(LOG_INFO, FNAME, "key %s has expired",
+ 				    key->name);
+ 				break;
+ 			}
+@@ -3607,12 +3607,12 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
+ 			    optinfo->authproto, optinfo->authalgorithm,
+ 			    optinfo->delayedauth_offset + sizeof(*dh6), key)
+ 			    == 0) {
+-				dprintf(LOG_DEBUG, FNAME,
++				debug_printf(LOG_DEBUG, FNAME,
+ 				    "message authentication validated for "
+ 				    "client %s", clientstr(client_conf,
+ 				    &optinfo->clientID));
+ 			} else {
+-				dprintf(LOG_INFO, FNAME, "invalid message "
++				debug_printf(LOG_INFO, FNAME, "invalid message "
+ 				    "authentication");
+ 				break;
+ 			}
+@@ -3624,7 +3624,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
+ 
+ 		if (get_rdvalue(roptinfo->authrdm, &roptinfo->authrd,
+ 		    sizeof(roptinfo->authrd))) {
+-			dprintf(LOG_ERR, FNAME, "failed to get a replay "
++			debug_printf(LOG_ERR, FNAME, "failed to get a replay "
+ 			    "detection value for %s",
+ 			    clientstr(client_conf, &optinfo->clientID));
+ 			break;	/* XXX: try to recover? */
+@@ -3635,7 +3635,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
+ 		roptinfo->delayedauth_realmval =
+ 		    malloc(roptinfo->delayedauth_realmlen);
+ 		if (roptinfo->delayedauth_realmval == NULL) {
+-			dprintf(LOG_ERR, FNAME, "failed to allocate memory "
++			debug_printf(LOG_ERR, FNAME, "failed to allocate memory "
+ 			    "for authentication realm for %s",
+ 			    clientstr(client_conf, &optinfo->clientID));
+ 			break;
+@@ -3647,7 +3647,7 @@ process_auth(dh6, len, client_conf, optinfo, roptinfo)
+ 
+ 		break;
+ 	default:
+-		dprintf(LOG_INFO, FNAME, "client %s wanted authentication "
++		debug_printf(LOG_INFO, FNAME, "client %s wanted authentication "
+ 		    "with unsupported protocol (%d)",
+ 		    clientstr(client_conf, &optinfo->clientID),
+ 		    optinfo->authproto);
+diff --git a/if.c b/if.c
+index 61a7fd6..c690671 100644
+--- a/if.c
++++ b/if.c
+@@ -60,12 +60,12 @@ ifinit(ifname)
+ 	struct dhcp6_if *ifp;
+ 
+ 	if ((ifp = find_ifconfbyname(ifname)) != NULL) {
+-		dprintf(LOG_NOTICE, FNAME, "duplicated interface: %s", ifname);
++		debug_printf(LOG_NOTICE, FNAME, "duplicated interface: %s", ifname);
+ 		return (NULL);
+ 	}
+ 
+ 	if ((ifp = malloc(sizeof(*ifp))) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "malloc failed");
++		debug_printf(LOG_ERR, FNAME, "malloc failed");
+ 		goto fail;
+ 	}
+ 	memset(ifp, 0, sizeof(*ifp));
+@@ -73,7 +73,7 @@ ifinit(ifname)
+ 	TAILQ_INIT(&ifp->event_list);
+ 
+ 	if ((ifp->ifname = strdup(ifname)) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "failed to copy ifname");
++		debug_printf(LOG_ERR, FNAME, "failed to copy ifname");
+ 		goto fail;
+ 	}
+ 
+@@ -92,7 +92,7 @@ ifinit(ifname)
+ 		struct sockaddr_in6 *sin6;
+ 
+ 		if (getifaddrs(&ifap) < 0) {
+-			dprintf(LOG_ERR, FNAME, "getifaddrs failed: %s",
++			debug_printf(LOG_ERR, FNAME, "getifaddrs failed: %s",
+ 			    strerror(errno));
+ 			goto fail;
+ 		}
+@@ -134,14 +134,14 @@ ifreset(ifp)
+ 	u_int32_t linkid;
+ 
+ 	if ((ifid = if_nametoindex(ifp->ifname)) == 0) {
+-		dprintf(LOG_ERR, FNAME, "invalid interface(%s): %s",
++		debug_printf(LOG_ERR, FNAME, "invalid interface(%s): %s",
+ 			ifp->ifname, strerror(errno));
+ 		return (-1);
+ 	}
+ 
+ #ifdef HAVE_SCOPELIB
+ 	if (inet_zoneid(AF_INET6, 2, ifname, &linkid)) {
+-		dprintf(LOG_ERR, FNAME, "failed to get link ID for %s",
++		debug_printf(LOG_ERR, FNAME, "failed to get link ID for %s",
+ 		    ifname);
+ 		return (-1);
+ 	}
+diff --git a/lease.c b/lease.c
+index d46ddfd..5cb7325 100644
+--- a/lease.c
++++ b/lease.c
+@@ -93,7 +93,7 @@ static struct hash_entry * hash_table_find __P((struct hash_table *, void *));
+ int
+ lease_init(void)
+ {
+-	dprintf(LOG_DEBUG, FNAME, "called");
++	debug_printf(LOG_DEBUG, FNAME, "called");
+ 
+ 	if (hash_table_init(&dhcp6_lease_table, DHCP6_LEASE_TABLE_SIZE,
+ 		in6_addr_hash, in6_addr_match) != 0) {
+@@ -116,10 +116,10 @@ lease_address(addr)
+ 	if (!addr)
+ 		return (FALSE);
+ 
+-	dprintf(LOG_DEBUG, FNAME, "addr=%s", in6addr2str(addr, 0));
++	debug_printf(LOG_DEBUG, FNAME, "addr=%s", in6addr2str(addr, 0));
+ 
+ 	if (hash_table_find(&dhcp6_lease_table, addr)) {
+-		dprintf(LOG_WARNING, FNAME, "already leased: %s",
++		debug_printf(LOG_WARNING, FNAME, "already leased: %s",
+ 			in6addr2str(addr, 0));
+ 		return (FALSE);
+ 	}
+@@ -138,10 +138,10 @@ release_address(addr)
+ 	if (!addr)
+ 		return;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "addr=%s", in6addr2str(addr, 0));
++	debug_printf(LOG_DEBUG, FNAME, "addr=%s", in6addr2str(addr, 0));
+ 
+ 	if (hash_table_remove(&dhcp6_lease_table, addr) != 0) {
+-		dprintf(LOG_WARNING, FNAME, "not found: %s", in6addr2str(addr, 0));
++		debug_printf(LOG_WARNING, FNAME, "not found: %s", in6addr2str(addr, 0));
+ 	}
+ }
+ 
+@@ -154,11 +154,11 @@ decline_address(addr)
+ 	if (!addr)
+ 		return;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "addr=%s", in6addr2str(addr, 0));
++	debug_printf(LOG_DEBUG, FNAME, "addr=%s", in6addr2str(addr, 0));
+ 
+ 	entry = hash_table_find(&dhcp6_lease_table, addr);
+ 	if (entry == NULL) {
+-		dprintf(LOG_WARNING, FNAME, "not found: %s",
++		debug_printf(LOG_WARNING, FNAME, "not found: %s",
+ 			in6addr2str(addr, 0));
+ 		return;
+ 	}
+diff --git a/prefixconf.c b/prefixconf.c
+index ace6ade..9450a3f 100644
+--- a/prefixconf.c
++++ b/prefixconf.c
+@@ -141,7 +141,7 @@ update_prefix(ia, pinfo, pifc, dhcpifp, ctlp, callback)
+ 	if (pinfo->vltime != DHCP6_DURATION_INFINITE &&
+ 	    (pinfo->pltime == DHCP6_DURATION_INFINITE ||
+ 	    pinfo->pltime > pinfo->vltime)) {
+-		dprintf(LOG_INFO, FNAME, "invalid prefix %s/%d: "
++		debug_printf(LOG_INFO, FNAME, "invalid prefix %s/%d: "
+ 		    "pltime (%lu) is larger than vltime (%lu)",
+ 		    in6addr2str(&pinfo->addr, 0), pinfo->plen,
+ 		    pinfo->pltime, pinfo->vltime);
+@@ -150,7 +150,7 @@ update_prefix(ia, pinfo, pifc, dhcpifp, ctlp, callback)
+ 
+ 	if (iac_pd == NULL) {
+ 		if ((iac_pd = malloc(sizeof(*iac_pd))) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME, "memory allocation failed");
++			debug_printf(LOG_NOTICE, FNAME, "memory allocation failed");
+ 			return (-1);
+ 		}
+ 		memset(iac_pd, 0, sizeof(*iac_pd));
+@@ -172,7 +172,7 @@ update_prefix(ia, pinfo, pifc, dhcpifp, ctlp, callback)
+ 	/* search for the given prefix, and make a new one if it fails */
+ 	if ((sp = find_siteprefix(&iac_pd->siteprefix_head, pinfo, 1)) == NULL) {
+ 		if ((sp = malloc(sizeof(*sp))) == NULL) {
+-			dprintf(LOG_NOTICE, FNAME, "memory allocation failed");
++			debug_printf(LOG_NOTICE, FNAME, "memory allocation failed");
+ 			return (-1);
+ 		}
+ 		memset(sp, 0, sizeof(*sp));
+@@ -192,7 +192,7 @@ update_prefix(ia, pinfo, pifc, dhcpifp, ctlp, callback)
+ 	/* update the prefix according to pinfo */
+ 	sp->prefix.pltime = pinfo->pltime;
+ 	sp->prefix.vltime = pinfo->vltime;
+-	dprintf(LOG_DEBUG, FNAME, "%s a prefix %s/%d pltime=%lu, vltime=%lu",
++	debug_printf(LOG_DEBUG, FNAME, "%s a prefix %s/%d pltime=%lu, vltime=%lu",
+ 	    spcreate ? "create" : "update",
+ 	    in6addr2str(&pinfo->addr, 0), pinfo->plen,
+ 	    pinfo->pltime, pinfo->vltime);
+@@ -209,7 +209,7 @@ update_prefix(ia, pinfo, pifc, dhcpifp, ctlp, callback)
+ 			 * [RFC3633 Section 12.1]
+ 			 */
+ 			if (strcmp(pif->ifname, dhcpifp->ifname) == 0) {
+-				dprintf(LOG_INFO, FNAME,
++				debug_printf(LOG_INFO, FNAME,
+ 				    "skip %s as a prefix interface",
+ 				    dhcpifp->ifname);
+ 				continue;
+@@ -235,7 +235,7 @@ update_prefix(ia, pinfo, pifc, dhcpifp, ctlp, callback)
+ 		if (sp->timer == NULL) {
+ 			sp->timer = dhcp6_add_timer(siteprefix_timo, sp);
+ 			if (sp->timer == NULL) {
+-				dprintf(LOG_NOTICE, FNAME,
++				debug_printf(LOG_NOTICE, FNAME,
+ 				    "failed to add prefix timer");
+ 				remove_siteprefix(sp); /* XXX */
+ 				return (-1);
+@@ -276,7 +276,7 @@ remove_siteprefix(sp)
+ {
+ 	struct dhcp6_ifprefix *ip;
+ 
+-	dprintf(LOG_DEBUG, FNAME, "remove a site prefix %s/%d",
++	debug_printf(LOG_DEBUG, FNAME, "remove a site prefix %s/%d",
+ 	    in6addr2str(&sp->prefix.addr, 0), sp->prefix.plen);
+ 
+ 	if (sp->timer)
+@@ -390,7 +390,7 @@ renew_data_free(evd)
+ 	struct dhcp6_list *ial;
+ 
+ 	if (evd->type != DHCP6_EVDATA_IAPD) {
+-		dprintf(LOG_ERR, FNAME, "assumption failure");
++		debug_printf(LOG_ERR, FNAME, "assumption failure");
+ 		exit(1);
+ 	}
+ 
+@@ -409,7 +409,7 @@ siteprefix_timo(arg)
+ 	struct ia *ia;
+ 	void (*callback)__P((struct ia *));
+ 
+-	dprintf(LOG_DEBUG, FNAME, "prefix timeout for %s/%d",
++	debug_printf(LOG_DEBUG, FNAME, "prefix timeout for %s/%d",
+ 	    in6addr2str(&sp->prefix.addr, 0), sp->prefix.plen);
+ 
+ 	ia = sp->ctl->iacpd_ia;
+@@ -438,7 +438,7 @@ add_ifprefix(siteprefix, prefix, pconf)
+ 	int b, i;
+ 
+ 	if ((ifpfx = malloc(sizeof(*ifpfx))) == NULL) {
+-		dprintf(LOG_NOTICE, FNAME,
++		debug_printf(LOG_NOTICE, FNAME,
+ 		    "failed to allocate memory for ifprefix");
+ 		return (-1);
+ 	}
+@@ -456,13 +456,13 @@ add_ifprefix(siteprefix, prefix, pconf)
+ 	 * XXX: our current implementation assumes ifid len is a multiple of 8
+ 	 */
+ 	if ((pconf->ifid_len % 8) != 0) {
+-		dprintf(LOG_ERR, FNAME,
++		debug_printf(LOG_ERR, FNAME,
+ 		    "assumption failure on the length of interface ID");
+ 		goto bad;
+ 	}
+ 	if (ifpfx->plen + pconf->ifid_len < 0 ||
+ 	    ifpfx->plen + pconf->ifid_len > 128) {
+-		dprintf(LOG_INFO, FNAME,
++		debug_printf(LOG_INFO, FNAME,
+ 			"invalid prefix length %d + %d + %d",
+ 			prefix->plen, pconf->sla_len, pconf->ifid_len);
+ 		goto bad;
+diff --git a/timer.c b/timer.c
+index c74aa1f..c1666b4 100644
+--- a/timer.c
++++ b/timer.c
+@@ -71,14 +71,14 @@ dhcp6_add_timer(timeout, timeodata)
+ 	struct dhcp6_timer *newtimer;
+ 
+ 	if ((newtimer = malloc(sizeof(*newtimer))) == NULL) {
+-		dprintf(LOG_ERR, FNAME, "can't allocate memory");
++		debug_printf(LOG_ERR, FNAME, "can't allocate memory");
+ 		return (NULL);
+ 	}
+ 
+ 	memset(newtimer, 0, sizeof(*newtimer));
+ 
+ 	if (timeout == NULL) {
+-		dprintf(LOG_ERR, FNAME, "timeout function unspecified");
++		debug_printf(LOG_ERR, FNAME, "timeout function unspecified");
+ 		exit(1);
+ 	}
+ 	newtimer->expire = timeout;
+@@ -165,7 +165,7 @@ dhcp6_timer_rest(timer)
+ 
+ 	gettimeofday(&now, NULL);
+ 	if (TIMEVAL_LEQ(timer->tm, now)) {
+-		dprintf(LOG_DEBUG, FNAME,
++		debug_printf(LOG_DEBUG, FNAME,
+ 		    "a timer must be expired, but not yet");
+ 		returnval.tv_sec = returnval.tv_usec = 0;
+ 	} else
+-- 
+1.5.6.5
+
diff --git a/wide-dhcpv6-0005-Update-ifid-on-interface-restart.patch b/wide-dhcpv6-0005-Update-ifid-on-interface-restart.patch
new file mode 100644
index 0000000..8470153
--- /dev/null
+++ b/wide-dhcpv6-0005-Update-ifid-on-interface-restart.patch
@@ -0,0 +1,35 @@
+From 0eb4cdb7bbf496b83923a05e4993b0e9757d0064 Mon Sep 17 00:00:00 2001
+From: Jeremie Corbier <jeremie+debian at famille-corbier.net>
+Date: Tue, 6 Apr 2010 15:51:12 +0200
+Subject: [PATCH] Update ifid on interface restart
+
+Interface ID may have changed between a stop and start.
+
+Signed-off-by: Jeremie Corbier <jeremie at famille-corbier.net>
+---
+ dhcp6c.c |    9 +++++++++
+ 1 files changed, 9 insertions(+), 0 deletions(-)
+
+diff --git a/dhcp6c.c b/dhcp6c.c
+index c959b7c..edeca80 100644
+--- a/dhcp6c.c
++++ b/dhcp6c.c
+@@ -768,6 +768,15 @@ client6_ifctl(ifname, command)
+ 
+ 	switch(command) {
+ 	case DHCP6CTL_COMMAND_START:
++		/*
++		 * The ifid might have changed, so reset it before releasing the
++		 * lease.
++		 */
++		if (ifreset(ifp)) {
++			dprintf(LOG_NOTICE, FNAME, "failed to reset %s",
++			    ifname);
++			return (-1);
++		}
+ 		free_resources(ifp);
+ 		if (client6_start(ifp)) {
+ 			debug_printf(LOG_NOTICE, FNAME, "failed to restart %s",
+-- 
+1.5.6.5
+
diff --git a/wide-dhcpv6-0006-Add-new-feature-dhcp6c-profiles.patch b/wide-dhcpv6-0006-Add-new-feature-dhcp6c-profiles.patch
new file mode 100644
index 0000000..f4e110c
--- /dev/null
+++ b/wide-dhcpv6-0006-Add-new-feature-dhcp6c-profiles.patch
@@ -0,0 +1,630 @@
+From 0c23a622a7e59af0484da59aeb064095e3c0b1e0 Mon Sep 17 00:00:00 2001
+From: Jeremie Corbier <jeremie+debian at famille-corbier.net>
+Date: Tue, 6 Apr 2010 15:51:14 +0200
+Subject: [PATCH] Add new feature: dhcp6c profiles
+
+This patch enables users to define interface profiles so one can configure a
+group of interfaces the same way without having to provide an interface
+statement for each.
+
+Signed-off-by: Jeremie Corbier <jeremie at famille-corbier.net>
+---
+ cfparse.y     |   23 ++++-
+ cftoken.l     |   10 ++
+ config.c      |  334 ++++++++++++++++++++++++++++++++-------------------------
+ config.h      |    3 +
+ dhcp6c.8      |    9 ++
+ dhcp6c.c      |    5 +-
+ dhcp6c.conf.5 |    7 ++
+ 7 files changed, 245 insertions(+), 146 deletions(-)
+
+diff --git a/cfparse.y b/cfparse.y
+index dcac3d7..c79d131 100644
+--- a/cfparse.y
++++ b/cfparse.y
+@@ -83,6 +83,7 @@ extern void yyerror __P((char *, ...))
+ 	} while (0)
+ 
+ static struct cf_namelist *iflist_head, *hostlist_head, *iapdlist_head;
++static struct cf_namelist *profilelist_head;
+ static struct cf_namelist *addrpoollist_head;
+ static struct cf_namelist *authinfolist_head, *keylist_head;
+ static struct cf_namelist *ianalist_head;
+@@ -102,6 +103,7 @@ static void cleanup_cflist __P((struct cf_list *));
+ %}
+ 
+ %token INTERFACE IFNAME
++%token PROFILE PROFILENAME
+ %token PREFIX_INTERFACE SLA_ID SLA_LEN DUID_ID
+ %token ID_ASSOC IA_PD IAID IA_NA
+ %token ADDRESS
+@@ -133,7 +135,7 @@ static void cleanup_cflist __P((struct cf_list *));
+ }
+ 
+ %type <str> IFNAME HOSTNAME AUTHNAME KEYNAME DUID_ID STRING QSTRING IAID
+-%type <str> POOLNAME
++%type <str> POOLNAME PROFILENAME
+ %type <num> NUMBER duration authproto authalg authrdm
+ %type <list> declaration declarations dhcpoption ifparam ifparams
+ %type <list> address_list address_list_ent dhcpoption_list
+@@ -153,6 +155,7 @@ statements:
+ 
+ statement:
+ 		interface_statement
++	|	profile_statement
+ 	|	host_statement
+ 	|	option_statement
+ 	|	ia_statement
+@@ -174,6 +177,18 @@ interface_statement:
+ 	}
+ 	;
+ 
++profile_statement:
++	PROFILE PROFILENAME BCL declarations ECL EOS
++	{
++		struct cf_namelist *profilelist;
++
++		MAKE_NAMELIST(profilelist, $2, $4);
++
++		if (add_namelist(profilelist, &profilelist_head))
++			return (-1);
++	}
++	;
++
+ host_statement:
+ 	HOST HOSTNAME BCL declarations ECL EOS
+ 	{
+@@ -1224,6 +1239,8 @@ cleanup()
+ {
+ 	cleanup_namelist(iflist_head);
+ 	iflist_head = NULL;
++	cleanup_namelist(profilelist_head);
++	profilelist_head = NULL;
+ 	cleanup_namelist(hostlist_head);
+ 	hostlist_head = NULL;
+ 	cleanup_namelist(iapdlist_head);
+@@ -1318,6 +1335,9 @@ cf_post_config()
+ 	if (configure_pool(addrpoollist_head))
+ 		config_fail();
+ 
++	if (configure_profile(profilelist_head))
++		config_fail();
++
+ 	if (configure_interface(iflist_head))
+ 		config_fail();
+ 
+@@ -1337,4 +1357,5 @@ void
+ cf_init()
+ {
+ 	iflist_head = NULL;
++	profilelist_head = NULL;
+ }
+diff --git a/cftoken.l b/cftoken.l
+index ad4128d..4c9ed10 100644
+--- a/cftoken.l
++++ b/cftoken.l
+@@ -111,6 +111,7 @@ ecl		\}
+ 
+ %s S_CNF
+ %s S_IFACE
++%s S_PROFILE
+ %s S_PREF
+ %s S_HOST
+ %s S_DUID
+@@ -137,6 +138,15 @@ ecl		\}
+ 	return (IFNAME);
+ }
+ 
++	/* profile configuration */
++<S_CNF>profile { DECHO; BEGIN S_PROFILE; return (PROFILE); }
++<S_PROFILE>{string} {
++	DECHO;
++	yylval.str = strdup(yytext);
++	BEGIN S_CNF;
++	return (PROFILENAME);
++}
++
+ 	/* host configuration */
+ <S_CNF>host { DECHO; BEGIN S_HOST; return (HOST); }
+ <S_HOST>{string} {
+diff --git a/config.c b/config.c
+index 3721545..23598fc 100644
+--- a/config.c
++++ b/config.c
+@@ -61,6 +61,7 @@
+ #include <lease.h>
+ 
+ extern int errno;
++char *profile = NULL;
+ 
+ struct prefix_ifconf *prefix_ifconflist;
+ struct dhcp6_list siplist, sipnamelist, dnslist, dnsnamelist, ntplist;
+@@ -70,6 +71,7 @@ struct dhcp6_list bcmcslist, bcmcsnamelist;
+ long long optrefreshtime;
+ 
+ static struct dhcp6_ifconf *dhcp6_ifconflist;
++static struct dhcp6_ifconf *dhcp6_profileconflist;
+ struct ia_conflist ia_conflist0;
+ static struct host_conf *host_conflist0, *host_conflist;
+ static struct keyinfo *key_list, *key_list0;
+@@ -134,6 +136,8 @@ static void clear_iaconf __P((struct ia_conflist *));
+ static void clear_hostconf __P((struct host_conf *));
+ static void clear_keys __P((struct keyinfo *));
+ static void clear_authinfo __P((struct authinfo *));
++static int configure_interface_or_profile __P((struct cf_namelist *,
++    struct dhcp6_ifconf **));
+ static int configure_duid __P((char *, struct duid *));
+ static int configure_addr __P((struct cf_list *, struct dhcp6_list *, char *));
+ static int configure_domain __P((struct cf_list *, struct dhcp6_list *, char *));
+@@ -149,170 +153,199 @@ configure_interface(iflist)
+ 	struct cf_namelist *iflist;
+ {
+ 	struct cf_namelist *ifp;
+-	struct dhcp6_ifconf *ifc;
+-	char *cp;
+ 
+ 	for (ifp = iflist; ifp; ifp = ifp->next) {
+-		struct cf_list *cfl;
+-
+ 		if (if_nametoindex(ifp->name) == 0) {
+ 			debug_printf(LOG_ERR, FNAME, "invalid interface(%s): %s",
+ 			    ifp->name, strerror(errno));
+ 			goto bad;
+ 		}
+ 
+-		if ((ifc = malloc(sizeof(*ifc))) == NULL) {
+-			debug_printf(LOG_ERR, FNAME,
+-			    "memory allocation for %s failed", ifp->name);
++		if (configure_interface_or_profile(ifp, &dhcp6_ifconflist))
+ 			goto bad;
+-		}
+-		memset(ifc, 0, sizeof(*ifc));
+-		ifc->next = dhcp6_ifconflist;
+-		dhcp6_ifconflist = ifc;
++	}
++
++	return (0);
++bad:
++	clear_ifconf(dhcp6_ifconflist);
++	dhcp6_ifconflist = NULL;
++	return (-1);
++}
++
++int
++configure_profile(profilelist)
++	struct cf_namelist *profilelist;
++{
++	struct cf_namelist *profp;
+ 
+-		if ((ifc->ifname = strdup(ifp->name)) == NULL) {
+-			debug_printf(LOG_ERR, FNAME, "failed to copy ifname");
++	for (profp = profilelist; profp; profp = profp->next) {
++		if (configure_interface_or_profile(profp,
++			    &dhcp6_profileconflist))
+ 			goto bad;
+-		}
++	}
+ 
+-		ifc->server_pref = DH6OPT_PREF_UNDEF;
+-		TAILQ_INIT(&ifc->reqopt_list);
+-		TAILQ_INIT(&ifc->iaconf_list);
++	return (0);
++bad:
++	clear_ifconf(dhcp6_profileconflist);
++	dhcp6_profileconflist = NULL;
++	return (-1);
++}
+ 
+-		for (cfl = ifp->params; cfl; cfl = cfl->next) {
+-			switch(cfl->type) {
+-			case DECL_REQUEST:
+-				if (dhcp6_mode != DHCP6_MODE_CLIENT) {
+-					debug_printf(LOG_INFO, FNAME, "%s:%d "
+-						"client-only configuration",
+-						configfilename,
+-						cfl->line);
+-					goto bad;
+-				}
+-				if (add_options(DHCPOPTCODE_REQUEST,
+-						ifc, cfl->list)) {
+-					goto bad;
+-				}
+-				break;
+-			case DECL_SEND:
+-				if (add_options(DHCPOPTCODE_SEND,
+-						ifc, cfl->list)) {
+-					goto bad;
+-				}
+-				break;
+-			case DECL_ALLOW:
+-				if (add_options(DHCPOPTCODE_ALLOW,
+-						ifc, cfl->list)) {
+-					goto bad;
+-				}
+-				break;
+-			case DECL_INFO_ONLY:
+-				if (dhcp6_mode != DHCP6_MODE_CLIENT) {
+-					debug_printf(LOG_INFO, FNAME, "%s:%d "
+-						"client-only configuration",
+-						configfilename, cfl->line);
+-					goto bad;
+-				}
+-				ifc->send_flags |= DHCIFF_INFO_ONLY;
+-				break;
+-			case DECL_PREFERENCE:
+-				if (dhcp6_mode != DHCP6_MODE_SERVER) {
+-					debug_printf(LOG_INFO, FNAME, "%s:%d "
+-						"server-only configuration",
+-						configfilename, cfl->line);
+-					goto bad;
+-				}
+-				ifc->server_pref = (int)cfl->num;
+-				if (ifc->server_pref < 0 ||
+-				    ifc->server_pref > 255) {
+-					debug_printf(LOG_INFO, FNAME, "%s:%d "
+-						"bad value: %d",
++static int configure_interface_or_profile(ifp, conflist)
++	struct cf_namelist *ifp;
++	struct dhcp6_ifconf **conflist;
++{
++	struct dhcp6_ifconf *conf;
++	char *cp;
++	struct cf_list *cfl;
++
++	if ((conf = malloc(sizeof(*conf))) == NULL) {
++		debug_printf(LOG_ERR, FNAME,
++		    "memory allocation for %s failed", ifp->name);
++		return (-1);
++	}
++	memset(conf, 0, sizeof(*conf));
++	conf->next = *conflist;
++	*conflist = conf;
++
++	if ((conf->ifname = strdup(ifp->name)) == NULL) {
++		debug_printf(LOG_ERR, FNAME, "failed to copy interface or "
++		    "profile name");
++		return (-1);
++	}
++
++	conf->server_pref = DH6OPT_PREF_UNDEF;
++	TAILQ_INIT(&conf->reqopt_list);
++	TAILQ_INIT(&conf->iaconf_list);
++
++	for (cfl = ifp->params; cfl; cfl = cfl->next) {
++		switch(cfl->type) {
++		case DECL_REQUEST:
++			if (dhcp6_mode != DHCP6_MODE_CLIENT) {
++				debug_printf(LOG_INFO, FNAME, "%s:%d "
++					"client-only configuration",
++					configfilename,
++					cfl->line);
++				return (-1);
++			}
++			if (add_options(DHCPOPTCODE_REQUEST,
++					conf, cfl->list)) {
++				return (-1);
++			}
++			break;
++		case DECL_SEND:
++			if (add_options(DHCPOPTCODE_SEND,
++					conf, cfl->list)) {
++				return (-1);
++			}
++			break;
++		case DECL_ALLOW:
++			if (add_options(DHCPOPTCODE_ALLOW,
++					conf, cfl->list)) {
++				return (-1);
++			}
++			break;
++		case DECL_INFO_ONLY:
++			if (dhcp6_mode != DHCP6_MODE_CLIENT) {
++				debug_printf(LOG_INFO, FNAME, "%s:%d "
++					"client-only configuration",
++					configfilename, cfl->line);
++				return (-1);
++			}
++			conf->send_flags |= DHCIFF_INFO_ONLY;
++			break;
++		case DECL_PREFERENCE:
++			if (dhcp6_mode != DHCP6_MODE_SERVER) {
++				debug_printf(LOG_INFO, FNAME, "%s:%d "
++					"server-only configuration",
++					configfilename, cfl->line);
++				return (-1);
++			}
++			conf->server_pref = (int)cfl->num;
++			if (conf->server_pref < 0 ||
++			    conf->server_pref > 255) {
++				debug_printf(LOG_INFO, FNAME, "%s:%d "
++					"bad value: %d",
++					configfilename, cfl->line,
++					conf->server_pref);
++				return (-1);
++			}
++			break;
++		case DECL_SCRIPT:
++			if (dhcp6_mode != DHCP6_MODE_CLIENT) {
++				debug_printf(LOG_INFO, FNAME, "%s:%d "
++					"client-only configuration",
++					configfilename, cfl->line);
++				return (-1);
++			}
++			if (conf->scriptpath) {
++				debug_printf(LOG_INFO, FNAME,
++				    "%s:%d duplicated configuration",
++				    configfilename, cfl->line);
++				return (-1);
++			}
++			cp = cfl->ptr;
++			conf->scriptpath = strdup(cp + 1);
++			if (conf->scriptpath == NULL) {
++				debug_printf(LOG_NOTICE, FNAME,
++				    "failed to copy script path");
++				return (-1);
++			}
++			cp = conf->scriptpath;
++			if (*cp != '/') {
++				debug_printf(LOG_INFO, FNAME,
++				    "script must be an absolute path");
++				return (-1);
++			}
++			cp += strlen(conf->scriptpath) - 1;
++			*cp = '\0'; /* clear the terminating quote */
++			break;
++		case DECL_ADDRESSPOOL:
++			{
++				struct dhcp6_poolspec* spec;
++				struct pool_conf* pool;
++
++				spec = (struct dhcp6_poolspec *)cfl->ptr;
++
++				for (pool = pool_conflist0; pool; pool = pool->next)
++					if (strcmp(spec->name, pool->name) == 0)
++						break;
++				if (pool == NULL) {
++					debug_printf(LOG_ERR, FNAME, "%s:%d "
++						"pool '%s' not found",
+ 						configfilename, cfl->line,
+-						ifc->server_pref);
+-					goto bad;
+-				}
+-				break;
+-			case DECL_SCRIPT:
+-				if (dhcp6_mode != DHCP6_MODE_CLIENT) {
+-					debug_printf(LOG_INFO, FNAME, "%s:%d "
+-						"client-only configuration",
+-						configfilename, cfl->line);
+-					goto bad;
+-				}
+-				if (ifc->scriptpath) {
+-					debug_printf(LOG_INFO, FNAME,
+-					    "%s:%d duplicated configuration",
+-					    configfilename, cfl->line);
+-					goto bad;
+-				}
+-				cp = cfl->ptr;
+-				ifc->scriptpath = strdup(cp + 1);
+-				if (ifc->scriptpath == NULL) {
+-					debug_printf(LOG_NOTICE, FNAME,
+-					    "failed to copy script path");
+-					goto bad;
++				   		spec->name);
++					return (-1);
+ 				}
+-				cp = ifc->scriptpath;
+-				if (*cp != '/') {
+-					debug_printf(LOG_INFO, FNAME,
+-					    "script must be an absolute path");
+-					goto bad;
++				if (spec->vltime != DHCP6_DURATION_INFINITE &&
++					(spec->pltime == DHCP6_DURATION_INFINITE ||
++					spec->pltime > spec->vltime)) {
++					debug_printf(LOG_ERR, FNAME, "%s:%d ",
++						configfilename, cfl->line,
++						"specified a larger preferred lifetime "
++						"than valid lifetime");
++					return (-1);
+ 				}
+-				cp += strlen(ifc->scriptpath) - 1;
+-				*cp = '\0'; /* clear the terminating quote */
+-				break;
+-			case DECL_ADDRESSPOOL:
+-				{
+-					struct dhcp6_poolspec* spec;
+-					struct pool_conf* pool;
+-
+-					spec = (struct dhcp6_poolspec *)cfl->ptr;
+-
+-					for (pool = pool_conflist0; pool; pool = pool->next)
+-						if (strcmp(spec->name, pool->name) == 0)
+-							break;
+-					if (pool == NULL) {
+-						debug_printf(LOG_ERR, FNAME, "%s:%d "
+-							"pool '%s' not found",
+-							configfilename, cfl->line,
+-					   		spec->name);
+-						goto bad;
+-					}
+-					if (spec->vltime != DHCP6_DURATION_INFINITE &&
+-						(spec->pltime == DHCP6_DURATION_INFINITE ||
+-						spec->pltime > spec->vltime)) {
+-						debug_printf(LOG_ERR, FNAME, "%s:%d ",
+-							configfilename, cfl->line,
+-							"specified a larger preferred lifetime "
+-							"than valid lifetime");
+-						goto bad;
+-					}
+-					ifc->pool = *spec;
+-					if ((ifc->pool.name = strdup(spec->name)) == NULL) {
+-						debug_printf(LOG_ERR, FNAME,
+-							"memory allocation failed");
+-						goto bad;
+-					}
+-					debug_printf(LOG_DEBUG, FNAME,
+-						"pool '%s' is specified to the interface '%s'",
+-						ifc->pool.name, ifc->ifname);
++				conf->pool = *spec;
++				if ((conf->pool.name = strdup(spec->name)) == NULL) {
++					debug_printf(LOG_ERR, FNAME,
++						"memory allocation failed");
++					return (-1);
+ 				}
+-				break;
+-			default:
+-				debug_printf(LOG_ERR, FNAME, "%s:%d "
+-					"invalid interface configuration",
+-					configfilename, cfl->line);
+-				goto bad;
++				debug_printf(LOG_DEBUG, FNAME,
++					"pool '%s' is specified to the interface '%s'",
++					conf->pool.name, conf->ifname);
+ 			}
++			break;
++		default:
++			debug_printf(LOG_ERR, FNAME, "%s:%d "
++				"invalid interface configuration",
++				configfilename, cfl->line);
++			return (-1);
+ 		}
+ 	}
+ 	
+ 	return (0);
+-
+-  bad:
+-	clear_ifconf(dhcp6_ifconflist);
+-	dhcp6_ifconflist = NULL;
+-	return (-1);
+ }
+ 
+ int
+@@ -1275,6 +1308,8 @@ configure_cleanup()
+ 	clear_iaconf(&ia_conflist0);
+ 	clear_ifconf(dhcp6_ifconflist);
+ 	dhcp6_ifconflist = NULL;
++	clear_ifconf(dhcp6_profileconflist);
++	dhcp6_profileconflist = NULL;
+ 	clear_hostconf(host_conflist0);
+ 	host_conflist0 = NULL;
+ 	clear_keys(key_list0);
+@@ -1322,8 +1357,17 @@ configure_commit()
+ 			if (strcmp(ifp->ifname, ifc->ifname) == 0)
+ 				break;
+ 		}
+-		if (ifc == NULL)
+-			continue;
++		if (ifc == NULL) {
++			if (profile == NULL)
++				continue;
++			for (ifc = dhcp6_profileconflist; ifc;
++				    ifc = ifc->next) {
++				if (strcmp(profile, ifc->ifname) == 0)
++					break;
++			}
++			if (ifc == NULL)
++				continue;
++		}
+ 
+ 		/* copy new configuration */
+ 		ifp->send_flags = ifc->send_flags;
+@@ -1349,6 +1393,8 @@ configure_commit()
+ 
+ 	clear_ifconf(dhcp6_ifconflist);
+ 	dhcp6_ifconflist = NULL;
++	clear_ifconf(dhcp6_profileconflist);
++	dhcp6_profileconflist = NULL;
+ 
+ 	/* clear unused IA configuration */
+ 	if (!TAILQ_EMPTY(&ia_conflist0)) {
+diff --git a/config.h b/config.h
+index bf6dae6..ea8d17c 100644
+--- a/config.h
++++ b/config.h
+@@ -285,6 +285,8 @@ dhcp6_mode_t;
+ 
+ extern const dhcp6_mode_t dhcp6_mode;
+ 
++extern char *profile;
++
+ extern struct dhcp6_if *dhcp6_if;
+ extern struct dhcp6_ifconf *dhcp6_iflist;
+ extern struct prefix_ifconf *prefix_ifconflist;
+@@ -304,6 +306,7 @@ extern long long optrefreshtime;
+ extern struct dhcp6_if *ifinit __P((char *));
+ extern int ifreset __P((struct dhcp6_if *));
+ extern int configure_interface __P((struct cf_namelist *));
++extern int configure_profile __P((struct cf_namelist *));
+ extern int configure_host __P((struct cf_namelist *));
+ extern int configure_keys __P((struct cf_namelist *));
+ extern int configure_authinfo __P((struct cf_namelist *));
+diff --git a/dhcp6c.8 b/dhcp6c.8
+index 1d69c9d..acc8f46 100644
+--- a/dhcp6c.8
++++ b/dhcp6c.8
+@@ -39,6 +39,7 @@
+ .Op Fl c Ar configfile
+ .Op Fl Ddfi
+ .Op Fl p Ar pid-file
++.Op Fl P Ar profile
+ .Ar interface
+ .Op Ar interfaces...
+ .\"
+@@ -92,6 +93,14 @@ Use
+ .Ar pid-file
+ to dump the process ID of
+ .Nm .
++.It Fl P Ar profile
++Use the given
++.Ar profile
++defined in the
++.Nm
++configuration file for
++.Ar interfaces
++which do not have a specific configuration.
+ .El
+ .Pp
+ The program will daemonize itself on invocation unless the
+diff --git a/dhcp6c.c b/dhcp6c.c
+index edeca80..35080e9 100644
+--- a/dhcp6c.c
++++ b/dhcp6c.c
+@@ -170,7 +170,7 @@ main(argc, argv)
+ 	else
+ 		progname++;
+ 
+-	while ((ch = getopt(argc, argv, "c:dDfik:p:")) != -1) {
++	while ((ch = getopt(argc, argv, "c:dDfik:p:P:")) != -1) {
+ 		switch (ch) {
+ 		case 'c':
+ 			conffile = optarg;
+@@ -193,6 +193,9 @@ main(argc, argv)
+ 		case 'p':
+ 			pid_file = optarg;
+ 			break;
++		case 'P':
++			profile = optarg;
++			break;
+ 		default:
+ 			usage();
+ 			exit(0);
+diff --git a/dhcp6c.conf.5 b/dhcp6c.conf.5
+index 5fc03d3..3d5d25a 100644
+--- a/dhcp6c.conf.5
++++ b/dhcp6c.conf.5
+@@ -288,6 +288,13 @@ file, and be created by the same owner who runs the daemon.
+ .El
+ .El
+ .\"
++.Sh Profile statement
++Some setups may require to configure an interface independently from its name.
++Profiles are available for this particular purpose.  They follow the same syntax
++as an interface statement except they can be arbitrarily named.  It is then
++possible to choose which profile to use for a given interface on the command
++line.
++.\"
+ .Sh Identity association statement
+ Identity association
+ .Pq IA
+-- 
+1.5.6.5
+
diff --git a/wide-dhcpv6-0007-Adding-ifid-option-to-the-dhcp6c.conf-prefix-interfa.patch b/wide-dhcpv6-0007-Adding-ifid-option-to-the-dhcp6c.conf-prefix-interfa.patch
new file mode 100644
index 0000000..5923459
--- /dev/null
+++ b/wide-dhcpv6-0007-Adding-ifid-option-to-the-dhcp6c.conf-prefix-interfa.patch
@@ -0,0 +1,122 @@
+From beb920d6755e2cbdf1de0a75ddfff102ca5678e6 Mon Sep 17 00:00:00 2001
+From: =?utf-8?q?Bj=C3=B8rn=20Mork?= <bjorn at mork.no>
+Date: Wed, 10 Nov 2010 07:41:55 +0100
+Subject: [PATCH] Adding ifid option to the dhcp6c.conf prefix-interface statement
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 8bit
+
+This adds the ability to override the default EUI-64 address selection.
+Useful for interfaces without a unique hardware address, or for creating
+more userfriendly addresses in general.
+
+Signed-off-by: Bjørn Mork <bjorn at mork.no>
+Signed-off-by: Jeremie Corbier <jeremie at famille-corbier.net>
+---
+ cfparse.y     |   10 +++++++++-
+ cftoken.l     |    1 +
+ config.c      |    5 +++++
+ config.h      |    2 +-
+ dhcp6c.conf.5 |   10 ++++++++++
+ 5 files changed, 26 insertions(+), 2 deletions(-)
+
+diff --git a/cfparse.y b/cfparse.y
+index c79d131..e83ecf7 100644
+--- a/cfparse.y
++++ b/cfparse.y
+@@ -104,7 +104,7 @@ static void cleanup_cflist __P((struct cf_list *));
+ 
+ %token INTERFACE IFNAME
+ %token PROFILE PROFILENAME
+-%token PREFIX_INTERFACE SLA_ID SLA_LEN DUID_ID
++%token PREFIX_INTERFACE SLA_ID SLA_LEN IFID DUID_ID
+ %token ID_ASSOC IA_PD IAID IA_NA
+ %token ADDRESS
+ %token REQUEST SEND ALLOW PREFERENCE
+@@ -1056,6 +1056,14 @@ ifparam:
+ 			l->num = $2;
+ 			$$ = l;
+ 		}
++	|	IFID NUMBER EOS
++		{
++			struct cf_list *l;
++
++			MAKE_CFLIST(l, IFPARAM_IFID, NULL, NULL);
++			l->num = (u_int64_t)$2;
++			$$ = l;
++		}
+ 	;
+ 
+ ianaconf_list:
+diff --git a/cftoken.l b/cftoken.l
+index 4c9ed10..6afda5f 100644
+--- a/cftoken.l
++++ b/cftoken.l
+@@ -240,6 +240,7 @@ ecl		\}
+ <S_CNF>prefix-interface { DECHO; BEGIN S_IFACE; return (PREFIX_INTERFACE); }
+ <S_CNF>sla-id { DECHO; return (SLA_ID); }
+ <S_CNF>sla-len { DECHO; return (SLA_LEN); }
++<S_CNF>ifid { DECHO; return (IFID); }
+ 
+ 	/* duration */
+ <S_CNF>infinity { DECHO; return (INFINITY); }
+diff --git a/config.c b/config.c
+index 23598fc..bb16c21 100644
+--- a/config.c
++++ b/config.c
+@@ -471,6 +471,7 @@ add_pd_pif(iapdc, cfl0)
+ {
+ 	struct cf_list *cfl;
+ 	struct prefix_ifconf *pif;
++	int i;
+ 
+ 	/* duplication check */
+ 	for (pif = TAILQ_FIRST(&iapdc->iapd_pif_list); pif;
+@@ -524,6 +525,10 @@ add_pd_pif(iapdc, cfl0)
+ 				goto bad;
+ 			}
+ 			break;
++		case IFPARAM_IFID:
++			for (i = sizeof(pif->ifid) -1; i >= 0; i--)
++				pif->ifid[i] = (cfl->num >> 8*(sizeof(pif->ifid) - 1 - i)) & 0xff;
++			break;
+ 		default:
+ 			debug_printf(LOG_ERR, FNAME, "%s:%d internal error: "
+ 			    "invalid configuration",
+diff --git a/config.h b/config.h
+index ea8d17c..64ce9e8 100644
+--- a/config.h
++++ b/config.h
+@@ -266,7 +266,7 @@ enum { DECL_SEND, DECL_ALLOW, DECL_INFO_ONLY, DECL_REQUEST, DECL_DUID,
+        DECL_PREFIX, DECL_PREFERENCE, DECL_SCRIPT, DECL_DELAYEDKEY,
+        DECL_ADDRESS,
+        DECL_RANGE, DECL_ADDRESSPOOL,
+-       IFPARAM_SLA_ID, IFPARAM_SLA_LEN,
++       IFPARAM_SLA_ID, IFPARAM_SLA_LEN, IFPARAM_IFID,
+        DHCPOPT_RAPID_COMMIT, DHCPOPT_AUTHINFO,
+        DHCPOPT_DNS, DHCPOPT_DNSNAME,
+        DHCPOPT_IA_PD, DHCPOPT_IA_NA, DHCPOPT_NTP,
+diff --git a/dhcp6c.conf.5 b/dhcp6c.conf.5
+index 3d5d25a..1c91d72 100644
+--- a/dhcp6c.conf.5
++++ b/dhcp6c.conf.5
+@@ -443,6 +443,16 @@ This statement specifies the length of the SLA ID in bits.
+ must be a decimal number between 0 and 128.
+ If the length is not specified by this statement,
+ the default value 16 will be used.
++.It Xo
++.Ic ifid Ar ID
++;
++.Xc
++This statement specifies the interface id.
++.Ar ID
++must be a decimal integer.  It will be combined with the delegated
++prefix and the sla-id to form a complete interface address.  The
++default is to use the EUI-64 address of the
++.Ar interface .
+ .El
+ .El
+ .\"
+-- 
+1.5.6.5
+
diff --git a/wide-dhcpv6-0008-Make-sla-len-config-optional.patch b/wide-dhcpv6-0008-Make-sla-len-config-optional.patch
new file mode 100644
index 0000000..eeab808
--- /dev/null
+++ b/wide-dhcpv6-0008-Make-sla-len-config-optional.patch
@@ -0,0 +1,20 @@
+--- wide-dhcpv6-20080615/prefixconf.c.orig	2013-05-14 22:26:46.433767395 +1000
++++ wide-dhcpv6-20080615/prefixconf.c	2013-05-14 23:17:49.229676947 +1000
+@@ -451,6 +451,17 @@
+ 	ifpfx->paddr.sin6_len = sizeof(struct sockaddr_in6);
+ #endif
+ 	ifpfx->paddr.sin6_addr = prefix->addr;
++
++	/* 
++         * dave (bevhost) thinks this should fix it rather than 
++         * generare the error below "invalid prefix length" 
++         * this way the sla-len can be left out of the config file 
++         * and calculated when the prefix is received
++         */
++	if (prefix->plen + pconf->ifid_len + pconf->sla_len > 128) {
++		pconf->sla_len = 128 - pconf->ifid_len - prefix->plen;
++	}
++
+ 	ifpfx->plen = prefix->plen + pconf->sla_len;
+ 	/*
+ 	 * XXX: our current implementation assumes ifid len is a multiple of 8
diff --git a/wide-dhcpv6-0009-Make-sla-id-config-optional.patch b/wide-dhcpv6-0009-Make-sla-id-config-optional.patch
new file mode 100644
index 0000000..de0206d
--- /dev/null
+++ b/wide-dhcpv6-0009-Make-sla-id-config-optional.patch
@@ -0,0 +1,60 @@
+--- wide-dhcpv6-20080615/config.c.orig	2013-05-16 20:52:15.404305638 +1000
++++ wide-dhcpv6-20080615/config.c	2013-05-16 21:28:27.109240220 +1000
+@@ -124,7 +124,7 @@
+ extern char *configfilename;
+ 
+ static struct keyinfo *find_keybyname __P((struct keyinfo *, char *));
+-static int add_pd_pif __P((struct iapd_conf *, struct cf_list *));
++static int add_pd_pif __P((struct iapd_conf *, struct cf_list *, u_int32_t));
+ static int add_options __P((int, struct dhcp6_ifconf *, struct cf_list *));
+ static int add_prefix __P((struct dhcp6_list *, char *, int,
+     struct dhcp6_prefix *));
+@@ -325,6 +325,8 @@
+ 	size_t confsize;
+ 	static int init = 1;
+ 
++	u_int32_t if_count;
++
+ 	if (init) {
+ 		TAILQ_INIT(&ia_conflist0);
+ 		init = 0;
+@@ -370,6 +372,8 @@
+ 			break;
+ 		}
+ 
++		if_count = 0;
++
+ 		/* set up parameters for the IA */
+ 		for (cfl = iap->params; cfl; cfl = cfl->next) {
+ 			struct iapd_conf *pdp = (struct iapd_conf *) iac;
+@@ -379,8 +383,9 @@
+ 			case IATYPE_PD:
+ 				switch(cfl->type) {
+ 				case IACONF_PIF:
+-					if (add_pd_pif(pdp, cfl))
++					if (add_pd_pif(pdp, cfl, if_count))
+ 						goto bad;
++					if_count++;
+ 					break;
+ 				case IACONF_PREFIX:
+ 					if (add_prefix(&pdp->iapd_prefix_list,
+@@ -432,9 +437,10 @@
+ }
+ 
+ static int
+-add_pd_pif(iapdc, cfl0)
++add_pd_pif(iapdc, cfl0, if_count)
+ 	struct iapd_conf *iapdc;
+ 	struct cf_list *cfl0;
++	u_int32_t if_count;
+ {
+ 	struct cf_list *cfl;
+ 	struct prefix_ifconf *pif;
+@@ -469,6 +475,7 @@
+ 		goto bad;
+ 	}
+ 
++	pif->sla_id = if_count;
+ 	pif->ifid_len = IFID_LEN_DEFAULT;
+ 	pif->sla_len = SLA_LEN_DEFAULT;
+ 	if (get_default_ifid(pif)) {
diff --git a/wide-dhcpv6-0010-move-client-script-to-after-update_ia.patch b/wide-dhcpv6-0010-move-client-script-to-after-update_ia.patch
new file mode 100644
index 0000000..7e56a8a
--- /dev/null
+++ b/wide-dhcpv6-0010-move-client-script-to-after-update_ia.patch
@@ -0,0 +1,34 @@
+--- wide-dhcpv6-20080615/dhcp6c.orig	2013-05-19 16:30:29.839073013 +1000
++++ wide-dhcpv6-20080615/dhcp6c.c	2013-05-19 16:31:06.513670394 +1000
+@@ -1845,15 +1845,6 @@
+ 	}
+ 
+ 	/*
+-	 * Call the configuration script, if specified, to handle various
+-	 * configuration parameters.
+-	 */
+-	if (ifp->scriptpath != NULL && strlen(ifp->scriptpath) != 0) {
+-		debug_printf(LOG_DEBUG, FNAME, "executes %s", ifp->scriptpath);
+-		client6_script(ifp->scriptpath, state, optinfo);
+-	}
+-
+-	/*
+ 	 * Set refresh timer for configuration information specified in
+ 	 * information-request.  If the timer value is specified by the server
+ 	 * in an information refresh time option, use it; use the protocol
+@@ -1905,6 +1896,15 @@
+ 		    &optinfo->serverID, ev->authparam);
+ 	}
+ 
++	/*
++	 * Call the configuration script, if specified, to handle various
++	 * configuration parameters.
++	 */
++	if (ifp->scriptpath != NULL && strlen(ifp->scriptpath) != 0) {
++		debug_printf(LOG_DEBUG, FNAME, "executes %s", ifp->scriptpath);
++		client6_script(ifp->scriptpath, state, optinfo);
++	}
++
+ 	dhcp6_remove_event(ev);
+ 
+ 	if (state == DHCP6S_RELEASE) {
diff --git a/wide-dhcpv6-0011-fedora20-cflag.patch b/wide-dhcpv6-0011-fedora20-cflag.patch
new file mode 100644
index 0000000..baccc3c
--- /dev/null
+++ b/wide-dhcpv6-0011-fedora20-cflag.patch
@@ -0,0 +1,32 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -82,21 +82,21 @@
+ 	mv lex.yy.c $@	
+ 
+ getaddrinfo.o:	$(srcdir)/missing/getaddrinfo.c
+-	$(CC) -c $(srcdir)/missing/$*.c
++	$(CC) $(CFLAGS) -c $(srcdir)/missing/$*.c
+ getnameinfo.o:	$(srcdir)/missing/getnameinfo.c
+-	$(CC) -c $(srcdir)/missing/$*.c
++	$(CC) $(CFLAGS) -c $(srcdir)/missing/$*.c
+ strlcat.o:	$(srcdir)/missing/strlcat.c
+-	$(CC) -c $(srcdir)/missing/$*.c
++	$(CC) $(CFLAGS) -c $(srcdir)/missing/$*.c
+ strlcpy.o:	$(srcdir)/missing/strlcpy.c
+-	$(CC) -c $(srcdir)/missing/$*.c
++	$(CC) $(CFLAGS) -c $(srcdir)/missing/$*.c
+ arc4random.o:	$(srcdir)/missing/arc4random.c
+ 	$(CC) $(CFLAGS) -c $(srcdir)/missing/$*.c
+ getifaddrs.o:	$(srcdir)/missing/getifaddrs.c
+-	$(CC) -c $(srcdir)/missing/$*.c
++	$(CC) $(CFLAGS) -c $(srcdir)/missing/$*.c
+ daemon.o:	$(srcdir)/missing/daemon.c
+-	$(CC) -c $(srcdir)/missing/$*.c
++	$(CC) $(CFLAGS) -c $(srcdir)/missing/$*.c
+ warnx.o:	$(srcdir)/missing/warnx.c
+-	$(CC) -c $(srcdir)/missing/$*.c
++	$(CC) $(CFLAGS) -c $(srcdir)/missing/$*.c
+ 
+ $(srcdir)/ianaopts.h: gentab.pl bootp-dhcp-parameters
+ 	expand bootp-dhcp-parameters | perl gentab.pl > ianaopts.h
+
diff --git a/wide-dhcpv6-0012-Fix-renewal-of-IA-NA.patch b/wide-dhcpv6-0012-Fix-renewal-of-IA-NA.patch
new file mode 100644
index 0000000..133331a
--- /dev/null
+++ b/wide-dhcpv6-0012-Fix-renewal-of-IA-NA.patch
@@ -0,0 +1,27 @@
+From badd9cc2bceb4d9f01f4a662eec64205f0dac127 Mon Sep 17 00:00:00 2001
+From: Jeremie Corbier <jeremie at famille-corbier.net>
+Date: Tue, 2 Dec 2014 11:04:59 +0100
+Subject: [PATCH 09/10] Fix renewal of IA NA
+
+Submitted-by: Vegard Engen <vegard at engen.priv.no>
+Signed-off-by: Jeremie Corbier <jeremie at famille-corbier.net>
+---
+ addrconf.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/addrconf.c b/addrconf.c
+index 98d03e5..47f1738 100644
+--- a/addrconf.c
++++ b/addrconf.c
+@@ -173,7 +173,7 @@ update_address(ia, addr, dhcpifp, ctlp, callback)
+ 	    sacreate ? "create" : "update",
+ 	    in6addr2str(&addr->addr, 0), addr->pltime, addr->vltime);
+ 
+-	if (sa->addr.vltime != 0)
++	if ((sa->addr.vltime != 0) && sacreate)
+ 		if (na_ifaddrconf(IFADDRCONF_ADD, sa) < 0)
+ 			return (-1);
+ 
+-- 
+1.7.10.4
+
diff --git a/wide-dhcpv6-0013-Fix-parallel-make-race-condition.patch b/wide-dhcpv6-0013-Fix-parallel-make-race-condition.patch
new file mode 100644
index 0000000..cdcabb2
--- /dev/null
+++ b/wide-dhcpv6-0013-Fix-parallel-make-race-condition.patch
@@ -0,0 +1,16 @@
+--- a/Makefile.in	2007-03-21 19:52:58.000000000 +1000
++++ b/Makefile.in	2015-02-07 18:03:10.799164484 +1000
+@@ -73,11 +73,11 @@
+ dhcp6ctl: $(CTLOBJS)
+ 	$(CC) $(LDFLAGS) -o $@ $(CTLOBJS) $(LIBOBJS) $(LIBS)
+ 
+-cfparse.c y.tab.h: cfparse.y
++cfparse.c: cfparse.y
+ 	@YACC@ -d cfparse.y
+ 	mv y.tab.c cfparse.c
+ 
+-cftoken.c: cftoken.l y.tab.h
++cftoken.c: cftoken.l cfparse.c
+ 	@LEX@ cftoken.l
+ 	mv lex.yy.c $@	
+ 
diff --git a/wide-dhcpv6.spec b/wide-dhcpv6.spec
new file mode 100644
index 0000000..600605d
--- /dev/null
+++ b/wide-dhcpv6.spec
@@ -0,0 +1,137 @@
+#
+# spec file for package wide-dhcpv6
+#
+
+%global ubuntu_release 13
+%global my_release 1
+%global _hardened_build 1
+
+Name:           wide-dhcpv6
+BuildRequires:  bison flex flex-devel systemd
+# The entire source code is BSD except the bison parser code which is GPL
+License:        BSD and GPLv2+
+Group:          System Environment/Daemons
+Summary:        DHCP Client and Server for IPv6
+Version:        20080615
+Url:            https://launchpad.net/ubuntu/+source/%{name}/%{version}-%{ubuntu_release}
+Release:        %{ubuntu_release}.%{my_release}%{dist}
+Source0:        http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
+Source1:        CHANGELOG-LINUX
+Source2:        COPYRIGHT
+Source3:        dhcp6c-script
+Source4:        dhcp6c.service
+Source5:        dhcp6r.service
+Source6:        dhcp6s.service
+Source7:        RELEASENOTES
+Patch1:         wide-dhcpv6-0001-Fix-manpages.patch
+Patch2:         wide-dhcpv6-0002-Don-t-strip-binaries.patch
+Patch3:         wide-dhcpv6-0003-Close-inherited-file-descriptors.patch
+Patch4:         wide-dhcpv6-0004-GNU-libc6-fixes.patch
+Patch5:         wide-dhcpv6-0005-Update-ifid-on-interface-restart.patch
+Patch6:         wide-dhcpv6-0006-Add-new-feature-dhcp6c-profiles.patch
+Patch7:         wide-dhcpv6-0007-Adding-ifid-option-to-the-dhcp6c.conf-prefix-interfa.patch
+Patch8:         wide-dhcpv6-0008-Make-sla-len-config-optional.patch
+Patch9:         wide-dhcpv6-0009-Make-sla-id-config-optional.patch
+Patch10:        wide-dhcpv6-0010-move-client-script-to-after-update_ia.patch
+Patch11:        wide-dhcpv6-0011-fedora20-cflag.patch
+Patch12:	wide-dhcpv6-0012-Fix-renewal-of-IA-NA.patch
+Patch13:	wide-dhcpv6-0013-Fix-parallel-make-race-condition.patch
+Requires(preun): systemd
+Requires(postun): systemd
+
+%description
+This is the DHCPv6 package from WIDE project. For more information visit the
+project web site at http://wide-dhcpv6.sourceforge.net/
+
+DHCPv6 allows prefix delegation and host configuration for the IPv6 network
+protocol.
+
+Multiple network interfaces are supported by this DHCPv6 package.
+
+This package contains the server, relay and client.
+
+
+%prep
+%setup -q 
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
+%patch10 -p1
+%patch11 -p1
+%patch12 -p1
+%patch13 -p1
+
+
+%build
+%configure --sysconfdir=%{_sysconfdir}/%{name} --enable-libdhcp=no
+make %{?_smp_mflags}	
+
+%install
+mkdir -p %{buildroot}%{_sbindir}
+mkdir -p %{buildroot}%{_sysconfdir}/%{name}
+mkdir -p %{buildroot}%{_mandir}/man{8,5}
+mkdir -p %{buildroot}%{_defaultdocdir}/%{name}
+install -p -m 755 dhcp6c dhcp6s dhcp6relay dhcp6ctl %{buildroot}%{_sbindir}
+install -p -m 644 dhcp6c.8 dhcp6s.8 dhcp6relay.8 dhcp6ctl.8 %{buildroot}/%{_mandir}/man8
+install -p -m 644 dhcp6c.conf.5 dhcp6s.conf.5 %{buildroot}/%{_mandir}/man5
+install -p -m 644 %{SOURCE1} %{buildroot}%{_defaultdocdir}/%{name}
+install -p -m 644 %{SOURCE2} %{buildroot}%{_defaultdocdir}/%{name}
+install -p -m 644 %{SOURCE3} %{buildroot}%{_defaultdocdir}/%{name}
+install -p -m 644 %{SOURCE4} %{buildroot}%{_defaultdocdir}/%{name}
+install -p -m 644 %{SOURCE5} %{buildroot}%{_defaultdocdir}/%{name}
+install -p -m 644 %{SOURCE6} %{buildroot}%{_defaultdocdir}/%{name}
+install -p -m 644 %{SOURCE7} %{buildroot}%{_defaultdocdir}/%{name}
+install -p -m 644 README CHANGES %{buildroot}%{_defaultdocdir}/%{name}
+install -p -m 644 dhcp6c.conf.sample %{buildroot}%{_defaultdocdir}/%{name}
+install -p -m 644 dhcp6s.conf.sample %{buildroot}%{_defaultdocdir}/%{name}
+
+%preun
+%systemd_preun dhcp6c.service
+%systemd_preun dhcp6r.service
+%systemd_preun dhcp6s.service
+
+%postun
+%systemd_postun_with_restart dhcp6c.service
+%systemd_postun_with_restart dhcp6r.service
+%systemd_postun_with_restart dhcp6s.service
+
+%files
+%dir %{_sysconfdir}/%{name}
+%{_defaultdocdir}/%{name}/*
+%{_sbindir}/*
+%{_mandir}/man?/*
+
+%changelog
+* Sat Feb 7 2015 dave at bevhost.com 20080615-13.1
+- Added patch 12 from ubuntu version
+- Added patch 13 so we can use parallel make
+
+* Tue Jan 14 2014 dave at bevhost.com 20080615-11.1.5
+- Added patch 11 provided by Scott Shambarger
+- Documentation directory now has no version number
+
+* Thu May 16 2013 dave at bevhost.com 20080615-11.1.4
+- Added patches 8 and 9, which simplify configuration
+- Added patch 10 which moves client script execution to after IP addr are added.
+- Added RELEASENOTES
+
+* Tue May 7 2013 dave at bevhost.com 20080615-11.1.3
+- make the build specific to fedora rawhide 
+
+* Mon May 6 2013 dave at bevhost.com 20080615-11.1.2
+- use macros in spec file wherever possible
+- add support for systemd
+
+* Wed Apr 24 2013 dave at bevhost.com 20080615-11.1.1
+- Move sysconfdir from /etc to /etc/wide-dhcpv6 to match man pages
+
+* Tue Apr 02 2013 dave at bevhost.com
+- converted from debian package
+
+


More information about the scm-commits mailing list