Permalink
Browse files

system: default gateway disappears, needs more refactoring for clarity

PR: #2164
  • Loading branch information...
fichtner committed Feb 3, 2018
1 parent 64ad42d commit f09eaf7f3a13309fc145f3749cbb1e5ac6c83a0d
Showing with 6 additions and 8 deletions.
  1. +6 −8 src/etc/inc/system.inc
@@ -457,13 +457,13 @@ function system_routing_configure($interface = '', $verbose = false)
$foundgwv6 = false;
$fargw = false;
/* XXX eventually this file-based workaround must be removed */
foreach (glob('/tmp/*_defaultgw{,v6}', GLOB_BRACE) as $to_delete) {
@unlink($to_delete);
}
/* tack on all the hard defined gateways as well */
if (isset($config['gateways']['gateway_item'])) {
/* XXX eventually this file-based workaround must be removed */
foreach (glob('/tmp/*_defaultgw{,v6}', GLOB_BRACE) as $to_delete) {
@unlink($to_delete);
}
foreach ($config['gateways']['gateway_item'] as $gateway) {
if (isset($gateway['defaultgw'])) {
if ($gateway['ipprotocol'] != "inet6" && (is_ipaddrv4($gateway['gateway']) || $gateway['gateway'] == "dynamic")) {
@@ -498,9 +498,6 @@ function system_routing_configure($interface = '', $verbose = false)
$foundgwv6 = true;
}
}
if ($foundgw === true && $foundgwv6 === true) {
break;
}
}
}
@@ -510,6 +507,7 @@ function system_routing_configure($interface = '', $verbose = false)
$gatewayip = get_interface_gateway("wan");
@touch("/tmp/{$defaultif}_defaultgw");
}
if (!$foundgwv6) {
$defaultifv6 = get_real_interface("wan");
$interfacegwv6 = "wan";

0 comments on commit f09eaf7

Please sign in to comment.