summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2014-11-01 18:42:41 +0100
committerErmal <eri@pfsense.org>2014-11-01 18:44:01 +0100
commit935fcedbca2dbe8c3d9eb41bc5739b511a9ec19a (patch)
tree3dcb71ca57565039f9b18590cee5f6b4b0e8ec12 /etc
parent4045cf1efd15e9cbf88b0e8b3e27428b2dfb3e1e (diff)
downloadpfsense-935fcedbca2dbe8c3d9eb41bc5739b511a9ec19a.zip
pfsense-935fcedbca2dbe8c3d9eb41bc5739b511a9ec19a.tar.gz
Fixes #3941. When optimizations of the loops were made this brought the problems of overriding default gateway by dynamic interfaces. Try to stick to the first found for now!
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/system.inc12
1 files changed, 6 insertions, 6 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index 9c0345d..febde8e 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -378,17 +378,17 @@ function system_routing_configure($interface = "") {
$gatewayip = "";
$interfacegw = "";
- $foundgw = false;
$gatewayipv6 = "";
$interfacegwv6 = "";
+ $foundgw = false;
$foundgwv6 = false;
/* tack on all the hard defined gateways as well */
if (is_array($config['gateways']['gateway_item'])) {
array_map('unlink', glob("{$g['tmp_path']}/*_defaultgw{,v6}", GLOB_BRACE));
foreach ($config['gateways']['gateway_item'] as $gateway) {
if (isset($gateway['defaultgw'])) {
- if ($gateway['ipprotocol'] != "inet6" && (is_ipaddrv4($gateway['gateway']) || $gateway['gateway'] == "dynamic")) {
- if(strstr($gateway['gateway'], ":"))
+ if ($foundgw == false && ($gateway['ipprotocol'] != "inet6" && (is_ipaddrv4($gateway['gateway']) || $gateway['gateway'] == "dynamic"))) {
+ if(strpos($gateway['gateway'], ":"))
continue;
if ($gateway['gateway'] == "dynamic")
$gateway['gateway'] = get_interface_gateway($gateway['interface']);
@@ -400,7 +400,7 @@ function system_routing_configure($interface = "") {
@file_put_contents("{$g['tmp_path']}/{$defaultif}_defaultgw", $gateway['gateway']);
}
$foundgw = true;
- } else if ($gateway['ipprotocol'] == "inet6" && (is_ipaddrv6($gateway['gateway']) || $gateway['gateway'] == "dynamic")) {
+ } else if ($foundgwv6 == false && ($gateway['ipprotocol'] == "inet6" && (is_ipaddrv6($gateway['gateway']) || $gateway['gateway'] == "dynamic"))) {
if ($gateway['gateway'] == "dynamic")
$gateway['gateway'] = get_interface_gateway_v6($gateway['interface']);
$gatewayipv6 = $gateway['gateway'];
@@ -421,13 +421,13 @@ function system_routing_configure($interface = "") {
$defaultif = get_real_interface("wan");
$interfacegw = "wan";
$gatewayip = get_interface_gateway("wan");
- @touch("{$g['tmp_path']}/{$defaultif}_defaultgw");
+ @file_put_contents("{$g['tmp_path']}/{$defaultif}_defaultgw", $gatewayip);
}
if ($foundgwv6 == false) {
$defaultifv6 = get_real_interface("wan");
$interfacegwv6 = "wan";
$gatewayipv6 = get_interface_gateway_v6("wan");
- @touch("{$g['tmp_path']}/{$defaultif}_defaultgwv6");
+ @file_put_contents("{$g['tmp_path']}/{$defaultifv6}_defaultgwv6", $gatewayipv6);
}
$dont_add_route = false;
/* if OLSRD is enabled, allow WAN to house DHCP. */
OpenPOWER on IntegriCloud