diff options
Diffstat (limited to 'src/etc/inc/services.inc')
-rw-r--r-- | src/etc/inc/services.inc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc index 333261d..d13f44a 100644 --- a/src/etc/inc/services.inc +++ b/src/etc/inc/services.inc @@ -725,6 +725,14 @@ EOPP; // Setup pool options foreach ($all_pools as $poolconf) { + if (!(ip_in_subnet($poolconf['range']['from'], "{$subnet}/{$ifcfgsn}") && ip_in_subnet($poolconf['range']['to'], "{$subnet}/{$ifcfgsn}"))) { + // If the user has changed the subnet from the interfaces page and applied, + // but has not updated the DHCP range, then the range to/from of the pool can be outside the subnet. + // In that case, ignore the pool and post an error. + $error_msg = sprintf(gettext("Invalid DHCP pool %s - %s for %s subnet %s/%s detected. Please correct the settings in Services, DHCP Server"), $poolconf['range']['from'], $poolconf['range']['to'], convert_real_interface_to_friendly_descr($dhcpif), $subnet, $ifcfgsn); + file_notice("DHCP", $error_msg); + continue; + } $dhcpdconf .= " pool {\n"; /* is failover dns setup? */ if (is_array($poolconf['dnsserver']) && $poolconf['dnsserver'][0] <> "") { @@ -2438,8 +2446,13 @@ function configure_cron() { file_put_contents("/etc/crontab", $crontab_contents); unset($crontab_contents); + /* make sure that cron is running and start it if it got killed somehow */ + if (!is_process_running("cron")) { + exec("cd /tmp && /usr/sbin/cron -s 2>/dev/null"); + } else { /* do a HUP kill to force sync changes */ - sigkillbypid("{$g['varrun_path']}/cron.pid", "HUP"); + sigkillbypid("{$g['varrun_path']}/cron.pid", "HUP"); + } conf_mount_ro(); } |