summaryrefslogtreecommitdiffstats
path: root/usr/local/www/diag_backup.php
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-02-11 01:08:24 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-02-11 01:08:24 +0000
commitbfd3e48743b399055876b6df70cf23a964e851eb (patch)
treebb897ea5aff590c21024f425bae35c272f9d5d59 /usr/local/www/diag_backup.php
parent019220cee1756ec6e4c0c5504f651a8602ed0ae5 (diff)
downloadpfsense-bfd3e48743b399055876b6df70cf23a964e851eb.zip
pfsense-bfd3e48743b399055876b6df70cf23a964e851eb.tar.gz
During restore, if m0n0wall is found, change to pfsense so that the configuration can automatically be upgraded.
Diffstat (limited to 'usr/local/www/diag_backup.php')
-rwxr-xr-xusr/local/www/diag_backup.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php
index de8917a..4bb6d41 100755
--- a/usr/local/www/diag_backup.php
+++ b/usr/local/www/diag_backup.php
@@ -61,6 +61,24 @@ if ($_POST) {
} else if ($mode == "restore") {
if (is_uploaded_file($_FILES['conffile']['tmp_name'])) {
if (config_install($_FILES['conffile']['tmp_name']) == 0) {
+ $command = "/sbin/sysctl -a | grep carp";
+ $fd = fopen($_FILES['conffile']['tmp_name']);
+ if(!$fd) {
+ syslog(LOG_WARNING, "Warning, could not open " . $_FILES['conffile']['tmp_name']);
+ return 1;
+ }
+ while(!feof($fd)) {
+ $tmp .= fread($fd,49);
+ }
+ fclose($fd);
+ if(stristr($tmp, "m0n0wall" != FALSE)) {
+ syslog(LOG_WARNING, "Upgrading m0n0wall configuration to pfsense.");
+ /* m0n0wall was found in config. convert it. */
+ $onlyconsonants = str_replace("m0n0wall", "pfsense", $tmp);
+ fopen($_FILES['conffile']['tmp_name'], "w");
+ fwrite($fd, $tmp);
+ fclose($fd);
+ }
system_reboot();
$savemsg = "The configuration has been restored. The firewall is now rebooting.";
} else {
OpenPOWER on IntegriCloud