Package: runit-services
Version: 0.5.5~deb12u1
Severity: normal
Tags: ipv6, patch

Dear Maintainer,

If isc-dhcp-server is installed and configured to start an IPv6 DHCP
server then the presence of the runscript from runit-services 0.5.0
onwards prevents the IPv6 server from being started.

The initscript starts both v4 and v6 servers so this bug affects users
who either switch from sysvinit to runit or upgrade a runit system.

The runscript also fails to create the required leases file that the
initscript creates.

This is not an issue in earlier versions of runit-services because prior
to fixing #351051 the script was named after an older version of the
daemon and therefore did not mask the initscript.

This problem can be resolved with a second runscript that launches the
IPv6 server, since it would be contrary to the runit idiom to launch two
supervised daemons from the same runscript.

A patch is available at:
https://salsa.debian.org/debian/runit-services/-/merge_requests/12

Also attached based on current archive state.

Thank you!


-- System Information:
Debian Release: 12.7
merged-usr: no
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-26-amd64 (SMP w/6 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /bin/dash
Init: runit (via /run/runit.stopit)
LSM: AppArmor: enabled

Versions of packages runit-services depends on:
ii  runit         2.1.2-54
ii  runit-helper  2.15.2

Versions of packages runit-services recommends:
ii  runit-init  2.1.2-54

Versions of packages runit-services suggests:
pn  socklog  <none>

-- no debconf information
>From 4c2e7f464727079f22dd9d21b3089da5a9fa76e6 Mon Sep 17 00:00:00 2001
From: Andrew Bower <and...@bower.uk>
Date: Sun, 27 Oct 2024 12:05:37 +0000
Subject: [PATCH] Start isc-dhcp-server for IPv6

Also:
1. ensures the required lease files are created before starting and
2. aborts if the INTERFACESv[46] files are not created.
---
 debian/runit-services.runit |  1 +
 sv/isc-dhcp-server.6/run    | 24 ++++++++++++++++++++++++
 sv/isc-dhcp-server/run      |  9 +++++++++
 3 files changed, 34 insertions(+)
 create mode 100755 sv/isc-dhcp-server.6/run

diff --git a/debian/runit-services.runit b/debian/runit-services.runit
index c40886e..f71c2b5 100644
--- a/debian/runit-services.runit
+++ b/debian/runit-services.runit
@@ -18,6 +18,7 @@ sv/gdomap/  noscripts,usr,disable,bin=/usr/bin/gdomap
 sv/gpm         noscripts,usr,onupgrade=nostop,bin=/usr/sbin/gpm
 sv/haveged  noscripts,usr,logscript,finish,bin=/usr/sbin/haveged
 sv/isc-dhcp-server        noscripts,usr,finish,logscript,bin=/usr/sbin/dhcpd
+sv/isc-dhcp-server.6      noscripts,usr,finish,logscript,bin=/usr/sbin/dhcpd
 sv/lightdm   
noscripts,usr,onupgrade=nostop,logscript,finish,bin=/usr/sbin/lightdm
 sv/lighttpd   noscripts,usr,bin=/usr/sbin/lighttpd
 sv/lircd         noscripts,usr,logscript,finish,bin=/usr/sbin/lircd
diff --git a/sv/isc-dhcp-server.6/run b/sv/isc-dhcp-server.6/run
new file mode 100755
index 0000000..6b72c9c
--- /dev/null
+++ b/sv/isc-dhcp-server.6/run
@@ -0,0 +1,24 @@
+#!/usr/bin/env /lib/runit/invoke-run
+#Copyright: 2005-2008 Gerrit Pape <p...@smarden.org>
+#        2023 Lorenzo Puliti <plore...@disroot.org>
+#        2024 Andrew Bower <and...@bower.uk>
+#License: BSD-3-Clause
+
+exec 2>&1
+
+[ -n "$INTERFACESv6" ] || {
+  echo "invoke-run: no IPv6 interfaces specified for ${PWD##*/}"
+  exit 162
+}
+
+leases="/var/lib/dhcp/dhcpd6.leases"
+[ -e "$leases" ] || touch "$leases"
+
+dhcpd -6 -f -d -t $INTERFACESv6 || exit 162
+dhcpd -6 -f -d -T $INTERFACESv6 || exit 162
+
+if [ -e /etc/runit/verbose ]; then
+       echo "invoke-run: starting ${PWD##*/}"
+fi
+
+exec dhcpd -6 -f -d $INTERFACESv6
diff --git a/sv/isc-dhcp-server/run b/sv/isc-dhcp-server/run
index 528681b..113849a 100755
--- a/sv/isc-dhcp-server/run
+++ b/sv/isc-dhcp-server/run
@@ -1,10 +1,19 @@
 #!/usr/bin/env /lib/runit/invoke-run
 #Copyright: 2005-2008 Gerrit Pape <p...@smarden.org>
 #        2023 Lorenzo Puliti <plore...@disroot.org>
+#        2024 Andrew Bower <and...@bower.uk>
 #License: BSD-3-Clause
 
 exec 2>&1
 
+[ -n "$INTERFACESv4" ] || {
+  echo "invoke-run: no IPv4 interfaces specified for ${PWD##*/}"
+  exit 162
+}
+
+leases="/var/lib/dhcp/dhcpd.leases"
+[ -e "$leases" ] || touch "$leases"
+
 dhcpd -4 -f -d -t $INTERFACESv4 || exit 162
 dhcpd -4 -f -d -T $INTERFACESv4 || exit 162
 
-- 
2.34.1

Reply via email to