Project

General

Profile

Actions

Regression #14897

closed

DHCPv4 service stopped after applying interface settings when no interfaces have DHCPv6 enabled

Added by Jim Pingle 6 months ago. Updated 6 months ago.

Status:
Resolved
Priority:
High
Assignee:
Category:
DHCP (IPv4)
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
23.09
Release Notes:
Force Exclusion
Affected Version:
2.8.0
Affected Architecture:

Description

When applying changes for an interface (e.g. WAN), during interface_bring_down() it ends up calling services_dhcpd_configure('inet6'); in certain conditions.

The services_dhcpd_configure() function kills all DHCP services (IPv4 and IPv6) but only reconfigures IPv6, which can leave IPv4 service down/disabled.

This affects both Kea and ISC.

Teaching services_dhcpd_kill_all() to kill by address family appears to resolve the issue as then it only acts on one address family for stop/start as intended in this case.

diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc
index 8a7d571aa5..819f6d7bb3 100644
--- a/src/etc/inc/services.inc
+++ b/src/etc/inc/services.inc
@@ -918,18 +918,28 @@ kea6_skip_first_pool_options:
        return 0;
 }

-function services_dhcpd_kill_all()
+function services_dhcpd_kill_all($family = 'all')
 {
        $dhcpd_var_run = g_get('dhcpd_chroot_path') . g_get('varrun_path');
        $kea_var_run = g_get('varrun_path') . '/kea';

-       $pids = [
+       $pids = [];
+       $pids4 = [
                $dhcpd_var_run . '/dhcpd.pid',
-               $dhcpd_var_run . '/dhcpdv6.pid',
                $kea_var_run . '/kea-dhcp4.kea-dhcp4.pid',
+       ];
+       $pids6 = [
+               $dhcpd_var_run . '/dhcpdv6.pid',
                $kea_var_run . '/kea-dhcp6.kea-dhcp6.pid'
        ];

+       if (($family === 'all') || ($family === 'inet')) {
+               $pids = array_merge($pids, $pids4);
+       }
+       if (($family === 'all') || ($family === 'inet6')) {
+               $pids = array_merge($pids, $pids6);
+       }
+
        foreach ($pids as $pid) {
                if (isvalidpid($pid)) {
                        killbypid($pid);
@@ -945,7 +955,7 @@ function services_dhcpd_configure($family = "all")
        /* block if dhcpd is already being configured */
        $dhcpdconfigurelck = lock('dhcpdconfigure', LOCK_EX);

-       services_dhcpd_kill_all();
+       services_dhcpd_kill_all($family);

        if (dhcp_is_backend('isc')) {
                $fd = fopen("{$g['tmp_path']}/dhcpd.sh", "w");
Actions #1

Updated by Jim Pingle 6 months ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100
Actions #2

Updated by Jim Pingle 6 months ago

  • Status changed from Feedback to Resolved
Actions #3

Updated by Jim Pingle 6 months ago

  • Target version changed from 2.8.0 to 2.7.1
Actions

Also available in: Atom PDF