Do not call write_config() when click on Apply Changes because it was already done and it causes dhcpd to restart one more time on secondary nodes. It fixes #3797

This commit is contained in:
Renato Botelho 2014-09-18 15:57:52 -03:00
parent cc265e2e59
commit e5b3335ad9
1 changed files with 30 additions and 28 deletions

View File

@ -211,7 +211,7 @@ function validate_partial_mac_list($maclist) {
return true;
}
if ($_POST) {
if (isset($_POST['submit'])) {
unset($input_errors);
@ -503,35 +503,37 @@ if ($_POST) {
}
write_config();
$retval = 0;
$retvaldhcp = 0;
$retvaldns = 0;
/* Stop DHCP so we can cleanup leases */
killbyname("dhcpd");
dhcp_clean_leases();
/* dnsmasq_configure calls dhcpd_configure */
/* no need to restart dhcpd twice */
if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic'])) {
$retvaldns = services_dnsmasq_configure();
if ($retvaldns == 0) {
clear_subsystem_dirty('hosts');
clear_subsystem_dirty('staticmaps');
}
} else {
$retvaldhcp = services_dhcpd_configure();
if ($retvaldhcp == 0)
clear_subsystem_dirty('staticmaps');
}
if ($dhcpd_enable_changed)
$retvalfc = filter_configure();
if($retvaldhcp == 1 || $retvaldns == 1 || $retvalfc == 1)
$retval = 1;
$savemsg = get_std_save_message($retval);
}
}
if (isset($_POST['submit']) || isset($_POST['apply'])) {
$retval = 0;
$retvaldhcp = 0;
$retvaldns = 0;
/* Stop DHCP so we can cleanup leases */
killbyname("dhcpd");
dhcp_clean_leases();
/* dnsmasq_configure calls dhcpd_configure */
/* no need to restart dhcpd twice */
if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic'])) {
$retvaldns = services_dnsmasq_configure();
if ($retvaldns == 0) {
clear_subsystem_dirty('hosts');
clear_subsystem_dirty('staticmaps');
}
} else {
$retvaldhcp = services_dhcpd_configure();
if ($retvaldhcp == 0)
clear_subsystem_dirty('staticmaps');
}
if ($dhcpd_enable_changed)
$retvalfc = filter_configure();
if($retvaldhcp == 1 || $retvaldns == 1 || $retvalfc == 1)
$retval = 1;
$savemsg = get_std_save_message($retval);
}
if ($act == "delpool") {
if ($a_pools[$_GET['id']]) {
unset($a_pools[$_GET['id']]);
@ -1159,7 +1161,7 @@ include("head.inc");
<input type="hidden" name="pool" value="<?php echo $pool; ?>"/>
<?php endif; ?>
<input name="if" type="hidden" value="<?=htmlspecialchars($if);?>"/>
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="enable_change(true)"/>
<input name="submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="enable_change(true)"/>
</td>
</tr>
<tr>