summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
Diffstat (limited to 'etc/inc')
-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