summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-05-19 08:50:48 -0400
committerjim-p <jimp@pfsense.org>2011-05-19 08:50:48 -0400
commit27d0722d13f41c3a569d05588e08dd2b1c18fd43 (patch)
tree3362f1f378d5d64de1446774fcb0b1b06b81c0b4 /etc/inc
parent62a29fe39e7d579788e97ca05c6266f46fe1f957 (diff)
parent2f6532d55221f86cbc717350eafb8e4404181cbd (diff)
downloadpfsense-27d0722d13f41c3a569d05588e08dd2b1c18fd43.zip
pfsense-27d0722d13f41c3a569d05588e08dd2b1c18fd43.tar.gz
Merge remote branch 'upstream/master'
Diffstat (limited to 'etc/inc')
-rw-r--r--etc/inc/globals.inc2
-rw-r--r--etc/inc/gwlb.inc2
-rw-r--r--etc/inc/pkg-utils.inc12
-rw-r--r--etc/inc/rrd.inc35
-rw-r--r--etc/inc/service-utils.inc14
-rw-r--r--etc/inc/upgrade_config.inc40
-rw-r--r--etc/inc/vpn.inc3
7 files changed, 67 insertions, 41 deletions
diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc
index 6993148..3bd0de2 100644
--- a/etc/inc/globals.inc
+++ b/etc/inc/globals.inc
@@ -91,7 +91,7 @@ $g = array(
"disablecrashreporter" => false,
"crashreporterurl" => "http://crashreporter.pfsense.org/crash_reporter.php",
"debug" => false,
- "latest_config" => "7.9",
+ "latest_config" => "8.0",
"nopkg_platforms" => array("cdrom"),
"minimum_ram_warning" => "101",
"minimum_ram_warning_text" => "128 MB",
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index ce5a328..bb7e66b 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -372,6 +372,7 @@ function return_gateway_groups_array() {
$gateways_arr = return_gateways_array();
$gateway_groups_array = array();
+ if (0) {
/*
* NOTE: The code below is meant to replace the default gateway when it goes down.
* This facilitates services running on pfSense itself and are not handled by a PBR to continue working.
@@ -405,6 +406,7 @@ function return_gateway_groups_array() {
}
}
unset($upgw, $dfltgwfound, $dfltgwdown, $gwname, $gwsttng);
+ }
if (is_array($config['gateways']['gateway_group'])) {
foreach($config['gateways']['gateway_group'] as $group) {
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc
index 5c21428..070dade 100644
--- a/etc/inc/pkg-utils.inc
+++ b/etc/inc/pkg-utils.inc
@@ -42,6 +42,7 @@
require_once("globals.inc");
require_once("xmlrpc.inc");
+require_once("service-utils.inc");
if(file_exists("/cf/conf/use_xmlreader"))
require_once("xmlreader.inc");
else
@@ -324,6 +325,8 @@ function uninstall_package($pkg_name) {
}
}
+ stop_service($pkg_name);
+
$id = get_pkg_id($pkg_name);
if ($id >= 0) {
$pkg_depends =& $config['installedpackages']['package'][$id]['depends_on_package'];
@@ -892,7 +895,7 @@ function delete_package($pkg) {
}
function delete_package_xml($pkg) {
- global $g, $config, $static_output, $pkg_interface;
+ global $g, $config, $static_output, $pkg_interface, $rcfileprefix;
conf_mount_rw();
@@ -964,6 +967,13 @@ function delete_package_xml($pkg) {
if($instservice['name'] == $service['name']) {
if($g['booting'] != true)
stop_service($service['name']);
+ if($service['rcfile']) {
+ $prefix = $rcfileprefix;
+ if (!empty($service['prefix']))
+ $prefix = $service['prefix'];
+ if (file_exists("{$prefix}{$service['rcfile']}"))
+ @unlink("{$prefix}{$service['rcfile']}");
+ }
unset($services[$key]);
}
}
diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc
index 529080c..d3de377 100644
--- a/etc/inc/rrd.inc
+++ b/etc/inc/rrd.inc
@@ -744,42 +744,7 @@ function enable_rrd_graphing() {
$rrdupdatesh .= "# polling Captive Portal for number of logged in users\n";
$rrdupdatesh .= "CP=`$php -q $captiveportal_gather loggedin`\n";
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$captiveportalloggedin \${CP}\n";
-
- $ifname= "captiveportal";
- if (!file_exists("$rrddbpath$ifname$captiveportaltotalusers")) {
- $rrdcreate = "$rrdtool create $rrddbpath$ifname$captiveportaltotalusers --step $rrdcaptiveportalinterval ";
- $rrdcreate .= "DS:totalusers:GAUGE:$captiveportalvalid:0:10000 ";
- $rrdcreate .= "RRA:AVERAGE:0.5:1:1000 ";
- $rrdcreate .= "RRA:AVERAGE:0.5:5:1100 ";
- $rrdcreate .= "RRA:AVERAGE:0.5:60:1175 ";
- $rrdcreate .= "RRA:AVERAGE:0.5:720:3000 ";
- $rrdcreate .= "RRA:MIN:0.5:1:1000 ";
- $rrdcreate .= "RRA:MIN:0.5:5:1100 ";
- $rrdcreate .= "RRA:MIN:0.5:60:1175 ";
- $rrdcreate .= "RRA:MIN:0.5:720:3000 ";
- $rrdcreate .= "RRA:MAX:0.5:1:1000 ";
- $rrdcreate .= "RRA:MAX:0.5:5:1100 ";
- $rrdcreate .= "RRA:MAX:0.5:60:1175 ";
- $rrdcreate .= "RRA:MAX:0.5:720:3000 ";
- $rrdcreate .= "RRA:LAST:0.5:1:1000 ";
- $rrdcreate .= "RRA:LAST:0.5:5:1100 ";
- $rrdcreate .= "RRA:LAST:0.5:60:1175 ";
- $rrdcreate .= "RRA:LAST:0.5:720:3000 ";
- create_new_rrd($rrdcreate);
- }
-
- /* enter UNKNOWN values in the RRD so it knows we rebooted. */
- if($g['booting']) {
- mwexec("$rrdtool update $rrddbpath$ifname$captiveportaltotalusers N:U");
- }
-
- /* the Captive Portal stats gathering function. */
- $rrdupdatesh .= "\n";
- $rrdupdatesh .= "# polling Captive Portal for number of concurrent users\n";
- $rrdupdatesh .= "CP=`$php -q $captiveportal_gather total`\n";
- $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$captiveportaltotalusers \${CP}\n";
-
}
$rrdupdatesh .= "sleep 60\n";
diff --git a/etc/inc/service-utils.inc b/etc/inc/service-utils.inc
index 895eb57..57b1719 100644
--- a/etc/inc/service-utils.inc
+++ b/etc/inc/service-utils.inc
@@ -82,6 +82,9 @@ function start_service($name) {
global $config;
global $rcfileprefix;
+ if (empty($name))
+ return;
+
/* make sure service is stopped before starting */
stop_service($name);
sleep(2);
@@ -114,6 +117,9 @@ function stop_service($name) {
global $config;
global $rcfileprefix;
+ if (empty($name))
+ return;
+
if ($config['installedpackages']['service']) {
foreach($config['installedpackages']['service'] as $service) {
if(strtolower($service['name']) == strtolower($name)) {
@@ -122,7 +128,10 @@ function stop_service($name) {
if(!empty($service['prefix'])) {
$prefix =& $service['prefix'];
}
- mwexec_bg("{$prefix}{$service['rcfile']} stop");
+ if(file_exists("{$prefix}{$service['rcfile']}")) {
+ mwexec_bg("{$prefix}{$service['rcfile']} stop");
+ }
+ return;
}
if (!empty($service['stopcmd']))
eval($service['stopcmd']);
@@ -144,6 +153,9 @@ function stop_service($name) {
function restart_service($name) {
global $config;
+ if (empty($name))
+ return;
+
stop_service($name);
start_service($name);
diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc
index 77a8682..1646292 100644
--- a/etc/inc/upgrade_config.inc
+++ b/etc/inc/upgrade_config.inc
@@ -1804,13 +1804,26 @@ function upgrade_053_to_054() {
$lbpool_srv_arr = array();
$gateway_group_arr = array();
$gateways = return_gateways_array();
+ $group_name_changes = array();
if (! is_array($config['gateways']['gateway_item']))
$config['gateways']['gateway_item'] = array();
$a_gateways =& $config['gateways']['gateway_item'];
foreach($lbpool_arr as $lbpool) {
if($lbpool['type'] == "gateway") {
- $gateway_group['name'] = $lbpool['name'];
+ // Gateway Groups have to have valid names in pf, old lb pools did not. Clean them up.
+ $group_name = ereg_replace("[^A-Za-z0-9]", "", $lbpool['name'] );
+ // If we made and changes, check for collisions and note the change.
+ if ($group_name != $lbpool['name']) {
+ // Make sure the name isn't already in use.
+ foreach ($gateway_group_arr as $gwg) {
+ // If the name is in use, add some random bits to avoid collision.
+ if ($gwg['name'] == $group_name)
+ $group_name .= uniqid();
+ }
+ $group_name_changes[$lbpool['name']] = $group_name;
+ }
+ $gateway_group['name'] = $group_name;
$gateway_group['descr'] = $lbpool['descr'];
$gateway_group['trigger'] = "down";
$gateway_group['item'] = array();
@@ -1855,6 +1868,11 @@ function upgrade_053_to_054() {
// Only set the gateway group array if we converted any
if (count($gateway_group_arr) != 0) {
$config['gateways']['gateway_group'] = $gateway_group_arr;
+ // Update any rules that had a gateway change, if any.
+ if (count($group_name_changes) > 0)
+ foreach ($config['filter']['rule'] as & $rule)
+ if (!empty($rule["gateway"]) && array_key_exists($rule["gateway"], $group_name_changes))
+ $rule["gateway"] = $group_name_changes[$rule["gateway"]];
}
}
@@ -2456,6 +2474,24 @@ function upgrade_076_to_077() {
}
function upgrade_077_to_078() {
+ if (is_array($config['pptpd']) && is_array($config['pptpd']['radius'])
+ && !is_array($config['pptpd']['radius']['server'])) {
+ $radarr = array();
+ $radsvr = array();
+ $radsvr['ip'] = $config['pptpd']['radius']['server'];
+ $radsvr['secret'] = $config['pptpd']['radius']['secret'];
+ $radsvr['port'] = 1812;
+ $radsvr['acctport'] = 1813;
+ $radsvr['enable'] = isset($config['pptpd']['radius']['enable']);
+ $radarr['accounting'] = isset($config['pptpd']['radius']['accounting']);
+ if ($radarr['accounting'])
+ $radarr['acct_update'] = $radsvr['ip'];
+ $radarr['server'] = $radsvr;
+ $config['pptpd']['radius'] = $radarr;
+ }
+}
+
+function upgrade_078_to_079() {
global $config;
global $g;
@@ -2541,7 +2577,7 @@ function upgrade_077_to_078() {
}
}
-function upgrade_078_to_079() {
+function upgrade_079_to_080() {
global $config;
/* enable the allow IPv6 toggle */
$config['system']['ipv6allow'] = true;
diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc
index 24e5956..80e3a85 100644
--- a/etc/inc/vpn.inc
+++ b/etc/inc/vpn.inc
@@ -282,7 +282,8 @@ function vpn_ipsec_configure($ipchg = false)
break;
}
- $pskconf .= "{$peerid_data}\t{$ph1ent['pre-shared-key']}\n";
+ if (!empty($peerid_data) && !empty($ph1ent['pre-shared-key']))
+ $pskconf .= trim($peerid_data) . "\t" . trim($ph1ent['pre-shared-key']) . "\n";
}
}
OpenPOWER on IntegriCloud