summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-02-27 12:47:03 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-02-27 12:47:03 -0300
commit08c3810cebdfb28624ebacf0df45e46a4e918b37 (patch)
treeac074679b5e0112e2ff9a28bf024b419d3cfb564 /etc
parent5b0e0182c7fa2eb756a574fc7cca4dd0ea1de06a (diff)
downloadpfsense-08c3810cebdfb28624ebacf0df45e46a4e918b37.zip
pfsense-08c3810cebdfb28624ebacf0df45e46a4e918b37.tar.gz
Just set defaultgw after all gateways are processed, it fixes return_gateways_array()
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/gwlb.inc39
1 files changed, 21 insertions, 18 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index 0f5b169..a8373a8 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -455,24 +455,6 @@ function return_gateways_array($disabled = false, $localhost = false) {
$found_defaultv6 = 1;
}
}
- /* FIXME: Should this be enabled.
- * Some interface like wan might be default but have no info recorded
- * the config. */
- /* this is a fallback if all else fails and we want to get packets out @smos */
- if (!isset($gateway['defaultgw'])) {
- if (($gateway['friendlyiface'] == "wan") && ($found_defaultv4 == 0) && (!isset($gateway['ipprotocol']) || ($gateway['ipprotocol'] == "inet"))) {
- if (file_exists("{$g['tmp_path']}/{$gateway['interface']}_defaultgw")) {
- $gateway['defaultgw'] = true;
- $found_defaultv4 = 1;
- }
- }
- if (($gateway['friendlyiface'] == "wan") && ($found_defaultv6 == 0) && ($gateway['ipprotocol'] == "inet6")) {
- if (file_exists("{$g['tmp_path']}/{$gateway['interface']}_defaultgwv6")) {
- $gateway['defaultgw'] = true;
- $found_defaultv6 = 1;
- }
- }
- }
/* include the gateway index as the attribute */
$gateway['attribute'] = $i;
@@ -644,6 +626,27 @@ function return_gateways_array($disabled = false, $localhost = false) {
unset($gateway);
}
+ /* FIXME: Should this be enabled.
+ * Some interface like wan might be default but have no info recorded
+ * the config. */
+ /* this is a fallback if all else fails and we want to get packets out @smos */
+ if ($found_defaultv4 == 0 || $found_defaultv6 == 0) {
+ foreach ($gateways_arr as &$gateway) {
+ if (($gateway['friendlyiface'] == "wan") && ($found_defaultv4 == 0) && (!isset($gateway['ipprotocol']) || ($gateway['ipprotocol'] == "inet"))) {
+ if (file_exists("{$g['tmp_path']}/{$gateway['interface']}_defaultgw")) {
+ $gateway['defaultgw'] = true;
+ $found_defaultv4 = 1;
+ }
+ }
+ if (($gateway['friendlyiface'] == "wan") && ($found_defaultv6 == 0) && ($gateway['ipprotocol'] == "inet6")) {
+ if (file_exists("{$g['tmp_path']}/{$gateway['interface']}_defaultgwv6")) {
+ $gateway['defaultgw'] = true;
+ $found_defaultv6 = 1;
+ }
+ }
+ }
+ }
+
if($localhost === true) {
/* attach localhost for Null routes */
$gwlo4 = array();
OpenPOWER on IntegriCloud