fixed typos, added functions for NAT naming
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
<?php
|
||||
|
||||
require_once("config.inc");
|
||||
require_once("guiconfig.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once("util.inc");
|
||||
require_once("filter.inc");
|
||||
@@ -27,9 +26,9 @@ require_once('plugins.inc.d/webgui.inc');
|
||||
#############
|
||||
|
||||
# Master Node/Router
|
||||
$wanInterface = 'wan';
|
||||
$wanInterface = 'opt1';
|
||||
$gatewayName = 'WAN_GW';
|
||||
$wanStaticIP = '192.168.101.1';
|
||||
$wanStaticIP = '10.0.12.5';
|
||||
$wanStaticIPSubnet = '30';
|
||||
|
||||
###################
|
||||
@@ -74,6 +73,34 @@ function echo_write_log ($message) {
|
||||
echo $message;
|
||||
}
|
||||
|
||||
function is_specialnet($net) {
|
||||
if (in_array($net, array('any','(self)'))) {
|
||||
return true;
|
||||
} else {
|
||||
foreach (legacy_config_get_interfaces(array("enable" => true)) as $ifent => $ifdetail) {
|
||||
if ($ifent == $net || (!isset($ifdetail['virtual']) && $ifent."ip" == $net)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function get_specialnets($only_enabled = false) {
|
||||
$specialnets = array();
|
||||
$specialnets["any"] = gettext("any");
|
||||
$specialnets["(self)"] = gettext("This Firewall");
|
||||
$filter = $only_enabled ? array("enable" => true) : array();
|
||||
foreach (legacy_config_get_interfaces($filter) as $ifent => $ifdetail) {
|
||||
$specialnets[$ifent] = htmlspecialchars($ifdetail['descr']) . " " . gettext("net");
|
||||
if (!isset($ifdetail['virtual'])) {
|
||||
$specialnets[$ifent."ip"] = htmlspecialchars($ifdetail['descr']). " ". gettext("address");
|
||||
}
|
||||
}
|
||||
|
||||
return $specialnets;
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo_write_log("Start of Script " . $argv[0]);
|
||||
@@ -105,7 +132,7 @@ if ($carpStatus == "MASTER") {
|
||||
$config['interfaces'][$wanInterface]['ipaddr'] = 'dhcp';
|
||||
$config['interfaces'][$wanInterface]['subnet'] = '';
|
||||
$config['interfaces'][$wanInterface]['gateway'] = '';
|
||||
echo_write_log("Loopiong through gateways to remove the static WAN gateway...");
|
||||
echo_write_log("Looping through gateways to remove the static WAN gateway...");
|
||||
foreach ($config['gateways']['gateway_item'] as $i => $gateway) {
|
||||
if ($gateway['name'] == $gatewayName) {
|
||||
echo_write_log("Removing the static WAN gateway: ". $gateway['name']);
|
||||
@@ -261,7 +288,7 @@ if (filter_var($config['hasync']['synchronizetoip'], FILTER_VALIDATE_IP)) {
|
||||
} else {
|
||||
echo_write_log("Ping was unsuccessful");
|
||||
}
|
||||
} while (true)
|
||||
} while (true);
|
||||
|
||||
exec('configctl system ha_reconfigure_backup', $output, $result);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user