diff options
author | Phil Davis <phil.davis@inf.org> | 2014-02-27 23:48:28 -0800 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2014-02-27 23:48:28 -0800 |
commit | d47e25c7775cbb150a59d56ddb4b2e360014eb12 (patch) | |
tree | 6c45d53fec82bd6a98c72810447c6b91c52a6eb7 /usr/local/www/firewall_rules_edit.php | |
parent | f60003faf1343a532f52a3f03a5e9c6687b470e3 (diff) | |
download | pfsense-d47e25c7775cbb150a59d56ddb4b2e360014eb12.zip pfsense-d47e25c7775cbb150a59d56ddb4b2e360014eb12.tar.gz |
Use return_gateway_groups_array() to build correct GWG list
Now return_gateway_groups_array() always returns at least the IP version 'ipprotocol' of each GWG, even if all its members are down at present. It is better to use this to check what IP version the GWG is. The previous check was using the IP address of the first member of the GWG to deduce 'ipprotocol'. That would fail if the WAN was DHCP and was down.
Diffstat (limited to 'usr/local/www/firewall_rules_edit.php')
-rwxr-xr-x | usr/local/www/firewall_rules_edit.php | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php index 9eafdd3..e3dd955 100755 --- a/usr/local/www/firewall_rules_edit.php +++ b/usr/local/www/firewall_rules_edit.php @@ -205,6 +205,7 @@ read_dummynet_config(); /* XXX: */ $dnqlist =& get_unique_dnqueue_list(); read_layer7_config(); $l7clist =& get_l7_unique_list(); +$a_gatewaygroups = return_gateway_groups_array(); if ($_POST) { unset($input_errors); @@ -216,7 +217,6 @@ if ($_POST) { } if (($_POST['ipprotocol'] <> "") && ($_POST['gateway'] <> "")) { - $a_gatewaygroups = return_gateway_groups_array(); if(is_array($config['gateways']['gateway_group'])) { foreach($config['gateways']['gateway_group'] as $gw_group) { if($gw_group['name'] == $_POST['gateway']) { @@ -1471,23 +1471,20 @@ $i--): ?> echo "<option value=\"{$gwname}\" {$selected}>{$gw['name']} - {$gw['gateway']}</option>\n"; } /* add gateway groups to the list */ - if (is_array($config['gateways']['gateway_group'])) { - foreach($config['gateways']['gateway_group'] as $gw_group) { - $af = explode("|", $gw_group['item'][0]); + if (is_array($a_gatewaygroups)) { + foreach($a_gatewaygroups as $gwg_name => $gwg_data) { if(($pconfig['ipprotocol'] == "inet46")) continue; - if(($pconfig['ipprotocol'] == "inet6") && !is_ipaddrv6(lookup_gateway_ip_by_name($af[0]))) + if(($pconfig['ipprotocol'] == "inet6") && ($gwg_data['ipprotocol'] != "inet6")) continue; - if(($pconfig['ipprotocol'] == "inet") && !is_ipaddrv4(lookup_gateway_ip_by_name($af[0]))) + if(($pconfig['ipprotocol'] == "inet") && ($gwg_data['ipprotocol'] != "inet")) continue; - if($gw_group['name'] == "") - continue; - if($pconfig['gateway'] == $gw_group['name']) { + if($pconfig['gateway'] == $gwg_name) { $selected = " selected=\"selected\""; } else { $selected = ""; } - echo "<option value=\"{$gw_group['name']}\" $selected>{$gw_group['name']}</option>\n"; + echo "<option value=\"{$gwg_name}\" $selected>{$gwg_name}</option>\n"; } } ?> |