Commit ee3dffdd authored by Michael Gilbert's avatar Michael Gilbert

release 4.3.3-6

parent c347ab8a
isc-dhcp (4.3.3-6) UNRELEASED; urgency=medium
isc-dhcp (4.3.3-6) experimental; urgency=medium
* Don't assume IPv6 prefix length of 64 (closes: #684009).
* Fix missing build flags from the last upload.
* Support IPv6 in the server init script (closes: #592539).
- Thanks to Florent Fourcot and Ron Murray.
* Don't assume an IPv6 prefix length of 64 (closes: #684009).
- Thanks to Arne Nordmark.
-- Michael Gilbert <mgilbert@debian.org> Sun, 04 Oct 2015 03:24:47 +0000
......
......@@ -13,7 +13,7 @@ INITCONFFILE=/etc/default/isc-dhcp-server
# preserve the configuration.
if [ -r ${INITCONFFILE} ]; then
. ${INITCONFFILE}
db_set isc-dhcp-server/interfaces "${INTERFACES}"
db_set isc-dhcp-server/interfaces "${INTERFACESv4}"
fi
db_title "DHCP Server"
......
#!/bin/sh
#
#
### BEGIN INIT INFO
# Provides: isc-dhcp-server
......@@ -34,72 +32,123 @@ fi
# Read init script configuration
[ -f "$DHCPD_DEFAULT" ] && . "$DHCPD_DEFAULT"
NAME=dhcpd
DESC="ISC DHCP server"
# fallback to default config file
DHCPD_CONF=${DHCPD_CONF:-/etc/dhcp/dhcpd.conf}
# try to read pid file name from config file, with fallback to /var/run/dhcpd.pid
if [ -z "$DHCPD_PID" ]; then
DHCPD_PID=$(sed -n -e 's/^[ \t]*pid-file-name[ \t]*"\(.*\)"[ \t]*;.*$/\1/p' < "$DHCPD_CONF" 2>/dev/null | head -n 1)
NAME4=dhcpd
NAME6=dhcpd6
DESC4="ISC DHCPv4 server"
DESC6="ISC DHCPv6 server"
# use already specified config file or fallback to defaults
DHCPDv4_CONF=${DHCPDv4_CONF:-/etc/dhcp/dhcpd.conf}
DHCPDv6_CONF=${DHCPDv6_CONF:-/etc/dhcp/dhcpd.conf}
# try to read pid file name from config file or fallback to defaults
if [ -z "$DHCPDv4_PID" ]; then
DHCPDv4_PID=$(sed -n -e 's/^[ \t]*pid-file-name[ \t]*"\(.*\)"[ \t]*;.*$/\1/p' < "$DHCPDv4_CONF" 2>/dev/null | head -n 1)
fi
if [ -z "$DHCPDv6_PID" ]; then
DHCPDv6_PID=$(sed -n -e 's/^[ \t]*pid-file-name[ \t]*"\(.*\)"[ \t]*;.*$/\1/p' < "$DHCPDv6_CONF" 2>/dev/null | head -n 1)
fi
DHCPD_PID="${DHCPD_PID:-/var/run/dhcpd.pid}"
DHCPDv4_PID="${DHCPDv4_PID:-/var/run/dhcpd.pid}"
DHCPDv6_PID="${DHCPDv4_PID:-/var/run/dhcpd6.pid}"
test_config()
{
if ! /usr/sbin/dhcpd -t $OPTIONS -q -cf "$DHCPD_CONF" > /dev/null 2>&1; then
echo "dhcpd self-test failed. Please fix $DHCPD_CONF."
VERSION="$1"
CONF="$2"
if ! /usr/sbin/dhcpd -t $VERSION -q -cf "$CONF" > /dev/null 2>&1; then
echo "dhcpd self-test failed. Please fix $CONF."
echo "The error was: "
/usr/sbin/dhcpd -t $OPTIONS -cf "$DHCPD_CONF"
/usr/sbin/dhcpd -t $VERSION -cf "$CONF"
exit 1
fi
touch /var/lib/dhcp/dhcpd.leases
}
# single arg is -v for messages, -q for none
check_status()
{
if [ ! -r "$DHCPD_PID" ]; then
test "$1" != -v || echo "$NAME is not running."
return 3
fi
if read pid < "$DHCPD_PID" && ps -p "$pid" > /dev/null 2>&1; then
test "$1" != -v || echo "$NAME is running."
return 0
else
test "$1" != -v || echo "$NAME is not running but $DHCPD_PID exists."
return 1
fi
OPTION="$1"
PIDFILE="$2"
NAME="$3"
if [ ! -r "$PIDFILE" ]; then
test "$OPTION" != -v || echo "$NAME is not running."
return 3
fi
if read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
test "$OPTION" != -v || echo "$NAME is running."
return 0
else
test "$OPTION" != -v || echo "$NAME is not running but $PIDFILE exists."
return 1
fi
}
start_daemon()
{
VERSION="$1"
CONF="$2"
NAME="$3"
PIDFILE="$4"
DESC="$5"
shift 5
INTERFACES="$*"
test_config "$VERSION" "$CONF"
log_daemon_msg "Starting $DESC" "$NAME"
if [ -e "$DHCPD_PID" ]; then
log_failure_msg "dhcpd service already running (pid file $PIDFILE currenty exists)"
exit 1
fi
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--exec /usr/sbin/dhcpd -- $VERSION -q -cf $CONF $INTERFACES
sleep 2
if check_status -q $PIDFILE $NAME; then
log_end_msg 0
else
log_failure_msg "check syslog for diagnostics."
log_end_msg 1
exit 1
fi
}
stop_daemon()
{
if check_status -q $DHCPDv4_PID $NAME4; then
log_daemon_msg "Stopping $DESC4" "$NAME4"
start-stop-daemon --stop --quiet --pidfile $DHCPDv4_PID
log_end_msg $?
rm -f "$DHCPDv4_PID"
fi
if check_status -q $DHCPDv6_PID $NAME6; then
log_daemon_msg "Stopping $DESC6" "$NAME6"
start-stop-daemon --stop --quiet --pidfile $DHCPDv6_PID
log_end_msg $?
rm -f "$DHCPDv6_PID"
fi
}
case "$1" in
start)
test_config
if [ -e "$DHCPD_PID" ]; then
log_failure_msg "dhcpd service already running (pid file $DHCPD_PID currenty exists)"
exit 1
if test -n "$INTERFACESv4"; then
start_daemon "-4" "$DHCPDv4_CONF" "$NAME4" \
"$DHCPDv4_PID" "$DESC4" "$INTERFACESv4"
fi
log_daemon_msg "Starting $DESC" "$NAME"
start-stop-daemon --start --quiet --pidfile "$DHCPD_PID" \
--exec /usr/sbin/dhcpd -- \
-q $OPTIONS -cf "$DHCPD_CONF" -pf "$DHCPD_PID" $INTERFACES
sleep 2
if check_status -q; then
log_end_msg 0
else
log_failure_msg "check syslog for diagnostics."
log_end_msg 1
exit 1
if test -n "$INTERFACESv6"; then
start_daemon "-6" "$DHCPDv6_CONF" "$NAME6" \
"$DHCPDv6_PID" "$DESC6" "$INTERFACESv6"
fi
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --stop --quiet --pidfile "$DHCPD_PID"
log_end_msg $?
rm -f "$DHCPD_PID"
stop_daemon
;;
restart | force-reload)
test_config
$0 stop
sleep 2
$0 start
......@@ -108,9 +157,12 @@ case "$1" in
fi
;;
status)
echo -n "Status of $DESC: "
check_status -v
exit "$?"
echo -n "Status of $DESC4: "
check_status -v $DHCPv4_PID $NAME4
STATUSv4="$?"
echo -n "Status of $DESC6: "
check_status -v $DHCPv6_PID $NAME6
exit "$(($STATUSv4|$?))"
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}"
......
......@@ -34,19 +34,15 @@ umask 022
[ -r "${INITCONFFILE}" ] || {
echo Generating ${INITCONFFILE}... >&2
cat >${INITCONFFILE} <<'EOFMAGICNUMBER1234'
# Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server)
# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPD_CONF=/etc/dhcp/dhcpd.conf
#DHCPDv4_CONF=/etc/dhcp/dhcpd.conf
#DHCPDv6_CONF=/etc/dhcp/dhcpd.conf
# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid
#DHCPDv4_PID=/var/run/dhcpd.pid
#DHCPDv6_PID=/var/run/dhcpd6.pid
# Additional options to start dhcpd with.
# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
......@@ -54,18 +50,19 @@ umask 022
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES=""
INTERFACESv4=""
INTERFACESv6=""
EOFMAGICNUMBER1234
}
# ------------------------- Debconf questions start ---------------------
db_get isc-dhcp-server/interfaces || true
INTERFACES="${RET}"
INTERFACESv4="${RET}"
if [ -n "$INTERFACES" ]; then
if [ -n "$INTERFACESv4" ]; then
TMPFILE="$(mktemp -q ${INITCONFFILE}.new.XXXXXX)"
sed -e "s,^[[:space:]]*INTERFACES[[:space:]]*=.*,INTERFACES=\"${INTERFACES}\"," \
sed -e "s,^[[:space:]]*INTERFACESv4[[:space:]]*=.*,INTERFACESv4=\"${INTERFACESv4}\"," \
<${INITCONFFILE} >${TMPFILE}
cp ${TMPFILE} ${INITCONFFILE}
rm ${TMPFILE}
......@@ -74,7 +71,7 @@ fi
# ------------------------- Debconf questions end ---------------------
db_stop
test ! -x /sbin/restorecon || /sbin/restorecon /var/lib/dhcp/dhcpd.leases
test ! -x /sbin/restorecon || restorecon /var/lib/dhcp/dhcpd.leases
#DEBHELPER#
......
......@@ -12,6 +12,7 @@ DHCLIENT_SCRIPT=/sbin/dhclient-script
CFLAGS+=-Wall
CFLAGS+=-I/usr/include/bind-export
CFLAGS+=$(shell dpkg-buildflags --get CFLAGS)
CFLAGS+=-D_PATH_DHCPD_CONF='\"/etc/dhcp/dhcpd.conf\"'
CFLAGS+=-D_PATH_DHCPD_DB='\"$(LEASE_PATH)/dhcpd.leases\"'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment