summaryrefslogtreecommitdiffstats
path: root/src/etc/inc
diff options
context:
space:
mode:
Diffstat (limited to 'src/etc/inc')
-rw-r--r--src/etc/inc/functions.inc2
-rw-r--r--src/etc/inc/pfsense-utils.inc4
-rw-r--r--src/etc/inc/service-utils.inc7
-rw-r--r--src/etc/inc/services.inc15
-rw-r--r--src/etc/inc/system.inc17
-rw-r--r--src/etc/inc/upgrade_config.inc95
6 files changed, 92 insertions, 48 deletions
diff --git a/src/etc/inc/functions.inc b/src/etc/inc/functions.inc
index 2c8f4c8..40e2dae 100644
--- a/src/etc/inc/functions.inc
+++ b/src/etc/inc/functions.inc
@@ -102,7 +102,7 @@ if (!function_exists("get_menu_messages")) {
foreach ($notices as $key => $value) {
$date = date("m-d-y H:i:s", $key);
$noticemsg = ($value['notice'] != "" ? $value['notice'] : $value['id']);
- $noticemsg = preg_replace("/(\"|\'|\n|<.?\w+>)/i", "", $noticemsg);
+ $noticemsg = strip_tags(preg_replace("/(\"|\'|\n|<.?\w+>)/i", "", $noticemsg));
if ((strlen($noticemsg)* 8) > $domtt_width) {
$domtt_width=(strlen($noticemsg) *8);
}
diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc
index dc44036..e782228 100644
--- a/src/etc/inc/pfsense-utils.inc
+++ b/src/etc/inc/pfsense-utils.inc
@@ -2232,8 +2232,8 @@ function version_compare_string($a, $b) {
}
}
function version_compare_numeric($a, $b) {
- $a_arr = explode('.', rtrim($a, '.0'));
- $b_arr = explode('.', rtrim($b, '.0'));
+ $a_arr = explode('.', rtrim($a, '.'));
+ $b_arr = explode('.', rtrim($b, '.'));
foreach ($a_arr as $n => $val) {
if (array_key_exists($n, $b_arr)) {
diff --git a/src/etc/inc/service-utils.inc b/src/etc/inc/service-utils.inc
index 2fa75cf..3a72295 100644
--- a/src/etc/inc/service-utils.inc
+++ b/src/etc/inc/service-utils.inc
@@ -344,13 +344,6 @@ function get_services() {
$services[] = $pconfig;
}
- if (isset($config['installedpackages']['routed']) && $config['installedpackages']['routed']['config'][0]['enable']) {
- $pconfig = array();
- $pconfig['name'] = "routed";
- $pconfig['description'] = gettext("RIP Daemon");
- $services[] = $pconfig;
- }
-
if (isset($config['ipsec']['enable'])) {
$pconfig = array();
$pconfig['name'] = "ipsec";
diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc
index 10f0451..7dd1739 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();
}
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc
index 41e798e..f7987e1 100644
--- a/src/etc/inc/system.inc
+++ b/src/etc/inc/system.inc
@@ -2042,6 +2042,7 @@ function system_dmesg_save() {
function system_set_harddisk_standby() {
global $g, $config;
+
if (isset($config['system']['developerspew'])) {
$mt = microtime();
echo "system_set_harddisk_standby() being called $mt\n";
@@ -2055,11 +2056,17 @@ function system_set_harddisk_standby() {
$standby = $config['system']['harddiskstandby'];
// Check for a numeric value
if (is_numeric($standby)) {
- // Sync the disk(s)
- pfSense_sync();
- if (set_single_sysctl('hw.ata.standby', (int)$standby)) {
- // Reinitialize ATA-drives
- mwexec('/usr/local/sbin/atareinit');
+ // Get only suitable candidates for standby; using get_smart_drive_list()
+ // from utils.inc to get the list of drives.
+ $harddisks = get_smart_drive_list();
+
+ // Since get_smart_drive_list() only matches ad|da|ada; lets put the check below
+ // just in case of some weird pfSense platform installs.
+ if (count($harddisks) > 0) {
+ // Iterate disks and run the camcontrol command for each
+ foreach ($harddisks as $harddisk) {
+ mwexec("/sbin/camcontrol standby {$harddisk} -t {$standby}");
+ }
if (platform_booting()) {
echo gettext("done.") . "\n";
}
diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc
index b91905c..ab5cb3e 100644
--- a/src/etc/inc/upgrade_config.inc
+++ b/src/etc/inc/upgrade_config.inc
@@ -258,8 +258,8 @@ function upgrade_014_to_015() {
if ($config['interfaces']['wan']['gateway'] <> "") {
$config['system']['gateway'] = $config['interfaces']['wan']['gateway'];
}
+ unset($config['interfaces']['wan']['gateway']);
}
- unset($config['interfaces']['wan']['gateway']);
/* Queues are no longer interface specific */
if (isset($config['interfaces']['lan']['schedulertype'])) {
@@ -285,9 +285,12 @@ function upgrade_015_to_016() {
$config['system']['alt_firmware_url']['enabled'] = "";
$config['system']['alt_firmware_url']['firmware_base_url'] = $config['system']['firmwareurl'];
$config['system']['alt_firmware_url']['firmware_filename'] = $config['system']['firmwarename'];
- unset($config['system']['firmwareurl'], $config['system']['firmwarename']);
- } else {
- unset($config['system']['firmwareurl'], $config['system']['firmwarename']);
+ }
+ if (isset($config['system']['firmwareurl'])) {
+ unset($config['system']['firmwareurl']);
+ }
+ if (isset($config['system']['firmwarename'])) {
+ unset($config['system']['firmwarename']);
}
}
@@ -295,12 +298,24 @@ function upgrade_015_to_016() {
function upgrade_016_to_017() {
global $config;
/* wipe previous shaper configuration */
- unset($config['shaper']['queue']);
- unset($config['shaper']['rule']);
- unset($config['interfaces']['wan']['bandwidth']);
- unset($config['interfaces']['wan']['bandwidthtype']);
- unset($config['interfaces']['lan']['bandwidth']);
- unset($config['interfaces']['lan']['bandwidthtype']);
+ if (isset($config['shaper']['queue'])) {
+ unset($config['shaper']['queue']);
+ }
+ if (isset($config['shaper']['rule'])) {
+ unset($config['shaper']['rule']);
+ }
+ if (isset($config['interfaces']['wan']['bandwidth'])) {
+ unset($config['interfaces']['wan']['bandwidth']);
+ }
+ if (isset($config['interfaces']['wan']['bandwidthtype'])) {
+ unset($config['interfaces']['wan']['bandwidthtype']);
+ }
+ if (isset($config['interfaces']['lan']['bandwidth'])) {
+ unset($config['interfaces']['lan']['bandwidth']);
+ }
+ if (isset($config['interfaces']['lan']['bandwidthtype'])) {
+ unset($config['interfaces']['lan']['bandwidthtype']);
+ }
$config['shaper']['enable'] = FALSE;
}
@@ -350,7 +365,9 @@ function upgrade_017_to_018() {
unset($config['installedpackages']['carp']);
}
/* Server NAT is no longer needed */
- unset($config['nat']['servernat']);
+ if (isset($config['nat']['servernat'])) {
+ unset($config['nat']['servernat']);
+ }
/* enable SSH */
if ($config['version'] == "1.8") {
@@ -361,7 +378,7 @@ function upgrade_017_to_018() {
function upgrade_018_to_019() {
global $config;
- $config['theme']="metallic";
+ $config['theme'] = "metallic";
}
@@ -412,7 +429,9 @@ function upgrade_023_to_024() {
function upgrade_024_to_025() {
global $config;
$config['interfaces']['wan']['use_rrd_gateway'] = $config['system']['use_rrd_gateway'];
- unset($config['system']['use_rrd_gateway']);
+ if (isset($config['system']['use_rrd_gateway'])) {
+ unset($config['system']['use_rrd_gateway']);
+ }
}
@@ -587,7 +606,7 @@ function upgrade_039_to_040() {
$config['system']['webgui']['auth_method'] = "session";
$config['system']['webgui']['backing_method'] = "htpasswd";
- if (isset ($config['system']['username'])) {
+ if (isset($config['system']['username'])) {
$config['system']['group'] = array();
$config['system']['group'][0]['name'] = "admins";
$config['system']['group'][0]['description'] = gettext("System Administrators");
@@ -627,8 +646,10 @@ function upgrade_039_to_040() {
$config['system']['nextgid'] = "111";
/* wipe previous auth configuration */
- unset ($config['system']['username']);
- unset ($config['system']['password']);
+ unset($config['system']['username']);
+ if (isset($config['system']['password'])) {
+ unset($config['system']['password']);
+ }
}
}
@@ -1495,7 +1516,9 @@ function upgrade_050_to_051() {
$pconfig['value'] = "0";
$config['sysctl']['item'][] = $pconfig;
- unset($config['bridge']);
+ if (isset($config['bridge'])) {
+ unset($config['bridge']);
+ }
$convert_bridges = false;
foreach ($config['interfaces'] as $intf) {
@@ -2025,7 +2048,9 @@ function upgrade_053_to_054() {
if (empty($config['load_balancer'])) {
unset($config['load_balancer']);
} else {
- unset($config['load_balancer']['lbpool']);
+ if (isset($config['load_balancer']['lbpool'])) {
+ unset($config['load_balancer']['lbpool']);
+ }
}
} else {
$config['load_balancer']['lbpool'] = $lbpool_srv_arr;
@@ -2978,10 +3003,10 @@ function upgrade_083_to_084() {
$config['hasync'] = $config['installedpackages']['carpsettings']['config'][0];
unset($config['installedpackages']['carpsettings']);
}
- if (empty($config['installedpackages']['carpsettings'])) {
+ if (empty($config['installedpackages']['carpsettings']) && isset($config['installedpackages']['carpsettings'])) {
unset($config['installedpackages']['carpsettings']);
}
- if (empty($config['installedpackages'])) {
+ if (empty($config['installedpackages']) && isset($config['installedpackages'])) {
unset($config['installedpackages']);
}
}
@@ -3393,8 +3418,12 @@ function upgrade_102_to_103() {
$config['nat']['outbound'] = $config['nat']['advancedoutbound'];
- unset($config['nat']['ipsecpassthru']);
- unset($config['nat']['advancedoutbound']);
+ if (isset($config['nat']['ipsecpassthru'])) {
+ unset($config['nat']['ipsecpassthru']);
+ }
+ if (isset($config['nat']['advancedoutbound'])) {
+ unset($config['nat']['advancedoutbound']);
+ }
}
function upgrade_103_to_104() {
@@ -3685,18 +3714,20 @@ function upgrade_111_to_112() {
function upgrade_112_to_113() {
global $config;
- if (isset($config['notifications']['smtp']['ssl']) &&
- $config['notifications']['smtp']['ssl'] == "checked") {
- $config['notifications']['smtp']['ssl'] = true;
- } else {
- unset($config['notifications']['smtp']['ssl']);
+ if (isset($config['notifications']['smtp']['ssl'])) {
+ if ($config['notifications']['smtp']['ssl'] == "checked") {
+ $config['notifications']['smtp']['ssl'] = true;
+ } else {
+ unset($config['notifications']['smtp']['ssl']);
+ }
}
- if (isset($config['notifications']['smtp']['tls']) &&
- $config['notifications']['smtp']['tls'] == "checked") {
- $config['notifications']['smtp']['tls'] = true;
- } else {
- unset($config['notifications']['smtp']['tls']);
+ if (isset($config['notifications']['smtp']['tls'])) {
+ if ($config['notifications']['smtp']['tls'] == "checked") {
+ $config['notifications']['smtp']['tls'] = true;
+ } else {
+ unset($config['notifications']['smtp']['tls']);
+ }
}
}
OpenPOWER on IntegriCloud