mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
dhcp: fix killbyname() usage which kills both services
This commit is contained in:
parent
e1f2fb0f3d
commit
bbee5f518f
@ -63,7 +63,6 @@ if (isset($opts['m']) && isset($opts['f'])) {
|
||||
}
|
||||
// XXX: should probably add some plugin hook for this.
|
||||
if ($fname == 'dhcpd' && $mname == 'core') {
|
||||
killbyname('dhcpd');
|
||||
plugins_configure('dhcp');
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +78,6 @@ function clear_all_log_files()
|
||||
}
|
||||
|
||||
system_syslogd_start();
|
||||
killbyname('dhcpd');
|
||||
plugins_configure('dhcp');
|
||||
}
|
||||
|
||||
|
||||
@ -37,11 +37,15 @@ require_once("plugins.inc.d/dhcpd.inc");
|
||||
* This function will remove entries from dhcpd.leases that would otherwise
|
||||
* overlap with static DHCP reservations. If we don't clean these out,
|
||||
* then DHCP will print a warning in the logs about a duplicate lease
|
||||
*
|
||||
* XXX errr: why are we doing this only on this particular page?
|
||||
*/
|
||||
function dhcp_clean_leases()
|
||||
{
|
||||
global $config;
|
||||
|
||||
killbypid('/var/dhcpd/var/run/dhcpd.pid', 'TERM', true);
|
||||
|
||||
$leasesfile = dhcpd_dhcpv4_leasesfile();
|
||||
if (!file_exists($leasesfile)) {
|
||||
return;
|
||||
@ -82,8 +86,6 @@ function validate_partial_mac_list($maclist) {
|
||||
|
||||
function reconfigure_dhcpd()
|
||||
{
|
||||
/* Stop DHCP so we can cleanup leases */
|
||||
killbyname("dhcpd");
|
||||
dhcp_clean_leases();
|
||||
system_hosts_generate();
|
||||
clear_subsystem_dirty('hosts');
|
||||
|
||||
@ -257,9 +257,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
);
|
||||
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if (!empty($_POST['deleteip']) && is_ipaddr($_POST['deleteip'])) {
|
||||
// delete dhcp lease
|
||||
/* Stop DHCPD */
|
||||
killbyname("dhcpd");
|
||||
killbypid('/var/dhcpd/var/run/dhcpd.pid', 'TERM', true);
|
||||
$fin = @fopen($leasesfile, "r");
|
||||
$fout = @fopen($leasesfile.".new", "w");
|
||||
if ($fin) {
|
||||
|
||||
@ -314,9 +314,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
}
|
||||
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if (!empty($_POST['deleteip']) && is_ipaddr($_POST['deleteip'])) {
|
||||
// delete dhcp lease
|
||||
/* Stop DHCPD */
|
||||
killbyname("dhcpd");
|
||||
killbypid('/var/dhcpd/var/run/dhcpdv6.pid', 'TERM', true);
|
||||
$fin = @fopen($leasesfile, "r");
|
||||
$fout = @fopen($leasesfile.".new", "w");
|
||||
if ($fin) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user