mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 17:14:46 +00:00
unbound: replace legacy_getall_interface_addresses() #3355
While here use a cheaper single lookup for all interfaces at once.
This commit is contained in:
parent
ad8ee2f286
commit
48e4fde62e
@ -722,15 +722,13 @@ function unbound_acls_subnets()
|
||||
/* add our networks for active interfaces including localhost */
|
||||
$subnets = array('127.0.0.1/8', '::1/64');
|
||||
|
||||
foreach ($active_interfaces as $ubif => $ubextra) {
|
||||
foreach (legacy_getall_interface_addresses(get_real_interface($ubif)) as $subnet) {
|
||||
if (!empty($ubextra['net4']) && is_subnetv4($subnet)) {
|
||||
$subnet = explode('/', $subnet)[0] . '/' . $ubextra['net4'];
|
||||
} elseif (!empty($ubextra['net6']) && is_subnetv6($subnet)) {
|
||||
$subnet = explode('/', $subnet)[0] . '/' . $ubextra['net6'];
|
||||
}
|
||||
$subnets[] = $subnet;
|
||||
foreach (interfaces_addresses(array_keys($active_interfaces), true) as $subnet => $info) {
|
||||
if (!empty($active_interfaces[$info['name']]['net4']) && is_subnetv4($subnet)) {
|
||||
$subnet = explode('/', $subnet)[0] . '/' . $active_interfaces[$info['name']]['net4'];
|
||||
} elseif (!empty($active_interfaces[$info['name']]['net6']) && is_subnetv6($subnet)) {
|
||||
$subnet = explode('/', $subnet)[0] . '/' . $active_interfaces[$info['name']]['net6'];
|
||||
}
|
||||
$subnets[] = $subnet;
|
||||
}
|
||||
|
||||
return $subnets;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user