system: make $keep the default

This commit is contained in:
Franco Fichtner 2018-03-16 08:06:48 +00:00
parent 09f45fbdbf
commit 397d78df9e
2 changed files with 3 additions and 3 deletions

View File

@ -770,8 +770,7 @@ function fixup_default_gateway($gateways_status, $gateways_arr)
continue;
}
/* switch only if another gateway is set aa the default */
system_default_route($dfltgwip, $ipprotocol, $gateways_arr[$dfltgwname]['friendlyiface'], isset($gateways_arr[$dfltgwname]['fargw']), true);
system_default_route($dfltgwip, $ipprotocol, $gateways_arr[$dfltgwname]['friendlyiface'], isset($gateways_arr[$dfltgwname]['fargw']));
}
}

View File

@ -417,7 +417,7 @@ function system_host_route($host, $gateway, $delete = true, $add = true)
}
}
function system_default_route($gateway, $family, $interface, $far = false, $keep = false)
function system_default_route($gateway, $family, $interface, $far = false, $keep = true)
{
$realif = get_real_interface($interface);
@ -434,6 +434,7 @@ function system_default_route($gateway, $family, $interface, $far = false, $keep
return;
}
/* XXX we can hardcode this as soon as testing goes ok */
if ($keep) {
$tmpcmd = "/sbin/route -n get -{$family} default 2>/dev/null | /usr/bin/awk '/gateway:/ {print $2}'";
$current = trim(exec($tmpcmd), " \n");