interfaces: remove unused $flush argument

This commit is contained in:
Franco Fichtner 2018-04-09 07:26:36 +02:00
parent 0d79bfda3c
commit 434347bb4e
4 changed files with 28 additions and 20 deletions

View File

@ -688,9 +688,9 @@ function return_gateways_array($disabled = false, $localhost = false, $inactive
/* special treatment for tunnel interfaces */
if ($gateway['ipprotocol'] == "inet6") {
$gateway['interface'] = get_real_interface($gateway['interface'], "inet6", false);
$gateway['interface'] = get_real_interface($gateway['interface'], 'inet6');
} else {
$gateway['interface'] = get_real_interface($gateway['interface'], "all", false);
$gateway['interface'] = get_real_interface($gateway['interface'], 'all');
}
/* entry has a default flag, use it */

View File

@ -3753,7 +3753,7 @@ function interface_get_wireless_clone($wlif)
}
}
function get_real_interface($interface = "wan", $family = "all", $flush = true)
function get_real_interface($interface = 'wan', $family = 'all')
{
global $config;
@ -3770,9 +3770,12 @@ function get_real_interface($interface = "wan", $family = "all", $flush = true)
break;
default:
if (empty($config['interfaces'][$interface])) {
// leftover from legacy code, it's not a very bright idea to use the same function call
// for both virtual as real interface names. does_interface_exist() is quite expensive.
if (does_interface_exist($interface, $flush)) {
/*
* Leftover from legacy code. It's not a very bright idea
* to use the same function call for both virtual as real
* interface names. does_interface_exist() is quite expensive.
*/
if (does_interface_exist($interface)) {
$wanif = $interface;
}
break;
@ -4036,17 +4039,22 @@ function find_interface_ipv6($interface)
function find_interface_ipv6_ll($interface)
{
$interface = trim($interface);
if (does_interface_exist($interface)) {
$ifinfo = legacy_getall_interface_addresses($interface);
foreach ($ifinfo as $line) {
if (strstr($line, ":")) {
$parts = explode("/", $line);
if (is_linklocal($parts[0])) {
return $parts[0];
}
if (!does_interface_exist($interface)) {
return null;
}
$ifinfo = legacy_getall_interface_addresses($interface);
foreach ($ifinfo as $line) {
if (strstr($line, ':')) {
$parts = explode('/', $line);
if (is_linklocal($parts[0])) {
return $parts[0];
}
}
}
return null;
}
@ -4119,7 +4127,7 @@ function get_interface_ip($interface = "wan")
}
}
function get_interface_ipv6($interface = "wan", $flush = false)
function get_interface_ipv6($interface = 'wan')
{
global $config;
@ -4148,14 +4156,14 @@ function get_interface_ipv6($interface = "wan", $flush = false)
break;
}
if (isset($config['interfaces'][$interface]['dhcp6prefixonly'])) {
$curip = find_interface_ipv6_ll($realif, $flush);
$curip = find_interface_ipv6_ll($realif);
if ($curip && is_ipaddrv6($curip) && ($curip != "::")) {
return $curip;
}
}
}
$curip = find_interface_ipv6($realif, $flush);
$curip = find_interface_ipv6($realif);
if ($curip && is_ipaddrv6($curip) && ($curip != "::")) {
return $curip;
} else {

View File

@ -575,7 +575,7 @@ echo "\n";
if ($intip != '' || $intip6 != '') {
if (count($ifdescrs) == '1' or $interface == 'lan') {
$intip = get_interface_ip($interface);
$intip6 = get_interface_ipv6($interface, true);
$intip6 = get_interface_ipv6($interface);
echo "You can now access the web GUI by opening\nthe following URL in your web browser:\n\n";
$webuiport = !empty($config['system']['webgui']['port']) ? ":{$config['system']['webgui']['port']}" : '';
if (is_ipaddr($intip)) {

View File

@ -51,11 +51,11 @@ log_error("IP renewal is starting on '{$argument}'");
if (empty($argument)) {
$interface = 'wan';
$interface_real = get_real_interface($interface, 'inet6');
$ip = get_interface_ipv6($interface, true);
$ip = get_interface_ipv6($interface);
} else {
$interface = convert_real_interface_to_friendly_interface_name($argument);
$interface_real = $argument;
$ip = get_interface_ipv6($interface, true);
$ip = get_interface_ipv6($interface);
}
/* If the interface is configured and not enabled, bail. We do not need to change settings for disabled interfaces. #3313 */