summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2007-04-24 00:47:11 +0000
committerScott Ullrich <sullrich@pfsense.org>2007-04-24 00:47:11 +0000
commit914a762d23d527bae849260cbf0ea7646b847ce7 (patch)
treec7d7c70bc85e21f902d4180dbc6024e2615e7b38
parent8b1f580608992558afd6151ce049f00a23781226 (diff)
downloadpfsense-914a762d23d527bae849260cbf0ea7646b847ce7.zip
pfsense-914a762d23d527bae849260cbf0ea7646b847ce7.tar.gz
* Use is_interface_mismatch() function * Do not allow configuration to continue until the interfaces are setup correctly * When restoring a configuration via the webConfigurator detect that a interface mismatch has occured and redirect the user to the assign interface screen. Once the assign interface Save button has been pressed go ahead and reboot. This might just prevent someone from throwing a fit since they do not have console access.
-rw-r--r--etc/inc/config.inc22
-rwxr-xr-xetc/rc.bootup29
-rwxr-xr-xusr/local/www/diag_backup.php5
-rwxr-xr-xusr/local/www/interfaces_assign.php9
4 files changed, 42 insertions, 23 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc
index 760f26e..c2270d6 100644
--- a/etc/inc/config.inc
+++ b/etc/inc/config.inc
@@ -1763,6 +1763,28 @@ function start_devd() {
unlink("/tmp/rc.linkup");
}
+function is_interface_mismatch() {
+ global $config, $g;
+ $lan_if = $config['interfaces']['lan']['if'];
+ $wan_if = get_real_wan_interface();
+ $do_assign = 0;
+ /* we need to ignore the vlan interface checks) */
+ if (stristr($lan_if, "vlan") == false and stristr($wan_if, "vlan") == false) {
+ if (does_interface_exist($lan_if) == false)
+ $do_assign = 1;
+ if ($config['interfaces']['wan']['ipaddr'] <> "pppoe" && $config['interfaces']['wan']['ipaddr'] <> "pptp" && $do_assign == 0)
+ if (does_interface_exist($wan_if) == false)
+ $do_assign = 1;
+ }
+ /* XXX: enumerate OPT interfaces looking for mismatches */
+ if (file_exists("{$g['tmp_path']}/assign_complete"))
+ return false;
+ if ($do_assign == 1)
+ return true;
+ else
+ return false;
+}
+
function set_device_perms() {
$devices = array(
'pf' => array( 'user' => 'proxy',
diff --git a/etc/rc.bootup b/etc/rc.bootup
index c5a90db..0c0f543 100755
--- a/etc/rc.bootup
+++ b/etc/rc.bootup
@@ -73,31 +73,16 @@
$lan_if = $config['interfaces']['lan']['if'];
$wan_if = get_real_wan_interface();
+ unmute_kernel_msgs();
/*
- * Determine if we need to throw a interface exception
- * and ask the user to reassign interfaces. This will
- * avoid a reboot and thats a good thing.
+ * Determine if we need to throw a interface exception
+ * and ask the user to reassign interfaces. This will
+ * avoid a reboot and thats a good thing.
*/
- $do_assign = 0;
- /* we need to ignore the vlan interface checks) */
- if(stristr($lan_if,"vlan") == false and stristr($wan_if,"vlan") == false) {
- if(does_interface_exist($lan_if) == false) {
- echo "\n\n\nLAN {$lan_if} interface mismatch.";
- $do_assign = 1;
- }
- if($config['interfaces']['wan']['ipaddr'] <> "pppoe" && $config['interfaces']['wan']['ipaddr'] <> "pptp" && $do_assign == 0) {
- if(does_interface_exist($wan_if) == false) {
- echo "\n\n\nWAN {$wan_if} interface mismatch.";
- $do_assign = 1;
- }
- }
- if($do_assign == 1 and !file_exists("{$g['tmp_path']}/assign_complete")) {
- $noreboot = true;
- echo " -- Running interface assignment option.\n";
- set_networking_interfaces_ports();
- }
+ while(is_interface_mismatch() == true) {
+ echo "\nNetwork interface mismatch -- Running interface assignment option.\n";
+ set_networking_interfaces_ports();
}
- unmute_kernel_msgs();
/* convert config and clean backups */
echo "Updating configuration...";
diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php
index 2f39422..4fed4c9 100755
--- a/usr/local/www/diag_backup.php
+++ b/usr/local/www/diag_backup.php
@@ -184,6 +184,11 @@ if ($_POST) {
$reboot_needed = true;
}
setup_serial_port();
+ if(is_interface_mismatch() == true) {
+ touch("/var/run/interface_mismatch_reboot_needed");
+ $reboot_needed = false;
+ header("Location: interfaces_assign.php");
+ }
} else {
$input_errors[] = "The configuration could not be restored.";
}
diff --git a/usr/local/www/interfaces_assign.php b/usr/local/www/interfaces_assign.php
index 7999fa3..581c8f2 100755
--- a/usr/local/www/interfaces_assign.php
+++ b/usr/local/www/interfaces_assign.php
@@ -191,10 +191,15 @@ if ($_GET['act'] == "add") {
}
-
$pgtitle = "Interfaces: Assign";
include("head.inc");
+if(file_exists("/var/run/interface_mismatch_reboot_needed"))
+ if ($_POST)
+ $savemsg = "The firewall is now rebooting.";
+ else
+ $savemsg = "Interface mismatch deteceted. Please resolved the mismatch and click Save. The firewall will reboot afterwards.";
+
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
@@ -287,6 +292,8 @@ include("head.inc");
if ($_POST) {
if (!$input_errors)
touch("/tmp/reload_interfaces");
+ if(file_exists("/var/run/interface_mismatch_reboot_needed"))
+ exec("/etc/rc.reboot");
}
?> \ No newline at end of file
OpenPOWER on IntegriCloud