From 3c1d4325f24b2cd042a5eb0c4718d920bb1c9e28 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 28 Jul 2025 13:34:45 -0700 Subject: [PATCH] Implement dnsmasq restart button --- includes/dhcp.php | 12 ++++++++++++ templates/dhcp.php | 1 + 2 files changed, 13 insertions(+) diff --git a/includes/dhcp.php b/includes/dhcp.php index f209813e..a4b06f76 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -37,6 +37,18 @@ function DisplayDHCPConfig() $status->addMessage('Failed to start dnsmasq', 'danger'); } } + } elseif (isset($_POST['restartdhcpd'])) { + if ($dnsmasq_state) { + exec('sudo /bin/systemctl restart dnsmasq.service', $dnsmasq, $return); + if ($return == 0) { + $status->addMessage('Successfully restarted dnsmasq', 'success'); + $dnsmasq_state = false; + } else { + $status->addMessage('Failed to restart dnsmasq', 'danger'); + } + } else { + $status->addMessage('dnsmasq already stopped', 'info'); + } } elseif (isset($_POST['stopdhcpd'])) { if ($dnsmasq_state) { exec('sudo /bin/systemctl stop dnsmasq.service', $dnsmasq, $return); diff --git a/templates/dhcp.php b/templates/dhcp.php index b83a6444..9e5803f9 100755 --- a/templates/dhcp.php +++ b/templates/dhcp.php @@ -3,6 +3,7 @@ " name="savedhcpdsettings" /> " name="stopdhcpd" /> + " name="restartdhcpd" /> " name="startdhcpd" />