Package: isc-dhcp-server
Version: 4.4.1-2
Severity: normal
Tags: ipv6 patch
Dear Maintainer,
> What led up to the situation?
The init script tries to launch two parallel instances of dhcpd, one
each for ipv4 and ipv6, unless INTERFACESv4 or INTERFACESv6 is
specified. The man page says:
> This should be done on systems where dhcpd is unable to identify
> non-broadcast interfaces, but should not be required on other systems.
My system doesn't seem to require this. We can avoid a specification
which could become wrong if the environment changes.
> What exactly did you do (or not do) that was effective (or ineffective)?
I tried specifying "OPTIONS=-4" in the defaults file, but that didn't prevent
the init script from trying to launch an instance for IPv6. That instance just
failed immediately, causing the init script to return failure.
Ultimately I modified the init script to respect two new variables:
IPV4ONLY and IPV6ONLY. I modified the "start" case to enter the
ipv4-only or ipv6-only behavior, respectively, if either is set.
INTERFACESv4 should still work, but specifying interfaces is no longer
mandatory.
isc-dhcp-server.patch - for /etc/init.d/isc-dhcp-server - is attached.
I changed some if/then keywords, slightly, to accommodate. Oh, the
status action seemed parallel to the start action, but missing a few
lines, so I added them. Let me know if that should be a separate patch,
or if it's a bad idea.
> What was the outcome of this action?
The outcome of specifying "OPTIONS=-4" was a failed instance of dhcpd, but that
makes sense given the structure of the init script.
The outcome of modifying the init script is a working server and
successful return codes from the init script.
> What outcome did you expect instead?
I expected it to work because I'm awesome. Oh, I expected, originally, for the
init script to let me choose a protocol, since it seems to allow that, without
also forcing me to specify which interface(s) to use.
-- System Information:
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster
Architecture: armv6l
Kernel: Linux 4.19.75+
Kernel taint flags: TAINT_CRAP
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1), LANGUAGE=en_US
(charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Versions of packages isc-dhcp-server depends on:
ii debconf [debconf-2.0] 1.5.71
ii debianutils 4.8.6.1
ii libc6 2.28-10+rpi1
ii libdns-export1104 1:9.11.5.P4+dfsg-5.1
ii libirs-export161 1:9.11.5.P4+dfsg-5.1
ii libisc-export1100 1:9.11.5.P4+dfsg-5.1
ii lsb-base 10.2019051400+rpi1
Versions of packages isc-dhcp-server recommends:
ii isc-dhcp-common 4.4.1-2
ii policycoreutils 2.8-1
Versions of packages isc-dhcp-server suggests:
pn isc-dhcp-server-ldap <none>
pn policykit-1 <none>
-- Configuration Files:
/etc/dhcp/dhcpd.conf changed:
ddns-update-style none;
option domain-search "neuronpointer.net";
option domain-name "neuronpointer.net";
option domain-name-servers neuron.neuronpointer.net;
default-lease-time 3600;
max-lease-time 200;
authoritative;
log-facility local7;
option architecture-type code 93 = unsigned integer 16;
subnet 192.168.11.0 netmask 255.255.255.0 {
option broadcast-address 192.168.11.255;
option routers gateway.neuronpointer.net;
#option domain-name-servers 192.168.11.54;
range 192.168.11.2 192.168.11.50;
}
group {
# EFI netboot
# This doesn't work yet.
option broadcast-address 192.168.11.255;
option routers gateway.neuronpointer.net;
#option domain-name-servers 192.168.11.54;
filename "syslinux.efi";
# First instruct PXE firmware to download ipxe, then instruct ipxe to
download syslinux.
#if exists user-class and option user-class = "iPXE" {
# filename "tftp://neuron/syslinux.efi";
#} else {
# filename "ipxe.efi";
#}
}
group {
# legacy netboot
option broadcast-address 192.168.11.255;
option routers gateway.neuronpointer.net;
#option domain-name-servers 192.168.11.54;
filename "lpxelinux.0";
}
group {
# no netboot
option broadcast-address 192.168.11.255;
option routers gateway.neuronpointer.net;
#option domain-name-servers 192.168.11.54;
host files {
hardware ethernet 02:55:08:42:95:49;
fixed-address files.neuronpointer.net;
}
host mawg {
hardware ethernet 9c:4e:36:c0:d6:00;
fixed-address mawg.neuronpointer.net;
}
host meliora {
hardware ethernet F0:DE:F1:90:77:CB;
fixed-address meliora.neuronpointer.net;
}
host neuron {
hardware ethernet B8:27:EB:47:A1:FB;
fixed-address neuron.neuronpointer.net;
}
host nixon {
hardware ethernet 00:0e:35:2d:9c:17;
fixed-address nixon.neuronpointer.net;
}
host no {
hardware ethernet 94:94:26:01:38:76;
fixed-address no.neuronpointer.net;
}
host peekaboo {
hardware ethernet A0:99:9B:0A:02:F3;
fixed-address peekaboo.neuronpointer.net;
}
host rudolph {
hardware ethernet 5C:C5:D4:64:E6:19;
fixed-address rudolph.neuronpointer.net;
}
host partybus {
hardware ethernet 3A:4E:D2:48:B3:B7;
fixed-address partybus.neuronpointer.net;
}
host synapse {
hardware ethernet B8:27:EB:D1:2D:A2;
fixed-address synapse.neuronpointer.net;
}
host wii {
hardware ethernet 9C:E6:35:83:64:4E;
fixed-address wii.neuronpointer.net;
}
host xbox {
hardware ethernet 50:1A:C5:5B:B7:AA;
fixed-address xbox.neuronpointer.net;
}
}
/etc/init.d/isc-dhcp-server changed:
PATH=/sbin:/bin:/usr/sbin:/usr/bin
test -f /usr/sbin/dhcpd || exit 0
DHCPD_DEFAULT="${DHCPD_DEFAULT:-/etc/default/isc-dhcp-server}"
if [ ! -f "$DHCPD_DEFAULT" ]; then
echo "$DHCPD_DEFAULT does not exist! - Aborting..."
if [ "$DHCPD_DEFAULT" = "/etc/default/isc-dhcp-server" ]; then
echo "Run 'dpkg-reconfigure isc-dhcp-server' to fix the
problem."
fi
exit 0
fi
. /lib/lsb/init-functions
[ -f "$DHCPD_DEFAULT" ] && . "$DHCPD_DEFAULT"
NAME4=dhcpd
NAME6=dhcpd6
DESC4="ISC DHCPv4 server"
DESC6="ISC DHCPv6 server"
DHCPDv4_CONF=${DHCPDv4_CONF:-/etc/dhcp/dhcpd.conf}
DHCPDv6_CONF=${DHCPDv6_CONF:-/etc/dhcp/dhcpd6.conf}
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]*dhcpv6-pid-file-name[ \t]*"\(.*\)"[
\t]*;.*$/\1/p' < "$DHCPDv6_CONF" 2>/dev/null | head -n 1)
fi
DHCPDv4_PID="${DHCPDv4_PID:-/var/run/dhcpd.pid}"
DHCPDv6_PID="${DHCPDv6_PID:-/var/run/dhcpd6.pid}"
test_config()
{
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 $VERSION -cf "$CONF"
exit 1
fi
}
check_status()
{
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 "$PIDFILE" ]; then
log_failure_msg "dhcpd service already running (pid file
$PIDFILE currenty exists)"
exit 1
fi
touch /var/lib/dhcp/$NAME.leases
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)
if test -n "$INTERFACES" -a -z "$INTERFACESv4"; then
echo "DHCPv4 interfaces are no longer set by the
INTERFACES variable in" >&2
echo "/etc/default/isc-dhcp-server. Please use
INTERFACESv4 instead." >&2
echo "Migrating automatically for now, but this will go
away in the future." >&2
INTERFACESv4="$INTERFACES"
fi
if test -n "$INTERFACESv4" -o -n "$IPV4"; then
echo "Launching IPv4 server only."
start_daemon "-4" "$DHCPDv4_CONF" "$NAME4" \
"$DHCPDv4_PID" "$DESC4" "$INTERFACESv4"
elif test -n "$INTERFACESv6" -o -n "$IPV6"; then
echo "Launching IPv6 server only."
start_daemon "-6" "$DHCPDv6_CONF" "$NAME6" \
"$DHCPDv6_PID" "$DESC6" "$INTERFACESv6"
else
echo "Launching both IPv4 and IPv6 servers (please
configure INTERFACES in /etc/default/isc-dhcp-server if you only want one or
the other)."
start_daemon "-4" "$DHCPDv4_CONF" "$NAME4" \
"$DHCPDv4_PID" "$DESC4" ""
start_daemon "-6" "$DHCPDv6_CONF" "$NAME6" \
"$DHCPDv6_PID" "$DESC6" ""
fi
;;
stop)
stop_daemon
;;
restart | force-reload)
$0 stop
sleep 2
$0 start
if [ "$?" != "0" ]; then
exit 1
fi
;;
status)
if test -n "$INTERFACES" -a -z "$INTERFACESv4"; then
INTERFACESv4="$INTERFACES"
fi
if test -n "$INTERFACESv4" -o -n "$IPV4"; then
echo -n "Status of $DESC4: "
check_status -v $DHCPDv4_PID $NAME4 || exit $?
elif test -n "$INTERFACESv6" -o -n "$IPV6"; then
echo -n "Status of $DESC6: "
check_status -v $DHCPDv6_PID $NAME6 || exit $?
else
echo -n "Status of $DESC4: "
check_status -v $DHCPDv4_PID $NAME4 || exit $?
echo -n "Status of $DESC6: "
check_status -v $DHCPDv6_PID $NAME6 || exit $?
fi
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}"
exit 1
esac
exit 0
-- debconf information:
isc-dhcp-server/interfaces:
--
Aaron Bugher
147c147
< if test -n "$INTERFACESv4"; then
---
> if test -n "$INTERFACESv4" -o -n "$IPV4ONLY"; then
151,152c151
< fi
< if test -n "$INTERFACESv6"; then
---
> elif test -n "$INTERFACESv6" -o -n "$IPV6ONLY"; then
156,157c155
< fi
< if test -z "$INTERFACESv4" -a -z "$INTERFACESv6"; then
---
> else
180c178,184
< if test -n "$INTERFACESv4"; then
---
> if test -n "$INTERFACESv4" -o -n "$IPV4ONLY"; then
> echo -n "Status of $DESC4: "
> check_status -v $DHCPDv4_PID $NAME4 || exit $?
> elif test -n "$INTERFACESv6" -o -n "$IPV6ONLY"; then
> echo -n "Status of $DESC6: "
> check_status -v $DHCPDv6_PID $NAME6 || exit $?
> else
183,184d186
< fi
< if test -n "$INTERFACESv6"; then