Package: isc-dhcp-server
Version: 4.1.1-P1-8
Severity: wishlist

Hi,

this is #565650 adapted to isc-dhcp-server 4.1.1

the attached patch will extend the isc-dhcp-server init script to accept
a second command line command, selecting a totally different
configuration file with a suffix.

/etc/init.d/isc-dhcp-server start
has identical behavior (and the expected behavior),
/etc/init.d/isc-dhcp-server start somesuffix
will start the DHCP server on the interfaces listed in
INTERFACES_somesuffix in /etc/default/isc-dhcp-server with the config
file read from /etc/dhcp/dhcpd-somesuffix.conf

This allows to run the DHCP server with a completely different
configuration for debugging or testing purposes while leaving the
original configuration unaltered. This prevents issues from happening
where a testing DHCP server remains running and the notebook is then
plugged into a productive network, as it makes sure that the original
configuration stays intact and does not need to be manually put back.

Please consider accepting the patch.

Greetings
Marc
--- dhcp3-server.dpkg-dist      2009-07-15 08:28:07.000000000 +0200
+++ dhcp3-server        2010-01-17 18:37:31.000000000 +0100
@@ -35,13 +35,24 @@
 NAME=dhcpd3
 DESC="DHCP server"
 DHCPDPID=/var/run/dhcpd.pid
+CONFIGFILE=/etc/dhcp3/dhcpd.conf
+IFCS="$INTERFACES"
+
+if [ -n "$2" ]; then
+  SUFFIX="$2"
+  DESC="DHCP server suffix $SUFFIX"
+  DHCPDPID=/var/run/dhcpd-$SUFFIX.pid
+  CONFIGFILE=/etc/dhcp3/dhcpd-$SUFFIX.conf
+  eval IFCS=\$INTERFACES_$SUFFIX
+fi
+
 
 test_config()
 {
-       if ! /usr/sbin/dhcpd3 -t -q > /dev/null 2>&1; then
+       if ! /usr/sbin/dhcpd3 -cf $CONFIGFILE -t -q > /dev/null 2>&1; then
                echo "dhcpd self-test failed. Please fix the config file."
                echo "The error was: "
-               /usr/sbin/dhcpd3 -t
+               /usr/sbin/dhcpd3 -cf $CONFIGFILE -t
                exit 1
        fi
 }
@@ -67,7 +78,7 @@
                test_config
                log_daemon_msg "Starting $DESC" "$NAME"
                start-stop-daemon --start --quiet --pidfile $DHCPDPID \
-                       --exec /usr/sbin/dhcpd3 -- -q $INTERFACES
+                       --exec /usr/sbin/dhcpd3 -- -pf $DHCPDPID -cf 
$CONFIGFILE -q $IFCS
                sleep 2
 
                if check_status -q; then

Reply via email to