mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
interfaces: trust the GUI to do its job
There is still a weird interaction between this code and get_real_interface as they both react to dhcp6usev4iface, but now this is more obvious and could help with refactors later on. The upside is that we do not have to adjust this for another IPv6 type that will gain IPv4 latch capability in the future.
This commit is contained in:
parent
62631e9bf5
commit
de7e37aa17
@ -4046,26 +4046,21 @@ function get_interface_ipv6($interface = 'wan')
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: On the case when only the prefix is requested,
|
||||
* the communication on WAN will be done over link-local.
|
||||
*/
|
||||
if (isset($config['interfaces'][$interface])) {
|
||||
switch ($config['interfaces'][$interface]['ipaddr']) {
|
||||
case 'pppoe':
|
||||
case 'l2tp':
|
||||
case 'pptp':
|
||||
case 'ppp':
|
||||
if (in_array($config['interfaces'][$interface]['ipaddrv6'], array('dhcp6', 'slaac', 'staticv6'))) {
|
||||
$realif = get_real_interface($interface, 'inet6');
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (isset($config['interfaces'][$interface]['dhcp6prefixonly'])) {
|
||||
$curip = find_interface_ipv6_ll($realif);
|
||||
if ($curip && is_ipaddrv6($curip) && ($curip != "::")) {
|
||||
return $curip;
|
||||
}
|
||||
if (isset($config['interfaces'][$interface]['dhcp6usev4iface'])) {
|
||||
$realif = get_real_interface($interface, 'inet6');
|
||||
}
|
||||
|
||||
if (isset($config['interfaces'][$interface]['dhcp6prefixonly'])) {
|
||||
$curip = find_interface_ipv6_ll($realif);
|
||||
if ($curip && is_ipaddrv6($curip) && ($curip != "::")) {
|
||||
return $curip;
|
||||
} else {
|
||||
/*
|
||||
* XXX This may have been an intended opt-out case earlier,
|
||||
* but it looks wrong to assume prefix-only and then fall
|
||||
* through to see if a different address is there.
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user