Skip to content

Commit

Permalink
interfaces: detect and ignore "detached" state for IPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Apr 22, 2024
1 parent b9317c3 commit 5db3c34
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/etc/inc/interfaces.inc
Expand Up @@ -4050,6 +4050,7 @@ function interfaces_addresses($interfaces, $as_subnet = false, $ifconfig_details
'bind' => true,
'bits' => $address['subnetbits'],
'deprecated' => !empty($address['deprecated']),
'detached' => !empty($address['detached']),
'tentative' => !empty($address['tentative']),
'family' => $proto == 'ipv4' ? 'inet' : 'inet6',
'interface' => !empty($ifcache[$realif]) ? $ifcache[$realif] : null,
Expand Down Expand Up @@ -4161,7 +4162,7 @@ function _interfaces_primary_address6($interface, $ifconfig_details = null, $all
}

foreach (interfaces_addresses($interface, false, $ifconfig_details) as $addr) {
if ($addr['family'] != 'inet6' || $addr['deprecated'] || $addr['tentative'] || $addr['alias']) {
if ($addr['family'] != 'inet6' || $addr['deprecated'] || $addr['detached'] || $addr['tentative'] || $addr['alias']) {
continue;
}

Expand Down
3 changes: 3 additions & 0 deletions src/etc/inc/interfaces.lib.inc
Expand Up @@ -338,6 +338,7 @@ function legacy_interfaces_details($intf = null)
$tmp = [
'autoconf' => false,
'deprecated' => false,
'detached' => false,
'ipaddr' => $addr,
'link-local' => !!preg_match('/^fe[89ab][0-9a-f]:/i', $addr),
'tentative' => false,
Expand All @@ -361,6 +362,8 @@ function legacy_interfaces_details($intf = null)
$tmp['autoconf'] = true;
} elseif ($line_parts[$i] == 'deprecated') {
$tmp['deprecated'] = true;
} elseif ($line_parts[$i] == 'detached') {
$tmp['detached'] = true;
} elseif ($line_parts[$i] == 'tentative') {
$tmp['tentative'] = true;
}
Expand Down

0 comments on commit 5db3c34

Please sign in to comment.