diff --git a/opnsense-carp-dhcp-master.php b/opnsense-carp-dhcp-master.php index 9f444d1..b8b3515 100644 --- a/opnsense-carp-dhcp-master.php +++ b/opnsense-carp-dhcp-master.php @@ -2,7 +2,6 @@ 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);