Skip to content

Commit

Permalink
system: default gateway disappears, needs more refactoring for clarity
Browse files Browse the repository at this point in the history
PR: #2164
  • Loading branch information
fichtner committed Feb 3, 2018
1 parent 64ad42d commit f09eaf7
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/etc/inc/system.inc
Expand Up @@ -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")) {
Expand Down Expand Up @@ -498,9 +498,6 @@ function system_routing_configure($interface = '', $verbose = false)
$foundgwv6 = true;
}
}
if ($foundgw === true && $foundgwv6 === true) {
break;
}
}
}

Expand All @@ -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";
Expand Down

0 comments on commit f09eaf7

Please sign in to comment.